Merge "pinctrl: qcom: Add support for user modification of the dir_conn list on MonacoAU"

This commit is contained in:
qctecmdr 2024-01-31 12:53:36 -08:00 committed by Gerrit - the friendly Code Review server
commit 24d17eeafb

View File

@ -20,6 +20,7 @@
#define REG_BASE 0x100000
#define REG_SIZE 0x1000
#define REG_DIRCONN 0xA9000
#define PINGROUP(id, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, wake_off, bit) \
{ \
.name = "gpio" #id, \
@ -30,6 +31,7 @@
.intr_cfg_reg = REG_BASE + 0x8 + REG_SIZE * id, \
.intr_status_reg = REG_BASE + 0xc + REG_SIZE * id, \
.intr_target_reg = REG_BASE + 0x8 + REG_SIZE * id, \
.dir_conn_reg = REG_BASE + REG_DIRCONN, \
.mux_bit = 2, \
.pull_bit = 0, \
.drv_bit = 6, \
@ -46,6 +48,7 @@
.intr_polarity_bit = 1, \
.intr_detection_bit = 2, \
.intr_detection_width = 2, \
.dir_conn_en_bit = 9, \
.wake_reg = REG_BASE + wake_off, \
.wake_bit = bit, \
.funcs = (int[]){ \
@ -1913,6 +1916,11 @@ static const struct msm_gpio_wakeirq_map monaco_auto_pdc_map[] = {
{ 104, 234 }, { 105, 223 }, { 129, 210 }, { 130, 222 },
};
static struct msm_dir_conn monaco_dir_conn[] = {
{-1, 0}, {-1, 0}, {-1, 0}, {-1, 0}, {-1, 0},
{-1, 0}, {-1, 0}, {-1, 0}, {-1, 0}
};
static const struct msm_pinctrl_soc_data monaco_auto_pinctrl = {
.pins = monaco_auto_pins,
.npins = ARRAY_SIZE(monaco_auto_pins),
@ -1925,8 +1933,36 @@ static const struct msm_pinctrl_soc_data monaco_auto_pinctrl = {
.nqup_regs = ARRAY_SIZE(monaco_auto_qup_regs),
.wakeirq_map = monaco_auto_pdc_map,
.nwakeirq_map = ARRAY_SIZE(monaco_auto_pdc_map),
.dir_conn = monaco_dir_conn,
};
static int monaco_pinctrl_dirconn_list_probe(struct platform_device *pdev)
{
int ret, n, dirconn_list_count, m;
struct device_node *np = pdev->dev.of_node;
n = of_property_count_elems_of_size(np, "qcom,dirconn-list", sizeof(u32));
if (n <= 0 || n % 2)
return -EINVAL;
m = ARRAY_SIZE(monaco_dir_conn) - 1;
dirconn_list_count = n / 2;
for (n = 0; n < dirconn_list_count; n++) {
ret = of_property_read_u32_index(np, "qcom,dirconn-list",
n * 2 + 0, &monaco_dir_conn[m].gpio);
if (ret)
return ret;
ret = of_property_read_u32_index(np, "qcom,dirconn-list",
n * 2 + 1, &monaco_dir_conn[m].irq);
if (ret)
return ret;
m--;
}
return 0;
}
static const struct of_device_id monaco_auto_pinctrl_of_match[] = {
{ .compatible = "qcom,monaco_auto-pinctrl", .data = &monaco_auto_pinctrl},
{},
@ -1936,6 +1972,16 @@ static int monaco_auto_pinctrl_probe(struct platform_device *pdev)
{
const struct msm_pinctrl_soc_data *pinctrl_data;
struct device *dev = &pdev->dev;
int len, ret;
if (of_find_property(pdev->dev.of_node, "qcom,dirconn-list", &len)) {
ret = monaco_pinctrl_dirconn_list_probe(pdev);
if (ret) {
dev_err(&pdev->dev,
"Unable to parse Direct Connect List\n");
return ret;
}
}
pinctrl_data = of_device_get_match_data(dev);
if (!pinctrl_data)