mirror of
https://github.com/torvalds/linux.git
synced 2026-05-29 09:33:31 +02:00
pinctrl: stm32: use new generic GPIO chip API
Convert the driver to using the new generic GPIO chip interfaces from linux/gpio/generic.h. Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> Link: https://lore.kernel.org/20250811-gpio-mmio-pinctrl-conv-v1-1-a84c5da2be20@linaro.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
8f5ae30d69
commit
4bcff9c05b
|
|
@ -6,6 +6,7 @@
|
||||||
#include <linux/bits.h>
|
#include <linux/bits.h>
|
||||||
#include <linux/clk.h>
|
#include <linux/clk.h>
|
||||||
#include <linux/gpio/driver.h>
|
#include <linux/gpio/driver.h>
|
||||||
|
#include <linux/gpio/generic.h>
|
||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_device.h>
|
#include <linux/of_device.h>
|
||||||
|
|
@ -45,7 +46,7 @@ struct stm32_hdp {
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
struct pinctrl_dev *pctl_dev;
|
struct pinctrl_dev *pctl_dev;
|
||||||
struct gpio_chip gpio_chip;
|
struct gpio_generic_chip gpio_chip;
|
||||||
u32 mux_conf;
|
u32 mux_conf;
|
||||||
u32 gposet_conf;
|
u32 gposet_conf;
|
||||||
const char * const *func_name;
|
const char * const *func_name;
|
||||||
|
|
@ -603,6 +604,7 @@ MODULE_DEVICE_TABLE(of, stm32_hdp_of_match);
|
||||||
|
|
||||||
static int stm32_hdp_probe(struct platform_device *pdev)
|
static int stm32_hdp_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
struct gpio_generic_chip_config config;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct stm32_hdp *hdp;
|
struct stm32_hdp *hdp;
|
||||||
u8 version;
|
u8 version;
|
||||||
|
|
@ -635,21 +637,25 @@ static int stm32_hdp_probe(struct platform_device *pdev)
|
||||||
if (err)
|
if (err)
|
||||||
return dev_err_probe(dev, err, "Failed to enable pinctrl\n");
|
return dev_err_probe(dev, err, "Failed to enable pinctrl\n");
|
||||||
|
|
||||||
hdp->gpio_chip.get_direction = stm32_hdp_gpio_get_direction;
|
hdp->gpio_chip.gc.get_direction = stm32_hdp_gpio_get_direction;
|
||||||
hdp->gpio_chip.ngpio = ARRAY_SIZE(stm32_hdp_pins);
|
hdp->gpio_chip.gc.ngpio = ARRAY_SIZE(stm32_hdp_pins);
|
||||||
hdp->gpio_chip.can_sleep = true;
|
hdp->gpio_chip.gc.can_sleep = true;
|
||||||
hdp->gpio_chip.names = stm32_hdp_pins_group;
|
hdp->gpio_chip.gc.names = stm32_hdp_pins_group;
|
||||||
|
|
||||||
err = bgpio_init(&hdp->gpio_chip, dev, 4,
|
config = (typeof(config)){
|
||||||
hdp->base + HDP_GPOVAL,
|
.dev = dev,
|
||||||
hdp->base + HDP_GPOSET,
|
.sz = 4,
|
||||||
hdp->base + HDP_GPOCLR,
|
.dat = hdp->base + HDP_GPOVAL,
|
||||||
NULL, NULL, BGPIOF_NO_INPUT);
|
.set = hdp->base + HDP_GPOSET,
|
||||||
|
.clr = hdp->base + HDP_GPOCLR,
|
||||||
|
.flags = BGPIOF_NO_INPUT,
|
||||||
|
};
|
||||||
|
|
||||||
|
err = gpio_generic_chip_init(&hdp->gpio_chip, &config);
|
||||||
if (err)
|
if (err)
|
||||||
return dev_err_probe(dev, err, "Failed to init bgpio\n");
|
return dev_err_probe(dev, err, "Failed to init the generic GPIO chip\n");
|
||||||
|
|
||||||
|
err = devm_gpiochip_add_data(dev, &hdp->gpio_chip.gc, hdp);
|
||||||
err = devm_gpiochip_add_data(dev, &hdp->gpio_chip, hdp);
|
|
||||||
if (err)
|
if (err)
|
||||||
return dev_err_probe(dev, err, "Failed to add gpiochip\n");
|
return dev_err_probe(dev, err, "Failed to add gpiochip\n");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user