From: Henning Schild <henning.schild@siemens.com>
To: Hans de Goede <hdegoede@redhat.com>,
Mark Gross <markgross@kernel.org>,
platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Tobias Schaffner <tobias.schaffner@siemens.com>,
"xingtong.wu" <xingtong.wu@siemens.com>
Subject: Re: [PATCH] platform/x86: simatic-ipc-batt: fix reading in BX_21A
Date: Fri, 28 Jul 2023 10:44:04 +0200 [thread overview]
Message-ID: <20230728104404.0f7e4ef9@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20230728083651.19747-1-henning.schild@siemens.com>
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;
prev parent reply other threads:[~2023-07-28 8:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230728104404.0f7e4ef9@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=tobias.schaffner@siemens.com \
--cc=xingtong.wu@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®