Commit 78df7bba authored by AngeloGioacchino Del Regno's avatar AngeloGioacchino Del Regno Committed by Linus Walleij

pinctrl: mediatek: paris: Unify probe function by using OF match data

All of the SoCs using Paris pinctrl are defining a custom probe
function that is simply calling mtk_paris_pinctrl_probe() passing
a pointer to the SoC specific mtk_pin_soc structure and nothing else.

Simplify the probe mechanism across all pinctrl drivers that are
using pinctrl-paris by passing the specific mtk_pin_soc as match
data and using function mtk_paris_pinctrl_probe as a common probe
function for all of them.
Signed-off-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: default avatarChen-Yu Tsai <wenst@chromium.org>
Link: https://lore.kernel.org/r/20220222111144.20796-2-angelogioacchino.delregno@collabora.comSigned-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent 89388f87
...@@ -1082,21 +1082,16 @@ static const struct mtk_pin_soc mt6765_data = { ...@@ -1082,21 +1082,16 @@ static const struct mtk_pin_soc mt6765_data = {
}; };
static const struct of_device_id mt6765_pinctrl_of_match[] = { static const struct of_device_id mt6765_pinctrl_of_match[] = {
{ .compatible = "mediatek,mt6765-pinctrl", }, { .compatible = "mediatek,mt6765-pinctrl", .data = &mt6765_data },
{ } { }
}; };
static int mt6765_pinctrl_probe(struct platform_device *pdev)
{
return mtk_paris_pinctrl_probe(pdev, &mt6765_data);
}
static struct platform_driver mt6765_pinctrl_driver = { static struct platform_driver mt6765_pinctrl_driver = {
.driver = { .driver = {
.name = "mt6765-pinctrl", .name = "mt6765-pinctrl",
.of_match_table = mt6765_pinctrl_of_match, .of_match_table = mt6765_pinctrl_of_match,
}, },
.probe = mt6765_pinctrl_probe, .probe = mtk_paris_pinctrl_probe,
}; };
static int __init mt6765_pinctrl_init(void) static int __init mt6765_pinctrl_init(void)
......
...@@ -758,21 +758,16 @@ static const struct mtk_pin_soc mt6779_data = { ...@@ -758,21 +758,16 @@ static const struct mtk_pin_soc mt6779_data = {
}; };
static const struct of_device_id mt6779_pinctrl_of_match[] = { static const struct of_device_id mt6779_pinctrl_of_match[] = {
{ .compatible = "mediatek,mt6779-pinctrl", }, { .compatible = "mediatek,mt6779-pinctrl", .data = &mt6779_data },
{ } { }
}; };
static int mt6779_pinctrl_probe(struct platform_device *pdev)
{
return mtk_paris_pinctrl_probe(pdev, &mt6779_data);
}
static struct platform_driver mt6779_pinctrl_driver = { static struct platform_driver mt6779_pinctrl_driver = {
.driver = { .driver = {
.name = "mt6779-pinctrl", .name = "mt6779-pinctrl",
.of_match_table = mt6779_pinctrl_of_match, .of_match_table = mt6779_pinctrl_of_match,
}, },
.probe = mt6779_pinctrl_probe, .probe = mtk_paris_pinctrl_probe,
}; };
static int __init mt6779_pinctrl_init(void) static int __init mt6779_pinctrl_init(void)
......
...@@ -58,21 +58,16 @@ static const struct mtk_pin_soc mt6797_data = { ...@@ -58,21 +58,16 @@ static const struct mtk_pin_soc mt6797_data = {
}; };
static const struct of_device_id mt6797_pinctrl_of_match[] = { static const struct of_device_id mt6797_pinctrl_of_match[] = {
{ .compatible = "mediatek,mt6797-pinctrl", }, { .compatible = "mediatek,mt6797-pinctrl", .data = &mt6797_data },
{ } { }
}; };
static int mt6797_pinctrl_probe(struct platform_device *pdev)
{
return mtk_paris_pinctrl_probe(pdev, &mt6797_data);
}
static struct platform_driver mt6797_pinctrl_driver = { static struct platform_driver mt6797_pinctrl_driver = {
.driver = { .driver = {
.name = "mt6797-pinctrl", .name = "mt6797-pinctrl",
.of_match_table = mt6797_pinctrl_of_match, .of_match_table = mt6797_pinctrl_of_match,
}, },
.probe = mt6797_pinctrl_probe, .probe = mtk_paris_pinctrl_probe,
}; };
static int __init mt6797_pinctrl_init(void) static int __init mt6797_pinctrl_init(void)
......
...@@ -567,22 +567,17 @@ static const struct mtk_pin_soc mt8183_data = { ...@@ -567,22 +567,17 @@ static const struct mtk_pin_soc mt8183_data = {
}; };
static const struct of_device_id mt8183_pinctrl_of_match[] = { static const struct of_device_id mt8183_pinctrl_of_match[] = {
{ .compatible = "mediatek,mt8183-pinctrl", }, { .compatible = "mediatek,mt8183-pinctrl", .data = &mt8183_data },
{ } { }
}; };
static int mt8183_pinctrl_probe(struct platform_device *pdev)
{
return mtk_paris_pinctrl_probe(pdev, &mt8183_data);
}
static struct platform_driver mt8183_pinctrl_driver = { static struct platform_driver mt8183_pinctrl_driver = {
.driver = { .driver = {
.name = "mt8183-pinctrl", .name = "mt8183-pinctrl",
.of_match_table = mt8183_pinctrl_of_match, .of_match_table = mt8183_pinctrl_of_match,
.pm = &mtk_paris_pinctrl_pm_ops, .pm = &mtk_paris_pinctrl_pm_ops,
}, },
.probe = mt8183_pinctrl_probe, .probe = mtk_paris_pinctrl_probe,
}; };
static int __init mt8183_pinctrl_init(void) static int __init mt8183_pinctrl_init(void)
......
...@@ -1381,22 +1381,17 @@ static const struct mtk_pin_soc mt8192_data = { ...@@ -1381,22 +1381,17 @@ static const struct mtk_pin_soc mt8192_data = {
}; };
static const struct of_device_id mt8192_pinctrl_of_match[] = { static const struct of_device_id mt8192_pinctrl_of_match[] = {
{ .compatible = "mediatek,mt8192-pinctrl", }, { .compatible = "mediatek,mt8192-pinctrl", .data = &mt8192_data },
{ } { }
}; };
static int mt8192_pinctrl_probe(struct platform_device *pdev)
{
return mtk_paris_pinctrl_probe(pdev, &mt8192_data);
}
static struct platform_driver mt8192_pinctrl_driver = { static struct platform_driver mt8192_pinctrl_driver = {
.driver = { .driver = {
.name = "mt8192-pinctrl", .name = "mt8192-pinctrl",
.of_match_table = mt8192_pinctrl_of_match, .of_match_table = mt8192_pinctrl_of_match,
.pm = &mtk_paris_pinctrl_pm_ops, .pm = &mtk_paris_pinctrl_pm_ops,
}, },
.probe = mt8192_pinctrl_probe, .probe = mtk_paris_pinctrl_probe,
}; };
static int __init mt8192_pinctrl_init(void) static int __init mt8192_pinctrl_init(void)
......
...@@ -959,22 +959,17 @@ static const struct mtk_pin_soc mt8195_data = { ...@@ -959,22 +959,17 @@ static const struct mtk_pin_soc mt8195_data = {
}; };
static const struct of_device_id mt8195_pinctrl_of_match[] = { static const struct of_device_id mt8195_pinctrl_of_match[] = {
{ .compatible = "mediatek,mt8195-pinctrl", }, { .compatible = "mediatek,mt8195-pinctrl", .data = &mt8195_data },
{ } { }
}; };
static int mt8195_pinctrl_probe(struct platform_device *pdev)
{
return mtk_paris_pinctrl_probe(pdev, &mt8195_data);
}
static struct platform_driver mt8195_pinctrl_driver = { static struct platform_driver mt8195_pinctrl_driver = {
.driver = { .driver = {
.name = "mt8195-pinctrl", .name = "mt8195-pinctrl",
.of_match_table = mt8195_pinctrl_of_match, .of_match_table = mt8195_pinctrl_of_match,
.pm = &mtk_paris_pinctrl_pm_ops, .pm = &mtk_paris_pinctrl_pm_ops,
}, },
.probe = mt8195_pinctrl_probe, .probe = mtk_paris_pinctrl_probe,
}; };
static int __init mt8195_pinctrl_init(void) static int __init mt8195_pinctrl_init(void)
......
...@@ -1021,8 +1021,7 @@ static int mtk_pctrl_build_state(struct platform_device *pdev) ...@@ -1021,8 +1021,7 @@ static int mtk_pctrl_build_state(struct platform_device *pdev)
return 0; return 0;
} }
int mtk_paris_pinctrl_probe(struct platform_device *pdev, int mtk_paris_pinctrl_probe(struct platform_device *pdev)
const struct mtk_pin_soc *soc)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct pinctrl_pin_desc *pins; struct pinctrl_pin_desc *pins;
...@@ -1034,7 +1033,11 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev, ...@@ -1034,7 +1033,11 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev,
return -ENOMEM; return -ENOMEM;
platform_set_drvdata(pdev, hw); platform_set_drvdata(pdev, hw);
hw->soc = soc;
hw->soc = device_get_match_data(dev);
if (!hw->soc)
return -ENOENT;
hw->dev = &pdev->dev; hw->dev = &pdev->dev;
if (!hw->soc->nbase_names) if (!hw->soc->nbase_names)
......
...@@ -57,8 +57,7 @@ ...@@ -57,8 +57,7 @@
id##_funcs, \ id##_funcs, \
} }
int mtk_paris_pinctrl_probe(struct platform_device *pdev, int mtk_paris_pinctrl_probe(struct platform_device *pdev);
const struct mtk_pin_soc *soc);
ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw, ssize_t mtk_pctrl_show_one_pin(struct mtk_pinctrl *hw,
unsigned int gpio, char *buf, unsigned int bufLen); unsigned int gpio, char *buf, unsigned int bufLen);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment