* [PATCH 0/2] platform/x86/siemens: fixes for CMOS battery hwmon
@ 2023-07-25 9:31 Henning Schild
2023-07-25 9:31 ` [PATCH 2/2] platform/x86/siemens: Kconfig: adjust help text Henning Schild
2023-07-28 8:36 ` [PATCH] platform/x86: simatic-ipc-batt: fix reading in BX_21A henning.schild
0 siblings, 2 replies; 5+ messages in thread
From: Henning Schild @ 2023-07-25 9:31 UTC (permalink / raw)
To: Hans de Goede, Mark Gross, platform-driver-x86, linux-kernel
Cc: Tobias Schaffner, Henning Schild
These two fixes apply on top of
[PATCH v2 0/3] platform/x86: move simatic drivers into subdir
One minor documentation mistake and one functional patch where one IPC
did not read out the GPIOs correctly.
Henning Schild (1):
platform/x86/siemens: Kconfig: adjust help text
xingtong.wu (1):
platform/x86: simatic-ipc-batt: fix reading in BX_21A
drivers/platform/x86/siemens/Kconfig | 2 +-
.../platform/x86/siemens/simatic-ipc-batt.c | 21 +++++++++----------
2 files changed, 11 insertions(+), 12 deletions(-)
--
2.41.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] platform/x86/siemens: Kconfig: adjust help text
2023-07-25 9:31 [PATCH 0/2] platform/x86/siemens: fixes for CMOS battery hwmon Henning Schild
@ 2023-07-25 9:31 ` Henning Schild
2023-07-31 11:16 ` Hans de Goede
2023-07-28 8:36 ` [PATCH] platform/x86: simatic-ipc-batt: fix reading in BX_21A henning.schild
1 sibling, 1 reply; 5+ messages in thread
From: Henning Schild @ 2023-07-25 9:31 UTC (permalink / raw)
To: Hans de Goede, Mark Gross, platform-driver-x86, linux-kernel
Cc: Tobias Schaffner, Henning Schild
There was a copy and paste mistake where the module name was not
correct.
Fixes: 917f54340794 ("platform/x86: simatic-ipc: add CMOS battery monitoring")
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
drivers/platform/x86/siemens/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/siemens/Kconfig b/drivers/platform/x86/siemens/Kconfig
index 8e78dc609a38..9c227a19432f 100644
--- a/drivers/platform/x86/siemens/Kconfig
+++ b/drivers/platform/x86/siemens/Kconfig
@@ -60,4 +60,4 @@ config SIEMENS_SIMATIC_IPC_BATT_F7188X
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.
+ will be called simatic-ipc-batt-f7188x.
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] platform/x86: simatic-ipc-batt: fix reading in BX_21A
2023-07-25 9:31 [PATCH 0/2] platform/x86/siemens: fixes for CMOS battery hwmon Henning Schild
2023-07-25 9:31 ` [PATCH 2/2] platform/x86/siemens: Kconfig: adjust help text Henning Schild
@ 2023-07-28 8:36 ` henning.schild
2023-07-28 8:44 ` Henning Schild
1 sibling, 1 reply; 5+ messages in thread
From: henning.schild @ 2023-07-28 8:36 UTC (permalink / raw)
To: Hans de Goede, Mark Gross, platform-driver-x86, linux-kernel
Cc: Tobias Schaffner, xingtong.wu, Henning Schild
From: "xingtong.wu" <xingtong.wu@siemens.com>
There was a case missing in a switch statement which lead to that model
not actually reading the GPIOs. That switch statement got simplified
now. Additionally on that model we need to initialize one pin
differently. As a drive-by finding also add a missing newline.
Fixes: 917f54340794 ("platform/x86: simatic-ipc: add CMOS battery monitoring")
Reported-by: Henning Schild <henning.schild@siemens.com>
Signed-off-by: xingtong.wu <xingtong.wu@siemens.com>
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
.../platform/x86/siemens/simatic-ipc-batt.c | 21 +++++++++----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/drivers/platform/x86/siemens/simatic-ipc-batt.c b/drivers/platform/x86/siemens/simatic-ipc-batt.c
index d2791ff84f23..e34417ca9e13 100644
--- a/drivers/platform/x86/siemens/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;
@@ -196,7 +192,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)
+ 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;
--
2.41.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: simatic-ipc-batt: fix reading in BX_21A
2023-07-28 8:36 ` [PATCH] platform/x86: simatic-ipc-batt: fix reading in BX_21A henning.schild
@ 2023-07-28 8:44 ` Henning Schild
0 siblings, 0 replies; 5+ messages in thread
From: Henning Schild @ 2023-07-28 8:44 UTC (permalink / raw)
To: Hans de Goede, Mark Gross, platform-driver-x86, linux-kernel
Cc: Tobias Schaffner, xingtong.wu
This is in fact "[PATCH 1/2]", it needed to be send again because it
somehow did not make it out into the archives correctly. Sorry for the
noise if you received it multiple times.
Henning
Am Fri, 28 Jul 2023 10:36:51 +0200
schrieb henning.schild@siemens.com:
> From: "xingtong.wu" <xingtong.wu@siemens.com>
>
> There was a case missing in a switch statement which lead to that
> model not actually reading the GPIOs. That switch statement got
> simplified now. Additionally on that model we need to initialize one
> pin differently. As a drive-by finding also add a missing newline.
>
> Fixes: 917f54340794 ("platform/x86: simatic-ipc: add CMOS battery
> monitoring") Reported-by: Henning Schild <henning.schild@siemens.com>
> Signed-off-by: xingtong.wu <xingtong.wu@siemens.com>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
> .../platform/x86/siemens/simatic-ipc-batt.c | 21
> +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/platform/x86/siemens/simatic-ipc-batt.c
> b/drivers/platform/x86/siemens/simatic-ipc-batt.c index
> d2791ff84f23..e34417ca9e13 100644 ---
> a/drivers/platform/x86/siemens/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;
> @@ -196,7 +192,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)
> + 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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] platform/x86/siemens: Kconfig: adjust help text
2023-07-25 9:31 ` [PATCH 2/2] platform/x86/siemens: Kconfig: adjust help text Henning Schild
@ 2023-07-31 11:16 ` Hans de Goede
0 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2023-07-31 11:16 UTC (permalink / raw)
To: Henning Schild, Mark Gross, platform-driver-x86, linux-kernel
Cc: Tobias Schaffner
Hi,
On 7/25/23 11:31, Henning Schild wrote:
> There was a copy and paste mistake where the module name was not
> correct.
>
> Fixes: 917f54340794 ("platform/x86: simatic-ipc: add CMOS battery monitoring")
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
Thank you, I have merged this entire series into
the platform-drivers-x86-simatic-ipc branch now:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=platform-drivers-x86-simatic-ipc
Note it will show up there once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
merged into the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/x86/siemens/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/siemens/Kconfig b/drivers/platform/x86/siemens/Kconfig
> index 8e78dc609a38..9c227a19432f 100644
> --- a/drivers/platform/x86/siemens/Kconfig
> +++ b/drivers/platform/x86/siemens/Kconfig
> @@ -60,4 +60,4 @@ config SIEMENS_SIMATIC_IPC_BATT_F7188X
> 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.
> + will be called simatic-ipc-batt-f7188x.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-31 11:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-25 9:31 [PATCH 0/2] platform/x86/siemens: fixes for CMOS battery hwmon Henning Schild
2023-07-25 9:31 ` [PATCH 2/2] platform/x86/siemens: Kconfig: adjust help text Henning Schild
2023-07-31 11:16 ` Hans de Goede
2023-07-28 8:36 ` [PATCH] platform/x86: simatic-ipc-batt: fix reading in BX_21A henning.schild
2023-07-28 8:44 ` Henning Schild
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox