Commit 17ffe3a0 authored by Hans de Goede's avatar Hans de Goede

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.
parents d4e695c0 c56beff2
......@@ -2,6 +2,7 @@
config LEDS_SIEMENS_SIMATIC_IPC
tristate "LED driver for Siemens Simatic IPCs"
depends on SIEMENS_SIMATIC_IPC
default y
help
This option enables support for the LEDs of several Industrial PCs
from Siemens.
......
......@@ -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"
......
......@@ -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
......
# 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.
# 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
......@@ -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>");
......@@ -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;
......
......@@ -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";
......
......@@ -1681,6 +1681,7 @@ config NIC7018_WDT
config SIEMENS_SIMATIC_IPC_WDT
tristate "Siemens Simatic IPC Watchdog"
depends on SIEMENS_SIMATIC_IPC
default y
select WATCHDOG_CORE
select P2SB
help
......
......@@ -22,6 +22,7 @@
#define SIMATIC_IPC_DEVICE_227G 5
#define SIMATIC_IPC_DEVICE_BX_21A 6
#define SIMATIC_IPC_DEVICE_BX_39A 7
#define SIMATIC_IPC_DEVICE_BX_59A 8
struct simatic_ipc_platform {
u8 devmode;
......
......@@ -36,6 +36,8 @@ enum simatic_ipc_station_ids {
SIMATIC_IPC_IPCBX_39A = 0x00001001,
SIMATIC_IPC_IPCPX_39A = 0x00001002,
SIMATIC_IPC_IPCBX_21A = 0x00001101,
SIMATIC_IPC_IPCBX_56A = 0x00001201,
SIMATIC_IPC_IPCBX_59A = 0x00001202,
};
static inline u32 simatic_ipc_get_station_id(u8 *data, int max_len)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment