Skip to contentSkip to conversation

Add support control UP board CPLD/FPGA pin control

PATCH In review larry.lai 4 participants 16 messages Dec 28, 2023 – Dec 30, 2023

Subsystems (5)
lore
Share & tools
lore

larry.lai

author
#0 lore raw

v8 cover Add support control UP board CPLD/FPGA pin control

The UP board <https://up-board.org/> is the computer board for Professional Makers and Industrial Applications. We want to upstream the UP board 40-pin GP-bus Kernel driver for giving the users better experience on the software release. (not just download from UP board github)

These patches are generated from the Linux kernel mainline tag v6.0.

This is the PATCH V8. It fixed and addressed Andy Shevchenko and Krzysztof Kozlowski review comments.

larry.lai (3):
mfd: Add support for UP board CPLD/FPGA
pinctrl: Add support pin control for UP board CPLD/FPGA
leds: Add support for UP board CPLD onboard LEDS

 drivers/leds/Kconfig              |   10 +
 drivers/leds/Makefile             |    1 +
 drivers/leds/leds-upboard.c       |  154 ++++
 drivers/mfd/Kconfig               |   12 +
 drivers/mfd/Makefile              |    1 +
 drivers/mfd/upboard-fpga.c        |  364 ++++++++
 drivers/pinctrl/Kconfig           |   15 +
 drivers/pinctrl/Makefile          |    1 +
 drivers/pinctrl/pinctrl-upboard.c | 1309 +++++++++++++++++++++++++++++
 include/linux/mfd/upboard-fpga.h  |   59 ++
 10 files changed, 1926 insertions(+)
 create mode 100644 drivers/leds/leds-upboard.c
 create mode 100644 drivers/mfd/upboard-fpga.c
 create mode 100644 drivers/pinctrl/pinctrl-upboard.c
 create mode 100644 include/linux/mfd/upboard-fpga.h

base-commit: 4fe89d07dcc2804c8b562f6c7896a45643d34b2f

Signature · 1 line
2.17.1
author
#1 lore raw

PATCH v8 1/3 mfd: Add support for UP board CPLD/FPGA

The UP Squared board <http://www.upboard.com> implements certain features (pin control, onboard LEDs or CEC) through an on-board CPLD/FPGA.

This driver implements the line protocol to read and write registers from the FPGA through regmap. The register address map is also included.

The UP Boards provide a few I/O pin headers (for both GPIO and functions), including a 40-pin Raspberry Pi compatible header.

This patch implements the FPGA-based pin controller that manages direction and enable state for those header pins.

Partial supported boards:
* UP core + CREX
* UP core + CRST02

---
PATCH V7 -> PATCH V8
(1) Refer 2023/11/14 Andy Shevchenko review, cleaned up coding style and addressed review comments.
PATCH V6 -> PATCH V7
(1) Refer 2023/09/15 Lee Jones review, cleaned up coding style and addressed review comments.
PATCH V5 -> PATCH V6
(1) Fixed kernel test robot compiler warning.
PATCH V4 -> PATCH V5
(1) Refer 2023/05/25 Lee Jones review, cleaned up coding style and addressed review comments.
(2) Synchronizing upboard github to v1.0.5 tag.
RFC 2023/04/25 -> PATCH V4
(1) Fixed kernel test robot compiler warning.
(2) Remove mistakes with wrong Reviewed-by tags.
RFC 2022/11/23 -> RFC 2023/04/25
(1) Refer 2022/12/08 Andy Shevchenko review, cleaned up coding style and addressed review comments.
PATCH V3 -> RFC 2022/11/23:
(1) Refer 2022/11/16 Lee Jones review, cleaned up coding style and addressed review comments.
(2) Description on the UP Boards FPGA register read/write protocols PATCH V2 -> V3:
(1) fixed kernel test robot compiler warning.
PATCH V1 -> V2:
(1) Synchronizing upboard github to rc2.
(2) Refer 2022/10/31 Lee Jones review, fixed some of the issues.

---
 drivers/mfd/Kconfig              |  12 +
 drivers/mfd/Makefile             |   1 +
 drivers/mfd/upboard-fpga.c       | 364 +++++++++++++++++++++++++++++++
 include/linux/mfd/upboard-fpga.h |  59 +++++
 4 files changed, 436 insertions(+)
 create mode 100644 drivers/mfd/upboard-fpga.c
 create mode 100644 include/linux/mfd/upboard-fpga.h
drivers/mfd/Kconfig +12 -0
index abb58ab1a1a4..54b5ddf782e3 100644
@@ -2104,6 +2104,18 @@ config MFD_QCOM_PM8008
 	  under it in the device tree. Additional drivers must be enabled in
 	  order to use the functionality of the device.
 
+config MFD_UPBOARD_FPGA
+	tristate "Support for the Intel platform foundation kit UP board FPGA"
+	select MFD_CORE
+	depends on (X86 && ACPI) || COMPILE_TEST
+	help
+	  Select this option to enable the AAEON UP and UP^2 on-board FPGA.
+	  This is core driver for the UP board that implements certain (pin
+	  control, onboard LEDs or CEC) through an on-board FPGA.
+
+	  To compile this driver as a module, choose M here: the module will be
+	  called upboard-fpga.
+
 menu "Multimedia Capabilities Port drivers"
 	depends on ARCH_SA1100
 
drivers/mfd/Makefile +1 -0
index 858cacf659d6..d9d10e3664f7 100644
@@ -250,6 +250,7 @@ obj-$(CONFIG_MFD_ALTERA_A10SR)	+= altera-a10sr.o
 obj-$(CONFIG_MFD_ALTERA_SYSMGR) += altera-sysmgr.o
 obj-$(CONFIG_MFD_STPMIC1)	+= stpmic1.o
 obj-$(CONFIG_MFD_SUN4I_GPADC)	+= sun4i-gpadc.o
+obj-$(CONFIG_MFD_UPBOARD_FPGA)	+= upboard-fpga.o
 
 obj-$(CONFIG_MFD_STM32_LPTIMER)	+= stm32-lptimer.o
 obj-$(CONFIG_MFD_STM32_TIMERS) 	+= stm32-timers.o
drivers/mfd/upboard-fpga.c new file +364 -0

364 lines not on this page · raw message

include/linux/mfd/upboard-fpga.h new file +59 -0

59 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH V8 1/3] mfd: Add support for UP board CPLD/FPGA

Quoted 6 lines · larry.lai

The UP Squared board <http://www.upboard.com> implements certain features (pin control, onboard LEDs or CEC) through an on-board CPLD/FPGA.

This driver implements the line protocol to read and write registers from the FPGA through regmap. The register address map is also included.

...

