pinctrl: amd: isp411: Add amdisp GPIO pinctrl
Subsystems (2)
PATCH 1/1 pinctrl: amd: isp411: Add amdisp GPIO pinctrl
Add pinctrl driver support for AMD SoC with isp41 hw ip block.
--- 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
drivers/pinctrl/Kconfig +13 -0
@@ -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
drivers/pinctrl/Makefile +1 -0
@@ -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
drivers/pinctrl/pinctrl-amdisp.c new file +290 -0
290 lines not on this page · raw message
drivers/pinctrl/pinctrl-amdisp.h new file +118 -0
118 lines not on this page · raw message
Signature · 1 line
2.43.0
Quoted 32 lines · Pratap Nirujogi
drivers/pinctrl/Makefile +1
-0@@ -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.odrivers/pinctrl/pinctrl-amdisp.c new file +14
-0@@ -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
drivers/pinctrl/pinctrl-amdisp.c line 24
Quoted 10 lines
drivers/pinctrl/pinctrl-amdisp.c new file +10
-0+* 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.
drivers/pinctrl/pinctrl-amdisp.c line 32
Quoted 8 lines
drivers/pinctrl/pinctrl-amdisp.c new file +8
-0+* +*/ + +#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?
drivers/pinctrl/pinctrl-amdisp.c line 38
Quoted 6 lines
drivers/pinctrl/pinctrl-amdisp.c new file +6
-0+#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?
Quoted 10 lines
drivers/pinctrl/pinctrl-amdisp.c new file +10
-0+#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
...
Quoted 31 lines
drivers/pinctrl/pinctrl-amdisp.c new file +31
-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);
drivers/pinctrl/pinctrl-amdisp.c line 214
Quoted 10 lines
drivers/pinctrl/pinctrl-amdisp.c new file +10
-0+ 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
Quoted 39 lines
drivers/pinctrl/pinctrl-amdisp.c new file +39
-0+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; +
drivers/pinctrl/pinctrl-amdisp.c line 263
Quoted 10 lines
drivers/pinctrl/pinctrl-amdisp.c new file +10
-0+ 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.
Quoted 16 lines
drivers/pinctrl/pinctrl-amdisp.c new file +16
-0+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); +
drivers/pinctrl/pinctrl-amdisp.c line 289
Quoted 10 lines
drivers/pinctrl/pinctrl-amdisp.c new file +10
-0+static void __exit amdisp_pinctrl_exit(void) +{ +platform_driver_unregister (&amdisp_pinctrl_driver); +} +module_exit (amdisp_pinctrl_exit); + +MODULE_AUTHOR ("Benjamin Chan <[email protected]>" ); +MODULE_AUTHOR ("Pratap Nirujogi <[email protected]>" ); +MODULE_DESCRIPTION ("AMDISP pinctrl driver" ); +MODULE_LICENSE ("GPL and additional rights" );
No, that's not true. Just like in other patch...
Quoted 1 line
+MODULE_ALIAS("platform:"
DRV_NAME);
Best regards,
Krzysztof
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
Quoted 40 lines · Krzysztof Kozlowski
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Quoted 36 lines · Pratap Nirujogi
drivers/pinctrl/Makefile +1
-0@@ -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.odrivers/pinctrl/pinctrl-amdisp.c new file +18
-0@@ -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
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c line 24
Quoted 6 lines
drivers/pinctrl/pinctrl-amdisp.c new file +6
-0+* 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.
Quoted 11 lines
drivers/pinctrl/pinctrl-amdisp.c line 32
Quoted 8 lines
drivers/pinctrl/pinctrl-amdisp.c new file +8
-0+* +*/ + +#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?
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c line 38
Quoted 6 lines
drivers/pinctrl/pinctrl-amdisp.c new file +6
-0+#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.
Quoted 48 lines
Quoted 10 lines
drivers/pinctrl/pinctrl-amdisp.c new file +10
-0+#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...
Quoted 35 lines
drivers/pinctrl/pinctrl-amdisp.c new file +35
-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);
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c line 214
Quoted 6 lines
drivers/pinctrl/pinctrl-amdisp.c new file +6
-0+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.
Quoted 43 lines
Quoted 43 lines
drivers/pinctrl/pinctrl-amdisp.c new file +43
-0+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; +
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c line 263
Quoted 6 lines
drivers/pinctrl/pinctrl-amdisp.c new file +6
-0+#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.
Quoted 20 lines
Quoted 20 lines
drivers/pinctrl/pinctrl-amdisp.c new file +20
-0+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); +}
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c line 289
Quoted 6 lines
drivers/pinctrl/pinctrl-amdisp.c new file +6
-0+module_exit (amdisp_pinctrl_exit); + +MODULE_AUTHOR ("Benjamin Chan <[email protected]>" ); +MODULE_AUTHOR ("Pratap Nirujogi <[email protected]>" ); +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.
Quoted 6 lines
Quoted 1 line
+MODULE_ALIAS("platform:"
DRV_NAME);Best regards,
Krzysztof
kernel test robot
build botkernel test robot noticed the following build errors:
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/[email protected]/config) compiler: arc-elf-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250302/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build errors:
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botkernel test robot noticed the following build warnings:
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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
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
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hi Pratap,
thanks for your patch!
Quoted 4 lines · Pratap Nirujogi
drivers/pinctrl/Kconfig +4
-0+config PINCTRL_AMDISP + tristate "AMDISP GPIO pin control" + depends on HAS_IOMEM + select GPIOLIB
drivers/pinctrl/Kconfig config PINCTRL_AMD
Quoted 10 lines
drivers/pinctrl/Kconfig +9
-0+ 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...
Quoted 4 lines
+/*
+ * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
+ * All Rights Reserved.
+ *
That can be kept
Quoted 11 lines
+ * 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
Quoted 8 lines
+ * 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.
Quoted 1 line
+#ifdef
CONFIG_GPIOLIB
You select GPIOLIB in the Kconfig so drop the ifdef, it's always available.
drivers/pinctrl/pinctrl-amdisp.c line 172
Quoted 6 lines
drivers/pinctrl/pinctrl-amdisp.c new file +6
-0+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.
drivers/pinctrl/pinctrl-amdisp.c line 182
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c new file +9
-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 ;
I think the core default-assigns owner so you don't need to assign this.
drivers/pinctrl/pinctrl-amdisp.c line 192
Quoted 10 lines
drivers/pinctrl/pinctrl-amdisp.c new file +10
-0+ 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.
drivers/pinctrl/pinctrl-amdisp.c line 198
Quoted 6 lines
drivers/pinctrl/pinctrl-amdisp.c new file +6
-0+ 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.
drivers/pinctrl/pinctrl-amdisp.c line 238
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c new file +9
-0+#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
drivers/pinctrl/pinctrl-amdisp.c line 262
Quoted 5 lines
drivers/pinctrl/pinctrl-amdisp.c new file +5
-0+#ifdef CONFIG_GPIOLIB + ret =amdisp_gpiochip_add (pdev, pctrl); +if (ret) +return ret; +#endif
Drop ifdefs
drivers/pinctrl/pinctrl-amdisp.c line 284
Quoted 11 lines
drivers/pinctrl/pinctrl-amdisp.c new file +11
-0+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.
drivers/pinctrl/pinctrl-amdisp.c line 289
Quoted 4 lines
drivers/pinctrl/pinctrl-amdisp.c new file +4
-0+MODULE_AUTHOR ("Benjamin Chan <[email protected]>" ); +MODULE_AUTHOR ("Pratap Nirujogi <[email protected]>" ); +MODULE_DESCRIPTION ("AMDISP pinctrl driver" ); +MODULE_LICENSE ("GPL and additional rights" );
Well that does not correspond to MIT does it?
Quoted 14 lines
drivers/pinctrl/pinctrl-amdisp.c new file +14
-0+/* 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
drivers/pinctrl/pinctrl-amdisp.c line 24
Quoted 10 lines
drivers/pinctrl/pinctrl-amdisp.c new file +10
-0+* 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
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
Quoted 54 lines · Linus Walleij
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
Hi Pratap,
thanks for your patch!
Quoted 4 lines · Pratap Nirujogi
drivers/pinctrl/Kconfig +4
-0+config PINCTRL_AMDISP + tristate "AMDISP GPIO pin control" + depends on HAS_IOMEM + select GPIOLIBdrivers/pinctrl/Kconfig config PINCTRL_AMD
Quoted 10 lines
drivers/pinctrl/Kconfig +9
-0+ 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...
Quoted 4 lines
+/*
+ * Copyright (C) 2025 Advanced Micro Devices, Inc. All rights reserved.
+ * All Rights Reserved.
+ *That can be kept
Quoted 11 lines
+ * 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 SHALLQuoted 8 lines
+ * 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.
Quoted 7 lines
This is already in:
LICENSES/preferred/MITWhich 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.
Quoted 5 lines
Quoted 1 line
+#ifdef
CONFIG_GPIOLIBYou select GPIOLIB in the
Kconfigso drop the ifdef, it's always available.
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c line 172
Quoted 6 lines
drivers/pinctrl/pinctrl-amdisp.c new file +6
-0+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.
Quoted 4 lines
Quoted 4 lines
drivers/pinctrl/pinctrl-amdisp.c new file +4
-0+static int amdisp_gpiochip_add (struct platform_device *pdev, +struct amdisp_pinctrl *pctrl) +{ +struct gpio_chip *gc = &pctrl->gc;
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c line 182
Quoted 5 lines
drivers/pinctrl/pinctrl-amdisp.c new file +5
-0+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.
Quoted 11 lines
drivers/pinctrl/pinctrl-amdisp.c line 192
Quoted 10 lines
drivers/pinctrl/pinctrl-amdisp.c new file +10
-0+ 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;
Quoted 2 lines
I.e. drop this.
Done.
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c line 198
Quoted 6 lines
drivers/pinctrl/pinctrl-amdisp.c new file +6
-0+ 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.
Quoted 12 lines
drivers/pinctrl/pinctrl-amdisp.c line 238
Quoted 9 lines
drivers/pinctrl/pinctrl-amdisp.c new file +9
-0+#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.
Quoted 8 lines
drivers/pinctrl/pinctrl-amdisp.c line 262
Quoted 5 lines
drivers/pinctrl/pinctrl-amdisp.c new file +5
-0+#ifdef CONFIG_GPIOLIB + ret =amdisp_gpiochip_add (pdev, pctrl); +if (ret) +return ret; +#endif Drop ifdefs
Done.
Quoted 14 lines
drivers/pinctrl/pinctrl-amdisp.c line 284
Quoted 11 lines
drivers/pinctrl/pinctrl-amdisp.c new file +11
-0+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()?
Quoted 3 lines
Try to just use
module_platform_driver()for the
whole module.
Done. thanks for this recommendation, replaced with module_platform_driver.
Quoted 7 lines
drivers/pinctrl/pinctrl-amdisp.c line 289
Quoted 4 lines
drivers/pinctrl/pinctrl-amdisp.c new file +4
-0+MODULE_AUTHOR ("Benjamin Chan <[email protected]>" ); +MODULE_AUTHOR ("Pratap Nirujogi <[email protected]>" ); +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.
Quoted 18 lines
Quoted 18 lines
drivers/pinctrl/pinctrl-amdisp.c new file +18
-0+/* 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
Quoted 9 lines
Quoted 6 lines
+ * 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.
Quoted 2 lines
Yours,
Linus Walleij