Add support control UP board CPLD/FPGA pin control
Subsystems (5)
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 RFC PATCH resend and fixed some of the review issues from Andy Shevchenko, Lee Jones reviewed on 2022/12/08.
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 | 79 ++ drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile | 1 + drivers/mfd/upboard-fpga.c | 527 ++++++++++++ drivers/pinctrl/Kconfig | 14 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-upboard.c | 1281 +++++++++++++++++++++++++++++ include/linux/mfd/upboard-fpga.h | 61 ++ 10 files changed, 1987 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
RFC 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 mfd 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 support for the FPGA-based pin controller that manages direction and enable state for those header pins.
Partial support UP boards:
* UP core + CREX
* UP core + CRST02
---
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 | 527 +++++++++++++++++++++++++++++++ include/linux/mfd/upboard-fpga.h | 61 ++++ 4 files changed, 601 insertions(+) create mode 100644 drivers/mfd/upboard-fpga.c create mode 100644 include/linux/mfd/upboard-fpga.h
drivers/mfd/Kconfig +12 -0
@@ -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_INTEL_UPBOARD_FPGA + tristate "Support for the Intel platform foundation kit UP board FPGA" + select MFD_CORE + depends on X86 && ACPI + help + Select this option to enable the Intel 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
@@ -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_INTEL_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 +527 -0
527 lines not on this page · raw message
include/linux/mfd/upboard-fpga.h new file +61 -0
61 lines not on this page · raw message
Signature · 1 line
2.17.1
Lee Jones
maintainerRe: [RFC RESEND 1/3] mfd: Add support for UP board CPLD/FPGA
Quoted 16 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 mfd 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 support for the FPGA-based pin controller that manages direction and enable state for those header pins.
Partial support UP boards:
* UP core + CREX
* UP core + CRST02
Quoted 6 lines
Signed-off-by Javier Arteaga <[email protected]>[merge various fixes]Signed-off-by Nicola Lunghi <[email protected]>Reviewed-by Lee Jones <[email protected]>Reviewed-by Andy Shevchenko <[email protected]>
Wait, what?!
When did Andy or I provide you with Reviewed-by tags?
You must to apply any tag that isn't explicitly provided to you.
Quoted 15 lines
Signed-off-by larry.lai <[email protected]>---
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.
---
Quoted 8 lines
--- drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile | 1 + drivers/mfd/upboard-fpga.c | 527 +++++++++++++++++++++++++++++++ include/linux/mfd/upboard-fpga.h | 61 ++++ 4 files changed, 601 insertions(+) create mode 100644 drivers/mfd/upboard-fpga.c create mode 100644 include/linux/mfd/upboard-fpga.h
I'm not even going to try and review this (again).
Looking at the subject line, this is patch is masquerading as a RESEND of an unreviewed v1. However, at best this is a RESEND of a reviewed (which was ignored) v3, perhaps even just a straight v4.
Either way, it appears as though the review comments you received in v3 were ignored. Please go back and fix those before submitting v5, thanks.
Signature · 1 line
Lee Jones [李琼斯]
kernel test robot
build botRe: [RFC RESEND 1/3] mfd: Add support for UP board CPLD/FPGA
In reply to larry.laikernel test robot noticed the following build warnings:
Hi larry.lai,
[This is a private test report for your RFC patch.] 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/20230425-232744 base: 4fe89d07dcc2804c8b562f6c7896a45643d34b2f patch link: https://lore.kernel.org/r/20230425152135.30745-2-larry.lai%40yunjingtech.com patch subject: [RFC RESEND 1/3] mfd: Add support for UP board CPLD/FPGA config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20230502/[email protected]/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/cb16ef420038f2bede2deb3878b529f0e6ea7729
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review larry-lai/mfd-Add-support-for-UP-board-CPLD-FPGA/20230425-232744
git checkout cb16ef420038f2bede2deb3878b529f0e6ea7729
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/firmware/ drivers/hwmon/ drivers/mfd/ drivers/pinctrl/ drivers/staging/media/atomisp/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/mfd/upboard-fpga.c:448:49: warning: data argument not used by format string [-Wformat-extra-args]
dev_err(fpga->dev, "Failed to add GPIO LEDs", ret);
~~~~~~~~~~~~~~~~~~~~~~~~~ ^
include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
~~~ ^
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
_p_func(dev, fmt, ##__VA_ARGS__); \
~~~ ^
drivers/mfd/upboard-fpga.c:486:20: error: assigning to 'struct regmap_config *' from 'const struct regmap_config *const' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
fpga->cpld_config = fpga_data->cpld_config;
^ ~~~~~~~~~~~~~~~~~~~~~~1 warning and 1 error generated.
vim +448 drivers/mfd/upboard-fpga.c
383
384 /*
385 * MFD upboard-fpga is ACPI driver and can recognize the AANT ID from different
386 * kind of upboards. We get the LED GPIO initialized information from this
387 * then add led-upboard driver.
388 */
389 int upboard_led_gpio_register(struct upboard_fpga *fpga)
390 {
391 struct gpio_led blue_led, yellow_led, green_led, red_led;
392 struct gpio_desc *desc;
393 static struct gpio_led upboard_gpio_leds[4];
394 int leds = 0;
395 static struct gpio_led_platform_data upboard_gpio_led_platform_data;
396 static const struct mfd_cell upboard_gpio_led_cells[] = {
397 MFD_CELL_BASIC("leds-gpio", NULL,
398 &upboard_gpio_led_platform_data,
399 sizeof(upboard_gpio_led_platform_data), 0)
400 };
401 int ret;
402
403 desc = devm_gpiod_get(fpga->dev, "blue", GPIOD_OUT_LOW);
404 if (!IS_ERR(desc)) {
405 blue_led.name = "upboard:blue:";
406 blue_led.gpio = desc_to_gpio(desc);
407 blue_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
408 upboard_gpio_leds[leds++] = blue_led;
409 devm_gpiod_put(fpga->dev, desc);
410 }
411 desc = devm_gpiod_get(fpga->dev, "yellow", GPIOD_OUT_LOW);
412 if (!IS_ERR(desc)) {
413 yellow_led.name = "upboard:yellow:";
414 yellow_led.gpio = desc_to_gpio(desc);
415 yellow_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
416 upboard_gpio_leds[leds++] = yellow_led;
417 devm_gpiod_put(fpga->dev, desc);
418 }
419 desc = devm_gpiod_get(fpga->dev, "green", GPIOD_OUT_LOW);
420 if (!IS_ERR(desc)) {
421 green_led.name = "upboard:green:";
422 green_led.gpio = desc_to_gpio(desc);
423 green_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
424 upboard_gpio_leds[leds++] = green_led;
425 devm_gpiod_put(fpga->dev, desc);
426 }
427 desc = devm_gpiod_get(fpga->dev, "red", GPIOD_OUT_LOW);
428 if (!IS_ERR(desc)) {
429 red_led.name = "upboard:red:";
430 red_led.gpio = desc_to_gpio(desc);
431 red_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
432 upboard_gpio_leds[leds++] = red_led;
433 devm_gpiod_put(fpga->dev, desc);
434 }
435
436 /* no LEDs */
437 if (leds == 0)
438 return 0;
439
440 upboard_gpio_led_platform_data.num_leds = leds;
441 upboard_gpio_led_platform_data.leds = upboard_gpio_leds;
442
443 ret = devm_mfd_add_devices(fpga->dev, PLATFORM_DEVID_AUTO,
444 upboard_gpio_led_cells,
445 ARRAY_SIZE(upboard_gpio_led_cells),
446 NULL, 0, NULL);
447 if (ret) {
> 448 dev_err(fpga->dev, "Failed to add GPIO LEDs", ret); 449 return ret;
450 }
451
452 return 0;
453 }
454
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
kernel test robot
build botRe: [RFC RESEND 1/3] mfd: Add support for UP board CPLD/FPGA
In reply to larry.laikernel test robot noticed the following build errors:
Hi larry.lai,
[This is a private test report for your RFC patch.] 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/20230425-232744 base: 4fe89d07dcc2804c8b562f6c7896a45643d34b2f patch link: https://lore.kernel.org/r/20230425152135.30745-2-larry.lai%40yunjingtech.com patch subject: [RFC RESEND 1/3] mfd: Add support for UP board CPLD/FPGA config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20230502/[email protected]/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/cb16ef420038f2bede2deb3878b529f0e6ea7729
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review larry-lai/mfd-Add-support-for-UP-board-CPLD-FPGA/20230425-232744 git checkout cb16ef420038f2bede2deb3878b529f0e6ea7729
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/mfd/upboard-fpga.c:448:49: warning: data argument not used by format string [-Wformat-extra-args]
dev_err(fpga->dev, "Failed to add GPIO LEDs", ret);
~~~~~~~~~~~~~~~~~~~~~~~~~ ^
include/linux/dev_printk.h:144:65: note: expanded from macro 'dev_err'
dev_printk_index_wrap(_dev_err, KERN_ERR, dev, dev_fmt(fmt), ##__VA_ARGS__)
~~~ ^
include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap'
_p_func(dev, fmt, ##__VA_ARGS__); \
~~~ ^
>> drivers/mfd/upboard-fpga.c:486:20: error: assigning to 'struct regmap_config *' from 'const struct regmap_config *const' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
fpga->cpld_config = fpga_data->cpld_config;
^ ~~~~~~~~~~~~~~~~~~~~~~1 warning and 1 error generated.
vim +486 drivers/mfd/upboard-fpga.c
465
466 static int __init upboard_fpga_probe(struct platform_device *pdev)
467 {
468 struct upboard_fpga *fpga;
469 const struct acpi_device_id *id;
470 const struct upboard_fpga_data *fpga_data;
471 int ret;
472 struct device *dev = &pdev->dev;
473
474 id = acpi_match_device(upboard_fpga_acpi_match, dev);
475 if (!id)
476 return -ENODEV;
477
478 fpga_data = (const struct upboard_fpga_data *) id->driver_data;
479
480 fpga = devm_kzalloc(dev, sizeof(*fpga), GFP_KERNEL);
481 if (!fpga)
482 return -ENOMEM;
483
484 platform_set_drvdata(pdev, fpga);
485 fpga->regmap = devm_regmap_init(dev, NULL, fpga, fpga_data->cpld_config);
> 486 fpga->cpld_config = fpga_data->cpld_config;
487
488 if (IS_ERR(fpga->regmap))
489 return PTR_ERR(fpga->regmap);
490
491 ret = upboard_fpga_gpio_init(fpga);
492 if (ret) {
493 /*
494 * This is for compatiable with some upboards w/o FPGA firmware,
495 * so just showing debug info and do not return directly.
496 */
497 dev_warn(dev, "Failed to initialize FPGA common GPIOs: %d", ret);
498 } else {
499 upboard_fpga_show_firmware_info(fpga);
500 }
501
502 /* register GPIO LEDs */
503 ret = upboard_led_gpio_register(fpga);
504 if (ret) {
505 /*
506 * This is for compatiable with some upboards w/o LEDs.
507 */
508 dev_warn(dev, "Failed to register LEDs: %d", ret);
509 }
510
511 return devm_mfd_add_devices(dev, PLATFORM_DEVID_AUTO,
512 fpga_data->cells,
513 fpga_data->ncells,
514 NULL, 0, NULL); 515 }
516
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
RFC 2/3 pinctrl: Add support pin control for UP board CPLD/FPGA
In reply to larry.laiThe UP Squared board <http://www.upboard.com> implements certain features (pin control) through an on-board FPGA.
---
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 | 14 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/pinctrl-upboard.c | 1281 +++++++++++++++++++++++++++++ 3 files changed, 1296 insertions(+) create mode 100644 drivers/pinctrl/pinctrl-upboard.c
drivers/pinctrl/Kconfig +14 -0
@@ -483,6 +483,20 @@ 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_INTEL_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
@@ -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 +1281 -0
1,281 lines not on this page · raw message
Signature · 1 line
2.17.1
kernel test robot
build botRe: [RFC RESEND 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA
kernel test robot noticed the following build warnings:
Hi larry.lai,
[This is a private test report for your RFC patch.] 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/20230425-232744 base: 4fe89d07dcc2804c8b562f6c7896a45643d34b2f patch link: https://lore.kernel.org/r/20230425152135.30745-3-larry.lai%40yunjingtech.com patch subject: [RFC RESEND 2/3] pinctrl: Add support pin control for UP board CPLD/FPGA config: i386-allmodconfig (https://download.01.org/0day-ci/archive/20230503/[email protected]/config) compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/b8c1c33f21a4a0526016b4ec803adabc2d32b035
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review larry-lai/mfd-Add-support-for-UP-board-CPLD-FPGA/20230425-232744
git checkout b8c1c33f21a4a0526016b4ec803adabc2d32b035
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/firmware/ drivers/hwmon/ drivers/pinctrl/ drivers/staging/media/atomisp/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
>> drivers/pinctrl/pinctrl-upboard.c:754:13: warning: variable length array used [-Wvla]
int offset[pctrl->pctldesc->npins];
^~~~~~~~~~~~~~~~~~~~~~
>> drivers/pinctrl/pinctrl-upboard.c:774:8: warning: mixing declarations and code is incompatible with standards before C99 [-Wdeclaration-after-statement]
bool input = false;
^
>> drivers/pinctrl/pinctrl-upboard.c:877:26: warning: unused variable 'pctrl' [-Wunused-variable]
struct upboard_pinctrl *pctrl = container_of(gc, struct upboard_pinctrl, chip);
^
drivers/pinctrl/pinctrl-upboard.c:888:19: warning: variable length array used [-Wvla]
char name[strlen(pctrl->pctldesc->pins[pin].name)];
~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/pinctrl/pinctrl-upboard.c:1009:5: warning: no previous prototype for function 'upboard_acpi_node_pin_mapping' [-Wmissing-prototypes]
int upboard_acpi_node_pin_mapping(struct upboard_fpga *fpga,
^
drivers/pinctrl/pinctrl-upboard.c:1009:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int upboard_acpi_node_pin_mapping(struct upboard_fpga *fpga,
^
static
>> drivers/pinctrl/pinctrl-upboard.c:1068:12: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
.ident = BOARD_UP_APL03,
^~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:85:26: note: expanded from macro 'BOARD_UP_APL03'
#define BOARD_UP_APL03 9
^
drivers/pinctrl/pinctrl-upboard.c:1075:12: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
.ident = BOARD_UP_WHL01,
^~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:82:26: note: expanded from macro 'BOARD_UP_WHL01'
#define BOARD_UP_WHL01 5
^
drivers/pinctrl/pinctrl-upboard.c:1082:12: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
.ident = BOARD_UPX_TGL,
^~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:87:25: note: expanded from macro 'BOARD_UPX_TGL'
#define BOARD_UPX_TGL 11
^~
drivers/pinctrl/pinctrl-upboard.c:1089:12: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
.ident = BOARD_UPN_EHL01,
^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:89:27: note: expanded from macro 'BOARD_UPN_EHL01'
#define BOARD_UPN_EHL01 13
^~
drivers/pinctrl/pinctrl-upboard.c:1096:12: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
.ident = BOARD_UPS_EHL01,
^~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:90:27: note: expanded from macro 'BOARD_UPS_EHL01'
#define BOARD_UPS_EHL01 14
^~
drivers/pinctrl/pinctrl-upboard.c:1103:12: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
.ident = BOARD_UPX_ADLP01,
^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:91:27: note: expanded from macro 'BOARD_UPX_ADLP01'
#define BOARD_UPX_ADLP01 15
^~
drivers/pinctrl/pinctrl-upboard.c:1110:12: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
.ident = BOARD_UPN_ADLN01,
^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:92:27: note: expanded from macro 'BOARD_UPN_ADLN01'
#define BOARD_UPN_ADLN01 16
^~
drivers/pinctrl/pinctrl-upboard.c:1117:12: warning: incompatible integer to pointer conversion initializing 'const char *' with an expression of type 'int' [-Wint-conversion]
.ident = BOARD_UPS_ADLP01,
^~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:93:27: note: expanded from macro 'BOARD_UPS_ADLP01'
#define BOARD_UPS_ADLP01 15
^~
>> drivers/pinctrl/pinctrl-upboard.c:1253:16: warning: incompatible pointer to integer conversion assigning to 'int' from 'const char *const' [-Wint-conversion]
pctrl->ident = system_id->ident;
^ ~~~~~~~~~~~~~~~~
drivers/pinctrl/pinctrl-upboard.c:298:38: warning: unused variable 'pin_groups' [-Wunused-const-variable]
static const struct upboard_pingroup pin_groups[] = {
^
drivers/pinctrl/pinctrl-upboard.c:320:38: warning: unused variable 'pin_functions' [-Wunused-const-variable]
static const struct upboard_function pin_functions[] = {
^16 warnings generated.
vim +754 drivers/pinctrl/pinctrl-upboard.c
750
751 static void upboard_alt_func_enable(struct gpio_chip *gc, const char *name, int id)
752 {
753 struct upboard_pinctrl *pctrl = container_of(gc, struct upboard_pinctrl, chip);
> 754 int offset[pctrl->pctldesc->npins];
755 int i, cnt;
756
757 /* find all pins */
758 for (i = 0, cnt = 0; i < pctrl->pctldesc->npins; i++) {
759 if (strstr(pctrl->pctldesc->pins[i].name, name))
760 offset[cnt++] = i;
761 }
762
763 for (i = 0; i < cnt; i++) {
764 if (pinctrl_gpio_request(pctrl->pins[offset[i]].gpio))
765 return; /* this pin is being used */
766
767 pinctrl_gpio_free(pctrl->pins[offset[i]].gpio);
768 }
769
770 /* change to alternate function */
771 for (i = 0; i < cnt; i++) {
772 if (pctrl->pins[offset[i]].regs == NULL)
773 continue;
> 774 bool input = false;
775 int mode = 1; /* default */
776 unsigned int val = readl(pctrl->pins[offset[i]].regs);
777
778 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "I2C")) {
779 switch (id) {
780 case BOARD_UPN_ADLN01:
781 case BOARD_UPX_ADLP01:
782 mode = 2;
783 break;
784 default:
785 break;
786 }
787 val |= mode<<PADCFG0_PMODE_SHIFT;
788 writel(val, pctrl->pins[offset[i]].regs);
789 upboard_fpga_request_free(pctrl->pctldev, offset[i]);
790 continue;
791 } else if (strstr(pctrl->pctldesc->pins[offset[i]].name, "UART")) {
792 switch (id) {
793 case BOARD_UPN_EHL01:
794 case BOARD_UPS_EHL01:
795 mode = 4;
796 break;
797 case BOARD_UPN_ADLN01:
798 case BOARD_UPX_ADLP01:
799 mode = 2;
800 break;
801 default:
802 break;
803 }
804 } else if (strstr(pctrl->pctldesc->pins[offset[i]].name, "SPI")) {
805 switch (id) {
806 case BOARD_UP_WHL01:
807 mode = 3;
808 break;
809 case BOARD_UPN_ADLN01:
810 case BOARD_UPX_ADLP01:
811 mode = 7;
812 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MOSI")) {
813 val &= ~PADCFG0_GPIOTXDIS;
814 val |= PADCFG0_GPIORXDIS;
815 }
816 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MISO")) {
817 val |= PADCFG0_GPIORXDIS;
818 }
819 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CLK")) {
820 val &= ~PADCFG0_GPIOTXDIS;
821 val |= PADCFG0_GPIORXDIS;
822 }
823 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CS0")) {
824 val |= PADCFG0_GPIORXDIS;
825 }
826 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CS1")) {
827 continue;
828 }
829 break;
830 default:
831 break;
832 }
833 } else if (strstr(pctrl->pctldesc->pins[offset[i]].name, "I2S")) {
834 switch (id) {
835 case BOARD_UPX_ADLP01:
836 mode = 4;
837 break;
838 default:
839 break;
840 }
841 }
842 val |= mode<<PADCFG0_PMODE_SHIFT;
843 writel(val, pctrl->pins[offset[i]].regs);
844
845 /* input pins */
846 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "RX"))
847 input = true;
848 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "CTS"))
849 input = true;
850 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "ADC"))
851 input = true;
852 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "MISO"))
853 input = true;
854 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "DIN"))
855 input = true;
856 if (strstr(pctrl->pctldesc->pins[offset[i]].name, "SDI"))
857 input = true;
858 upboard_fpga_set_direction(pctrl->pctldev, NULL, offset[i], input);
859 }
860 }
861
862 static int upboard_rpi_to_native_gpio(struct gpio_chip *gc, unsigned int gpio)
863 {
864 struct upboard_pinctrl *pctrl = container_of(gc, struct upboard_pinctrl, chip);
865 unsigned int pin = pctrl->rpi_mapping[gpio];
866 struct pinctrl_gpio_range *range;
867
868 range = pinctrl_find_gpio_range_from_pin(pctrl->pctldev, pin);
869 if (!range)
870 return -ENODEV;
871
872 return range->base;
873 }
874
875 static int upboard_gpio_request(struct gpio_chip *gc, unsigned int offset)
876 {
> 877 struct upboard_pinctrl *pctrl = container_of(gc, struct upboard_pinctrl, chip); 878 int gpio = upboard_rpi_to_native_gpio(gc, offset);
879
880 return pinctrl_gpio_request(gpio);
881 }
882
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests
RFC 3/3 leds: Add support for UP board CPLD onboard LEDS
In reply to larry.laiThe UP boards come with a few FPGA-controlled onboard LEDs:
* UP Board: yellow, green, red
* UP Squared: blue, yellow, green, red
This patch depends on patch "mfd: Add support for UP board CPLD/FPGA".
---
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 | 79 +++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 drivers/leds/leds-upboard.c
drivers/leds/Kconfig +10 -0
@@ -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_INTEL_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
@@ -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 +79 -0
79 lines not on this page · raw message
Signature · 1 line
2.17.1
Lee Jones
maintainerRe: [RFC RESEND 3/3] leds: Add support for UP board CPLD onboard LEDS
Quoted 8 lines · larry.lai
The UP boards come with a few FPGA-controlled onboard LEDs:
* UP Board: yellow, green, red
* UP Squared: blue, yellow, green, redThis patch depends on patch "mfd: Add support for UP board CPLD/FPGA".
Reviewed-by Andy Shevchenko <[email protected]>Reviewed-by Lee Jones <[email protected]>
Definitely not. Please try again after reading:
Documentation/process/submitting-patches.rst
Quoted 15 lines
Signed-off-by larry.lai <[email protected]>---
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 | 79 +++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 drivers/leds/leds-upboard.c
Signature · 1 line
Lee Jones [李琼斯]