Quoted 8 lines
drivers/mfd/upboard-fpga.c new file +8 -0
+
+static const struct acpi_device_id upboard_fpga_acpi_match[] = {
+	{ "AANT0F00", (kernel_ulong_t)&upboard_up_fpga_data },
+	{ "AANT0F01", (kernel_ulong_t)&upboard_up2_fpga_data },
+	{ "AANT0F02", (kernel_ulong_t)&upboard_upcore_crex_fpga_data },
+	{ "AANT0F03", (kernel_ulong_t)&upboard_upcore_crst02_fpga_data },
+	{ "AANT0F04", (kernel_ulong_t)&upboard_up_fpga_data },
+	{ }

drivers/mfd/upboard-fpga.c line 326

Quoted 10 lines
drivers/mfd/upboard-fpga.c new file +10 -0
+};
+MODULE_DEVICE_TABLE(acpi, upboard_fpga_acpi_match);
+
+static int upboard_fpga_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct upboard_fpga *ddata;
+	int ret;
+
+	ddata = devm_kzalloc(dev, sizeof(ddata), GFP_KERNEL);

This wasn't tested. You allocate size of the pointer.

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH V8 1/3] mfd: Add support for UP board CPLD/FPGA

In reply to larry.lai
Quoted 6 lines · larry.lai

The UP Squared board <http://www.upboard.com> implements certain features (pin control, onboard LEDs or CEC) through an on-board CPLD/FPGA.

This driver implements the line protocol to read and write registers from the FPGA through regmap. The register address map is also included.

...

drivers/mfd/upboard-fpga.c line 38

Quoted 13 lines
drivers/mfd/upboard-fpga.c new file +13 -0
+#define FIRMWARE_ID_BUILD_OFFSET	12
+#define FIRMWARE_ID_MAJOR_OFFSET	8
+#define FIRMWARE_ID_MINOR_OFFSET	4
+#define FIRMWARE_ID_PATCH_OFFSET	0
+#define FIRMWARE_ID_MASK		GENMASK(3, 0)
+
+/*
+ * read CPLD register on custom protocol
+ * send clock and addr bit in strobe and datain pins then read from dataout pin
+ */
+static int upboard_cpld_read(void *context, unsigned int reg, unsigned int *val)
+{
+	struct upboard_fpga * const fpga = context;

This const does not make sense. Drop it. Unless you wanted to say something else, like struct is not modified, but then please read C tutorials. This applies to all your three patches.

Best regards,
Krzysztof

#4 lore raw

Re: [PATCH V8 1/3] mfd: Add support for UP board CPLD/FPGA

Quoted 3 lines · Krzysztof Kozlowski
Quoted 2 lines · larry.lai

The UP Squared board <http://www.upboard.com> implements certain features (pin control, onboard LEDs or CEC) through an on-board CPLD/FPGA.

...

Quoted 7 lines

drivers/mfd/upboard-fpga.c line 38

Quoted 3 lines
drivers/mfd/upboard-fpga.c new file +3 -0
+static int upboard_cpld_read(void *context, unsigned int reg, unsigned int *val)
+{
+	struct upboard_fpga * const fpga = context;

This const does not make sense. Drop it. Unless you wanted to say something else, like struct is not modified, but then please read C tutorials. This applies to all your three patches.

will do

Signature · 2 lines
Best Regards,
Jack Chang
author
#5 lore raw

PATCH v8 2/3 pinctrl: Add support pin control for UP board CPLD/FPGA

In reply to larry.lai

The UP Squared board <http://www.upboard.com> implements certain features (pin control) through an on-board FPGA.

---
PATCH V7 -> PATCH V8
(1) Refer 2023/11/14 Andy Shevchenko review, cleaned up coding style and addressed review comments.
(2) Refer 2023/11/01 Krzysztof Kozlowski review, cleaned up coding style and addressed review comments.
PATCH V6 -> V7: There's no change.
PATCH V5 -> PATCH V6
(1) Refer 2023/08/10 Linus Walleij review, cleaned up coding style and addressed review comments.
PATCH V4 -> PATCH V5
(1) Fixed kernel test robot compiler warning.
(2) Synchronizing upboard github to v1.0.5 tag.
RFC 2023/04/25 -> PATCH V4
(1) Fixed kernel test robot compiler warning.
(2) Remove mistakes with wrong Reviewed-by tags.
RFC 2022/11/23 -> RFC 2023/04/25
(1) Refer 2022/12/08 Andy Shevchenko review, cleaned up coding style and addressed review comments.
PATCH V3 -> RFC 2022/11/23:
(1) Refer 2022/11/09 Linus Walleij review, cleaned up coding style and addressed review comments.
PATCH V2 -> V3:
There's no change.
PATCH V1 -> V2:
(1) Synchronized with upboard github to rc2
(2) Refer 2022/10/19 Mark Brown and Andy Shevchenko review, we removed the regmap and acpi patches and implement in upboard pinctrl driver.
(3) Refer 2022/10/19 Andy Shevchenko review, fixed the coding style issues, removed using gpio_xxxx API and removed including <linux/gpio.h>.

---
 drivers/pinctrl/Kconfig           |   15 +
 drivers/pinctrl/Makefile          |    1 +
 drivers/pinctrl/pinctrl-upboard.c | 1309 +++++++++++++++++++++++++++++
 3 files changed, 1325 insertions(+)
 create mode 100644 drivers/pinctrl/pinctrl-upboard.c
drivers/pinctrl/Kconfig +15 -0
index 1cf74b0c42e5..c114fc2b7cec 100644
@@ -483,6 +483,21 @@ config PINCTRL_THUNDERBAY
 	  rate control and direction control. This module will be
 	  called as pinctrl-thunderbay.
 
+config PINCTRL_UPBOARD
+	tristate "UP board FPGA pin controller"
+	depends on (X86 && ACPI) || COMPILE_TEST
+	depends on MFD_UPBOARD_FPGA
+	select GENERIC_PINCONF
+	select PINMUX
+	select PINCONF
+	help
+	  Pin controller for the FPGA GPIO lines on UP boards. Due to the
+	  hardware layout, these are meant to be controlled in tandem with their
+	  corresponding Intel SoC GPIOs.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called pinctrl-upboard.
+
 config PINCTRL_ZYNQ
 	bool "Pinctrl driver for Xilinx Zynq"
 	depends on ARCH_ZYNQ
drivers/pinctrl/Makefile +1 -0
index e76f5cdc64b0..c366706d36e7 100644
@@ -48,6 +48,7 @@ obj-$(CONFIG_PINCTRL_STMFX) 	+= pinctrl-stmfx.o
 obj-$(CONFIG_PINCTRL_SX150X)	+= pinctrl-sx150x.o
 obj-$(CONFIG_PINCTRL_TB10X)	+= pinctrl-tb10x.o
 obj-$(CONFIG_PINCTRL_THUNDERBAY) += pinctrl-thunderbay.o
+obj-$(CONFIG_PINCTRL_UPBOARD)	+= pinctrl-upboard.o
 obj-$(CONFIG_PINCTRL_ZYNQMP)	+= pinctrl-zynqmp.o
 obj-$(CONFIG_PINCTRL_ZYNQ)	+= pinctrl-zynq.o
 
drivers/pinctrl/pinctrl-upboard.c new file +1309 -0

1,309 lines not on this page · raw message

Signature · 1 line
2.17.1
#6 lore raw

Re: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA

Quoted 3 lines · larry.lai

The UP Squared board <http://www.upboard.com> implements certain features (pin control) through an on-board FPGA.

...

drivers/pinctrl/pinctrl-upboard.c line 1309

Quoted 6 lines
drivers/pinctrl/pinctrl-upboard.c new file +6 -0
+module_platform_driver_probe(upboard_pinctrl_driver, upboard_pinctrl_probe);
+
+MODULE_AUTHOR("Gary Wang <[email protected]>");
+MODULE_DESCRIPTION("UP Board HAT pin controller driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:upboard-pinctrl");

This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

Thank you.

Best regards,
Krzysztof

#7 lore raw

Re: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA

Quoted 3 lines · Krzysztof Kozlowski
Quoted 2 lines · larry.lai

The UP Squared board <http://www.upboard.com> implements certain features (pin control) through an on-board FPGA.

...

Quoted 8 lines
Quoted 1 line

+MODULE_ALIAS("platform:upboard-pinctrl");

This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

add "platform:" for auto probe these two drivers when upboard-fpga has probe and register these 2 drivers.

Signature · 2 lines
Best Regards,
Jack Chang
#8 lore raw

Re: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA

Quoted 11 lines · Jack Chang
Quoted 3 lines · Krzysztof Kozlowski
Quoted 2 lines · larry.lai

The UP Squared board <http://www.upboard.com> implements certain features (pin control) through an on-board FPGA.

...

Quoted 4 lines
Quoted 1 line

+MODULE_ALIAS("platform:upboard-pinctrl");

This is a friendly reminder during the review process.

Quoted 7 lines
Quoted 4 lines

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

add "platform:" for auto probe these two drivers when upboard-fpga has probe and register these 2 drivers.

Why do you use alias instead of missing ID table? This scales poorly. Use ID table and if you disagree, then respond with proper comment. You just replied something obvious.

Best regards,
Krzysztof

#9 lore raw

Re: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA

In reply to larry.lai
kernel test robot noticed the following build warnings:

Hi larry.lai,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 4fe89d07dcc2804c8b562f6c7896a45643d34b2f]

url:    https://github.com/intel-lab-lkp/linux/commits/larry-lai/mfd-Add-support-for-UP-board-CPLD-FPGA/20231228-231750
base:   4fe89d07dcc2804c8b562f6c7896a45643d34b2f
patch link:    https://lore.kernel.org/r/20231228151544.14408-3-larry.lai%40yunjingtech.com
patch subject: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA
config: m68k-allmodconfig (https://download.01.org/0day-ci/archive/20231229/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231229/[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 warnings (new ones prefixed by >>):

drivers/pinctrl/pinctrl-upboard.c: In function 'upboard_alt_func_enable':

>> drivers/pinctrl/pinctrl-upboard.c:709:9: warning: ISO C90 forbids variable length array 'offset' [-Wvla]
     709 |         int offset[pctrl->pctldesc->npins];
         |         ^~~
   drivers/pinctrl/pinctrl-upboard.c: At top level:
>> drivers/pinctrl/pinctrl-upboard.c:46:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      46 | #define BOARD_UP_APL01                          1
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1089:26: note: in expansion of macro 'BOARD_UP_APL01'
    1089 |                 .ident = BOARD_UP_APL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:46:49: note: (near initialization for 'upboard_dmi_table[0].ident')
      46 | #define BOARD_UP_APL01                          1
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1089:26: note: in expansion of macro 'BOARD_UP_APL01'
    1089 |                 .ident = BOARD_UP_APL01,
         |                          ^~~~~~~~~~~~~~
>> drivers/pinctrl/pinctrl-upboard.c:46:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      46 | #define BOARD_UP_APL01                          1
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1096:26: note: in expansion of macro 'BOARD_UP_APL01'
    1096 |                 .ident = BOARD_UP_APL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:46:49: note: (near initialization for 'upboard_dmi_table[1].ident')
      46 | #define BOARD_UP_APL01                          1
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1096:26: note: in expansion of macro 'BOARD_UP_APL01'
    1096 |                 .ident = BOARD_UP_APL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:53:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      53 | #define BOARD_UP_APL03                          9
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1103:26: note: in expansion of macro 'BOARD_UP_APL03'
    1103 |                 .ident = BOARD_UP_APL03,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:53:49: note: (near initialization for 'upboard_dmi_table[2].ident')
      53 | #define BOARD_UP_APL03                          9
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1103:26: note: in expansion of macro 'BOARD_UP_APL03'
    1103 |                 .ident = BOARD_UP_APL03,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:50:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      50 | #define BOARD_UP_WHL01                          5
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1110:26: note: in expansion of macro 'BOARD_UP_WHL01'
    1110 |                 .ident = BOARD_UP_WHL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:50:49: note: (near initialization for 'upboard_dmi_table[3].ident')
      50 | #define BOARD_UP_WHL01                          5
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1110:26: note: in expansion of macro 'BOARD_UP_WHL01'
    1110 |                 .ident = BOARD_UP_WHL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:55:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      55 | #define BOARD_UPX_TGL                           11
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1117:26: note: in expansion of macro 'BOARD_UPX_TGL'
    1117 |                 .ident = BOARD_UPX_TGL,
         |                          ^~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:55:49: note: (near initialization for 'upboard_dmi_table[4].ident')
      55 | #define BOARD_UPX_TGL                           11
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1117:26: note: in expansion of macro 'BOARD_UPX_TGL'
    1117 |                 .ident = BOARD_UPX_TGL,
         |                          ^~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:57:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      57 | #define BOARD_UPN_EHL01                         13
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1124:26: note: in expansion of macro 'BOARD_UPN_EHL01'
    1124 |                 .ident = BOARD_UPN_EHL01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:57:49: note: (near initialization for 'upboard_dmi_table[5].ident')
      57 | #define BOARD_UPN_EHL01                         13
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1124:26: note: in expansion of macro 'BOARD_UPN_EHL01'
    1124 |                 .ident = BOARD_UPN_EHL01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:57:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      57 | #define BOARD_UPN_EHL01                         13
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:58:49: note: in expansion of macro 'BOARD_UPN_EHL01'
      58 | #define BOARD_UPS_EHL01                         BOARD_UPN_EHL01
         |                                                 ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:1131:26: note: in expansion of macro 'BOARD_UPS_EHL01'
    1131 |                 .ident = BOARD_UPS_EHL01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:57:49: note: (near initialization for 'upboard_dmi_table[6].ident')
      57 | #define BOARD_UPN_EHL01                         13
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:58:49: note: in expansion of macro 'BOARD_UPN_EHL01'
      58 | #define BOARD_UPS_EHL01                         BOARD_UPN_EHL01
         |                                                 ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:1131:26: note: in expansion of macro 'BOARD_UPS_EHL01'
    1131 |                 .ident = BOARD_UPS_EHL01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:59:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      59 | #define BOARD_UPX_ADLP01                        15
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1138:26: note: in expansion of macro 'BOARD_UPX_ADLP01'
    1138 |                 .ident = BOARD_UPX_ADLP01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:59:49: note: (near initialization for 'upboard_dmi_table[7].ident')
      59 | #define BOARD_UPX_ADLP01                        15
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1138:26: note: in expansion of macro 'BOARD_UPX_ADLP01'
    1138 |                 .ident = BOARD_UPX_ADLP01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:60:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      60 | #define BOARD_UPN_ADLN01                        16
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1145:26: note: in expansion of macro 'BOARD_UPN_ADLN01'
    1145 |                 .ident = BOARD_UPN_ADLN01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:60:49: note: (near initialization for 'upboard_dmi_table[8].ident')
      60 | #define BOARD_UPN_ADLN01                        16
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1145:26: note: in expansion of macro 'BOARD_UPN_ADLN01'
    1145 |                 .ident = BOARD_UPN_ADLN01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:59:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      59 | #define BOARD_UPX_ADLP01                        15
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:61:49: note: in expansion of macro 'BOARD_UPX_ADLP01'
      61 | #define BOARD_UPS_ADLP01                        BOARD_UPX_ADLP01
         |                                                 ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:1152:26: note: in expansion of macro 'BOARD_UPS_ADLP01'
    1152 |                 .ident = BOARD_UPS_ADLP01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:59:49: note: (near initialization for 'upboard_dmi_table[9].ident')
      59 | #define BOARD_UPX_ADLP01                        15
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:61:49: note: in expansion of macro 'BOARD_UPX_ADLP01'
      61 | #define BOARD_UPS_ADLP01                        BOARD_UPX_ADLP01
         |                                                 ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:1152:26: note: in expansion of macro 'BOARD_UPS_ADLP01'
    1152 |                 .ident = BOARD_UPS_ADLP01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:62:49: warning: initialization of 'const char *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
      62 | #define BOARD_UP_ADLN01                         18
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1159:26: note: in expansion of macro 'BOARD_UP_ADLN01'
    1159 |                 .ident = BOARD_UP_ADLN01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:62:49: note: (near initialization for 'upboard_dmi_table[10].ident')
      62 | #define BOARD_UP_ADLN01                         18
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1159:26: note: in expansion of macro 'BOARD_UP_ADLN01'
    1159 |                 .ident = BOARD_UP_ADLN01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c: In function 'upboard_pinctrl_probe':
>> drivers/pinctrl/pinctrl-upboard.c:1185:26: warning: assignment to 'int' from 'const char *' makes integer from pointer without a cast [-Wint-conversion]
    1185 |                 board_id = system_id->ident;
         |                          ^

vim +/offset +709 drivers/pinctrl/pinctrl-upboard.c

705
706 static void upboard_alt_func_enable(struct gpio_chip *gc, const char *name, int id)
707 {
708 struct upboard_pinctrl *pctrl = container_of(gc, struct upboard_pinctrl, chip);

 > 709		int offset[pctrl->pctldesc->npins];

710 int i, cnt;
711 bool input;
712 int mode;
713 unsigned int val;
714
715 /* find all pins */
716 for (i = 0, cnt = 0; i < pctrl->pctldesc->npins; i++) {
717 if (strstr(pctrl->pctldesc->pins[i].name, name))
718 offset[cnt++] = i;
719 }
720
721 /* change to alternate function */
722 for (i = 0; i < cnt; i++) {
723 if (pctrl->pins[offset[i]].regs == NULL)
724 continue;
725 input = false;
726 mode = 0; /* default GPIO */
727 val = readl(pctrl->pins[offset[i]].regs);
728
729 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "I2C") ||
730 strstr(pctrl->pctldesc->pins[offset[i]].name, "PINMUX")) {
731 mode = 1;
732 switch (id) {
733 case BOARD_UPN_ADLN01:
734 case BOARD_UPX_ADLP01:
735 mode = 2;
736 break;
737 default:
738 break;
739 }
740
741 val |= mode<<PADCFG0_PMODE_SHIFT;
742 writel(val, pctrl->pins[offset[i]].regs);
743 upboard_fpga_request_free(pctrl->pctldev, offset[i]);
744 continue;
745 }
746
747 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "UART")) {
748 mode = 1;
749 switch (id) {
750 case BOARD_UPN_EHL01:
751 mode = 4;
752 break;
753 case BOARD_UP_ADLN01:
754 case BOARD_UPN_ADLN01:
755 case BOARD_UPX_ADLP01:
756 mode = 2;
757 break;
758 default:
759 break;
760 }
761 }
762
763 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "SPI")) {
764 mode = 1;
765 switch (id) {
766 case BOARD_UP_WHL01:
767 mode = 3;
768 break;
769 case BOARD_UP_ADLN01:
770 case BOARD_UPN_ADLN01:
771 case BOARD_UPX_ADLP01:
772 mode = 7;
773 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MOSI")) {
774 val &= ~PADCFG0_GPIOTXDIS;
775 val |= PADCFG0_GPIORXDIS;
776 }
777
778 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MISO"))
779 val |= PADCFG0_GPIORXDIS;
780
781 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CLK")) {
782 val &= ~PADCFG0_GPIOTXDIS;
783 val |= PADCFG0_GPIORXDIS;
784 }
785 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CS0"))
786 val |= PADCFG0_GPIORXDIS;
787
788 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CS1"))
789 continue;
790 break;
791 default:
792 break;
793 }
794 }
795
796 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "I2S")) {
797 mode = 1;
798 switch (id) {
799 case BOARD_UPX_ADLP01:
800 mode = 4;
801 break;
802 default:
803 break;
804 }
805 }
806
807 val |= mode<<PADCFG0_PMODE_SHIFT;
808 writel(val, pctrl->pins[offset[i]].regs);
809
810 /* input pins */
811 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "RX"))
812 input = true;
813
814 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CTS"))
815 input = true;
816
817 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "ADC")) {
818 input = true;
819 if (id == BOARD_UP_APL01)
820 upboard_fpga_request_enable(pctrl->pctldev, NULL, offset[i]);
821 else
822 upboard_fpga_request_free(pctrl->pctldev, offset[i]);
823 }
824
825 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MISO"))
826 input = true;
827
828 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "DIN"))
829 input = true;
830
831 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "SDI"))
832 input = true;
833
834 upboard_fpga_set_direction(pctrl->pctldev, NULL, offset[i], input);
835 }
836 }
837

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#10 lore raw

Re: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA

In reply to larry.lai
kernel test robot noticed the following build warnings:

Hi larry.lai,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 4fe89d07dcc2804c8b562f6c7896a45643d34b2f]

url:    https://github.com/intel-lab-lkp/linux/commits/larry-lai/mfd-Add-support-for-UP-board-CPLD-FPGA/20231228-231750
base:   4fe89d07dcc2804c8b562f6c7896a45643d34b2f
patch link:    https://lore.kernel.org/r/20231228151544.14408-3-larry.lai%40yunjingtech.com
patch subject: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20231229/[email protected]/config)
compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231229/[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 warnings (new ones prefixed by >>):

>> drivers/pinctrl/pinctrl-upboard.c:709:13: warning: variable length array used [-Wvla]
     709 |         int offset[pctrl->pctldesc->npins];
         |                    ^~~~~~~~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:1089:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1089 |                 .ident = BOARD_UP_APL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:46:27: note: expanded from macro 'BOARD_UP_APL01'
      46 | #define BOARD_UP_APL01                          1
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1096:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1096 |                 .ident = BOARD_UP_APL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:46:27: note: expanded from macro 'BOARD_UP_APL01'
      46 | #define BOARD_UP_APL01                          1
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1103:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1103 |                 .ident = BOARD_UP_APL03,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:53:27: note: expanded from macro 'BOARD_UP_APL03'
      53 | #define BOARD_UP_APL03                          9
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1110:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1110 |                 .ident = BOARD_UP_WHL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:50:27: note: expanded from macro 'BOARD_UP_WHL01'
      50 | #define BOARD_UP_WHL01                          5
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1117:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1117 |                 .ident = BOARD_UPX_TGL,
         |                          ^~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:55:26: note: expanded from macro 'BOARD_UPX_TGL'
      55 | #define BOARD_UPX_TGL                           11
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1124:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1124 |                 .ident = BOARD_UPN_EHL01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:57:28: note: expanded from macro 'BOARD_UPN_EHL01'
      57 | #define BOARD_UPN_EHL01                         13
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1131:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1131 |                 .ident = BOARD_UPS_EHL01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:58:28: note: expanded from macro 'BOARD_UPS_EHL01'
      58 | #define BOARD_UPS_EHL01                         BOARD_UPN_EHL01
         |                                                 ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:57:28: note: expanded from macro 'BOARD_UPN_EHL01'
      57 | #define BOARD_UPN_EHL01                         13
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1138:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1138 |                 .ident = BOARD_UPX_ADLP01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:59:28: note: expanded from macro 'BOARD_UPX_ADLP01'
      59 | #define BOARD_UPX_ADLP01                        15
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1145:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1145 |                 .ident = BOARD_UPN_ADLN01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:60:28: note: expanded from macro 'BOARD_UPN_ADLN01'
      60 | #define BOARD_UPN_ADLN01                        16
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1152:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1152 |                 .ident = BOARD_UPS_ADLP01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:61:28: note: expanded from macro 'BOARD_UPS_ADLP01'
      61 | #define BOARD_UPS_ADLP01                        BOARD_UPX_ADLP01
         |                                                 ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:59:28: note: expanded from macro 'BOARD_UPX_ADLP01'
      59 | #define BOARD_UPX_ADLP01                        15
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1159:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1159 |                 .ident = BOARD_UP_ADLN01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:62:28: note: expanded from macro 'BOARD_UP_ADLN01'
      62 | #define BOARD_UP_ADLN01                         18
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1185:12: error: incompatible pointer to integer conversion assigning to 'int' from 'const char *const' [-Wint-conversion]
    1185 |                 board_id = system_id->ident;
         |                          ^ ~~~~~~~~~~~~~~~~

1 warning and 12 errors generated.

vim +709 drivers/pinctrl/pinctrl-upboard.c

705
706 static void upboard_alt_func_enable(struct gpio_chip *gc, const char *name, int id)
707 {
708 struct upboard_pinctrl *pctrl = container_of(gc, struct upboard_pinctrl, chip);

 > 709		int offset[pctrl->pctldesc->npins];

710 int i, cnt;
711 bool input;
712 int mode;
713 unsigned int val;
714
715 /* find all pins */
716 for (i = 0, cnt = 0; i < pctrl->pctldesc->npins; i++) {
717 if (strstr(pctrl->pctldesc->pins[i].name, name))
718 offset[cnt++] = i;
719 }
720
721 /* change to alternate function */
722 for (i = 0; i < cnt; i++) {
723 if (pctrl->pins[offset[i]].regs == NULL)
724 continue;
725 input = false;
726 mode = 0; /* default GPIO */
727 val = readl(pctrl->pins[offset[i]].regs);
728
729 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "I2C") ||
730 strstr(pctrl->pctldesc->pins[offset[i]].name, "PINMUX")) {
731 mode = 1;
732 switch (id) {
733 case BOARD_UPN_ADLN01:
734 case BOARD_UPX_ADLP01:
735 mode = 2;
736 break;
737 default:
738 break;
739 }
740
741 val |= mode<<PADCFG0_PMODE_SHIFT;
742 writel(val, pctrl->pins[offset[i]].regs);
743 upboard_fpga_request_free(pctrl->pctldev, offset[i]);
744 continue;
745 }
746
747 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "UART")) {
748 mode = 1;
749 switch (id) {
750 case BOARD_UPN_EHL01:
751 mode = 4;
752 break;
753 case BOARD_UP_ADLN01:
754 case BOARD_UPN_ADLN01:
755 case BOARD_UPX_ADLP01:
756 mode = 2;
757 break;
758 default:
759 break;
760 }
761 }
762
763 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "SPI")) {
764 mode = 1;
765 switch (id) {
766 case BOARD_UP_WHL01:
767 mode = 3;
768 break;
769 case BOARD_UP_ADLN01:
770 case BOARD_UPN_ADLN01:
771 case BOARD_UPX_ADLP01:
772 mode = 7;
773 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MOSI")) {
774 val &= ~PADCFG0_GPIOTXDIS;
775 val |= PADCFG0_GPIORXDIS;
776 }
777
778 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MISO"))
779 val |= PADCFG0_GPIORXDIS;
780
781 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CLK")) {
782 val &= ~PADCFG0_GPIOTXDIS;
783 val |= PADCFG0_GPIORXDIS;
784 }
785 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CS0"))
786 val |= PADCFG0_GPIORXDIS;
787
788 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CS1"))
789 continue;
790 break;
791 default:
792 break;
793 }
794 }
795
796 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "I2S")) {
797 mode = 1;
798 switch (id) {
799 case BOARD_UPX_ADLP01:
800 mode = 4;
801 break;
802 default:
803 break;
804 }
805 }
806
807 val |= mode<<PADCFG0_PMODE_SHIFT;
808 writel(val, pctrl->pins[offset[i]].regs);
809
810 /* input pins */
811 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "RX"))
812 input = true;
813
814 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CTS"))
815 input = true;
816
817 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "ADC")) {
818 input = true;
819 if (id == BOARD_UP_APL01)
820 upboard_fpga_request_enable(pctrl->pctldev, NULL, offset[i]);
821 else
822 upboard_fpga_request_free(pctrl->pctldev, offset[i]);
823 }
824
825 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MISO"))
826 input = true;
827
828 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "DIN"))
829 input = true;
830
831 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "SDI"))
832 input = true;
833
834 upboard_fpga_set_direction(pctrl->pctldev, NULL, offset[i], input);
835 }
836 }
837

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#11 lore raw

