The real change is in p2 and p1 just prepares to multiplex an IO region.
We introduce a custom driver to read CMOS battery information on several
of the Industrial PCs.
This is based on
"[PATCH 0/1] leds: simatic-ipc-leds-gpio: add new model BX-21A"
Henning Schild (2):
watchdog: simatic-ipc-wdt: make IO region access of one model muxed
platform/x86: add CMOS battery monitoring for simatic IPCs
drivers/platform/x86/Kconfig | 48 ++++
drivers/platform/x86/Makefile | 6 +-
.../x86/simatic-ipc-batt-apollolake.c | 51 ++++
.../x86/simatic-ipc-batt-elkhartlake.c | 51 ++++
.../platform/x86/simatic-ipc-batt-f7188x.c | 70 +++++
drivers/platform/x86/simatic-ipc-batt.c | 250 ++++++++++++++++++
drivers/platform/x86/simatic-ipc-batt.h | 20 ++
drivers/platform/x86/simatic-ipc.c | 65 ++++-
drivers/watchdog/simatic-ipc-wdt.c | 9 +-
.../platform_data/x86/simatic-ipc-base.h | 1 +
10 files changed, 553 insertions(+), 18 deletions(-)
create mode 100644 drivers/platform/x86/simatic-ipc-batt-apollolake.c
create mode 100644 drivers/platform/x86/simatic-ipc-batt-elkhartlake.c
create mode 100644 drivers/platform/x86/simatic-ipc-batt-f7188x.c
create mode 100644 drivers/platform/x86/simatic-ipc-batt.c
create mode 100644 drivers/platform/x86/simatic-ipc-batt.h
--
2.39.3
The IO region used for the watchdog also hold CMOS battery monitoring
information. Make the access muxed so that a hwmon driver can use the
region as well.
Signed-off-by: Henning Schild <[email protected]>
---
drivers/watchdog/simatic-ipc-wdt.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/watchdog/simatic-ipc-wdt.c b/drivers/watchdog/simatic-ipc-wdt.c
index 6599695dc672..cdc1a2e15180 100644
--- a/drivers/watchdog/simatic-ipc-wdt.c
+++ b/drivers/watchdog/simatic-ipc-wdt.c
@@ -155,9 +155,8 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
switch (plat->devmode) {
case SIMATIC_IPC_DEVICE_227E:
- if (!devm_request_region(dev, gp_status_reg_227e_res.start,
- resource_size(&gp_status_reg_227e_res),
- KBUILD_MODNAME)) {
+ res = &gp_status_reg_227e_res;
+ if (!request_muxed_region(res->start, resource_size(res), res->name)) {
dev_err(dev,
"Unable to register IO resource at %pR\n",
&gp_status_reg_227e_res);
@@ -210,6 +209,10 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
if (wdd_data.bootstatus)
dev_warn(dev, "last reboot caused by watchdog reset\n");
+ if (plat->devmode == SIMATIC_IPC_DEVICE_227E)
+ release_region(gp_status_reg_227e_res.start,
+ resource_size(&gp_status_reg_227e_res));
+
watchdog_set_nowayout(&wdd_data, nowayout);
watchdog_stop_on_reboot(&wdd_data);
return devm_watchdog_register_device(dev, &wdd_data);
--
2.39.3
On 7/6/23 08:48, Henning Schild wrote:
> The IO region used for the watchdog also hold CMOS battery monitoring
> information. Make the access muxed so that a hwmon driver can use the
> region as well.
>
> Signed-off-by: Henning Schild <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
> ---
> drivers/watchdog/simatic-ipc-wdt.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/watchdog/simatic-ipc-wdt.c b/drivers/watchdog/simatic-ipc-wdt.c
> index 6599695dc672..cdc1a2e15180 100644
> --- a/drivers/watchdog/simatic-ipc-wdt.c
> +++ b/drivers/watchdog/simatic-ipc-wdt.c
> @@ -155,9 +155,8 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
>
> switch (plat->devmode) {
> case SIMATIC_IPC_DEVICE_227E:
> - if (!devm_request_region(dev, gp_status_reg_227e_res.start,
> - resource_size(&gp_status_reg_227e_res),
> - KBUILD_MODNAME)) {
> + res = &gp_status_reg_227e_res;
> + if (!request_muxed_region(res->start, resource_size(res), res->name)) {
> dev_err(dev,
> "Unable to register IO resource at %pR\n",
> &gp_status_reg_227e_res);
> @@ -210,6 +209,10 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
> if (wdd_data.bootstatus)
> dev_warn(dev, "last reboot caused by watchdog reset\n");
>
> + if (plat->devmode == SIMATIC_IPC_DEVICE_227E)
> + release_region(gp_status_reg_227e_res.start,
> + resource_size(&gp_status_reg_227e_res));
> +
> watchdog_set_nowayout(&wdd_data, nowayout);
> watchdog_stop_on_reboot(&wdd_data);
> return devm_watchdog_register_device(dev, &wdd_data);
Hi Guenter,
On 7/6/23 18:03, Guenter Roeck wrote:
> On 7/6/23 08:48, Henning Schild wrote:
>> The IO region used for the watchdog also hold CMOS battery monitoring
>> information. Make the access muxed so that a hwmon driver can use the
>> region as well.
>>
>> Signed-off-by: Henning Schild <[email protected]>
>
> Acked-by: Guenter Roeck <[email protected]>
Thank you. Is it ok if I pick up his patch and merge it together with 2/2
through the pdx86 tree ?
Regards,
Hans
>
>> ---
>> drivers/watchdog/simatic-ipc-wdt.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/watchdog/simatic-ipc-wdt.c b/drivers/watchdog/simatic-ipc-wdt.c
>> index 6599695dc672..cdc1a2e15180 100644
>> --- a/drivers/watchdog/simatic-ipc-wdt.c
>> +++ b/drivers/watchdog/simatic-ipc-wdt.c
>> @@ -155,9 +155,8 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
>> switch (plat->devmode) {
>> case SIMATIC_IPC_DEVICE_227E:
>> - if (!devm_request_region(dev, gp_status_reg_227e_res.start,
>> - resource_size(&gp_status_reg_227e_res),
>> - KBUILD_MODNAME)) {
>> + res = &gp_status_reg_227e_res;
>> + if (!request_muxed_region(res->start, resource_size(res), res->name)) {
>> dev_err(dev,
>> "Unable to register IO resource at %pR\n",
>> &gp_status_reg_227e_res);
>> @@ -210,6 +209,10 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
>> if (wdd_data.bootstatus)
>> dev_warn(dev, "last reboot caused by watchdog reset\n");
>> + if (plat->devmode == SIMATIC_IPC_DEVICE_227E)
>> + release_region(gp_status_reg_227e_res.start,
>> + resource_size(&gp_status_reg_227e_res));
>> +
>> watchdog_set_nowayout(&wdd_data, nowayout);
>> watchdog_stop_on_reboot(&wdd_data);
>> return devm_watchdog_register_device(dev, &wdd_data);
>
On Mon, Jul 10, 2023 at 03:33:45PM +0200, Hans de Goede wrote:
> Hi Guenter,
>
> On 7/6/23 18:03, Guenter Roeck wrote:
> > On 7/6/23 08:48, Henning Schild wrote:
> >> The IO region used for the watchdog also hold CMOS battery monitoring
> >> information. Make the access muxed so that a hwmon driver can use the
> >> region as well.
> >>
> >> Signed-off-by: Henning Schild <[email protected]>
> >
> > Acked-by: Guenter Roeck <[email protected]>
>
> Thank you. Is it ok if I pick up his patch and merge it together with 2/2
> through the pdx86 tree ?
>
Yes. That was my assumption.
Guenter
> Regards,
>
> Hans
>
>
> >
> >> ---
> >> ? drivers/watchdog/simatic-ipc-wdt.c | 9 ++++++---
> >> ? 1 file changed, 6 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/watchdog/simatic-ipc-wdt.c b/drivers/watchdog/simatic-ipc-wdt.c
> >> index 6599695dc672..cdc1a2e15180 100644
> >> --- a/drivers/watchdog/simatic-ipc-wdt.c
> >> +++ b/drivers/watchdog/simatic-ipc-wdt.c
> >> @@ -155,9 +155,8 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
> >> ? ????? switch (plat->devmode) {
> >> ????? case SIMATIC_IPC_DEVICE_227E:
> >> -??????? if (!devm_request_region(dev, gp_status_reg_227e_res.start,
> >> -???????????????????? resource_size(&gp_status_reg_227e_res),
> >> -???????????????????? KBUILD_MODNAME)) {
> >> +??????? res = &gp_status_reg_227e_res;
> >> +??????? if (!request_muxed_region(res->start, resource_size(res), res->name)) {
> >> ????????????? dev_err(dev,
> >> ????????????????? "Unable to register IO resource at %pR\n",
> >> ????????????????? &gp_status_reg_227e_res);
> >> @@ -210,6 +209,10 @@ static int simatic_ipc_wdt_probe(struct platform_device *pdev)
> >> ????? if (wdd_data.bootstatus)
> >> ????????? dev_warn(dev, "last reboot caused by watchdog reset\n");
> >> ? +??? if (plat->devmode == SIMATIC_IPC_DEVICE_227E)
> >> +??????? release_region(gp_status_reg_227e_res.start,
> >> +?????????????????? resource_size(&gp_status_reg_227e_res));
> >> +
> >> ????? watchdog_set_nowayout(&wdd_data, nowayout);
> >> ????? watchdog_stop_on_reboot(&wdd_data);
> >> ????? return devm_watchdog_register_device(dev, &wdd_data);
> >
>
Am Mon, 10 Jul 2023 06:45:14 -0700
schrieb Guenter Roeck <[email protected]>:
> On Mon, Jul 10, 2023 at 03:33:45PM +0200, Hans de Goede wrote:
> > Hi Guenter,
> >
> > On 7/6/23 18:03, Guenter Roeck wrote:
> > > On 7/6/23 08:48, Henning Schild wrote:
> > >> The IO region used for the watchdog also hold CMOS battery
> > >> monitoring information. Make the access muxed so that a hwmon
> > >> driver can use the region as well.
> > >>
> > >> Signed-off-by: Henning Schild <[email protected]>
> > >
> > > Acked-by: Guenter Roeck <[email protected]>
> >
> > Thank you. Is it ok if I pick up his patch and merge it together
> > with 2/2 through the pdx86 tree ?
> >
>
> Yes. That was my assumption.
Thanks guys. Cant believe i made it with v1. Getting better at this ;)
Henning
> Guenter
>
> > Regards,
> >
> > Hans
> >
> >
> > >
> > >> ---
> > >> drivers/watchdog/simatic-ipc-wdt.c | 9 ++++++---
> > >> 1 file changed, 6 insertions(+), 3 deletions(-)
> > >>
> > >> diff --git a/drivers/watchdog/simatic-ipc-wdt.c
> > >> b/drivers/watchdog/simatic-ipc-wdt.c index
> > >> 6599695dc672..cdc1a2e15180 100644 ---
> > >> a/drivers/watchdog/simatic-ipc-wdt.c +++
> > >> b/drivers/watchdog/simatic-ipc-wdt.c @@ -155,9 +155,8 @@ static
> > >> int simatic_ipc_wdt_probe(struct platform_device *pdev) switch
> > >> (plat->devmode) { case SIMATIC_IPC_DEVICE_227E:
> > >> - if (!devm_request_region(dev,
> > >> gp_status_reg_227e_res.start,
> > >> - resource_size(&gp_status_reg_227e_res),
> > >> - KBUILD_MODNAME)) {
> > >> + res = &gp_status_reg_227e_res;
> > >> + if (!request_muxed_region(res->start,
> > >> resource_size(res), res->name)) { dev_err(dev,
> > >> "Unable to register IO resource at %pR\n",
> > >> &gp_status_reg_227e_res);
> > >> @@ -210,6 +209,10 @@ static int simatic_ipc_wdt_probe(struct
> > >> platform_device *pdev) if (wdd_data.bootstatus)
> > >> dev_warn(dev, "last reboot caused by watchdog
> > >> reset\n");
> > >> + if (plat->devmode == SIMATIC_IPC_DEVICE_227E)
> > >> + release_region(gp_status_reg_227e_res.start,
> > >> + resource_size(&gp_status_reg_227e_res));
> > >> +
> > >> watchdog_set_nowayout(&wdd_data, nowayout);
> > >> watchdog_stop_on_reboot(&wdd_data);
> > >> return devm_watchdog_register_device(dev, &wdd_data);
> > >
> >
Hi,
On 7/6/23 17:48, Henning Schild wrote:
> The real change is in p2 and p1 just prepares to multiplex an IO region.
> We introduce a custom driver to read CMOS battery information on several
> of the Industrial PCs.
>
> This is based on
> "[PATCH 0/1] leds: simatic-ipc-leds-gpio: add new model BX-21A"
>
> Henning Schild (2):
> watchdog: simatic-ipc-wdt: make IO region access of one model muxed
> platform/x86: add CMOS battery monitoring for simatic IPCs
Thank you. I've merged both into a platform-drivers-x86-simatic-ipc
branch where I'm collecting all the pending platform/x86: simatic-ipc
work.
I'll tag + send a pull-request to Lee Jones (for some dependent LED
patches) later today.
Guenter, I'll Cc you on the pull-req in case you also want to merge
the (immutable) tag to pick up the small watchdog change in this
series.
Regards,
Hans
>
> drivers/platform/x86/Kconfig | 48 ++++
> drivers/platform/x86/Makefile | 6 +-
> .../x86/simatic-ipc-batt-apollolake.c | 51 ++++
> .../x86/simatic-ipc-batt-elkhartlake.c | 51 ++++
> .../platform/x86/simatic-ipc-batt-f7188x.c | 70 +++++
> drivers/platform/x86/simatic-ipc-batt.c | 250 ++++++++++++++++++
> drivers/platform/x86/simatic-ipc-batt.h | 20 ++
> drivers/platform/x86/simatic-ipc.c | 65 ++++-
> drivers/watchdog/simatic-ipc-wdt.c | 9 +-
> .../platform_data/x86/simatic-ipc-base.h | 1 +
> 10 files changed, 553 insertions(+), 18 deletions(-)
> create mode 100644 drivers/platform/x86/simatic-ipc-batt-apollolake.c
> create mode 100644 drivers/platform/x86/simatic-ipc-batt-elkhartlake.c
> create mode 100644 drivers/platform/x86/simatic-ipc-batt-f7188x.c
> create mode 100644 drivers/platform/x86/simatic-ipc-batt.c
> create mode 100644 drivers/platform/x86/simatic-ipc-batt.h
>