linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
To: "Pali Rohár" <pali.rohar@gmail.com>
Cc: "Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Michał Kępień" <kernel@kempniu.pl>,
	"Jean Delvare" <jdelvare@suse.com>,
	"Wolfram Sang" <wsa@the-dreams.de>,
	"Steven Honeyman" <stevenhoneyman@gmail.com>,
	"Valdis Kletnieks" <Valdis.Kletnieks@vt.edu>,
	"Jochen Eisinger" <jochen@penguin-breeder.org>,
	"Gabriele Mazzotta" <gabriele.mzt@gmail.com>,
	"Andy Lutomirski" <luto@kernel.org>,
	"Mario Limonciello" <Mario_Limonciello@dell.com>,
	"Alex Hung" <alex.hung@canonical.com>,
	"Takashi Iwai" <tiwai@suse.de>,
	linux-i2c@vger.kernel.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Platform Driver" <platform-driver-x86@vger.kernel.org>
Subject: Re: [PATCH] i2c: i801: Register optional lis3lv02d i2c device on Dell machines
Date: Wed, 4 Jan 2017 13:33:32 +0100	[thread overview]
Message-ID: <20170104123332.GU5767@mail.corp.redhat.com> (raw)
In-Reply-To: <20170104113500.GF3499@pali>

On Jan 04 2017 or thereabouts, Pali Rohár wrote:
> On Wednesday 04 January 2017 11:25:44 Benjamin Tissoires wrote:
> > On Jan 04 2017 or thereabouts, Andy Shevchenko wrote:
> > > On Tue, Jan 3, 2017 at 10:39 PM, Pali Rohár <pali.rohar@gmail.com> wrote:
> > > >
> > > > With Michał we already discussed about it, see emails. Basically you can
> > > > enable/disable kernel modules at compile time or blacklist at runtime
> > > > (or even chose what will be compiled into vmlinux and what as external
> > > > .ko module). Some distributions blacklist i2c-i801.ko module...
> > > 
> > > But you understand that any of compile/not compile is not an option, right?
> > > The case which we face will be both of them, if possible, will be
> > > compiled as modules.
> > > 
> > > Blacklisting means making your problem the actual user's one. Not good.
> > > 
> > > > And
> > > > there can be also problem with initialization of i2c-i801 driver (fix is
> > > > in commit a7ae81952cda, but does not have to work at every time!). So
> > > > that move on whitelisted machines can potentially cause disappearance of
> > > > /dev/freefall and users will not have hdd protection which is currently
> > > > working.
> > > 
> > 
> > I am seeing the same issues with psmouse and SMBus touchpads. The PS/2
> > device knows about the availability of a better but unlisted device at
> > the ACPI level.
> > 
> > The way I solved this to not have to deal with compile/not compile and
> > runtime errors is the same way Wolfram told you about: bus notifiers.
> > I also use an intermediate platform driver to not add i2c dependency on
> > psmouse.
> > 
> > For you the solution would be:
> > - In dell-smo8800, after checking the whitelist, add a platform driver
> >   "dell-lis3lv02d-platform", and add in the platform_data the I2C address
> >   of the chip.
> > - create a new driver dell-lis3lv02d-platform.ko which listens for the
> >   i2c bus creation and registers the lis3lv02d I2C node when it sees a
> >   matching adapter. (see [1] for my solution)
> > - in dell-lis3lv02d-platform.ko make sure to set the irq to -ENOENT so
> >   that lis3lv02d.ko doesn't create /dev/freefall which will still be
> >   handled by ACPI.
> > 
> > How does that sound?
> 
> Yes, something like this was already suggested. But it is more
> complicated as my approach and less error prone... See my notes in
> previous emails.

Sorry but I can't find your notes about errors in your previous emails.
This solution indeed is a little bit more complex than just adding the
bits in i2c-i801, but I don't really see the reason for an *adapter*
driver to instantiate specific *clients* depending on some DMI
matching.

It's a platform issue, so it should be solved at a platform level, not
at the i2c adapter level.

Plus the bus notifier solutions guarantees plain separation between the
elements and prevents any conflicts, with or without compile guards.

> 
> My current path (after fixing IRQ to -1) is smaller more intuitive and

This will only fix the fact that you have 2 concurrent drivers on the
same resource (freefall), not the fact that the global design of having
2 drivers which do not cooperate is wrong.

> do not introduce new complicated parts like bus notifier and new "fake"
> i2c driver...

It's not a "fake i2c driver". It's a platform driver. If you don't like
the idea of the platform driver, just add the bus notifier code in
dell-smo8800, but this will pull a new dependency on I2C in this ACPI
driver.

Cheers,
Benjamin