Re: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA

In reply to larry.lai
kernel test robot noticed the following build errors:

Hi larry.lai,

kernel test robot noticed the following build errors:

[auto build test ERROR on 4fe89d07dcc2804c8b562f6c7896a45643d34b2f]

url:    https://github.com/intel-lab-lkp/linux/commits/larry-lai/mfd-Add-support-for-UP-board-CPLD-FPGA/20231228-231750
base:   4fe89d07dcc2804c8b562f6c7896a45643d34b2f
patch link:    https://lore.kernel.org/r/20231228151544.14408-3-larry.lai%40yunjingtech.com
patch subject: [PATCH V8 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20231229/[email protected]/config)
compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231229/[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-upboard.c:709:13: warning: variable length array used [-Wvla]

     709 |         int offset[pctrl->pctldesc->npins];
         |                    ^~~~~~~~~~~~~~~~~~~~~~
>> drivers/pinctrl/pinctrl-upboard.c:1089:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1089 |                 .ident = BOARD_UP_APL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:46:27: note: expanded from macro 'BOARD_UP_APL01'
      46 | #define BOARD_UP_APL01                          1
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1096:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1096 |                 .ident = BOARD_UP_APL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:46:27: note: expanded from macro 'BOARD_UP_APL01'
      46 | #define BOARD_UP_APL01                          1
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1103:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1103 |                 .ident = BOARD_UP_APL03,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:53:27: note: expanded from macro 'BOARD_UP_APL03'
      53 | #define BOARD_UP_APL03                          9
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1110:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1110 |                 .ident = BOARD_UP_WHL01,
         |                          ^~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:50:27: note: expanded from macro 'BOARD_UP_WHL01'
      50 | #define BOARD_UP_WHL01                          5
         |                                                 ^
   drivers/pinctrl/pinctrl-upboard.c:1117:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1117 |                 .ident = BOARD_UPX_TGL,
         |                          ^~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:55:26: note: expanded from macro 'BOARD_UPX_TGL'
      55 | #define BOARD_UPX_TGL                           11
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1124:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1124 |                 .ident = BOARD_UPN_EHL01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:57:28: note: expanded from macro 'BOARD_UPN_EHL01'
      57 | #define BOARD_UPN_EHL01                         13
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1131:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1131 |                 .ident = BOARD_UPS_EHL01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:58:28: note: expanded from macro 'BOARD_UPS_EHL01'
      58 | #define BOARD_UPS_EHL01                         BOARD_UPN_EHL01
         |                                                 ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:57:28: note: expanded from macro 'BOARD_UPN_EHL01'
      57 | #define BOARD_UPN_EHL01                         13
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1138:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1138 |                 .ident = BOARD_UPX_ADLP01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:59:28: note: expanded from macro 'BOARD_UPX_ADLP01'
      59 | #define BOARD_UPX_ADLP01                        15
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1145:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1145 |                 .ident = BOARD_UPN_ADLN01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:60:28: note: expanded from macro 'BOARD_UPN_ADLN01'
      60 | #define BOARD_UPN_ADLN01                        16
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1152:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1152 |                 .ident = BOARD_UPS_ADLP01,
         |                          ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:61:28: note: expanded from macro 'BOARD_UPS_ADLP01'
      61 | #define BOARD_UPS_ADLP01                        BOARD_UPX_ADLP01
         |                                                 ^~~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:59:28: note: expanded from macro 'BOARD_UPX_ADLP01'
      59 | #define BOARD_UPX_ADLP01                        15
         |                                                 ^~
   drivers/pinctrl/pinctrl-upboard.c:1159:12: error: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
    1159 |                 .ident = BOARD_UP_ADLN01,
         |                          ^~~~~~~~~~~~~~~
   drivers/pinctrl/pinctrl-upboard.c:62:28: note: expanded from macro 'BOARD_UP_ADLN01'
      62 | #define BOARD_UP_ADLN01                         18
         |                                                 ^~
>> drivers/pinctrl/pinctrl-upboard.c:1185:12: error: incompatible pointer to integer conversion assigning to 'int' from 'const char *const' [-Wint-conversion]
    1185 |                 board_id = system_id->ident;
         |                          ^ ~~~~~~~~~~~~~~~~

1 warning and 12 errors generated.

vim +1089 drivers/pinctrl/pinctrl-upboard.c

1085
1086 /* DMI Matches to assign pin mapping driver data */
1087 static const struct dmi_system_id upboard_dmi_table[] __initconst = {
1088 {

> 1089			.ident = BOARD_UP_APL01,
  1090			.matches = { /* UP SQUARED */
  1091				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1092				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UP-APL01"),
  1093			},
  1094		},
  1095		{
  1096			.ident = BOARD_UP_APL01,
  1097			.matches = { /* UP SQUARED Pro*/
  1098				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1099				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UPN-APL01"),
  1100			},
  1101		},
  1102		{
  1103			.ident = BOARD_UP_APL03,
  1104			.matches = { /* UP 4000 */
  1105				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1106				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UP-APL03"),
  1107			},
  1108		},
  1109		{
  1110			.ident = BOARD_UP_WHL01,
  1111			.matches = { /* UPX WHL */
  1112				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1113				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UP-WHL01"),
  1114			},
  1115		},
  1116		{
  1117			.ident = BOARD_UPX_TGL,
  1118			.matches = { /* UP i11 */
  1119				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1120				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UPX-TGL01"),
  1121			},
  1122		},
  1123		{
  1124			.ident = BOARD_UPN_EHL01,
  1125			.matches = { /* UP 6000 */
  1126				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1127				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UPN-EHL01"),
  1128			},
  1129		},
  1130		{
  1131			.ident = BOARD_UPS_EHL01,
  1132			.matches = { /* UP squared v2 */
  1133				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1134				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UPS-EHL01"),
  1135			},
  1136		},
  1137		{
  1138			.ident = BOARD_UPX_ADLP01,
  1139			.matches = { /* UP Xtreme i12 */
  1140				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1141				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UPX-ADLP01"),
  1142			},
  1143		},
  1144		{
  1145			.ident = BOARD_UPN_ADLN01,
  1146			.matches = { /* UP 7000 */
  1147				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1148				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UPN-ADLN01"),
  1149			},
  1150		},
  1151		{
  1152			.ident = BOARD_UPS_ADLP01,
  1153			.matches = { /* UP Squared i12 */
  1154				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1155				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UPS-ADLP01"),
  1156			},
  1157		},
  1158		{
  1159			.ident = BOARD_UP_ADLN01,
  1160			.matches = { /* UP 7000 */
  1161				DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AAEON"),
  1162				DMI_EXACT_MATCH(DMI_BOARD_NAME, "UP-ADLN01"),
  1163			},
  1164		},
  1165		{ }	/* Terminating entry */
  1166	};
  1167	
  1168	static int upboard_pinctrl_probe(struct platform_device *pdev)
  1169	{
  1170		struct upboard_fpga * const fpga = dev_get_drvdata(pdev->dev.parent);
  1171		struct pinctrl_desc *pctldesc;
  1172		struct upboard_pinctrl *pctrl;
  1173		struct upboard_pin *pins;
  1174		const struct dmi_system_id *system_id;
  1175		const unsigned int *rpi_mapping;
  1176		unsigned int ngpio;
  1177		int ret;
  1178		int i;
  1179		/* default */
  1180		int board_id = BOARD_UP_APL03;
  1181	
  1182		/* check board id to arrange driver data */
  1183		system_id = dmi_first_match(upboard_dmi_table);
  1184		if (system_id)
> 1185			board_id = system_id->ident;
  1186		dev_info(&pdev->dev, "Compatible Up Board ID %d", board_id);
  1187		switch (board_id) {
  1188		case BOARD_UP_APL01:
  1189			pctldesc = &upboard_up2_pinctrl_desc;
  1190			rpi_mapping = upboard_up2_rpi_mapping;
  1191			ngpio = ARRAY_SIZE(upboard_up2_rpi_mapping);
  1192			break;
  1193		case BOARD_UP_UPCORE:
  1194			pctldesc = &upboard_upcore_crex_pinctrl_desc;
  1195			rpi_mapping = upboard_upcore_crex_rpi_mapping;
  1196			ngpio = ARRAY_SIZE(upboard_upcore_crex_rpi_mapping);
  1197			break;
  1198		case BOARD_UP_CORE_PLUS:
  1199			pctldesc = &upboard_upcore_crst02_pinctrl_desc;
  1200			rpi_mapping = upboard_upcore_crst02_rpi_mapping;
  1201			ngpio = ARRAY_SIZE(upboard_upcore_crst02_rpi_mapping);
  1202			break;
  1203		default:
  1204			pctldesc = &upboard_up_pinctrl_desc;
  1205			rpi_mapping = upboard_up_rpi_mapping;
  1206			ngpio = ARRAY_SIZE(upboard_up_rpi_mapping);
  1207			break;
  1208		}
  1209	
  1210		pctldesc->name = dev_name(&pdev->dev);
  1211	
  1212		pins = devm_kcalloc(&pdev->dev, pctldesc->npins, sizeof(*pins), GFP_KERNEL);
  1213		if (!pins)
  1214			return -ENOMEM;
  1215	
  1216		/* initialise pins */
  1217		for (i = 0; i < pctldesc->npins; i++) {
  1218			struct upboard_pin *pin = &pins[i];
  1219			struct pinctrl_pin_desc *pd = (struct pinctrl_pin_desc *) &pctldesc->pins[i];
  1220			struct reg_field fldconf = {0};
  1221			unsigned int regoff = (pd->number / UPFPGA_REGISTER_SIZE);
  1222			unsigned int lsb = pd->number % UPFPGA_REGISTER_SIZE;
  1223	
  1224			pin->funcbit = NULL;
  1225	
  1226			if (pd->drv_data) {
  1227				fldconf = *(struct reg_field *)pd->drv_data;
  1228	
  1229				pin->funcbit = devm_regmap_field_alloc(&pdev->dev,
  1230								       fpga->regmap,
  1231								       fldconf);
  1232				if (IS_ERR(pin->funcbit))
  1233					return PTR_ERR(pin->funcbit);
  1234			}
  1235	
  1236			fldconf.reg = UPFPGA_REG_GPIO_EN0 + regoff;
  1237			fldconf.lsb = lsb;
  1238			fldconf.msb = lsb;
  1239	
  1240			pin->enbit = devm_regmap_field_alloc(&pdev->dev,
  1241							     fpga->regmap,
  1242							     fldconf);
  1243			if (IS_ERR(pin->enbit))
  1244				return PTR_ERR(pin->enbit);
  1245	
  1246			fldconf.reg = UPFPGA_REG_GPIO_DIR0 + regoff;
  1247			fldconf.lsb = lsb;
  1248			fldconf.msb = lsb;
  1249	
  1250			pin->dirbit = devm_regmap_field_alloc(&pdev->dev,
  1251							      fpga->regmap,
  1252							      fldconf);
  1253			if (IS_ERR(pin->dirbit))
  1254				return PTR_ERR(pin->dirbit);
  1255	
  1256			pd->drv_data = pin;
  1257		}
  1258	
  1259		/* create a new pinctrl device and register it */
  1260		pctrl = devm_kzalloc(&pdev->dev, sizeof(*pctrl), GFP_KERNEL);
  1261		if (!pctrl)
  1262			return -ENOMEM;
  1263	
  1264		pctrl->rpi_mapping = rpi_mapping;
  1265		pctrl->chip = upboard_gpio_chip;
  1266		pctrl->pctldesc = pctldesc;
  1267		pctrl->chip.parent = &pdev->dev;
  1268		pctrl->chip.ngpio = ngpio;
  1269		pctrl->pins = pins;
  1270		pctrl->ident = board_id;
  1271	
  1272		ret = devm_gpiochip_add_data(&pdev->dev, &pctrl->chip, pctrl);
  1273		if (ret)
  1274			return ret;
  1275	
  1276		pctrl->pctldev = devm_pinctrl_register(&pdev->dev, pctldesc, pctrl);
  1277		if (IS_ERR(pctrl->pctldev))
  1278			return PTR_ERR(pctrl->pctldev);
  1279	
  1280		/* add acpi pin mapping according to external-gpios key */
  1281		ret = upboard_acpi_node_pin_mapping(fpga, pctrl,
  1282						    "external",
  1283						    dev_name(&pdev->dev),
  1284						    0);
  1285		if (ret)
  1286			return ret;
  1287	
  1288		upboard_alt_func_enable(&pctrl->chip, "I2C",    pctrl->ident);
  1289		upboard_alt_func_enable(&pctrl->chip, "SPI",    pctrl->ident);
  1290		upboard_alt_func_enable(&pctrl->chip, "UART",   pctrl->ident);
  1291		upboard_alt_func_enable(&pctrl->chip, "I2S",    pctrl->ident);
  1292		upboard_alt_func_enable(&pctrl->chip, "PWM",    pctrl->ident);
  1293		upboard_alt_func_enable(&pctrl->chip, "ADC",    pctrl->ident);

1294 upboard_alt_func_enable(&pctrl->chip, "PINMUX", pctrl->ident);
1295
1296 return ret;
1297 }
1298

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
author
#12 lore raw

PATCH v8 3/3 leds: Add support for UP board CPLD onboard LEDS

In reply to larry.lai

The UP boards come with a few FPGA-controlled onboard LEDs:
* UP Board: yellow, green, red
* UP Squared: blue, yellow, green, red

---
PATCH V7 -> PATCH V8
(1) Refer 2023/11/01 Krzysztof Kozlowski review, cleaned up coding style and addressed review comments.
PATCH V6 --> PATCH V7: cleaned up coding style and addressed review comments.
PATCH V4 -> PATCH V6 : There is no change.
RFC 2023/04/25 -> PATCH V4
(1) Fixed kernel test robot compiler warning.
(2) Remove mistakes with wrong Reviewed-by tags.
RFC 2022/11/23 --> RFC 2023/04/25: Refer 2022/12/08 Lee Jones review, cleaned up coding style.
PATCH V3 -> RFC 2022/11/23: Update the changes Copyright. PATCH V1 -> V3: There is no change.
PATCH --> PATCH V1: Refer 2022/10/03 Andy Shevchenko review, cleaned up coding style.

---
 drivers/leds/Kconfig        |  10 +++
 drivers/leds/Makefile       |   1 +
 drivers/leds/leds-upboard.c | 154 ++++++++++++++++++++++++++++++++++++
 3 files changed, 165 insertions(+)
 create mode 100644 drivers/leds/leds-upboard.c
drivers/leds/Kconfig +10 -0
index 499d0f215a8b..80b9c394c5b6 100644
@@ -872,6 +872,16 @@ source "drivers/leds/flash/Kconfig"
 comment "RGB LED drivers"
 source "drivers/leds/rgb/Kconfig"
 
+config LEDS_UPBOARD
+	tristate "LED support for the UP board"
+	depends on LEDS_CLASS
+	depends on MFD_UPBOARD_FPGA
+	help
+	  This option enables support for the UP board LEDs.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called leds-upboard.
+
 comment "LED Triggers"
 source "drivers/leds/trigger/Kconfig"
 
drivers/leds/Makefile +1 -0
index 4fd2f92cd198..e72956645646 100644
@@ -83,6 +83,7 @@ obj-$(CONFIG_LEDS_TI_LMU_COMMON)	+= leds-ti-lmu-common.o
 obj-$(CONFIG_LEDS_TLC591XX)		+= leds-tlc591xx.o
 obj-$(CONFIG_LEDS_TPS6105X)		+= leds-tps6105x.o
 obj-$(CONFIG_LEDS_TURRIS_OMNIA)		+= leds-turris-omnia.o
+obj-$(CONFIG_LEDS_UPBOARD)		+= leds-upboard.o
 obj-$(CONFIG_LEDS_WM831X_STATUS)	+= leds-wm831x-status.o
 obj-$(CONFIG_LEDS_WM8350)		+= leds-wm8350.o
 obj-$(CONFIG_LEDS_WRAP)			+= leds-wrap.o
drivers/leds/leds-upboard.c new file +154 -0

154 lines not on this page · raw message

Signature · 1 line
2.17.1
#13 lore raw

Re: [PATCH V8 3/3] leds: Add support for UP board CPLD onboard LEDS

Quoted 4 lines · larry.lai

The UP boards come with a few FPGA-controlled onboard LEDs:
* UP Board: yellow, green, red
* UP Squared: blue, yellow, green, red

...

drivers/leds/leds-upboard.c line 118

Quoted 8 lines
drivers/leds/leds-upboard.c new file +8 -0
+
+static int upboard_led_probe(struct platform_device *pdev)
+{
+	struct upboard_fpga * const cpld = dev_get_drvdata(pdev->dev.parent);
+	struct reg_field fldconf = {
+		.reg = UPFPGA_REG_FUNC_EN0,
+	};
+	struct upboard_led_data * const pdata = pdev->dev.platform_data;

Your const does not make sense. Please read C standard how qualifiers are applied.

...

drivers/leds/leds-upboard.c line 154

Quoted 6 lines
drivers/leds/leds-upboard.c new file +6 -0
+module_platform_driver_probe(upboard_led_driver, upboard_led_probe);
+
+MODULE_AUTHOR("Gary Wang <[email protected]>");
+MODULE_DESCRIPTION("UP Board LED driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:upboard-led");

Nothing improved here.

This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

Thank you.

Best regards,
Krzysztof

#14 lore raw

Re: [PATCH V8 3/3] leds: Add support for UP board CPLD onboard LEDS

Quoted 2 lines · Krzysztof Kozlowski
Quoted 1 line · larry.lai

The UP boards come with a few FPGA-controlled onboard LEDs:

...

Quoted 10 lines

drivers/leds/leds-upboard.c line 118

Quoted 7 lines
drivers/leds/leds-upboard.c new file +7 -0
+static int upboard_led_probe(struct platform_device *pdev)
+{
+	struct upboard_fpga * const cpld = dev_get_drvdata(pdev->dev.parent);
+	struct reg_field fldconf = {
+		.reg = UPFPGA_REG_FUNC_EN0,
+	};
+	struct upboard_led_data * const pdata = pdev->dev.platform_data;

Your const does not make sense. Please read C standard how qualifiers are applied.

will do

Quoted 10 lines
Quoted 1 line

+MODULE_ALIAS("platform:upboard-led");

Nothing improved here.

This is a friendly reminder during the review process.

It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.

the same as pinctrl-upboard doing

Signature · 2 lines
Best Regards,
Jack Chang
#15 lore raw
In reply to larry.lai
Quoted 7 lines · larry.lai

The UP board <https://up-board.org/> is the computer board for Professional Makers and Industrial Applications. We want to upstream the UP board 40-pin GP-bus Kernel driver for giving the users better experience on the software release. (not just download from UP board github)

These patches are generated from the Linux kernel mainline tag v6.0.

That's too old. Please use latest mainline.

Best regards,
Krzysztof