[PATCH v3 4/7] gpio: tps6594x: add GPIO support for TPS6594x PMIC
Krzysztof Kozlowski
krzysztof.kozlowski at linaro.org
Wed Nov 9 00:50:38 PST 2022
On 09/11/2022 07:55, Matt Ranostay wrote:
> Add support for TPS6594X PMICs GPIO interface that has 11 that can be
> configured as input or outputs.
>
> Tested-by: Keerthy <j-keerthy at ti.com>
> Signed-off-by: Matt Ranostay <mranostay at ti.com>
> ---
> drivers/gpio/Kconfig | 7 ++
> drivers/gpio/Makefile | 1 +
> drivers/gpio/gpio-tps6594x.c | 142 +++++++++++++++++++++++++++++++++++
> include/linux/mfd/tps6594x.h | 6 ++
> 4 files changed, 156 insertions(+)
> create mode 100644 drivers/gpio/gpio-tps6594x.c
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 8c756cb29214..0225e6bddf0a 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -1405,6 +1405,13 @@ config GPIO_TPS65912
> help
> This driver supports TPS65912 GPIO chip.
>
> +config GPIO_TPS6594X
> + tristate "TI TPS6594X GPIO driver"
> + depends on MFD_TPS6594X
Maybe || COMPILE_TEST?
> + help
> + Select this option to enable GPIO driver for the TPS6954X
> + PMIC chip family. There are 11 GPIOs that can be configured.
> +
(...)
> +
> +static int tps6594x_gpio_probe(struct platform_device *pdev)
> +{
> + struct tps6594x *tps = dev_get_drvdata(pdev->dev.parent);
> + struct tps6594x_gpio *gpio;
> +
> + gpio = devm_kzalloc(&pdev->dev, sizeof(*gpio), GFP_KERNEL);
and here you did it correctly... I don't get why your two patches differ.
> + if (!gpio)
> + return -ENOMEM;
> +
> + gpio->tps = dev_get_drvdata(pdev->dev.parent);
> + gpio->gpio_chip = template_chip;
> + gpio->gpio_chip.parent = tps->dev;
> +
> + return devm_gpiochip_add_data(&pdev->dev, &gpio->gpio_chip, gpio);
> +}
> +
> +static const struct of_device_id of_tps6594x_gpio_match[] = {
> + { .compatible = "ti,tps6594x-gpio", },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, of_tps6594x_gpio_match);
> +
> +static struct platform_driver tps6594x_gpio_driver = {
> + .driver = {
> + .name = "tps6594x-gpio",
> + .of_match_table = of_match_ptr(of_tps6594x_gpio_match),
Drop of_match_ptr(). It comes with maybe_unused, which you do not have here.
Best regards,
Krzysztof
More information about the linux-arm-kernel
mailing list