> > [1] https://github.com/bentiss/linux/blob/synaptics-rmi4-v4.9-rc7+/drivers/input/rmi4/rmi_platform.c 
> 
> -- 
> Pali Rohár
> pali.rohar@gmail.com

  reply	other threads:[~2017-01-04 12:34 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-27 12:52 [PATCH] i2c: i801: Register optional lis3lv02d i2c device on Dell machines Pali Rohár
2016-12-27 13:43 ` Wolfram Sang
2016-12-27 13:51   ` Pali Rohár
2016-12-27 22:15     ` Andy Shevchenko
2016-12-27 22:41       ` Valdis.Kletnieks
2016-12-28  7:55         ` Andy Shevchenko
2016-12-28  9:05           ` Pali Rohár
2016-12-28 14:03             ` Wolfram Sang
2016-12-29  4:37               ` Valdis.Kletnieks
2016-12-28  8:38       ` Pali Rohár
2016-12-28 14:02     ` Wolfram Sang
2017-01-04  9:45       ` Jean Delvare
2016-12-29  8:29 ` Michał Kępień
2016-12-29  9:00   ` Pali Rohár
2016-12-29 13:47     ` Michał Kępień
2016-12-29 14:17       ` Pali Rohár
2016-12-29 21:09         ` Michał Kępień
2016-12-29 21:28           ` Pali Rohár
2017-01-03  9:06             ` Benjamin Tissoires
2017-01-03  9:23               ` Pali Rohár
2017-01-03 18:38               ` Dmitry Torokhov
2017-01-03 18:50                 ` Pali Rohár
2017-01-03 18:58                   ` Mario.Limonciello
2017-01-03 19:48                   ` Dmitry Torokhov
2017-01-03 20:05                     ` Pali Rohár
2017-01-03 20:24                       ` Dmitry Torokhov
2017-01-03 20:39                         ` Pali Rohár
2017-01-03 20:59                           ` Dmitry Torokhov
2017-01-04  8:18                             ` Pali Rohár
2017-01-04  9:05                               ` Benjamin Tissoires
2017-01-04  9:18                                 ` Pali Rohár
2017-01-04 10:13                                   ` Benjamin Tissoires
2017-01-04 10:21                                     ` Pali Rohár
2017-01-04 10:32                                       ` Benjamin Tissoires
2017-01-04 11:22                                         ` Pali Rohár
2017-01-04 12:00                                           ` Pali Rohár
2017-01-04 13:02                                             ` Benjamin Tissoires
2017-01-04 16:06                                               ` Pali Rohár
2017-01-04 17:39                                                 ` Benjamin Tissoires
2017-01-04 17:46                                                   ` Wolfram Sang
2017-01-04 17:54                                                     ` Dmitry Torokhov
2017-01-04 21:49                                                       ` Benjamin Tissoires
2017-01-04 21:55                                                         ` Dmitry Torokhov
2017-01-04 21:55                                                       ` Wolfram Sang
2017-01-04 22:00                                                         ` Dmitry Torokhov
2017-01-04 22:03                                                           ` Dmitry Torokhov
2017-01-05  2:20                                                       ` [PATCH] i2c: do not enable fall back to Host Notify by default kbuild test robot
2017-01-05  2:21                                                       ` kbuild test robot
2017-01-05  8:54                                                       ` [PATCH] i2c: i801: Register optional lis3lv02d i2c device on Dell machines Pali Rohár
2017-01-05  9:26                                                         ` Benjamin Tissoires
2017-01-04 18:50                             ` Jean Delvare
2017-01-04  9:53                           ` Andy Shevchenko
2017-01-04 10:25                             ` Benjamin Tissoires
2017-01-04 11:35                               ` Pali Rohár
2017-01-04 12:33                                 ` Benjamin Tissoires [this message]
2017-01-03 21:29                     ` Benjamin Tissoires
2017-01-04  6:36                       ` Dmitry Torokhov
2017-01-04  9:13                         ` Benjamin Tissoires
2017-01-04  9:25                           ` Pali Rohár
2017-01-03 20:20                   ` Andy Shevchenko
2017-01-04 10:18               ` Jean Delvare
2017-01-07 12:49         ` Wolfram Sang

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=20170104123332.GU5767@mail.corp.redhat.com \
    --to=benjamin.tissoires@redhat.com \
    --cc=Mario_Limonciello@dell.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=alex.hung@canonical.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=gabriele.mzt@gmail.com \
    --cc=jdelvare@suse.com \
    --cc=jochen@penguin-breeder.org \
    --cc=kernel@kempniu.pl \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=pali.rohar@gmail.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=stevenhoneyman@gmail.com \
    --cc=tiwai@suse.de \
    --cc=wsa@the-dreams.de \
    /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;
as well as URLs for NNTP newsgroup(s).