Re: [PATCH v2 1/3] dt-bindings: rtc: pcf8523: add DSM pm option for battery switch-over
From: Alexandre Belloni
Date: Tue Aug 25 2020 - 16:08:57 EST
On 27/07/2020 22:13:42+0100, Miguel Borges de Freitas wrote:
> Russell King - ARM Linux admin <linux@xxxxxxxxxxxxxxx> escreveu no dia
> segunda, 27/07/2020 à(s) 18:30:
> >
> > On Mon, Jul 27, 2020 at 06:16:32PM +0200, Alexandre Belloni wrote:
> > > On 27/07/2020 17:55:50+0200, Jon Nettleton wrote:
> > > > > So, can we please have that discussion, it is pertinent to this patch.
> > > > >
> > > >
> > > > Thinking about this some more, I believe whether or not an IOCTL
> > > > interface is in the works or needed is irrelevant. This patch
> > > > describes the hardware and how it is designed and the topic of
> > > > discussion is if we need a simple boolean state, or if we need
> > > > something that could be used to support dynamic configuration in the
> > > > future. I would rather make this decision now rather than keep
> > > > tacking on boolean config options, or revisit a bunch of device-tree
> > > > changes.
>
> For what it's worth I also tend to agree.
> The patchset, regardless of the property name (that I admit might be
> misleading), is intended at enforcing a mode that the RTC/driver
> should use by default. This mode is strongly related to the hardware
> definition/implementation and its capabilities. While I understand the
> need for the IOCTL interface to solve issues exactly like the
> aforementioned factory example, I fail to see how it can be of any
> help to solve the problem at hand - as it won't likely configure the
> driver to use a different default mode depending on the board. The
> IOCTL interface might also allow the userspace to change this property
> back to the default mode (000) and end up breaking the RTC operation,
> but I guess that's the cost of configurability and, in the end, the
> user's responsibility.
> Any pointers on how to proceed are appreciated.
>
I would think the simpler way to proceed is to have a device specific
property indicating that standard mode is not available. From the
driver, you can then switch from standard to DSM when this property is
present.
I think it is difficult to come up with a generic property for that as
most other RTCs with level/threshold switching have a fast edge
detection feature that is usually enabled by default. So what they would
require instead is a property indicating that the voltage is ramping
down at a certain rate allowing to disable fast edge detection and
saving a bit of power.
--
Alexandre Belloni, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com