lkml.org 
[lkml]   [2020]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv3 4/5] Input: EXC3000: Add support to query model and fw_version
On Wed, May 20, 2020 at 11:25:40PM +0200, Sebastian Reichel wrote:
> Hi,
>
> On Wed, May 20, 2020 at 10:49:52AM -0700, Dmitry Torokhov wrote:
> > Hi Sebastian,
> >
> > On Wed, May 20, 2020 at 05:39:35PM +0200, Sebastian Reichel wrote:
> > > Expose model and fw_version via sysfs. Also query the model
> > > in probe to make sure, that the I2C communication with the
> > > device works before successfully probing the driver.
> > >
> > > This is a bit complicated, since EETI devices do not have
> > > a sync interface. Sending the commands and directly reading
> > > does not work. Sending the command and waiting for some time
> > > is also not an option, since there might be touch events in
> > > the mean time.
> > >
> > > Last but not least we do not cache the results, since this
> > > interface can be used to check the I2C communication is still
> > > working as expected.
> > >
> > > Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> > > ---
> > > .../ABI/testing/sysfs-driver-input-exc3000 | 15 ++
> > > drivers/input/touchscreen/exc3000.c | 145 +++++++++++++++++-
> > > 2 files changed, 159 insertions(+), 1 deletion(-)
> > > create mode 100644 Documentation/ABI/testing/sysfs-driver-input-exc3000
> > >
> > > diff --git a/Documentation/ABI/testing/sysfs-driver-input-exc3000 b/Documentation/ABI/testing/sysfs-driver-input-exc3000
> > > new file mode 100644
> > > index 000000000000..d79da4f869af
> > > --- /dev/null
> > > +++ b/Documentation/ABI/testing/sysfs-driver-input-exc3000
> > > @@ -0,0 +1,15 @@
> > > +What: /sys/class/input/inputX/fw_version
> > > +Date: May 2020
> > > +Contact: linux-input@vger.kernel.org
> > > +Description: Reports the firmware version provided by the touchscreen, for example "00_T6" on a EXC80H60
> > > +
> > > + Access: Read
> > > + Valid values: Represented as string
> > > +
> > > +What: /sys/class/input/inputX/model
> > > +Date: May 2020
> > > +Contact: linux-input@vger.kernel.org
> > > +Description: Reports the model identification provided by the touchscreen, for example "Orion_1320" on a EXC80H60
> > > +
> > > + Access: Read
> > > + Valid values: Represented as string
> >
> > These are properties of the controller (i2c device), not input
> > abstraction class on top of it, so the attributes should be attached to
> > i2c_client instance.
> >
> > Please use devm_device_add_group() in probe to instantiate them at the
> > proper level.
>
> As written in the cover letter using devm_device_add_group() in
> probe routine results in a udev race condition:
>
> http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/

This race has been solved with the addition of KOBJ_BIND/KOBJ_UNBIND
uevents that signal when driver is bound or unbound from the device.
Granted, current systemd/udev drops them as it does not know how to
"add" to the device state, but this is on systemd to solve.

Thanks.

--
Dmitry

\
 
 \ /
  Last update: 2020-05-21 07:54    [W:0.160 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site