linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] leds: simatic-ipc-leds-gpio: add new model BX-21A
@ 2023-05-31 15:54 Henning Schild
  2023-05-31 15:54 ` [PATCH 1/1] " Henning Schild
  2023-05-31 16:01 ` [PATCH 0/1] " Henning Schild
  0 siblings, 2 replies; 7+ messages in thread
From: Henning Schild @ 2023-05-31 15:54 UTC (permalink / raw)
  To: Pavel Machek, Lee Jones, Hans de Goede, Mark Gross,
	Andy Shevchenko, linux-kernel, linux-leds, platform-driver-x86
  Cc: Henning Schild

This is a rather simple patch adding LED support for yet another Simatic
IPC model.

Note that this is based on
 "[PATCH v4 0/4] leds: simatic-ipc-leds-gpio: split up"

Henning Schild (1):
  leds: simatic-ipc-leds-gpio: add new model BX-21A

 drivers/leds/simple/Kconfig                   | 13 +++++
 drivers/leds/simple/Makefile                  |  1 +
 .../leds/simple/simatic-ipc-leds-gpio-core.c  |  4 ++
 .../simatic-ipc-leds-gpio-elkhartlake.c       | 57 +++++++++++++++++++
 drivers/platform/x86/simatic-ipc.c            |  3 +
 .../platform_data/x86/simatic-ipc-base.h      |  1 +
 include/linux/platform_data/x86/simatic-ipc.h |  3 +-
 7 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c

-- 
2.39.3


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/1] leds: simatic-ipc-leds-gpio: add new model BX-21A
  2023-05-31 15:54 [PATCH 0/1] leds: simatic-ipc-leds-gpio: add new model BX-21A Henning Schild
@ 2023-05-31 15:54 ` Henning Schild
  2023-06-01  8:53   ` Hans de Goede
  2023-06-01 16:50   ` Andy Shevchenko
  2023-05-31 16:01 ` [PATCH 0/1] " Henning Schild
  1 sibling, 2 replies; 7+ messages in thread
From: Henning Schild @ 2023-05-31 15:54 UTC (permalink / raw)
  To: Pavel Machek, Lee Jones, Hans de Goede, Mark Gross,
	Andy Shevchenko, linux-kernel, linux-leds, platform-driver-x86
  Cc: Henning Schild

This adds support for the Siemens Simatic IPC BX-21A. Its LEDs are
connected to GPIO pins provided by the Intel Elkhart Lake pinctrl
driver.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 drivers/leds/simple/Kconfig                   | 13 +++++
 drivers/leds/simple/Makefile                  |  1 +
 .../leds/simple/simatic-ipc-leds-gpio-core.c  |  4 ++
 .../simatic-ipc-leds-gpio-elkhartlake.c       | 57 +++++++++++++++++++
 drivers/platform/x86/simatic-ipc.c            |  3 +
 .../platform_data/x86/simatic-ipc-base.h      |  1 +
 include/linux/platform_data/x86/simatic-ipc.h |  3 +-
 7 files changed, 81 insertions(+), 1 deletion(-)
 create mode 100644 drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c

diff --git a/drivers/leds/simple/Kconfig b/drivers/leds/simple/Kconfig
index 44fa0f93cb3b..626ab18ac09d 100644
--- a/drivers/leds/simple/Kconfig
+++ b/drivers/leds/simple/Kconfig
@@ -34,3 +34,16 @@ config LEDS_SIEMENS_SIMATIC_IPC_F7188X
 
 	  To compile this driver as a module, choose M here: the module
 	  will be called simatic-ipc-leds-gpio-f7188x.
+
+config LEDS_SIEMENS_SIMATIC_IPC_ELKHARTLAKE
+	tristate "LED driver for Siemens Simatic IPCs based on Intel Elkhart Lake GPIO"
+	depends on LEDS_GPIO
+	depends on PINCTRL_ELKHARTLAKE
+	depends on SIEMENS_SIMATIC_IPC
+	default LEDS_SIEMENS_SIMATIC_IPC
+	help
+	  This option enables support for the LEDs of several Industrial PCs
+	  from Siemens based on Elkhart Lake GPIO i.e. BX-21A.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called simatic-ipc-leds-gpio-elkhartlake.
diff --git a/drivers/leds/simple/Makefile b/drivers/leds/simple/Makefile
index e3e840cea275..783578f11bb0 100644
--- a/drivers/leds/simple/Makefile
+++ b/drivers/leds/simple/Makefile
@@ -2,3 +2,4 @@
 obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC)			+= simatic-ipc-leds.o
 obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC_APOLLOLAKE)	+= simatic-ipc-leds-gpio-core.o simatic-ipc-leds-gpio-apollolake.o
 obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC_F7188X)		+= simatic-ipc-leds-gpio-core.o simatic-ipc-leds-gpio-f7188x.o
+obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC_ELKHARTLAKE)	+= simatic-ipc-leds-gpio-core.o simatic-ipc-leds-gpio-elkhartlake.o
diff --git a/drivers/leds/simple/simatic-ipc-leds-gpio-core.c b/drivers/leds/simple/simatic-ipc-leds-gpio-core.c
index 2a21b663df87..c552ea73ed9d 100644
--- a/drivers/leds/simple/simatic-ipc-leds-gpio-core.c
+++ b/drivers/leds/simple/simatic-ipc-leds-gpio-core.c
@@ -57,6 +57,7 @@ int simatic_ipc_leds_gpio_probe(struct platform_device *pdev,
 	switch (plat->devmode) {
 	case SIMATIC_IPC_DEVICE_127E:
 	case SIMATIC_IPC_DEVICE_227G:
+	case SIMATIC_IPC_DEVICE_BX_21A:
 		break;
 	default:
 		return -ENODEV;
@@ -72,6 +73,9 @@ int simatic_ipc_leds_gpio_probe(struct platform_device *pdev,
 		goto out;
 	}
 
+	if (!table_extra)
+		return 0;
+
 	table_extra->dev_id = dev_name(dev);
 	gpiod_add_lookup_table(table_extra);
 
diff --git a/drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c b/drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c
new file mode 100644
index 000000000000..6ba21dbb3ba0
--- /dev/null
+++ b/drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Siemens SIMATIC IPC driver for GPIO based LEDs
+ *
+ * Copyright (c) Siemens AG, 2023
+ *
+ * Author:
+ *  Henning Schild <henning.schild@siemens.com>
+ */
+
+#include <linux/gpio/machine.h>
+#include <linux/gpio/consumer.h>
+#include <linux/leds.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/platform_data/x86/simatic-ipc-base.h>
+
+#include "simatic-ipc-leds-gpio.h"
+
+static struct gpiod_lookup_table simatic_ipc_led_gpio_table = {
+	.dev_id = "leds-gpio",
+	.table = {
+		GPIO_LOOKUP_IDX("INTC1020:04", 72, NULL, 0, GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP_IDX("INTC1020:04", 77, NULL, 1, GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP_IDX("INTC1020:04", 78, NULL, 2, GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP_IDX("INTC1020:04", 58, NULL, 3, GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP_IDX("INTC1020:04", 60, NULL, 4, GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP_IDX("INTC1020:04", 62, NULL, 5, GPIO_ACTIVE_HIGH),
+		{} /* Terminating entry */
+	},
+};
+
+static int simatic_ipc_leds_gpio_elkhartlake_probe(struct platform_device *pdev)
+{
+	return simatic_ipc_leds_gpio_probe(pdev, &simatic_ipc_led_gpio_table,
+					   NULL);
+}
+
+static int simatic_ipc_leds_gpio_elkhartlake_remove(struct platform_device *pdev)
+{
+	return simatic_ipc_leds_gpio_remove(pdev, &simatic_ipc_led_gpio_table,
+					    NULL);
+}
+
+static struct platform_driver simatic_ipc_led_gpio_elkhartlake_driver = {
+	.probe = simatic_ipc_leds_gpio_elkhartlake_probe,
+	.remove = simatic_ipc_leds_gpio_elkhartlake_remove,
+	.driver = {
+		.name = KBUILD_MODNAME,
+	},
+};
+module_platform_driver(simatic_ipc_led_gpio_elkhartlake_driver);
+
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:" KBUILD_MODNAME);
+MODULE_SOFTDEP("pre: simatic-ipc-leds-gpio-core platform:elkhartlake-pinctrl");
+MODULE_AUTHOR("Henning Schild <henning.schild@siemens.com>");
diff --git a/drivers/platform/x86/simatic-ipc.c b/drivers/platform/x86/simatic-ipc.c
index c773995b230d..4402cd354104 100644
--- a/drivers/platform/x86/simatic-ipc.c
+++ b/drivers/platform/x86/simatic-ipc.c
@@ -48,6 +48,7 @@ static struct {
 	{SIMATIC_IPC_IPC477E, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_427E},
 	{SIMATIC_IPC_IPCBX_39A, SIMATIC_IPC_DEVICE_227G, SIMATIC_IPC_DEVICE_227G},
 	{SIMATIC_IPC_IPCPX_39A, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_227G},
+	{SIMATIC_IPC_IPCBX_21A, SIMATIC_IPC_DEVICE_BX_21A, SIMATIC_IPC_DEVICE_NONE},
 };
 
 static int register_platform_devices(u32 station_id)
@@ -72,6 +73,8 @@ static int register_platform_devices(u32 station_id)
 			pdevname = KBUILD_MODNAME "_leds_gpio_apollolake";
 		if (ledmode == SIMATIC_IPC_DEVICE_227G)
 			pdevname = KBUILD_MODNAME "_leds_gpio_f7188x";
+		if (ledmode == SIMATIC_IPC_DEVICE_BX_21A)
+			pdevname = KBUILD_MODNAME "_leds_gpio_elkhartlake";
 		platform_data.devmode = ledmode;
 		ipc_led_platform_device =
 			platform_device_register_data(NULL,
diff --git a/include/linux/platform_data/x86/simatic-ipc-base.h b/include/linux/platform_data/x86/simatic-ipc-base.h
index 57d6a10dfc9e..00bf18ecb160 100644
--- a/include/linux/platform_data/x86/simatic-ipc-base.h
+++ b/include/linux/platform_data/x86/simatic-ipc-base.h
@@ -20,6 +20,7 @@
 #define SIMATIC_IPC_DEVICE_127E 3
 #define SIMATIC_IPC_DEVICE_227E 4
 #define SIMATIC_IPC_DEVICE_227G 5
+#define SIMATIC_IPC_DEVICE_BX_21A 6
 
 struct simatic_ipc_platform {
 	u8	devmode;
diff --git a/include/linux/platform_data/x86/simatic-ipc.h b/include/linux/platform_data/x86/simatic-ipc.h
index a48bb5240977..1a8e4c1099e3 100644
--- a/include/linux/platform_data/x86/simatic-ipc.h
+++ b/include/linux/platform_data/x86/simatic-ipc.h
@@ -2,7 +2,7 @@
 /*
  * Siemens SIMATIC IPC drivers
  *
- * Copyright (c) Siemens AG, 2018-2021
+ * Copyright (c) Siemens AG, 2018-2023
  *
  * Authors:
  *  Henning Schild <henning.schild@siemens.com>
@@ -34,6 +34,7 @@ enum simatic_ipc_station_ids {
 	SIMATIC_IPC_IPC227G = 0x00000F01,
 	SIMATIC_IPC_IPCBX_39A = 0x00001001,
 	SIMATIC_IPC_IPCPX_39A = 0x00001002,
+	SIMATIC_IPC_IPCBX_21A = 0x00001101,
 };
 
 static inline u32 simatic_ipc_get_station_id(u8 *data, int max_len)
-- 
2.39.3


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/1] leds: simatic-ipc-leds-gpio: add new model BX-21A
  2023-05-31 15:54 [PATCH 0/1] leds: simatic-ipc-leds-gpio: add new model BX-21A Henning Schild
  2023-05-31 15:54 ` [PATCH 1/1] " Henning Schild
@ 2023-05-31 16:01 ` Henning Schild
  1 sibling, 0 replies; 7+ messages in thread
From: Henning Schild @ 2023-05-31 16:01 UTC (permalink / raw)
  To: Pavel Machek, Lee Jones, Hans de Goede, Mark Gross,
	Andy Shevchenko, linux-kernel, linux-leds, platform-driver-x86

Am Wed, 31 May 2023 17:54:56 +0200
schrieb Henning Schild <henning.schild@siemens.com>:

> This is a rather simple patch adding LED support for yet another
> Simatic IPC model.
> 
> Note that this is based on
>  "[PATCH v4 0/4] leds: simatic-ipc-leds-gpio: split up"

I have been waiting with this until the split is ready to merge and
until i got access to one of the machines. Got such a box today and the
last comments on that split seem promising, so here we go.

There is at least one similar IPC still to come, but that will likely
be contributed by someone else from Siemens. As we are trying to get
more people into upstream work.

Henning

> Henning Schild (1):
>   leds: simatic-ipc-leds-gpio: add new model BX-21A
> 
>  drivers/leds/simple/Kconfig                   | 13 +++++
>  drivers/leds/simple/Makefile                  |  1 +
>  .../leds/simple/simatic-ipc-leds-gpio-core.c  |  4 ++
>  .../simatic-ipc-leds-gpio-elkhartlake.c       | 57
> +++++++++++++++++++ drivers/platform/x86/simatic-ipc.c            |
> 3 + .../platform_data/x86/simatic-ipc-base.h      |  1 +
>  include/linux/platform_data/x86/simatic-ipc.h |  3 +-
>  7 files changed, 81 insertions(+), 1 deletion(-)
>  create mode 100644
> drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] leds: simatic-ipc-leds-gpio: add new model BX-21A
  2023-05-31 15:54 ` [PATCH 1/1] " Henning Schild
@ 2023-06-01  8:53   ` Hans de Goede
  2023-07-05 10:48     ` Henning Schild
  2023-06-01 16:50   ` Andy Shevchenko
  1 sibling, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2023-06-01  8:53 UTC (permalink / raw)
  To: Henning Schild, Pavel Machek, Lee Jones, Mark Gross,
	Andy Shevchenko, linux-kernel, linux-leds, platform-driver-x86

Hi,

On 5/31/23 17:54, Henning Schild wrote:
> This adds support for the Siemens Simatic IPC BX-21A. Its LEDs are
> connected to GPIO pins provided by the Intel Elkhart Lake pinctrl
> driver.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>

Thank you for the patch.

Since this mostly touches files under drivers/leds I believe it would be best for this to be merged through Lee's LEDs tree.

Here is my ack for merging the pdx86 bits through that tree:

Acked-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans




> ---
>  drivers/leds/simple/Kconfig                   | 13 +++++
>  drivers/leds/simple/Makefile                  |  1 +
>  .../leds/simple/simatic-ipc-leds-gpio-core.c  |  4 ++
>  .../simatic-ipc-leds-gpio-elkhartlake.c       | 57 +++++++++++++++++++
>  drivers/platform/x86/simatic-ipc.c            |  3 +
>  .../platform_data/x86/simatic-ipc-base.h      |  1 +
>  include/linux/platform_data/x86/simatic-ipc.h |  3 +-
>  7 files changed, 81 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c
> 
> diff --git a/drivers/leds/simple/Kconfig b/drivers/leds/simple/Kconfig
> index 44fa0f93cb3b..626ab18ac09d 100644
> --- a/drivers/leds/simple/Kconfig
> +++ b/drivers/leds/simple/Kconfig
> @@ -34,3 +34,16 @@ config LEDS_SIEMENS_SIMATIC_IPC_F7188X
>  
>  	  To compile this driver as a module, choose M here: the module
>  	  will be called simatic-ipc-leds-gpio-f7188x.
> +
> +config LEDS_SIEMENS_SIMATIC_IPC_ELKHARTLAKE
> +	tristate "LED driver for Siemens Simatic IPCs based on Intel Elkhart Lake GPIO"
> +	depends on LEDS_GPIO
> +	depends on PINCTRL_ELKHARTLAKE
> +	depends on SIEMENS_SIMATIC_IPC
> +	default LEDS_SIEMENS_SIMATIC_IPC
> +	help
> +	  This option enables support for the LEDs of several Industrial PCs
> +	  from Siemens based on Elkhart Lake GPIO i.e. BX-21A.
> +
> +	  To compile this driver as a module, choose M here: the module
> +	  will be called simatic-ipc-leds-gpio-elkhartlake.
> diff --git a/drivers/leds/simple/Makefile b/drivers/leds/simple/Makefile
> index e3e840cea275..783578f11bb0 100644
> --- a/drivers/leds/simple/Makefile
> +++ b/drivers/leds/simple/Makefile
> @@ -2,3 +2,4 @@
>  obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC)			+= simatic-ipc-leds.o
>  obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC_APOLLOLAKE)	+= simatic-ipc-leds-gpio-core.o simatic-ipc-leds-gpio-apollolake.o
>  obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC_F7188X)		+= simatic-ipc-leds-gpio-core.o simatic-ipc-leds-gpio-f7188x.o
> +obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC_ELKHARTLAKE)	+= simatic-ipc-leds-gpio-core.o simatic-ipc-leds-gpio-elkhartlake.o
> diff --git a/drivers/leds/simple/simatic-ipc-leds-gpio-core.c b/drivers/leds/simple/simatic-ipc-leds-gpio-core.c
> index 2a21b663df87..c552ea73ed9d 100644
> --- a/drivers/leds/simple/simatic-ipc-leds-gpio-core.c
> +++ b/drivers/leds/simple/simatic-ipc-leds-gpio-core.c
> @@ -57,6 +57,7 @@ int simatic_ipc_leds_gpio_probe(struct platform_device *pdev,
>  	switch (plat->devmode) {
>  	case SIMATIC_IPC_DEVICE_127E:
>  	case SIMATIC_IPC_DEVICE_227G:
> +	case SIMATIC_IPC_DEVICE_BX_21A:
>  		break;
>  	default:
>  		return -ENODEV;
> @@ -72,6 +73,9 @@ int simatic_ipc_leds_gpio_probe(struct platform_device *pdev,
>  		goto out;
>  	}
>  
> +	if (!table_extra)
> +		return 0;
> +
>  	table_extra->dev_id = dev_name(dev);
>  	gpiod_add_lookup_table(table_extra);
>  
> diff --git a/drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c b/drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c
> new file mode 100644
> index 000000000000..6ba21dbb3ba0
> --- /dev/null
> +++ b/drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c
> @@ -0,0 +1,57 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Siemens SIMATIC IPC driver for GPIO based LEDs
> + *
> + * Copyright (c) Siemens AG, 2023
> + *
> + * Author:
> + *  Henning Schild <henning.schild@siemens.com>
> + */
> +
> +#include <linux/gpio/machine.h>
> +#include <linux/gpio/consumer.h>
> +#include <linux/leds.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/platform_data/x86/simatic-ipc-base.h>
> +
> +#include "simatic-ipc-leds-gpio.h"
> +
> +static struct gpiod_lookup_table simatic_ipc_led_gpio_table = {
> +	.dev_id = "leds-gpio",
> +	.table = {
> +		GPIO_LOOKUP_IDX("INTC1020:04", 72, NULL, 0, GPIO_ACTIVE_HIGH),
> +		GPIO_LOOKUP_IDX("INTC1020:04", 77, NULL, 1, GPIO_ACTIVE_HIGH),
> +		GPIO_LOOKUP_IDX("INTC1020:04", 78, NULL, 2, GPIO_ACTIVE_HIGH),
> +		GPIO_LOOKUP_IDX("INTC1020:04", 58, NULL, 3, GPIO_ACTIVE_HIGH),
> +		GPIO_LOOKUP_IDX("INTC1020:04", 60, NULL, 4, GPIO_ACTIVE_HIGH),
> +		GPIO_LOOKUP_IDX("INTC1020:04", 62, NULL, 5, GPIO_ACTIVE_HIGH),
> +		{} /* Terminating entry */
> +	},
> +};
> +
> +static int simatic_ipc_leds_gpio_elkhartlake_probe(struct platform_device *pdev)
> +{
> +	return simatic_ipc_leds_gpio_probe(pdev, &simatic_ipc_led_gpio_table,
> +					   NULL);
> +}
> +
> +static int simatic_ipc_leds_gpio_elkhartlake_remove(struct platform_device *pdev)
> +{
> +	return simatic_ipc_leds_gpio_remove(pdev, &simatic_ipc_led_gpio_table,
> +					    NULL);
> +}
> +
> +static struct platform_driver simatic_ipc_led_gpio_elkhartlake_driver = {
> +	.probe = simatic_ipc_leds_gpio_elkhartlake_probe,
> +	.remove = simatic_ipc_leds_gpio_elkhartlake_remove,
> +	.driver = {
> +		.name = KBUILD_MODNAME,
> +	},
> +};
> +module_platform_driver(simatic_ipc_led_gpio_elkhartlake_driver);
> +
> +MODULE_LICENSE("GPL v2");
> +MODULE_ALIAS("platform:" KBUILD_MODNAME);
> +MODULE_SOFTDEP("pre: simatic-ipc-leds-gpio-core platform:elkhartlake-pinctrl");
> +MODULE_AUTHOR("Henning Schild <henning.schild@siemens.com>");
> diff --git a/drivers/platform/x86/simatic-ipc.c b/drivers/platform/x86/simatic-ipc.c
> index c773995b230d..4402cd354104 100644
> --- a/drivers/platform/x86/simatic-ipc.c
> +++ b/drivers/platform/x86/simatic-ipc.c
> @@ -48,6 +48,7 @@ static struct {
>  	{SIMATIC_IPC_IPC477E, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_427E},
>  	{SIMATIC_IPC_IPCBX_39A, SIMATIC_IPC_DEVICE_227G, SIMATIC_IPC_DEVICE_227G},
>  	{SIMATIC_IPC_IPCPX_39A, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_227G},
> +	{SIMATIC_IPC_IPCBX_21A, SIMATIC_IPC_DEVICE_BX_21A, SIMATIC_IPC_DEVICE_NONE},
>  };
>  
>  static int register_platform_devices(u32 station_id)
> @@ -72,6 +73,8 @@ static int register_platform_devices(u32 station_id)
>  			pdevname = KBUILD_MODNAME "_leds_gpio_apollolake";
>  		if (ledmode == SIMATIC_IPC_DEVICE_227G)
>  			pdevname = KBUILD_MODNAME "_leds_gpio_f7188x";
> +		if (ledmode == SIMATIC_IPC_DEVICE_BX_21A)
> +			pdevname = KBUILD_MODNAME "_leds_gpio_elkhartlake";
>  		platform_data.devmode = ledmode;
>  		ipc_led_platform_device =
>  			platform_device_register_data(NULL,
> diff --git a/include/linux/platform_data/x86/simatic-ipc-base.h b/include/linux/platform_data/x86/simatic-ipc-base.h
> index 57d6a10dfc9e..00bf18ecb160 100644
> --- a/include/linux/platform_data/x86/simatic-ipc-base.h
> +++ b/include/linux/platform_data/x86/simatic-ipc-base.h
> @@ -20,6 +20,7 @@
>  #define SIMATIC_IPC_DEVICE_127E 3
>  #define SIMATIC_IPC_DEVICE_227E 4
>  #define SIMATIC_IPC_DEVICE_227G 5
> +#define SIMATIC_IPC_DEVICE_BX_21A 6
>  
>  struct simatic_ipc_platform {
>  	u8	devmode;
> diff --git a/include/linux/platform_data/x86/simatic-ipc.h b/include/linux/platform_data/x86/simatic-ipc.h
> index a48bb5240977..1a8e4c1099e3 100644
> --- a/include/linux/platform_data/x86/simatic-ipc.h
> +++ b/include/linux/platform_data/x86/simatic-ipc.h
> @@ -2,7 +2,7 @@
>  /*
>   * Siemens SIMATIC IPC drivers
>   *
> - * Copyright (c) Siemens AG, 2018-2021
> + * Copyright (c) Siemens AG, 2018-2023
>   *
>   * Authors:
>   *  Henning Schild <henning.schild@siemens.com>
> @@ -34,6 +34,7 @@ enum simatic_ipc_station_ids {
>  	SIMATIC_IPC_IPC227G = 0x00000F01,
>  	SIMATIC_IPC_IPCBX_39A = 0x00001001,
>  	SIMATIC_IPC_IPCPX_39A = 0x00001002,
> +	SIMATIC_IPC_IPCBX_21A = 0x00001101,
>  };
>  
>  static inline u32 simatic_ipc_get_station_id(u8 *data, int max_len)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] leds: simatic-ipc-leds-gpio: add new model BX-21A
  2023-05-31 15:54 ` [PATCH 1/1] " Henning Schild
  2023-06-01  8:53   ` Hans de Goede
@ 2023-06-01 16:50   ` Andy Shevchenko
  1 sibling, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2023-06-01 16:50 UTC (permalink / raw)
  To: Henning Schild
  Cc: Pavel Machek, Lee Jones, Hans de Goede, Mark Gross, linux-kernel,
	linux-leds, platform-driver-x86

On Wed, May 31, 2023 at 05:54:57PM +0200, Henning Schild wrote:
> This adds support for the Siemens Simatic IPC BX-21A. Its LEDs are
> connected to GPIO pins provided by the Intel Elkhart Lake pinctrl
> driver.

...

> +static struct platform_driver simatic_ipc_led_gpio_elkhartlake_driver = {
> +	.probe = simatic_ipc_leds_gpio_elkhartlake_probe,
> +	.remove = simatic_ipc_leds_gpio_elkhartlake_remove,
> +	.driver = {
> +		.name = KBUILD_MODNAME,

Just wondering if module name and hence device instance name (which may be
longer) can be so long.

Hint: you can use EHL/ehl for elkhartlake and in same way for the rest if any.

> +	},
> +};

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] leds: simatic-ipc-leds-gpio: add new model BX-21A
  2023-06-01  8:53   ` Hans de Goede
@ 2023-07-05 10:48     ` Henning Schild
  2023-07-13 13:20       ` Lee Jones
  0 siblings, 1 reply; 7+ messages in thread
From: Henning Schild @ 2023-07-05 10:48 UTC (permalink / raw)
  To: Lee Jones
  Cc: Hans de Goede, Pavel Machek, Mark Gross, Andy Shevchenko,
	linux-kernel, linux-leds, platform-driver-x86

Am Thu, 1 Jun 2023 10:53:48 +0200
schrieb Hans de Goede <hdegoede@redhat.com>:

> Hi,
> 
> On 5/31/23 17:54, Henning Schild wrote:
> > This adds support for the Siemens Simatic IPC BX-21A. Its LEDs are
> > connected to GPIO pins provided by the Intel Elkhart Lake pinctrl
> > driver.
> > 
> > Signed-off-by: Henning Schild <henning.schild@siemens.com>  
> 
> Thank you for the patch.
> 
> Since this mostly touches files under drivers/leds I believe it would
> be best for this to be merged through Lee's LEDs tree.

Lee i saw that your tree got merged recently. This one was not yet part
of it.

Henning

> Here is my ack for merging the pdx86 bits through that tree:
> 
> Acked-by: Hans de Goede <hdegoede@redhat.com>
> 
> Regards,
> 
> Hans
> 
> 
> 
> 
> > ---
> >  drivers/leds/simple/Kconfig                   | 13 +++++
> >  drivers/leds/simple/Makefile                  |  1 +
> >  .../leds/simple/simatic-ipc-leds-gpio-core.c  |  4 ++
> >  .../simatic-ipc-leds-gpio-elkhartlake.c       | 57
> > +++++++++++++++++++ drivers/platform/x86/simatic-ipc.c            |
> >  3 + .../platform_data/x86/simatic-ipc-base.h      |  1 +
> >  include/linux/platform_data/x86/simatic-ipc.h |  3 +-
> >  7 files changed, 81 insertions(+), 1 deletion(-)
> >  create mode 100644
> > drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c
> > 
> > diff --git a/drivers/leds/simple/Kconfig
> > b/drivers/leds/simple/Kconfig index 44fa0f93cb3b..626ab18ac09d
> > 100644 --- a/drivers/leds/simple/Kconfig
> > +++ b/drivers/leds/simple/Kconfig
> > @@ -34,3 +34,16 @@ config LEDS_SIEMENS_SIMATIC_IPC_F7188X
> >  
> >  	  To compile this driver as a module, choose M here: the
> > module will be called simatic-ipc-leds-gpio-f7188x.
> > +
> > +config LEDS_SIEMENS_SIMATIC_IPC_ELKHARTLAKE
> > +	tristate "LED driver for Siemens Simatic IPCs based on
> > Intel Elkhart Lake GPIO"
> > +	depends on LEDS_GPIO
> > +	depends on PINCTRL_ELKHARTLAKE
> > +	depends on SIEMENS_SIMATIC_IPC
> > +	default LEDS_SIEMENS_SIMATIC_IPC
> > +	help
> > +	  This option enables support for the LEDs of several
> > Industrial PCs
> > +	  from Siemens based on Elkhart Lake GPIO i.e. BX-21A.
> > +
> > +	  To compile this driver as a module, choose M here: the
> > module
> > +	  will be called simatic-ipc-leds-gpio-elkhartlake.
> > diff --git a/drivers/leds/simple/Makefile
> > b/drivers/leds/simple/Makefile index e3e840cea275..783578f11bb0
> > 100644 --- a/drivers/leds/simple/Makefile
> > +++ b/drivers/leds/simple/Makefile
> > @@ -2,3 +2,4 @@
> >  obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC)			+=
> > simatic-ipc-leds.o
> > obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC_APOLLOLAKE)	+=
> > simatic-ipc-leds-gpio-core.o simatic-ipc-leds-gpio-apollolake.o
> > obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC_F7188X)		+=
> > simatic-ipc-leds-gpio-core.o simatic-ipc-leds-gpio-f7188x.o
> > +obj-$(CONFIG_LEDS_SIEMENS_SIMATIC_IPC_ELKHARTLAKE)	+=
> > simatic-ipc-leds-gpio-core.o simatic-ipc-leds-gpio-elkhartlake.o
> > diff --git a/drivers/leds/simple/simatic-ipc-leds-gpio-core.c
> > b/drivers/leds/simple/simatic-ipc-leds-gpio-core.c index
> > 2a21b663df87..c552ea73ed9d 100644 ---
> > a/drivers/leds/simple/simatic-ipc-leds-gpio-core.c +++
> > b/drivers/leds/simple/simatic-ipc-leds-gpio-core.c @@ -57,6 +57,7
> > @@ int simatic_ipc_leds_gpio_probe(struct platform_device *pdev,
> > switch (plat->devmode) { case SIMATIC_IPC_DEVICE_127E: case
> > SIMATIC_IPC_DEVICE_227G:
> > +	case SIMATIC_IPC_DEVICE_BX_21A:
> >  		break;
> >  	default:
> >  		return -ENODEV;
> > @@ -72,6 +73,9 @@ int simatic_ipc_leds_gpio_probe(struct
> > platform_device *pdev, goto out;
> >  	}
> >  
> > +	if (!table_extra)
> > +		return 0;
> > +
> >  	table_extra->dev_id = dev_name(dev);
> >  	gpiod_add_lookup_table(table_extra);
> >  
> > diff --git
> > a/drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c
> > b/drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c new file
> > mode 100644 index 000000000000..6ba21dbb3ba0 --- /dev/null
> > +++ b/drivers/leds/simple/simatic-ipc-leds-gpio-elkhartlake.c
> > @@ -0,0 +1,57 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +/*
> > + * Siemens SIMATIC IPC driver for GPIO based LEDs
> > + *
> > + * Copyright (c) Siemens AG, 2023
> > + *
> > + * Author:
> > + *  Henning Schild <henning.schild@siemens.com>
> > + */
> > +
> > +#include <linux/gpio/machine.h>
> > +#include <linux/gpio/consumer.h>
> > +#include <linux/leds.h>
> > +#include <linux/module.h>
> > +#include <linux/platform_device.h>
> > +#include <linux/platform_data/x86/simatic-ipc-base.h>
> > +
> > +#include "simatic-ipc-leds-gpio.h"
> > +
> > +static struct gpiod_lookup_table simatic_ipc_led_gpio_table = {
> > +	.dev_id = "leds-gpio",
> > +	.table = {
> > +		GPIO_LOOKUP_IDX("INTC1020:04", 72, NULL, 0,
> > GPIO_ACTIVE_HIGH),
> > +		GPIO_LOOKUP_IDX("INTC1020:04", 77, NULL, 1,
> > GPIO_ACTIVE_HIGH),
> > +		GPIO_LOOKUP_IDX("INTC1020:04", 78, NULL, 2,
> > GPIO_ACTIVE_HIGH),
> > +		GPIO_LOOKUP_IDX("INTC1020:04", 58, NULL, 3,
> > GPIO_ACTIVE_HIGH),
> > +		GPIO_LOOKUP_IDX("INTC1020:04", 60, NULL, 4,
> > GPIO_ACTIVE_HIGH),
> > +		GPIO_LOOKUP_IDX("INTC1020:04", 62, NULL, 5,
> > GPIO_ACTIVE_HIGH),
> > +		{} /* Terminating entry */
> > +	},
> > +};
> > +
> > +static int simatic_ipc_leds_gpio_elkhartlake_probe(struct
> > platform_device *pdev) +{
> > +	return simatic_ipc_leds_gpio_probe(pdev,
> > &simatic_ipc_led_gpio_table,
> > +					   NULL);
> > +}
> > +
> > +static int simatic_ipc_leds_gpio_elkhartlake_remove(struct
> > platform_device *pdev) +{
> > +	return simatic_ipc_leds_gpio_remove(pdev,
> > &simatic_ipc_led_gpio_table,
> > +					    NULL);
> > +}
> > +
> > +static struct platform_driver
> > simatic_ipc_led_gpio_elkhartlake_driver = {
> > +	.probe = simatic_ipc_leds_gpio_elkhartlake_probe,
> > +	.remove = simatic_ipc_leds_gpio_elkhartlake_remove,
> > +	.driver = {
> > +		.name = KBUILD_MODNAME,
> > +	},
> > +};
> > +module_platform_driver(simatic_ipc_led_gpio_elkhartlake_driver);
> > +
> > +MODULE_LICENSE("GPL v2");
> > +MODULE_ALIAS("platform:" KBUILD_MODNAME);
> > +MODULE_SOFTDEP("pre: simatic-ipc-leds-gpio-core
> > platform:elkhartlake-pinctrl"); +MODULE_AUTHOR("Henning Schild
> > <henning.schild@siemens.com>"); diff --git
> > a/drivers/platform/x86/simatic-ipc.c
> > b/drivers/platform/x86/simatic-ipc.c index
> > c773995b230d..4402cd354104 100644 ---
> > a/drivers/platform/x86/simatic-ipc.c +++
> > b/drivers/platform/x86/simatic-ipc.c @@ -48,6 +48,7 @@ static
> > struct { {SIMATIC_IPC_IPC477E, SIMATIC_IPC_DEVICE_NONE,
> > SIMATIC_IPC_DEVICE_427E}, {SIMATIC_IPC_IPCBX_39A,
> > SIMATIC_IPC_DEVICE_227G, SIMATIC_IPC_DEVICE_227G},
> > {SIMATIC_IPC_IPCPX_39A, SIMATIC_IPC_DEVICE_NONE,
> > SIMATIC_IPC_DEVICE_227G},
> > +	{SIMATIC_IPC_IPCBX_21A, SIMATIC_IPC_DEVICE_BX_21A,
> > SIMATIC_IPC_DEVICE_NONE}, };
> >  
> >  static int register_platform_devices(u32 station_id)
> > @@ -72,6 +73,8 @@ static int register_platform_devices(u32
> > station_id) pdevname = KBUILD_MODNAME "_leds_gpio_apollolake";
> >  		if (ledmode == SIMATIC_IPC_DEVICE_227G)
> >  			pdevname = KBUILD_MODNAME
> > "_leds_gpio_f7188x";
> > +		if (ledmode == SIMATIC_IPC_DEVICE_BX_21A)
> > +			pdevname = KBUILD_MODNAME
> > "_leds_gpio_elkhartlake"; platform_data.devmode = ledmode;
> >  		ipc_led_platform_device =
> >  			platform_device_register_data(NULL,
> > diff --git a/include/linux/platform_data/x86/simatic-ipc-base.h
> > b/include/linux/platform_data/x86/simatic-ipc-base.h index
> > 57d6a10dfc9e..00bf18ecb160 100644 ---
> > a/include/linux/platform_data/x86/simatic-ipc-base.h +++
> > b/include/linux/platform_data/x86/simatic-ipc-base.h @@ -20,6 +20,7
> > @@ #define SIMATIC_IPC_DEVICE_127E 3
> >  #define SIMATIC_IPC_DEVICE_227E 4
> >  #define SIMATIC_IPC_DEVICE_227G 5
> > +#define SIMATIC_IPC_DEVICE_BX_21A 6
> >  
> >  struct simatic_ipc_platform {
> >  	u8	devmode;
> > diff --git a/include/linux/platform_data/x86/simatic-ipc.h
> > b/include/linux/platform_data/x86/simatic-ipc.h index
> > a48bb5240977..1a8e4c1099e3 100644 ---
> > a/include/linux/platform_data/x86/simatic-ipc.h +++
> > b/include/linux/platform_data/x86/simatic-ipc.h @@ -2,7 +2,7 @@
> >  /*
> >   * Siemens SIMATIC IPC drivers
> >   *
> > - * Copyright (c) Siemens AG, 2018-2021
> > + * Copyright (c) Siemens AG, 2018-2023
> >   *
> >   * Authors:
> >   *  Henning Schild <henning.schild@siemens.com>
> > @@ -34,6 +34,7 @@ enum simatic_ipc_station_ids {
> >  	SIMATIC_IPC_IPC227G = 0x00000F01,
> >  	SIMATIC_IPC_IPCBX_39A = 0x00001001,
> >  	SIMATIC_IPC_IPCPX_39A = 0x00001002,
> > +	SIMATIC_IPC_IPCBX_21A = 0x00001101,
> >  };
> >  
> >  static inline u32 simatic_ipc_get_station_id(u8 *data, int
> > max_len)  
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] leds: simatic-ipc-leds-gpio: add new model BX-21A
  2023-07-05 10:48     ` Henning Schild
@ 2023-07-13 13:20       ` Lee Jones
  0 siblings, 0 replies; 7+ messages in thread
From: Lee Jones @ 2023-07-13 13:20 UTC (permalink / raw)
  To: Henning Schild
  Cc: Hans de Goede, Pavel Machek, Mark Gross, Andy Shevchenko,
	linux-kernel, linux-leds, platform-driver-x86

On Wed, 05 Jul 2023, Henning Schild wrote:

> Am Thu, 1 Jun 2023 10:53:48 +0200
> schrieb Hans de Goede <hdegoede@redhat.com>:
> 
> > Hi,
> > 
> > On 5/31/23 17:54, Henning Schild wrote:
> > > This adds support for the Siemens Simatic IPC BX-21A. Its LEDs are
> > > connected to GPIO pins provided by the Intel Elkhart Lake pinctrl
> > > driver.
> > > 
> > > Signed-off-by: Henning Schild <henning.schild@siemens.com>  
> > 
> > Thank you for the patch.
> > 
> > Since this mostly touches files under drivers/leds I believe it would
> > be best for this to be merged through Lee's LEDs tree.
> 
> Lee i saw that your tree got merged recently. This one was not yet part
> of it.

That's correct.  Did I say that it would be?

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-07-13 13:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31 15:54 [PATCH 0/1] leds: simatic-ipc-leds-gpio: add new model BX-21A Henning Schild
2023-05-31 15:54 ` [PATCH 1/1] " Henning Schild
2023-06-01  8:53   ` Hans de Goede
2023-07-05 10:48     ` Henning Schild
2023-07-13 13:20       ` Lee Jones
2023-06-01 16:50   ` Andy Shevchenko
2023-05-31 16:01 ` [PATCH 0/1] " Henning Schild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).