diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-07-31 17:05:44 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-07-31 17:05:44 +0300 |
commit | 17ffe3a0fded309449e8bf201ad70358f3d52772 (patch) | |
tree | f3b5e5abc181dd088347e4b374851a8787600489 /drivers/platform | |
parent | d4e695c016e0d5e15e91c7570ac4eef401b5c771 (diff) | |
parent | c56beff2037549c951042d178de75e535818a98a (diff) | |
download | linux-17ffe3a0fded309449e8bf201ad70358f3d52772.tar.xz |
Merge tag 'ib-pdx86-simatic-v6.6-2' into review-hans
Immutable branch between pdx86 simatic branch and LED due for the v6.6 merge window
ib-pdx86-simatic-v6.6-2: v6.5-rc1 + ib-pdx86-simatic-v6.6 +
more recent pdx86 simatic-ipc patches for merging into
the LED subsystem for v6.6.
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/Kconfig | 59 | ||||
-rw-r--r-- | drivers/platform/x86/Makefile | 6 | ||||
-rw-r--r-- | drivers/platform/x86/siemens/Kconfig | 64 | ||||
-rw-r--r-- | drivers/platform/x86/siemens/Makefile | 11 | ||||
-rw-r--r-- | drivers/platform/x86/siemens/simatic-ipc-batt-apollolake.c (renamed from drivers/platform/x86/simatic-ipc-batt-apollolake.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/siemens/simatic-ipc-batt-elkhartlake.c (renamed from drivers/platform/x86/simatic-ipc-batt-elkhartlake.c) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/siemens/simatic-ipc-batt-f7188x.c (renamed from drivers/platform/x86/simatic-ipc-batt-f7188x.c) | 37 | ||||
-rw-r--r-- | drivers/platform/x86/siemens/simatic-ipc-batt.c (renamed from drivers/platform/x86/simatic-ipc-batt.c) | 22 | ||||
-rw-r--r-- | drivers/platform/x86/siemens/simatic-ipc-batt.h (renamed from drivers/platform/x86/simatic-ipc-batt.h) | 0 | ||||
-rw-r--r-- | drivers/platform/x86/siemens/simatic-ipc.c (renamed from drivers/platform/x86/simatic-ipc.c) | 12 |
10 files changed, 125 insertions, 86 deletions
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 3a991e55e6d0..228fadb1c037 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig @@ -1074,64 +1074,7 @@ config INTEL_SCU_IPC_UTIL low level access for debug work and updating the firmware. Say N unless you will be doing this on an Intel MID platform. -config SIEMENS_SIMATIC_IPC - tristate "Siemens Simatic IPC Class driver" - help - This Simatic IPC class driver is the central of several drivers. It - is mainly used for system identification, after which drivers in other - classes will take care of driving specifics of those machines. - i.e. LEDs and watchdog. - - To compile this driver as a module, choose M here: the module - will be called simatic-ipc. - -config SIEMENS_SIMATIC_IPC_BATT - tristate "CMOS battery driver for Siemens Simatic IPCs" - depends on HWMON - depends on SIEMENS_SIMATIC_IPC - default SIEMENS_SIMATIC_IPC - help - This option enables support for monitoring the voltage of the CMOS - batteries of several Industrial PCs from Siemens. - - To compile this driver as a module, choose M here: the module - will be called simatic-ipc-batt. - -config SIEMENS_SIMATIC_IPC_BATT_APOLLOLAKE - tristate "CMOS Battery monitoring for Simatic IPCs based on Apollo Lake GPIO" - depends on PINCTRL_BROXTON - depends on SIEMENS_SIMATIC_IPC_BATT - default SIEMENS_SIMATIC_IPC_BATT - help - This option enables CMOS battery monitoring for Simatic Industrial PCs - from Siemens based on Apollo Lake GPIO. - - To compile this driver as a module, choose M here: the module - will be called simatic-ipc-batt-apollolake. - -config SIEMENS_SIMATIC_IPC_BATT_ELKHARTLAKE - tristate "CMOS Battery monitoring for Simatic IPCs based on Elkhart Lake GPIO" - depends on PINCTRL_ELKHARTLAKE - depends on SIEMENS_SIMATIC_IPC_BATT - default SIEMENS_SIMATIC_IPC_BATT - help - This option enables CMOS battery monitoring for Simatic Industrial PCs - from Siemens based on Elkhart Lake GPIO. - - To compile this driver as a module, choose M here: the module - will be called simatic-ipc-batt-elkhartlake. - -config SIEMENS_SIMATIC_IPC_BATT_F7188X - tristate "CMOS Battery monitoring for Simatic IPCs based on Nuvoton GPIO" - depends on GPIO_F7188X - depends on SIEMENS_SIMATIC_IPC_BATT - default SIEMENS_SIMATIC_IPC_BATT - help - This option enables CMOS battery monitoring for Simatic Industrial PCs - from Siemens based on Nuvoton GPIO. - - To compile this driver as a module, choose M here: the module - will be called simatic-ipc-batt-elkhartlake. +source "drivers/platform/x86/siemens/Kconfig" config WINMATE_FM07_KEYS tristate "Winmate FM07/FM07P front-panel keys driver" diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile index a5f81dc8ba4e..b457de5abf7d 100644 --- a/drivers/platform/x86/Makefile +++ b/drivers/platform/x86/Makefile @@ -131,11 +131,7 @@ obj-$(CONFIG_INTEL_SCU_IPC_UTIL) += intel_scu_ipcutil.o obj-$(CONFIG_X86_INTEL_LPSS) += pmc_atom.o # Siemens Simatic Industrial PCs -obj-$(CONFIG_SIEMENS_SIMATIC_IPC) += simatic-ipc.o -obj-$(CONFIG_SIEMENS_SIMATIC_IPC_BATT) += simatic-ipc-batt.o -obj-$(CONFIG_SIEMENS_SIMATIC_IPC_BATT_APOLLOLAKE) += simatic-ipc-batt-apollolake.o -obj-$(CONFIG_SIEMENS_SIMATIC_IPC_BATT_ELKHARTLAKE) += simatic-ipc-batt-elkhartlake.o -obj-$(CONFIG_SIEMENS_SIMATIC_IPC_BATT_F7188X) += simatic-ipc-batt-f7188x.o +obj-$(CONFIG_SIEMENS_SIMATIC_IPC) += siemens/ # Winmate obj-$(CONFIG_WINMATE_FM07_KEYS) += winmate-fm07-keys.o diff --git a/drivers/platform/x86/siemens/Kconfig b/drivers/platform/x86/siemens/Kconfig new file mode 100644 index 000000000000..33d028c26bf8 --- /dev/null +++ b/drivers/platform/x86/siemens/Kconfig @@ -0,0 +1,64 @@ +# SPDX-License-Identifier: GPL-2.0-only +# +# Siemens X86 Platform Specific Drivers +# + +config SIEMENS_SIMATIC_IPC + tristate "Siemens Simatic IPC Class driver" + help + This Simatic IPC class driver is the central of several drivers. It + is mainly used for system identification, after which drivers in other + classes will take care of driving specifics of those machines. + i.e. LEDs and watchdog. + + To compile this driver as a module, choose M here: the module + will be called simatic-ipc. + +config SIEMENS_SIMATIC_IPC_BATT + tristate "CMOS battery driver for Siemens Simatic IPCs" + default SIEMENS_SIMATIC_IPC + depends on HWMON + depends on SIEMENS_SIMATIC_IPC + help + This option enables support for monitoring the voltage of the CMOS + batteries of several Industrial PCs from Siemens. + + To compile this driver as a module, choose M here: the module + will be called simatic-ipc-batt. + +config SIEMENS_SIMATIC_IPC_BATT_APOLLOLAKE + tristate "CMOS Battery monitoring for Simatic IPCs based on Apollo Lake GPIO" + default SIEMENS_SIMATIC_IPC_BATT + depends on PINCTRL_BROXTON + depends on SIEMENS_SIMATIC_IPC_BATT + help + This option enables CMOS battery monitoring for Simatic Industrial PCs + from Siemens based on Apollo Lake GPIO. + + To compile this driver as a module, choose M here: the module + will be called simatic-ipc-batt-apollolake. + +config SIEMENS_SIMATIC_IPC_BATT_ELKHARTLAKE + tristate "CMOS Battery monitoring for Simatic IPCs based on Elkhart Lake GPIO" + default SIEMENS_SIMATIC_IPC_BATT + depends on PINCTRL_ELKHARTLAKE + depends on SIEMENS_SIMATIC_IPC_BATT + help + This option enables CMOS battery monitoring for Simatic Industrial PCs + from Siemens based on Elkhart Lake GPIO. + + To compile this driver as a module, choose M here: the module + will be called simatic-ipc-batt-elkhartlake. + +config SIEMENS_SIMATIC_IPC_BATT_F7188X + tristate "CMOS Battery monitoring for Simatic IPCs based on Nuvoton GPIO" + default SIEMENS_SIMATIC_IPC_BATT + depends on GPIO_F7188X + depends on PINCTRL_ALDERLAKE + depends on SIEMENS_SIMATIC_IPC_BATT + help + This option enables CMOS battery monitoring for Simatic Industrial PCs + from Siemens based on Nuvoton GPIO. + + To compile this driver as a module, choose M here: the module + will be called simatic-ipc-batt-f7188x. diff --git a/drivers/platform/x86/siemens/Makefile b/drivers/platform/x86/siemens/Makefile new file mode 100644 index 000000000000..2b384b4cb8ba --- /dev/null +++ b/drivers/platform/x86/siemens/Makefile @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Makefile for linux/drivers/platform/x86/siemens +# Siemens x86 Platform-Specific Drivers +# + +obj-$(CONFIG_SIEMENS_SIMATIC_IPC) += simatic-ipc.o +obj-$(CONFIG_SIEMENS_SIMATIC_IPC_BATT) += simatic-ipc-batt.o +obj-$(CONFIG_SIEMENS_SIMATIC_IPC_BATT_APOLLOLAKE) += simatic-ipc-batt-apollolake.o +obj-$(CONFIG_SIEMENS_SIMATIC_IPC_BATT_ELKHARTLAKE) += simatic-ipc-batt-elkhartlake.o +obj-$(CONFIG_SIEMENS_SIMATIC_IPC_BATT_F7188X) += simatic-ipc-batt-f7188x.o diff --git a/drivers/platform/x86/simatic-ipc-batt-apollolake.c b/drivers/platform/x86/siemens/simatic-ipc-batt-apollolake.c index 8a67979d8f96..8a67979d8f96 100644 --- a/drivers/platform/x86/simatic-ipc-batt-apollolake.c +++ b/drivers/platform/x86/siemens/simatic-ipc-batt-apollolake.c diff --git a/drivers/platform/x86/simatic-ipc-batt-elkhartlake.c b/drivers/platform/x86/siemens/simatic-ipc-batt-elkhartlake.c index 607d033911a2..607d033911a2 100644 --- a/drivers/platform/x86/simatic-ipc-batt-elkhartlake.c +++ b/drivers/platform/x86/siemens/simatic-ipc-batt-elkhartlake.c diff --git a/drivers/platform/x86/simatic-ipc-batt-f7188x.c b/drivers/platform/x86/siemens/simatic-ipc-batt-f7188x.c index ed330f6a8ea8..a66107e0fe1e 100644 --- a/drivers/platform/x86/simatic-ipc-batt-f7188x.c +++ b/drivers/platform/x86/siemens/simatic-ipc-batt-f7188x.c @@ -17,6 +17,8 @@ #include "simatic-ipc-batt.h" +static struct gpiod_lookup_table *batt_lookup_table; + static struct gpiod_lookup_table simatic_ipc_batt_gpio_table_227g = { .table = { GPIO_LOOKUP_IDX("gpio-f7188x-7", 6, NULL, 0, GPIO_ACTIVE_HIGH), @@ -34,24 +36,39 @@ static struct gpiod_lookup_table simatic_ipc_batt_gpio_table_bx_39a = { }, }; +static struct gpiod_lookup_table simatic_ipc_batt_gpio_table_bx_59a = { + .table = { + GPIO_LOOKUP_IDX("gpio-f7188x-7", 6, NULL, 0, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("gpio-f7188x-7", 5, NULL, 1, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX("INTC1056:00", 438, NULL, 2, GPIO_ACTIVE_HIGH), + {} /* Terminating entry */ + } +}; + static int simatic_ipc_batt_f7188x_remove(struct platform_device *pdev) { - const struct simatic_ipc_platform *plat = pdev->dev.platform_data; - - if (plat->devmode == SIMATIC_IPC_DEVICE_227G) - return simatic_ipc_batt_remove(pdev, &simatic_ipc_batt_gpio_table_227g); - - return simatic_ipc_batt_remove(pdev, &simatic_ipc_batt_gpio_table_bx_39a); + return simatic_ipc_batt_remove(pdev, batt_lookup_table); } static int simatic_ipc_batt_f7188x_probe(struct platform_device *pdev) { const struct simatic_ipc_platform *plat = pdev->dev.platform_data; - if (plat->devmode == SIMATIC_IPC_DEVICE_227G) - return simatic_ipc_batt_probe(pdev, &simatic_ipc_batt_gpio_table_227g); + switch (plat->devmode) { + case SIMATIC_IPC_DEVICE_227G: + batt_lookup_table = &simatic_ipc_batt_gpio_table_227g; + break; + case SIMATIC_IPC_DEVICE_BX_39A: + batt_lookup_table = &simatic_ipc_batt_gpio_table_bx_39a; + break; + case SIMATIC_IPC_DEVICE_BX_59A: + batt_lookup_table = &simatic_ipc_batt_gpio_table_bx_59a; + break; + default: + return -ENODEV; + } - return simatic_ipc_batt_probe(pdev, &simatic_ipc_batt_gpio_table_bx_39a); + return simatic_ipc_batt_probe(pdev, batt_lookup_table); } static struct platform_driver simatic_ipc_batt_driver = { @@ -66,5 +83,5 @@ module_platform_driver(simatic_ipc_batt_driver); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:" KBUILD_MODNAME); -MODULE_SOFTDEP("pre: simatic-ipc-batt gpio_f7188x platform:elkhartlake-pinctrl"); +MODULE_SOFTDEP("pre: simatic-ipc-batt gpio_f7188x platform:elkhartlake-pinctrl platform:alderlake-pinctrl"); MODULE_AUTHOR("Henning Schild <henning.schild@siemens.com>"); diff --git a/drivers/platform/x86/simatic-ipc-batt.c b/drivers/platform/x86/siemens/simatic-ipc-batt.c index d2791ff84f23..d66b9969234b 100644 --- a/drivers/platform/x86/simatic-ipc-batt.c +++ b/drivers/platform/x86/siemens/simatic-ipc-batt.c @@ -92,19 +92,14 @@ static long simatic_ipc_batt_read_value(struct device *dev) next_update = priv.last_updated_jiffies + msecs_to_jiffies(BATT_DELAY_MS); if (time_after(jiffies, next_update) || !priv.last_updated_jiffies) { - switch (priv.devmode) { - case SIMATIC_IPC_DEVICE_127E: - case SIMATIC_IPC_DEVICE_227G: - case SIMATIC_IPC_DEVICE_BX_39A: - priv.current_state = simatic_ipc_batt_read_gpio(); - break; - case SIMATIC_IPC_DEVICE_227E: + if (priv.devmode == SIMATIC_IPC_DEVICE_227E) priv.current_state = simatic_ipc_batt_read_io(dev); - break; - } + else + priv.current_state = simatic_ipc_batt_read_gpio(); + priv.last_updated_jiffies = jiffies; if (priv.current_state < SIMATIC_IPC_BATT_LEVEL_FULL) - dev_warn(dev, "CMOS battery needs to be replaced."); + dev_warn(dev, "CMOS battery needs to be replaced.\n"); } return priv.current_state; @@ -163,6 +158,7 @@ int simatic_ipc_batt_probe(struct platform_device *pdev, struct gpiod_lookup_tab struct simatic_ipc_platform *plat; struct device *dev = &pdev->dev; struct device *hwmon_dev; + unsigned long flags; int err; plat = pdev->dev.platform_data; @@ -173,6 +169,7 @@ int simatic_ipc_batt_probe(struct platform_device *pdev, struct gpiod_lookup_tab case SIMATIC_IPC_DEVICE_227G: case SIMATIC_IPC_DEVICE_BX_39A: case SIMATIC_IPC_DEVICE_BX_21A: + case SIMATIC_IPC_DEVICE_BX_59A: table->dev_id = dev_name(dev); gpiod_add_lookup_table(table); break; @@ -196,7 +193,10 @@ int simatic_ipc_batt_probe(struct platform_device *pdev, struct gpiod_lookup_tab } if (table->table[2].key) { - priv.gpios[2] = devm_gpiod_get_index(dev, "CMOSBattery meter", 2, GPIOD_OUT_HIGH); + flags = GPIOD_OUT_HIGH; + if (priv.devmode == SIMATIC_IPC_DEVICE_BX_21A || SIMATIC_IPC_DEVICE_BX_59A) + flags = GPIOD_OUT_LOW; + priv.gpios[2] = devm_gpiod_get_index(dev, "CMOSBattery meter", 2, flags); if (IS_ERR(priv.gpios[2])) { err = PTR_ERR(priv.gpios[1]); priv.gpios[2] = NULL; diff --git a/drivers/platform/x86/simatic-ipc-batt.h b/drivers/platform/x86/siemens/simatic-ipc-batt.h index 4545cd3e3026..4545cd3e3026 100644 --- a/drivers/platform/x86/simatic-ipc-batt.h +++ b/drivers/platform/x86/siemens/simatic-ipc-batt.h diff --git a/drivers/platform/x86/simatic-ipc.c b/drivers/platform/x86/siemens/simatic-ipc.c index 13c857316c7f..02c540cf4070 100644 --- a/drivers/platform/x86/simatic-ipc.c +++ b/drivers/platform/x86/siemens/simatic-ipc.c @@ -78,6 +78,12 @@ static struct { {SIMATIC_IPC_IPCBX_21A, SIMATIC_IPC_DEVICE_BX_21A, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_BX_21A, { "emc1403", NULL }}, + {SIMATIC_IPC_IPCBX_56A, + SIMATIC_IPC_DEVICE_BX_59A, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_BX_59A, + { "emc1403", "w83627hf_wdt" }}, + {SIMATIC_IPC_IPCBX_59A, + SIMATIC_IPC_DEVICE_BX_59A, SIMATIC_IPC_DEVICE_NONE, SIMATIC_IPC_DEVICE_BX_59A, + { "emc1403", "w83627hf_wdt" }}, }; static int register_platform_devices(u32 station_id) @@ -103,7 +109,9 @@ static int register_platform_devices(u32 station_id) pdevname = KBUILD_MODNAME "_batt_apollolake"; if (battmode == SIMATIC_IPC_DEVICE_BX_21A) pdevname = KBUILD_MODNAME "_batt_elkhartlake"; - if (battmode == SIMATIC_IPC_DEVICE_227G || battmode == SIMATIC_IPC_DEVICE_BX_39A) + if (battmode == SIMATIC_IPC_DEVICE_227G || + battmode == SIMATIC_IPC_DEVICE_BX_39A || + battmode == SIMATIC_IPC_DEVICE_BX_59A) pdevname = KBUILD_MODNAME "_batt_f7188x"; platform_data.devmode = battmode; ipc_batt_platform_device = @@ -121,7 +129,7 @@ static int register_platform_devices(u32 station_id) pdevname = KBUILD_MODNAME "_leds"; if (ledmode == SIMATIC_IPC_DEVICE_127E) pdevname = KBUILD_MODNAME "_leds_gpio_apollolake"; - if (ledmode == SIMATIC_IPC_DEVICE_227G) + if (ledmode == SIMATIC_IPC_DEVICE_227G || SIMATIC_IPC_DEVICE_BX_59A) pdevname = KBUILD_MODNAME "_leds_gpio_f7188x"; if (ledmode == SIMATIC_IPC_DEVICE_BX_21A) pdevname = KBUILD_MODNAME "_leds_gpio_elkhartlake"; |