* Communication between kernel and user-space
@ 2021-08-30 13:51 Thomas Marangoni
2021-08-30 15:02 ` Rafael J. Wysocki
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Marangoni @ 2021-08-30 13:51 UTC (permalink / raw)
To: linux-pm
Hello,
I'm currently working on the axp209 driver. The device has multiple
warnings like: temperature too high or low, over-voltage, under-voltage
etc. What is the recommended way to communicate such warnings to the
user-space, besides dmesg, so programs can handle them? Or should I just
create my own attribute for each warning and set it to a specific value
from the kernel and let user-space applications reset them to
acknowledge them? And if there is a recommended way can you name me a
driver that is using it?
Thanks for your help!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Communication between kernel and user-space
2021-08-30 13:51 Communication between kernel and user-space Thomas Marangoni
@ 2021-08-30 15:02 ` Rafael J. Wysocki
2021-08-31 6:49 ` Thomas Marangoni
0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2021-08-30 15:02 UTC (permalink / raw)
To: Thomas Marangoni; +Cc: Linux PM
On Mon, Aug 30, 2021 at 3:51 PM Thomas Marangoni
<thomas.marangoni@mec.at> wrote:
>
> Hello,
>
> I'm currently working on the axp209 driver.
What kind of devices is it going to handle, specifically?
> The device has multiple
> warnings like: temperature too high or low,
You should be able to use the existing thermal framework for this.
> over-voltage, under-voltage
But there's no generic way to communicate those AFAICS.
The question here is what user space is going to do about them, though.
> etc. What is the recommended way to communicate such warnings to the
> user-space, besides dmesg, so programs can handle them? Or should I just
> create my own attribute for each warning and set it to a specific value
> from the kernel and let user-space applications reset them to
> acknowledge them? And if there is a recommended way can you name me a
> driver that is using it?
>
> Thanks for your help!
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Communication between kernel and user-space
2021-08-30 15:02 ` Rafael J. Wysocki
@ 2021-08-31 6:49 ` Thomas Marangoni
2021-09-27 15:03 ` Sebastian Reichel
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Marangoni @ 2021-08-31 6:49 UTC (permalink / raw)
To: linux-pm
> What kind of devices is it going to handle, specifically?
The AXP209 is a power management chip for e.g. Allwinner A20 (ARM
architecture), I want to focus on the axp20x-battery driver.
>> The device has multiple
>> warnings like: temperature too high or low,
> You should be able to use the existing thermal framework for this.
>
>> over-voltage, under-voltage
> But there's no generic way to communicate those AFAICS.
>
> The question here is what user space is going to do about them, though.
Events I like to communicate to the user-space:
- Battery Temperature to high (as already mentioned, possible with
thermal framework)
- Battery Temperature to low (as already mentioned, possible with
thermal framework)
- AXP209Internal over-temperature (should also be possible with thermal
framework)
- Low Voltage Level 2 (shuts down the device)
- Low Voltage Level 1
- Over Voltage
- Under Voltage
- Chargingcurrent shortage
In my case the application would prepare for a shutdown if the low
voltage warning level 1 event is received. For the other events the user
would get a warning with instruction how to handle them from the
application.
>> etc. What is the recommended way to communicate such warnings to the
>> user-space, besides dmesg, so programs can handle them? Or should I just
>> create my own attribute for each warning and set it to a specific value
>> from the kernel and let user-space applications reset them to
>> acknowledge them? And if there is a recommended way can you name me a
>> driver that is using it?
>>
>> Thanks for your help!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Communication between kernel and user-space
2021-08-31 6:49 ` Thomas Marangoni
@ 2021-09-27 15:03 ` Sebastian Reichel
0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Reichel @ 2021-09-27 15:03 UTC (permalink / raw)
To: Thomas Marangoni; +Cc: linux-pm
[-- Attachment #1: Type: text/plain, Size: 2336 bytes --]
Hi,
On Tue, Aug 31, 2021 at 08:49:04AM +0200, Thomas Marangoni wrote:
> > What kind of devices is it going to handle, specifically?
> The AXP209 is a power management chip for e.g. Allwinner A20 (ARM
> architecture), I want to focus on the axp20x-battery driver.
>
> > > The device has multiple
> > > warnings like: temperature too high or low,
> > You should be able to use the existing thermal framework for this.
> >
> > > over-voltage, under-voltage
> > But there's no generic way to communicate those AFAICS.
> >
> > The question here is what user space is going to do about them, though.
>
> Events I like to communicate to the user-space:
>
> - Battery Temperature to high (as already mentioned, possible with thermal
> framework)
> - Battery Temperature to low (as already mentioned, possible with thermal
> framework)
> - AXP209Internal over-temperature (should also be possible with thermal
> framework)
> - Low Voltage Level 2 (shuts down the device)
>
> - Low Voltage Level 1
> - Over Voltage
> - Under Voltage
> - Chargingcurrent shortage
>
> In my case the application would prepare for a shutdown if the low voltage
> warning level 1 event is received. For the other events the user would get a
> warning with instruction how to handle them from the application.
>
> > > etc. What is the recommended way to communicate such warnings to the
> > > user-space, besides dmesg, so programs can handle them? Or should I just
> > > create my own attribute for each warning and set it to a specific value
> > > from the kernel and let user-space applications reset them to
> > > acknowledge them? And if there is a recommended way can you name me a
> > > driver that is using it?
> > >
> > > Thanks for your help!
power-supply drivers can expose the health property, which exposes
status like overvoltage or overheat (just one at a time though.
Drivers should report the most critical one).
In general userspace gets a uevent notification with all properties incl.
health when power_supply_changed() is called for the device. It
definetly should be called when health status changes.
You can find more information in Documentation/ABI/testing/sysfs-class-power
(look for "/health") and by searching the kernel tree for
POWER_SUPPLY_PROP_HEALTH.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-27 15:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30 13:51 Communication between kernel and user-space Thomas Marangoni
2021-08-30 15:02 ` Rafael J. Wysocki
2021-08-31 6:49 ` Thomas Marangoni
2021-09-27 15:03 ` Sebastian Reichel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.