Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

pinctrl: qcom: use generic pin function helpers

With the pinmux core no longer duplicating memory used to store the
struct pinfunction objects in .rodata, we can now use the existing
infrastructure for storing and looking up pin functions in qualcomm
drivers. Remove hand-crafted callbacks.

Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Bartosz Golaszewski and committed by
Linus Walleij
6f6835be d57b7979

+14 -30
+1
drivers/pinctrl/qcom/Kconfig
··· 8 8 depends on OF 9 9 select QCOM_SCM 10 10 select PINMUX 11 + select GENERIC_PINMUX_FUNCTIONS 11 12 select PINCONF 12 13 select GENERIC_PINCONF 13 14 select GPIOLIB_IRQCHIP
+13 -30
drivers/pinctrl/qcom/pinctrl-msm.c
··· 31 31 #include "../core.h" 32 32 #include "../pinconf.h" 33 33 #include "../pinctrl-utils.h" 34 + #include "../pinmux.h" 34 35 35 36 #include "pinctrl-msm.h" 36 37 ··· 151 150 return gpiochip_line_is_valid(chip, offset) ? 0 : -EINVAL; 152 151 } 153 152 154 - static int msm_get_functions_count(struct pinctrl_dev *pctldev) 155 - { 156 - struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 157 - 158 - return pctrl->soc->nfunctions; 159 - } 160 - 161 - static const char *msm_get_function_name(struct pinctrl_dev *pctldev, 162 - unsigned function) 163 - { 164 - struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 165 - 166 - return pctrl->soc->functions[function].name; 167 - } 168 - 169 - static int msm_get_function_groups(struct pinctrl_dev *pctldev, 170 - unsigned function, 171 - const char * const **groups, 172 - unsigned * const num_groups) 173 - { 174 - struct msm_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); 175 - 176 - *groups = pctrl->soc->functions[function].groups; 177 - *num_groups = pctrl->soc->functions[function].ngroups; 178 - return 0; 179 - } 180 - 181 153 static int msm_pinmux_set_mux(struct pinctrl_dev *pctldev, 182 154 unsigned function, 183 155 unsigned group) ··· 262 288 263 289 static const struct pinmux_ops msm_pinmux_ops = { 264 290 .request = msm_pinmux_request, 265 - .get_functions_count = msm_get_functions_count, 266 - .get_function_name = msm_get_function_name, 267 - .get_function_groups = msm_get_function_groups, 291 + .get_functions_count = pinmux_generic_get_function_count, 292 + .get_function_name = pinmux_generic_get_function_name, 293 + .get_function_groups = pinmux_generic_get_function_groups, 268 294 .gpio_request_enable = msm_pinmux_request_gpio, 269 295 .set_mux = msm_pinmux_set_mux, 270 296 }; ··· 1526 1552 int msm_pinctrl_probe(struct platform_device *pdev, 1527 1553 const struct msm_pinctrl_soc_data *soc_data) 1528 1554 { 1555 + const struct pinfunction *func; 1529 1556 struct msm_pinctrl *pctrl; 1530 1557 struct resource *res; 1531 1558 int ret; ··· 1579 1604 if (IS_ERR(pctrl->pctrl)) { 1580 1605 dev_err(&pdev->dev, "Couldn't register pinctrl driver\n"); 1581 1606 return PTR_ERR(pctrl->pctrl); 1607 + } 1608 + 1609 + for (i = 0; i < soc_data->nfunctions; i++) { 1610 + func = &soc_data->functions[i]; 1611 + 1612 + ret = pinmux_generic_add_pinfunction(pctrl->pctrl, func, NULL); 1613 + if (ret < 0) 1614 + return ret; 1582 1615 } 1583 1616 1584 1617 ret = msm_gpio_init(pctrl);