* [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
@ 2025-02-28 16:57 Pratap Nirujogi
2025-03-01 13:32 ` Krzysztof Kozlowski
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Pratap Nirujogi @ 2025-02-28 16:57 UTC (permalink / raw)
To: linus.walleij; +Cc: linux-gpio, linux-kernel, benjamin.chan, Pratap Nirujogi
Add pinctrl driver support for AMD SoC with isp41 hw ip block.
Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com>
---
drivers/pinctrl/Kconfig | 13 ++
drivers/pinctrl/Makefile | 1 +
drivers/pinctrl/pinctrl-amdisp.c | 290 +++++++++++++++++++++++++++++++
drivers/pinctrl/pinctrl-amdisp.h | 118 +++++++++++++
4 files changed, 422 insertions(+)
create mode 100644 drivers/pinctrl/pinctrl-amdisp.c
create mode 100644 drivers/pinctrl/pinctrl-amdisp.h
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index 95a8e2b9a614..5819f18b2ddc 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -49,6 +49,19 @@ config PINCTRL_AMD
Requires ACPI/FDT device enumeration code to set up a platform
device.
+config PINCTRL_AMDISP
+ tristate "AMDISP GPIO pin control"
+ depends on HAS_IOMEM
+ select GPIOLIB
+ select PINCONF
+ select GENERIC_PINCONF
+ help
+ The driver for memory mapped GPIO functionality on AMD platforms
+ with ISP support. All the pins are output controlled only
+
+ Requires AMDGPU to MFD add device for enumeration to set up as
+ platform device.
+
config PINCTRL_APPLE_GPIO
tristate "Apple SoC GPIO pin controller driver"
depends on ARCH_APPLE
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index fba1c56624c0..ac27e88677d1 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o
obj-$(CONFIG_OF) += devicetree.o
obj-$(CONFIG_PINCTRL_AMD) += pinctrl-amd.o
+obj-$(CONFIG_PINCTRL_AMDISP) += pinctrl-amdisp.o
obj-$(CONFIG_PINCTRL_APPLE_GPIO) += pinctrl-apple-gpio.o
obj-$(CONFIG_PINCTRL_ARTPEC6) += pinctrl-artpec6.o
obj-$(CONFIG_PINCTRL_AS3722) += pinctrl-as3722.o
diff --git a/drivers/pinctrl/pinctrl-amdisp.c b/drivers/pinctrl/pinctrl-amdisp.c
new file mode 100644
index 000000000000..659406586cb2
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-amdisp.c
@@ -0,0 +1,290 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+#include <linux/gpio/driver.h>
+#include <linux/pinctrl/machine.h>
+#include <linux/slab.h>
+#include <linux/spinlock.h>
+#include <linux/interrupt.h>
+
+#include "core.h"
+#include "pinctrl-utils.h"
+#include "pinctrl-amd.h"
+#include "pinctrl-amdisp.h"
+
+#define DRV_NAME "amdisp-pinctrl"
+#define GPIO_CONTROL_PIN 4
+#define GPIO_OFFSET_0 0x0
+#define GPIO_OFFSET_1 0x4
+#define GPIO_OFFSET_2 0x50
+
+static const u32 gpio_offset[] = {
+ GPIO_OFFSET_0,
+ GPIO_OFFSET_1,
+ GPIO_OFFSET_2
+};
+
+struct amdisp_pinctrl_data {
+ const struct pinctrl_pin_desc *pins;
+ unsigned int npins;
+ const struct amdisp_function *functions;
+ unsigned int nfunctions;
+ const struct amdisp_pingroup *groups;
+ unsigned int ngroups;
+};
+
+static const struct amdisp_pinctrl_data amdisp_pinctrl_data = {
+ .pins = amdisp_pins,
+ .npins = ARRAY_SIZE(amdisp_pins),
+ .functions = amdisp_functions,
+ .nfunctions = ARRAY_SIZE(amdisp_functions),
+ .groups = amdisp_groups,
+ .ngroups = ARRAY_SIZE(amdisp_groups),
+};
+
+struct amdisp_pinctrl {
+ struct device *dev;
+ struct pinctrl_dev *pctrl;
+ struct pinctrl_desc desc;
+ struct pinctrl_gpio_range gpio_range;
+ struct gpio_chip gc;
+ const struct amdisp_pinctrl_data *data;
+ void __iomem *gpiobase;
+ raw_spinlock_t lock;
+};
+
+static int amdisp_get_groups_count(struct pinctrl_dev *pctldev)
+{
+ struct amdisp_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
+
+ return pctrl->data->ngroups;
+}
+
+static const char *amdisp_get_group_name(struct pinctrl_dev *pctldev,
+ unsigned int group)
+{
+ struct amdisp_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
+
+ return pctrl->data->groups[group].name;
+}
+
+static int amdisp_get_group_pins(struct pinctrl_dev *pctldev,
+ unsigned int group,
+ const unsigned int **pins,
+ unsigned int *num_pins)
+{
+ struct amdisp_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
+
+ *pins = pctrl->data->groups[group].pins;
+ *num_pins = pctrl->data->groups[group].npins;
+ return 0;
+}
+
+const struct pinctrl_ops amdisp_pinctrl_ops = {
+ .get_groups_count = amdisp_get_groups_count,
+ .get_group_name = amdisp_get_group_name,
+ .get_group_pins = amdisp_get_group_pins,
+};
+
+#ifdef CONFIG_GPIOLIB
+static int amdisp_gpio_get_direction(struct gpio_chip *gc, unsigned int gpio)
+{
+ /* amdisp gpio only has output mode */
+ return GPIO_LINE_DIRECTION_OUT;
+}
+
+static int amdisp_gpio_direction_input(struct gpio_chip *gc, unsigned int gpio)
+{
+ return -EOPNOTSUPP;
+}
+
+static int amdisp_gpio_direction_output(struct gpio_chip *gc, unsigned int gpio,
+ int value)
+{
+ /* Nothing to do, amdisp gpio only has output mode */
+ return 0;
+}
+
+static int amdisp_gpio_get(struct gpio_chip *gc, unsigned int gpio)
+{
+ unsigned long flags;
+ u32 pin_reg;
+ struct amdisp_pinctrl *pctrl = gpiochip_get_data(gc);
+
+ raw_spin_lock_irqsave(&pctrl->lock, flags);
+ pin_reg = readl(pctrl->gpiobase + gpio_offset[gpio]);
+ raw_spin_unlock_irqrestore(&pctrl->lock, flags);
+
+ return !!(pin_reg & BIT(GPIO_CONTROL_PIN));
+}
+
+static void amdisp_gpio_set(struct gpio_chip *gc, unsigned int gpio, int value)
+{
+ unsigned long flags;
+ u32 pin_reg;
+ struct amdisp_pinctrl *pctrl = gpiochip_get_data(gc);
+
+ raw_spin_lock_irqsave(&pctrl->lock, flags);
+ pin_reg = readl(pctrl->gpiobase + gpio_offset[gpio]);
+ if (value)
+ pin_reg |= BIT(GPIO_CONTROL_PIN);
+ else
+ pin_reg &= ~BIT(GPIO_CONTROL_PIN);
+ writel(pin_reg, pctrl->gpiobase + gpio_offset[gpio]);
+ raw_spin_unlock_irqrestore(&pctrl->lock, flags);
+}
+
+static int amdisp_gpio_set_config(struct gpio_chip *gc, unsigned int gpio,
+ unsigned long config)
+{
+ /* Nothing to do, amdisp gpio has no other config */
+ return 0;
+}
+
+static int amdisp_gpiochip_add(struct platform_device *pdev,
+ struct amdisp_pinctrl *pctrl)
+{
+ struct gpio_chip *gc = &pctrl->gc;
+ struct pinctrl_gpio_range *grange = &pctrl->gpio_range;
+ int ret;
+
+ gc->label = dev_name(pctrl->dev);
+ gc->owner = THIS_MODULE;
+ gc->parent = &pdev->dev;
+ gc->names = amdisp_range_pins_name;
+ gc->request = gpiochip_generic_request;
+ gc->free = gpiochip_generic_free;
+ gc->get_direction = amdisp_gpio_get_direction;
+ gc->direction_input = amdisp_gpio_direction_input;
+ gc->direction_output = amdisp_gpio_direction_output;
+ gc->get = amdisp_gpio_get;
+ gc->set = amdisp_gpio_set;
+ gc->set_config = amdisp_gpio_set_config;
+ gc->base = -1;
+ gc->ngpio = ARRAY_SIZE(amdisp_range_pins);
+#if defined(CONFIG_OF_GPIO)
+ gc->of_node = pdev->dev.of_node;
+ gc->of_gpio_n_cells = 2;
+#endif
+
+ grange->id = 0;
+ grange->pin_base = 0;
+ grange->base = 0;
+ grange->pins = amdisp_range_pins;
+ grange->npins = ARRAY_SIZE(amdisp_range_pins);
+ grange->name = gc->label;
+ grange->gc = gc;
+
+ ret = devm_gpiochip_add_data(&pdev->dev, gc, pctrl);
+ if (ret)
+ return ret;
+
+ pinctrl_add_gpio_range(pctrl->pctrl, grange);
+
+ dev_info(&pdev->dev, "register amdisp gpio controller\n");
+ return 0;
+}
+#endif
+
+static int amdisp_pinctrl_probe(struct platform_device *pdev)
+{
+ struct amdisp_pinctrl *pctrl;
+ struct resource *res;
+ int ret;
+
+ pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL);
+ if (!pctrl)
+ return -ENOMEM;
+
+ pdev->dev.init_name = DRV_NAME;
+#ifdef CONFIG_GPIOLIB
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (IS_ERR(res))
+ return PTR_ERR(res);
+
+ pctrl->gpiobase = devm_ioremap_resource(&pdev->dev, res);
+ if (IS_ERR(pctrl->gpiobase))
+ return PTR_ERR(pctrl->gpiobase);
+#endif
+ platform_set_drvdata(pdev, pctrl);
+
+ pctrl->dev = &pdev->dev;
+ pctrl->data = &amdisp_pinctrl_data;
+ pctrl->desc.owner = THIS_MODULE;
+ pctrl->desc.pctlops = &amdisp_pinctrl_ops;
+ pctrl->desc.pmxops = NULL;
+ pctrl->desc.name = dev_name(&pdev->dev);
+ pctrl->desc.pins = pctrl->data->pins;
+ pctrl->desc.npins = pctrl->data->npins;
+ ret = devm_pinctrl_register_and_init(&pdev->dev, &pctrl->desc,
+ pctrl, &pctrl->pctrl);
+ if (ret)
+ return ret;
+
+ ret = pinctrl_enable(pctrl->pctrl);
+ if (ret)
+ return ret;
+
+#ifdef CONFIG_GPIOLIB
+ ret = amdisp_gpiochip_add(pdev, pctrl);
+ if (ret)
+ return ret;
+#endif
+ dev_info(&pdev->dev, "amdisp pinctrl init successful\n");
+ return 0;
+}
+
+static struct platform_driver amdisp_pinctrl_driver = {
+ .driver = {
+ .name = DRV_NAME,
+ },
+ .probe = amdisp_pinctrl_probe,
+};
+
+static int __init amdisp_pinctrl_init(void)
+{
+ return platform_driver_register(&amdisp_pinctrl_driver);
+}
+arch_initcall(amdisp_pinctrl_init);
+
+static void __exit amdisp_pinctrl_exit(void)
+{
+ platform_driver_unregister(&amdisp_pinctrl_driver);
+}
+module_exit(amdisp_pinctrl_exit);
+
+MODULE_AUTHOR("Benjamin Chan <benjamin.chan@amd.com>");
+MODULE_AUTHOR("Pratap Nirujogi <pratap.nirujogi@amd.com>");
+MODULE_DESCRIPTION("AMDISP pinctrl driver");
+MODULE_LICENSE("GPL and additional rights");
+MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/drivers/pinctrl/pinctrl-amdisp.h b/drivers/pinctrl/pinctrl-amdisp.h
new file mode 100644
index 000000000000..8a541e024300
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-amdisp.h
@@ -0,0 +1,118 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+ * USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ */
+
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/pinctrl/pinmux.h>
+#include <linux/pinctrl/pinconf-generic.h>
+
+static const struct pinctrl_pin_desc amdisp_pins[] = {
+ PINCTRL_PIN(0, "GPIO_0"), /* sensor0 control */
+ PINCTRL_PIN(1, "GPIO_1"), /* sensor1 control */
+ PINCTRL_PIN(2, "GPIO_2"), /* sensor2 control */
+};
+
+#define AMDISP_GPIO_PINS(pin) \
+static const unsigned int gpio##pin##_pins[] = { pin }
+AMDISP_GPIO_PINS(0);
+AMDISP_GPIO_PINS(1);
+AMDISP_GPIO_PINS(2);
+
+static const unsigned int amdisp_range_pins[] = {
+ 0, 1, 2
+};
+
+static const char * const amdisp_range_pins_name[] = {
+ "gpio0", "gpio1", "gpio2"
+};
+
+enum amdisp_functions {
+ mux_gpio,
+ mux_NA
+};
+
+static const char * const gpio_groups[] = {
+ "gpio0", "gpio1", "gpio2"
+};
+
+/**
+ * struct amdisp_function - a pinmux function
+ * @name: Name of the pinmux function.
+ * @groups: List of pingroups for this function.
+ * @ngroups: Number of entries in @groups.
+ */
+struct amdisp_function {
+ const char *name;
+ const char * const *groups;
+ unsigned int ngroups;
+};
+
+#define FUNCTION(fname) \
+ [mux_##fname] = { \
+ .name = #fname, \
+ .groups = fname##_groups, \
+ .ngroups = ARRAY_SIZE(fname##_groups), \
+ }
+
+static const struct amdisp_function amdisp_functions[] = {
+ FUNCTION(gpio),
+};
+
+/**
+ * struct amdisp_pingroup - a pinmux group
+ * @name: Name of the pinmux group.
+ * @pins: List of pins for this group.
+ * @npins: Number of entries in @pins.
+ * @funcs: List of functions belongs to this group.
+ * @nfuncs: Number of entries in @funcs.
+ * @offset: Group offset in amdisp pinmux groups.
+ */
+struct amdisp_pingroup {
+ const char *name;
+ const unsigned int *pins;
+ unsigned int npins;
+ unsigned int *funcs;
+ unsigned int nfuncs;
+ unsigned int offset;
+};
+
+#define PINGROUP(id, f0) \
+ { \
+ .name = "gpio" #id, \
+ .pins = gpio##id##_pins, \
+ .npins = ARRAY_SIZE(gpio##id##_pins), \
+ .funcs = (int[]){ \
+ mux_##f0, \
+ }, \
+ .nfuncs = 1, \
+ .offset = id, \
+ }
+
+static const struct amdisp_pingroup amdisp_groups[] = {
+ PINGROUP(0, gpio),
+ PINGROUP(1, gpio),
+ PINGROUP(2, gpio),
+};
--
2.43.0
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
2025-02-28 16:57 [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl Pratap Nirujogi
@ 2025-03-01 13:32 ` Krzysztof Kozlowski
2025-03-04 23:22 ` Nirujogi, Pratap
2025-03-01 22:08 ` kernel test robot
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-03-01 13:32 UTC (permalink / raw)
To: Pratap Nirujogi, linus.walleij; +Cc: linux-gpio, linux-kernel, benjamin.chan
On 28/02/2025 17:57, Pratap Nirujogi wrote:
> diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
> index fba1c56624c0..ac27e88677d1 100644
> --- a/drivers/pinctrl/Makefile
> +++ b/drivers/pinctrl/Makefile
> @@ -10,6 +10,7 @@ obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o
> obj-$(CONFIG_OF) += devicetree.o
>
> obj-$(CONFIG_PINCTRL_AMD) += pinctrl-amd.o
> +obj-$(CONFIG_PINCTRL_AMDISP) += pinctrl-amdisp.o
> obj-$(CONFIG_PINCTRL_APPLE_GPIO) += pinctrl-apple-gpio.o
> obj-$(CONFIG_PINCTRL_ARTPEC6) += pinctrl-artpec6.o
> obj-$(CONFIG_PINCTRL_AS3722) += pinctrl-as3722.o
> diff --git a/drivers/pinctrl/pinctrl-amdisp.c b/drivers/pinctrl/pinctrl-amdisp.c
> new file mode 100644
> index 000000000000..659406586cb2
> --- /dev/null
> +++ b/drivers/pinctrl/pinctrl-amdisp.c
> @@ -0,0 +1,290 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sub license, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial portions
> + * of the Software.
Same problems as with rest of AMD patches.
> + *
> + */
> +
> +#include <linux/module.h>
> +#include <linux/err.h>
> +#include <linux/io.h>
> +#include <linux/module.h>
> +#include <linux/of.h>
Where do you use it?
> +#include <linux/platform_device.h>
> +#include <linux/gpio/driver.h>
> +#include <linux/pinctrl/machine.h>
> +#include <linux/slab.h>
> +#include <linux/spinlock.h>
> +#include <linux/interrupt.h>
Where do you use half of these headers?
> +#include "core.h"
> +#include "pinctrl-utils.h"
> +#include "pinctrl-amd.h"
> +#include "pinctrl-amdisp.h"
> +
> +#define DRV_NAME "amdisp-pinctrl"
> +#define GPIO_CONTROL_PIN 4
> +#define GPIO_OFFSET_0 0x0
> +#define GPIO_OFFSET_1 0x4
> +#define GPIO_OFFSET_2 0x50
...
> +static int amdisp_gpiochip_add(struct platform_device *pdev,
> + struct amdisp_pinctrl *pctrl)
> +{
> + struct gpio_chip *gc = &pctrl->gc;
> + struct pinctrl_gpio_range *grange = &pctrl->gpio_range;
> + int ret;
> +
> + gc->label = dev_name(pctrl->dev);
> + gc->owner = THIS_MODULE;
> + gc->parent = &pdev->dev;
> + gc->names = amdisp_range_pins_name;
> + gc->request = gpiochip_generic_request;
> + gc->free = gpiochip_generic_free;
> + gc->get_direction = amdisp_gpio_get_direction;
> + gc->direction_input = amdisp_gpio_direction_input;
> + gc->direction_output = amdisp_gpio_direction_output;
> + gc->get = amdisp_gpio_get;
> + gc->set = amdisp_gpio_set;
> + gc->set_config = amdisp_gpio_set_config;
> + gc->base = -1;
> + gc->ngpio = ARRAY_SIZE(amdisp_range_pins);
> +#if defined(CONFIG_OF_GPIO)
> + gc->of_node = pdev->dev.of_node;
> + gc->of_gpio_n_cells = 2;
> +#endif
> +
> + grange->id = 0;
> + grange->pin_base = 0;
> + grange->base = 0;
> + grange->pins = amdisp_range_pins;
> + grange->npins = ARRAY_SIZE(amdisp_range_pins);
> + grange->name = gc->label;
> + grange->gc = gc;
> +
> + ret = devm_gpiochip_add_data(&pdev->dev, gc, pctrl);
> + if (ret)
> + return ret;
> +
> + pinctrl_add_gpio_range(pctrl->pctrl, grange);
> +
> + dev_info(&pdev->dev, "register amdisp gpio controller\n");
Drop
> + return 0;
> +}
> +#endif
> +
> +static int amdisp_pinctrl_probe(struct platform_device *pdev)
> +{
> + struct amdisp_pinctrl *pctrl;
> + struct resource *res;
> + int ret;
> +
> + pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL);
> + if (!pctrl)
> + return -ENOMEM;
> +
> + pdev->dev.init_name = DRV_NAME;
> +#ifdef CONFIG_GPIOLIB
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (IS_ERR(res))
> + return PTR_ERR(res);
> +
> + pctrl->gpiobase = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(pctrl->gpiobase))
> + return PTR_ERR(pctrl->gpiobase);
> +#endif
> + platform_set_drvdata(pdev, pctrl);
> +
> + pctrl->dev = &pdev->dev;
> + pctrl->data = &amdisp_pinctrl_data;
> + pctrl->desc.owner = THIS_MODULE;
> + pctrl->desc.pctlops = &amdisp_pinctrl_ops;
> + pctrl->desc.pmxops = NULL;
> + pctrl->desc.name = dev_name(&pdev->dev);
> + pctrl->desc.pins = pctrl->data->pins;
> + pctrl->desc.npins = pctrl->data->npins;
> + ret = devm_pinctrl_register_and_init(&pdev->dev, &pctrl->desc,
> + pctrl, &pctrl->pctrl);
> + if (ret)
> + return ret;
> +
> + ret = pinctrl_enable(pctrl->pctrl);
> + if (ret)
> + return ret;
> +
> +#ifdef CONFIG_GPIOLIB
> + ret = amdisp_gpiochip_add(pdev, pctrl);
> + if (ret)
> + return ret;
> +#endif
> + dev_info(&pdev->dev, "amdisp pinctrl init successful\n");
Drop, useless. Not mentioning that drivers should be silent on success.
> + return 0;
> +}
> +
> +static struct platform_driver amdisp_pinctrl_driver = {
> + .driver = {
> + .name = DRV_NAME,
> + },
> + .probe = amdisp_pinctrl_probe,
> +};
> +
> +static int __init amdisp_pinctrl_init(void)
> +{
> + return platform_driver_register(&amdisp_pinctrl_driver);
> +}
> +arch_initcall(amdisp_pinctrl_init);
> +
> +static void __exit amdisp_pinctrl_exit(void)
> +{
> + platform_driver_unregister(&amdisp_pinctrl_driver);
> +}
> +module_exit(amdisp_pinctrl_exit);
> +
> +MODULE_AUTHOR("Benjamin Chan <benjamin.chan@amd.com>");
> +MODULE_AUTHOR("Pratap Nirujogi <pratap.nirujogi@amd.com>");
> +MODULE_DESCRIPTION("AMDISP pinctrl driver");
> +MODULE_LICENSE("GPL and additional rights");
No, that's not true. Just like in other patch...
> +MODULE_ALIAS("platform:" DRV_NAME);
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
2025-03-01 13:32 ` Krzysztof Kozlowski
@ 2025-03-04 23:22 ` Nirujogi, Pratap
0 siblings, 0 replies; 8+ messages in thread
From: Nirujogi, Pratap @ 2025-03-04 23:22 UTC (permalink / raw)
To: Krzysztof Kozlowski, Pratap Nirujogi, linus.walleij
Cc: linux-gpio, linux-kernel, benjamin.chan, bin.du, king.li,
gjorgji.rosikopulos, dominic.antony
Hi Krzysztof,
Thanks for your review.
I pushed the new v2 patch addressing the comments.
Please help reviewing the new v2 and will look forward for your feedback.
Thanks,
Pratap
On 3/1/2025 8:32 AM, Krzysztof Kozlowski wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On 28/02/2025 17:57, Pratap Nirujogi wrote:
>> diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
>> index fba1c56624c0..ac27e88677d1 100644
>> --- a/drivers/pinctrl/Makefile
>> +++ b/drivers/pinctrl/Makefile
>> @@ -10,6 +10,7 @@ obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o
>> obj-$(CONFIG_OF) += devicetree.o
>>
>> obj-$(CONFIG_PINCTRL_AMD) += pinctrl-amd.o
>> +obj-$(CONFIG_PINCTRL_AMDISP) += pinctrl-amdisp.o
>> obj-$(CONFIG_PINCTRL_APPLE_GPIO) += pinctrl-apple-gpio.o
>> obj-$(CONFIG_PINCTRL_ARTPEC6) += pinctrl-artpec6.o
>> obj-$(CONFIG_PINCTRL_AS3722) += pinctrl-as3722.o
>> diff --git a/drivers/pinctrl/pinctrl-amdisp.c b/drivers/pinctrl/pinctrl-amdisp.c
>> new file mode 100644
>> index 000000000000..659406586cb2
>> --- /dev/null
>> +++ b/drivers/pinctrl/pinctrl-amdisp.c
>> @@ -0,0 +1,290 @@
>> +/* SPDX-License-Identifier: MIT */
>> +/*
>> + * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
>> + * All Rights Reserved.
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the
>> + * "Software"), to deal in the Software without restriction, including
>> + * without limitation the rights to use, copy, modify, merge, publish,
>> + * distribute, sub license, and/or sell copies of the Software, and to
>> + * permit persons to whom the Software is furnished to do so, subject to
>> + * the following conditions:
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
>> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
>> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
>> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
>> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
>> + *
>> + * The above copyright notice and this permission notice (including the
>> + * next paragraph) shall be included in all copies or substantial portions
>> + * of the Software.
>
> Same problems as with rest of AMD patches.
>
Done. Updated copyright header.
>> + *
>> + */
>> +
>> +#include <linux/module.h>
>> +#include <linux/err.h>
>> +#include <linux/io.h>
>> +#include <linux/module.h>
>> +#include <linux/of.h>
>
> Where do you use it?
>
>> +#include <linux/platform_device.h>
>> +#include <linux/gpio/driver.h>
>> +#include <linux/pinctrl/machine.h>
>> +#include <linux/slab.h>
>> +#include <linux/spinlock.h>
>> +#include <linux/interrupt.h>
>
> Where do you use half of these headers?
>
Done. Yes, most of them are not used, removed in v2.
>> +#include "core.h"
>> +#include "pinctrl-utils.h"
>> +#include "pinctrl-amd.h"
>> +#include "pinctrl-amdisp.h"
>> +
>> +#define DRV_NAME "amdisp-pinctrl"
>> +#define GPIO_CONTROL_PIN 4
>> +#define GPIO_OFFSET_0 0x0
>> +#define GPIO_OFFSET_1 0x4
>> +#define GPIO_OFFSET_2 0x50
>
> ...
>
>> +static int amdisp_gpiochip_add(struct platform_device *pdev,
>> + struct amdisp_pinctrl *pctrl)
>> +{
>> + struct gpio_chip *gc = &pctrl->gc;
>> + struct pinctrl_gpio_range *grange = &pctrl->gpio_range;
>> + int ret;
>> +
>> + gc->label = dev_name(pctrl->dev);
>> + gc->owner = THIS_MODULE;
>> + gc->parent = &pdev->dev;
>> + gc->names = amdisp_range_pins_name;
>> + gc->request = gpiochip_generic_request;
>> + gc->free = gpiochip_generic_free;
>> + gc->get_direction = amdisp_gpio_get_direction;
>> + gc->direction_input = amdisp_gpio_direction_input;
>> + gc->direction_output = amdisp_gpio_direction_output;
>> + gc->get = amdisp_gpio_get;
>> + gc->set = amdisp_gpio_set;
>> + gc->set_config = amdisp_gpio_set_config;
>> + gc->base = -1;
>> + gc->ngpio = ARRAY_SIZE(amdisp_range_pins);
>> +#if defined(CONFIG_OF_GPIO)
>> + gc->of_node = pdev->dev.of_node;
>> + gc->of_gpio_n_cells = 2;
>> +#endif
>> +
>> + grange->id = 0;
>> + grange->pin_base = 0;
>> + grange->base = 0;
>> + grange->pins = amdisp_range_pins;
>> + grange->npins = ARRAY_SIZE(amdisp_range_pins);
>> + grange->name = gc->label;
>> + grange->gc = gc;
>> +
>> + ret = devm_gpiochip_add_data(&pdev->dev, gc, pctrl);
>> + if (ret)
>> + return ret;
>> +
>> + pinctrl_add_gpio_range(pctrl->pctrl, grange);
>> +
>> + dev_info(&pdev->dev, "register amdisp gpio controller\n");
>
> Drop
>
Done. Removed noisy success prints.
>> + return 0;
>> +}
>> +#endif
>> +
>> +static int amdisp_pinctrl_probe(struct platform_device *pdev)
>> +{
>> + struct amdisp_pinctrl *pctrl;
>> + struct resource *res;
>> + int ret;
>> +
>> + pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL);
>> + if (!pctrl)
>> + return -ENOMEM;
>> +
>> + pdev->dev.init_name = DRV_NAME;
>> +#ifdef CONFIG_GPIOLIB
>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> + if (IS_ERR(res))
>> + return PTR_ERR(res);
>> +
>> + pctrl->gpiobase = devm_ioremap_resource(&pdev->dev, res);
>> + if (IS_ERR(pctrl->gpiobase))
>> + return PTR_ERR(pctrl->gpiobase);
>> +#endif
>> + platform_set_drvdata(pdev, pctrl);
>> +
>> + pctrl->dev = &pdev->dev;
>> + pctrl->data = &amdisp_pinctrl_data;
>> + pctrl->desc.owner = THIS_MODULE;
>> + pctrl->desc.pctlops = &amdisp_pinctrl_ops;
>> + pctrl->desc.pmxops = NULL;
>> + pctrl->desc.name = dev_name(&pdev->dev);
>> + pctrl->desc.pins = pctrl->data->pins;
>> + pctrl->desc.npins = pctrl->data->npins;
>> + ret = devm_pinctrl_register_and_init(&pdev->dev, &pctrl->desc,
>> + pctrl, &pctrl->pctrl);
>> + if (ret)
>> + return ret;
>> +
>> + ret = pinctrl_enable(pctrl->pctrl);
>> + if (ret)
>> + return ret;
>> +
>> +#ifdef CONFIG_GPIOLIB
>> + ret = amdisp_gpiochip_add(pdev, pctrl);
>> + if (ret)
>> + return ret;
>> +#endif
>> + dev_info(&pdev->dev, "amdisp pinctrl init successful\n");
>
> Drop, useless. Not mentioning that drivers should be silent on success.
>
Done.
>> + return 0;
>> +}
>> +
>> +static struct platform_driver amdisp_pinctrl_driver = {
>> + .driver = {
>> + .name = DRV_NAME,
>> + },
>> + .probe = amdisp_pinctrl_probe,
>> +};
>> +
>> +static int __init amdisp_pinctrl_init(void)
>> +{
>> + return platform_driver_register(&amdisp_pinctrl_driver);
>> +}
>> +arch_initcall(amdisp_pinctrl_init);
>> +
>> +static void __exit amdisp_pinctrl_exit(void)
>> +{
>> + platform_driver_unregister(&amdisp_pinctrl_driver);
>> +}
>> +module_exit(amdisp_pinctrl_exit);
>> +
>> +MODULE_AUTHOR("Benjamin Chan <benjamin.chan@amd.com>");
>> +MODULE_AUTHOR("Pratap Nirujogi <pratap.nirujogi@amd.com>");
>> +MODULE_DESCRIPTION("AMDISP pinctrl driver");
>> +MODULE_LICENSE("GPL and additional rights");
>
> No, that's not true. Just like in other patch...
>
Done. Updated license info.
>> +MODULE_ALIAS("platform:" DRV_NAME);
>
>
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
2025-02-28 16:57 [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl Pratap Nirujogi
2025-03-01 13:32 ` Krzysztof Kozlowski
@ 2025-03-01 22:08 ` kernel test robot
2025-03-02 1:22 ` kernel test robot
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2025-03-01 22:08 UTC (permalink / raw)
To: Pratap Nirujogi, linus.walleij
Cc: oe-kbuild-all, linux-gpio, linux-kernel, benjamin.chan,
Pratap Nirujogi
Hi Pratap,
kernel test robot noticed the following build errors:
[auto build test ERROR on linusw-pinctrl/devel]
[also build test ERROR on linusw-pinctrl/for-next linus/master v6.14-rc4 next-20250228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pratap-Nirujogi/pinctrl-amd-isp411-Add-amdisp-GPIO-pinctrl/20250301-011050
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link: https://lore.kernel.org/r/20250228165749.3476210-1-pratap.nirujogi%40amd.com
patch subject: [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
config: arc-randconfig-002-20250302 (https://download.01.org/0day-ci/archive/20250302/202503020508.tSquVmjP-lkp@intel.com/config)
compiler: arc-elf-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250302/202503020508.tSquVmjP-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503020508.tSquVmjP-lkp@intel.com/
All error/warnings (new ones prefixed by >>):
drivers/pinctrl/pinctrl-amdisp.c: In function 'amdisp_gpiochip_add':
>> drivers/pinctrl/pinctrl-amdisp.c:196:13: error: 'struct gpio_chip' has no member named 'of_node'; did you mean 'fwnode'?
196 | gc->of_node = pdev->dev.of_node;
| ^~~~~~~
| fwnode
In file included from drivers/pinctrl/pinctrl-amdisp.c:42:
drivers/pinctrl/pinctrl-amd.h: At top level:
>> drivers/pinctrl/pinctrl-amd.h:1478:34: warning: 'pmx_functions' defined but not used [-Wunused-const-variable=]
1478 | static const struct amd_function pmx_functions[] = {
| ^~~~~~~~~~~~~
>> drivers/pinctrl/pinctrl-amd.h:882:30: warning: 'kerncz_groups' defined but not used [-Wunused-const-variable=]
882 | static const struct pingroup kerncz_groups[] = {
| ^~~~~~~~~~~~~
>> drivers/pinctrl/pinctrl-amd.h:111:38: warning: 'kerncz_pins' defined but not used [-Wunused-const-variable=]
111 | static const struct pinctrl_pin_desc kerncz_pins[] = {
| ^~~~~~~~~~~
vim +196 drivers/pinctrl/pinctrl-amdisp.c
173
174 static int amdisp_gpiochip_add(struct platform_device *pdev,
175 struct amdisp_pinctrl *pctrl)
176 {
177 struct gpio_chip *gc = &pctrl->gc;
178 struct pinctrl_gpio_range *grange = &pctrl->gpio_range;
179 int ret;
180
181 gc->label = dev_name(pctrl->dev);
182 gc->owner = THIS_MODULE;
183 gc->parent = &pdev->dev;
184 gc->names = amdisp_range_pins_name;
185 gc->request = gpiochip_generic_request;
186 gc->free = gpiochip_generic_free;
187 gc->get_direction = amdisp_gpio_get_direction;
188 gc->direction_input = amdisp_gpio_direction_input;
189 gc->direction_output = amdisp_gpio_direction_output;
190 gc->get = amdisp_gpio_get;
191 gc->set = amdisp_gpio_set;
192 gc->set_config = amdisp_gpio_set_config;
193 gc->base = -1;
194 gc->ngpio = ARRAY_SIZE(amdisp_range_pins);
195 #if defined(CONFIG_OF_GPIO)
> 196 gc->of_node = pdev->dev.of_node;
197 gc->of_gpio_n_cells = 2;
198 #endif
199
200 grange->id = 0;
201 grange->pin_base = 0;
202 grange->base = 0;
203 grange->pins = amdisp_range_pins;
204 grange->npins = ARRAY_SIZE(amdisp_range_pins);
205 grange->name = gc->label;
206 grange->gc = gc;
207
208 ret = devm_gpiochip_add_data(&pdev->dev, gc, pctrl);
209 if (ret)
210 return ret;
211
212 pinctrl_add_gpio_range(pctrl->pctrl, grange);
213
214 dev_info(&pdev->dev, "register amdisp gpio controller\n");
215 return 0;
216 }
217 #endif
218
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
2025-02-28 16:57 [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl Pratap Nirujogi
2025-03-01 13:32 ` Krzysztof Kozlowski
2025-03-01 22:08 ` kernel test robot
@ 2025-03-02 1:22 ` kernel test robot
2025-03-02 3:42 ` kernel test robot
2025-03-04 8:34 ` Linus Walleij
4 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2025-03-02 1:22 UTC (permalink / raw)
To: Pratap Nirujogi, linus.walleij
Cc: oe-kbuild-all, linux-gpio, linux-kernel, benjamin.chan,
Pratap Nirujogi
Hi Pratap,
kernel test robot noticed the following build errors:
[auto build test ERROR on linusw-pinctrl/devel]
[also build test ERROR on linusw-pinctrl/for-next linus/master v6.14-rc4 next-20250228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pratap-Nirujogi/pinctrl-amd-isp411-Add-amdisp-GPIO-pinctrl/20250301-011050
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link: https://lore.kernel.org/r/20250228165749.3476210-1-pratap.nirujogi%40amd.com
patch subject: [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
config: hexagon-randconfig-r072-20250302 (https://download.01.org/0day-ci/archive/20250302/202503020937.17QhMxc9-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 14170b16028c087ca154878f5ed93d3089a965c6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250302/202503020937.17QhMxc9-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503020937.17QhMxc9-lkp@intel.com/
All errors (new ones prefixed by >>):
>> drivers/pinctrl/pinctrl-amdisp.c:196:6: error: no member named 'of_node' in 'struct gpio_chip'; did you mean 'fwnode'?
196 | gc->of_node = pdev->dev.of_node;
| ^~~~~~~
| fwnode
include/linux/gpio/driver.h:421:24: note: 'fwnode' declared here
421 | struct fwnode_handle *fwnode;
| ^
1 error generated.
vim +196 drivers/pinctrl/pinctrl-amdisp.c
173
174 static int amdisp_gpiochip_add(struct platform_device *pdev,
175 struct amdisp_pinctrl *pctrl)
176 {
177 struct gpio_chip *gc = &pctrl->gc;
178 struct pinctrl_gpio_range *grange = &pctrl->gpio_range;
179 int ret;
180
181 gc->label = dev_name(pctrl->dev);
182 gc->owner = THIS_MODULE;
183 gc->parent = &pdev->dev;
184 gc->names = amdisp_range_pins_name;
185 gc->request = gpiochip_generic_request;
186 gc->free = gpiochip_generic_free;
187 gc->get_direction = amdisp_gpio_get_direction;
188 gc->direction_input = amdisp_gpio_direction_input;
189 gc->direction_output = amdisp_gpio_direction_output;
190 gc->get = amdisp_gpio_get;
191 gc->set = amdisp_gpio_set;
192 gc->set_config = amdisp_gpio_set_config;
193 gc->base = -1;
194 gc->ngpio = ARRAY_SIZE(amdisp_range_pins);
195 #if defined(CONFIG_OF_GPIO)
> 196 gc->of_node = pdev->dev.of_node;
197 gc->of_gpio_n_cells = 2;
198 #endif
199
200 grange->id = 0;
201 grange->pin_base = 0;
202 grange->base = 0;
203 grange->pins = amdisp_range_pins;
204 grange->npins = ARRAY_SIZE(amdisp_range_pins);
205 grange->name = gc->label;
206 grange->gc = gc;
207
208 ret = devm_gpiochip_add_data(&pdev->dev, gc, pctrl);
209 if (ret)
210 return ret;
211
212 pinctrl_add_gpio_range(pctrl->pctrl, grange);
213
214 dev_info(&pdev->dev, "register amdisp gpio controller\n");
215 return 0;
216 }
217 #endif
218
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
2025-02-28 16:57 [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl Pratap Nirujogi
` (2 preceding siblings ...)
2025-03-02 1:22 ` kernel test robot
@ 2025-03-02 3:42 ` kernel test robot
2025-03-04 8:34 ` Linus Walleij
4 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2025-03-02 3:42 UTC (permalink / raw)
To: Pratap Nirujogi, linus.walleij
Cc: oe-kbuild-all, linux-gpio, linux-kernel, benjamin.chan,
Pratap Nirujogi
Hi Pratap,
kernel test robot noticed the following build warnings:
[auto build test WARNING on linusw-pinctrl/devel]
[also build test WARNING on linusw-pinctrl/for-next linus/master v6.14-rc4 next-20250228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Pratap-Nirujogi/pinctrl-amd-isp411-Add-amdisp-GPIO-pinctrl/20250301-011050
base: https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git devel
patch link: https://lore.kernel.org/r/20250228165749.3476210-1-pratap.nirujogi%40amd.com
patch subject: [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
config: um-randconfig-r112-20250302 (https://download.01.org/0day-ci/archive/20250302/202503021137.LAkq3bMU-lkp@intel.com/config)
compiler: clang version 21.0.0git (https://github.com/llvm/llvm-project 14170b16028c087ca154878f5ed93d3089a965c6)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250302/202503021137.LAkq3bMU-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503021137.LAkq3bMU-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/pinctrl/pinctrl-amdisp.c:113:26: sparse: sparse: symbol 'amdisp_pinctrl_ops' was not declared. Should it be static?
vim +/amdisp_pinctrl_ops +113 drivers/pinctrl/pinctrl-amdisp.c
112
> 113 const struct pinctrl_ops amdisp_pinctrl_ops = {
114 .get_groups_count = amdisp_get_groups_count,
115 .get_group_name = amdisp_get_group_name,
116 .get_group_pins = amdisp_get_group_pins,
117 };
118
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
2025-02-28 16:57 [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl Pratap Nirujogi
` (3 preceding siblings ...)
2025-03-02 3:42 ` kernel test robot
@ 2025-03-04 8:34 ` Linus Walleij
2025-03-04 23:22 ` Nirujogi, Pratap
4 siblings, 1 reply; 8+ messages in thread
From: Linus Walleij @ 2025-03-04 8:34 UTC (permalink / raw)
To: Pratap Nirujogi; +Cc: linux-gpio, linux-kernel, benjamin.chan
Hi Pratap,
thanks for your patch!
On Fri, Feb 28, 2025 at 5:58 PM Pratap Nirujogi <pratap.nirujogi@amd.com> wrote:
> +config PINCTRL_AMDISP
> + tristate "AMDISP GPIO pin control"
> + depends on HAS_IOMEM
> + select GPIOLIB
> + select PINCONF
> + select GENERIC_PINCONF
> + help
> + The driver for memory mapped GPIO functionality on AMD platforms
> + with ISP support. All the pins are output controlled only
> +
> + Requires AMDGPU to MFD add device for enumeration to set up as
> + platform device.
> +/* SPDX-License-Identifier: MIT */
OK we have this...
> +/*
> + * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
> + * All Rights Reserved.
> + *
That can be kept
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sub license, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial portions
> + * of the Software.
This is already in:
LICENSES/preferred/MIT
Which is referenced by the SPDX tag.
Can we just drop it? It's very annoying with all this boilerplate.
> +#ifdef CONFIG_GPIOLIB
You select GPIOLIB in the Kconfig so drop the ifdef, it's always
available.
> +static int amdisp_gpio_set_config(struct gpio_chip *gc, unsigned int gpio,
> + unsigned long config)
> +{
> + /* Nothing to do, amdisp gpio has no other config */
> + return 0;
> +}
Don't even assign the callback then, that's fine.
> +static int amdisp_gpiochip_add(struct platform_device *pdev,
> + struct amdisp_pinctrl *pctrl)
> +{
> + struct gpio_chip *gc = &pctrl->gc;
> + struct pinctrl_gpio_range *grange = &pctrl->gpio_range;
> + int ret;
> +
> + gc->label = dev_name(pctrl->dev);
> + gc->owner = THIS_MODULE;
I think the core default-assigns owner so you don't need to
assign this.
> + gc->parent = &pdev->dev;
> + gc->names = amdisp_range_pins_name;
> + gc->request = gpiochip_generic_request;
> + gc->free = gpiochip_generic_free;
> + gc->get_direction = amdisp_gpio_get_direction;
> + gc->direction_input = amdisp_gpio_direction_input;
> + gc->direction_output = amdisp_gpio_direction_output;
> + gc->get = amdisp_gpio_get;
> + gc->set = amdisp_gpio_set;
> + gc->set_config = amdisp_gpio_set_config;
I.e. drop this.
> + gc->base = -1;
> + gc->ngpio = ARRAY_SIZE(amdisp_range_pins);
> +#if defined(CONFIG_OF_GPIO)
> + gc->of_node = pdev->dev.of_node;
> + gc->of_gpio_n_cells = 2;
> +#endif
Drop the ifdefs.
> +#ifdef CONFIG_GPIOLIB
> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> + if (IS_ERR(res))
> + return PTR_ERR(res);
> +
> + pctrl->gpiobase = devm_ioremap_resource(&pdev->dev, res);
> + if (IS_ERR(pctrl->gpiobase))
> + return PTR_ERR(pctrl->gpiobase);
> +#endif
Drop ifdefs
> +#ifdef CONFIG_GPIOLIB
> + ret = amdisp_gpiochip_add(pdev, pctrl);
> + if (ret)
> + return ret;
> +#endif
Drop ifdefs
> +static int __init amdisp_pinctrl_init(void)
> +{
> + return platform_driver_register(&amdisp_pinctrl_driver);
> +}
> +arch_initcall(amdisp_pinctrl_init);
> +
> +static void __exit amdisp_pinctrl_exit(void)
> +{
> + platform_driver_unregister(&amdisp_pinctrl_driver);
> +}
> +module_exit(amdisp_pinctrl_exit);
Why do you need arch_initcall()?
Try to just use module_platform_driver() for the
whole module.
> +MODULE_AUTHOR("Benjamin Chan <benjamin.chan@amd.com>");
> +MODULE_AUTHOR("Pratap Nirujogi <pratap.nirujogi@amd.com>");
> +MODULE_DESCRIPTION("AMDISP pinctrl driver");
> +MODULE_LICENSE("GPL and additional rights");
Well that does not correspond to MIT does it?
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
> + * All Rights Reserved.
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the
> + * "Software"), to deal in the Software without restriction, including
> + * without limitation the rights to use, copy, modify, merge, publish,
> + * distribute, sub license, and/or sell copies of the Software, and to
> + * permit persons to whom the Software is furnished to do so, subject to
> + * the following conditions:
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
> + *
> + * The above copyright notice and this permission notice (including the
> + * next paragraph) shall be included in all copies or substantial portions
> + * of the Software.
Can we drop this?
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl
2025-03-04 8:34 ` Linus Walleij
@ 2025-03-04 23:22 ` Nirujogi, Pratap
0 siblings, 0 replies; 8+ messages in thread
From: Nirujogi, Pratap @ 2025-03-04 23:22 UTC (permalink / raw)
To: Linus Walleij, Pratap Nirujogi
Cc: linux-gpio, linux-kernel, benjamin.chan, bin.du, king.li,
gjorgji.rosikopulos, dominic.antony
Hi Linus,
Thanks for your review. Please help reviewing the new v2 patch with
comments addressed and will look forward for your feedback.
Thanks,
Pratap
On 3/4/2025 3:34 AM, Linus Walleij wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> Hi Pratap,
>
> thanks for your patch!
>
> On Fri, Feb 28, 2025 at 5:58 PM Pratap Nirujogi <pratap.nirujogi@amd.com> wrote:
>
>> +config PINCTRL_AMDISP
>> + tristate "AMDISP GPIO pin control"
>> + depends on HAS_IOMEM
>> + select GPIOLIB
>> + select PINCONF
>> + select GENERIC_PINCONF
>> + help
>> + The driver for memory mapped GPIO functionality on AMD platforms
>> + with ISP support. All the pins are output controlled only
>> +
>> + Requires AMDGPU to MFD add device for enumeration to set up as
>> + platform device.
>
>> +/* SPDX-License-Identifier: MIT */
>
> OK we have this...
>
>> +/*
>> + * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
>> + * All Rights Reserved.
>> + *
>
> That can be kept
>
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the
>> + * "Software"), to deal in the Software without restriction, including
>> + * without limitation the rights to use, copy, modify, merge, publish,
>> + * distribute, sub license, and/or sell copies of the Software, and to
>> + * permit persons to whom the Software is furnished to do so, subject to
>> + * the following conditions:
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
>> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
>> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
>> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
>> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
>> + *
>> + * The above copyright notice and this permission notice (including the
>> + * next paragraph) shall be included in all copies or substantial portions
>> + * of the Software.
>
> This is already in:
> LICENSES/preferred/MIT
>
> Which is referenced by the SPDX tag.
>
> Can we just drop it? It's very annoying with all this boilerplate.
>
Done. Updated copright header in v2.
>> +#ifdef CONFIG_GPIOLIB
>
> You select GPIOLIB in the Kconfig so drop the ifdef, it's always
> available.
>
>> +static int amdisp_gpio_set_config(struct gpio_chip *gc, unsigned int gpio,
>> + unsigned long config)
>> +{
>> + /* Nothing to do, amdisp gpio has no other config */
>> + return 0;
>> +}
>
> Don't even assign the callback then, that's fine.
>
Done.
>> +static int amdisp_gpiochip_add(struct platform_device *pdev,
>> + struct amdisp_pinctrl *pctrl)
>> +{
>> + struct gpio_chip *gc = &pctrl->gc;
>> + struct pinctrl_gpio_range *grange = &pctrl->gpio_range;
>> + int ret;
>> +
>> + gc->label = dev_name(pctrl->dev);
>> + gc->owner = THIS_MODULE;
>
> I think the core default-assigns owner so you don't need to
> assign this.
>
Done.
>> + gc->parent = &pdev->dev;
>> + gc->names = amdisp_range_pins_name;
>> + gc->request = gpiochip_generic_request;
>> + gc->free = gpiochip_generic_free;
>> + gc->get_direction = amdisp_gpio_get_direction;
>> + gc->direction_input = amdisp_gpio_direction_input;
>> + gc->direction_output = amdisp_gpio_direction_output;
>> + gc->get = amdisp_gpio_get;
>> + gc->set = amdisp_gpio_set;
>> + gc->set_config = amdisp_gpio_set_config;
>
> I.e. drop this.
>
Done.
>> + gc->base = -1;
>> + gc->ngpio = ARRAY_SIZE(amdisp_range_pins);
>> +#if defined(CONFIG_OF_GPIO)
>> + gc->of_node = pdev->dev.of_node;
>> + gc->of_gpio_n_cells = 2;
>> +#endif
>
> Drop the ifdefs.
>
Done.
>> +#ifdef CONFIG_GPIOLIB
>> + res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>> + if (IS_ERR(res))
>> + return PTR_ERR(res);
>> +
>> + pctrl->gpiobase = devm_ioremap_resource(&pdev->dev, res);
>> + if (IS_ERR(pctrl->gpiobase))
>> + return PTR_ERR(pctrl->gpiobase);
>> +#endif
>
> Drop ifdefs
>
Done.
>> +#ifdef CONFIG_GPIOLIB
>> + ret = amdisp_gpiochip_add(pdev, pctrl);
>> + if (ret)
>> + return ret;
>> +#endif
>
> Drop ifdefs
>
Done.
>> +static int __init amdisp_pinctrl_init(void)
>> +{
>> + return platform_driver_register(&amdisp_pinctrl_driver);
>> +}
>> +arch_initcall(amdisp_pinctrl_init);
>> +
>> +static void __exit amdisp_pinctrl_exit(void)
>> +{
>> + platform_driver_unregister(&amdisp_pinctrl_driver);
>> +}
>> +module_exit(amdisp_pinctrl_exit);
>
> Why do you need arch_initcall()?
>
> Try to just use module_platform_driver() for the
> whole module.
>
Done. thanks for this recommendation, replaced with module_platform_driver.
>> +MODULE_AUTHOR("Benjamin Chan <benjamin.chan@amd.com>");
>> +MODULE_AUTHOR("Pratap Nirujogi <pratap.nirujogi@amd.com>");
>> +MODULE_DESCRIPTION("AMDISP pinctrl driver");
>> +MODULE_LICENSE("GPL and additional rights");
>
> Well that does not correspond to MIT does it?
>
Done. Updated license info in v2.
>> +/* SPDX-License-Identifier: MIT */
>> +/*
>> + * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
>> + * All Rights Reserved.
>> + *
>> + * Permission is hereby granted, free of charge, to any person obtaining a
>> + * copy of this software and associated documentation files (the
>> + * "Software"), to deal in the Software without restriction, including
>> + * without limitation the rights to use, copy, modify, merge, publish,
>> + * distribute, sub license, and/or sell copies of the Software, and to
>> + * permit persons to whom the Software is furnished to do so, subject to
>> + * the following conditions:
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
>> + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
>> + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
>> + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
>> + * USE OR OTHER DEALINGS IN THE SOFTWARE.
>> + *
>> + * The above copyright notice and this permission notice (including the
>> + * next paragraph) shall be included in all copies or substantial portions
>> + * of the Software.
>
> Can we drop this?
>
Done.
> Yours,
> Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-03-04 23:22 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-28 16:57 [PATCH] pinctrl: amd: isp411: Add amdisp GPIO pinctrl Pratap Nirujogi
2025-03-01 13:32 ` Krzysztof Kozlowski
2025-03-04 23:22 ` Nirujogi, Pratap
2025-03-01 22:08 ` kernel test robot
2025-03-02 1:22 ` kernel test robot
2025-03-02 3:42 ` kernel test robot
2025-03-04 8:34 ` Linus Walleij
2025-03-04 23:22 ` Nirujogi, Pratap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox