linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Prarit Bhargava <prarit@redhat.com>
To: Jean Delvare <jdelvare@suse.de>
Cc: linux-i2c@vger.kernel.org, linux-acpi@vger.kernel.org,
	Seth Heasley <seth.heasley@intel.com>,
	Matthew Garrett <matthew.garrett@nebula.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Janet Morgan <janet.morgan@intel.com>,
	Myron Stowe <mstowe@redhat.com>
Subject: Re: [PATCH RFC] i2c algo, Add i2c-algo-i801 driver [v1]
Date: Wed, 09 Apr 2014 12:57:36 -0400	[thread overview]
Message-ID: <53457C00.1030400@redhat.com> (raw)
In-Reply-To: <20140409183732.5c8f6355@endymion.delvare>



On 04/09/2014 12:37 PM, Jean Delvare wrote:
> Hi Prarit,
> 
> On Wed,  9 Apr 2014 12:22:43 -0400, Prarit Bhargava wrote:
>> RFC and a work in progress ... I need to go through and do a bunch of error
>> condition checking, more testing, etc.  I'm just throwing this out there to see
>> if anyone has any major concerns about doing something like this.
>>
>> TODO:
>>
>> - decipher error returns from ACPI AML operations (and implement those too)
>> - additional error checking from i2c and acpi function calls (this code is
>> not robust enough)
>> - testing
>>
>> P.
>>
>> ----8<----
>>
>> Some ACPI tables on new systems implement an SBUS device in ACPI.  This results
>> in a conflict with the ACPI tables and the i2c-i801 driver over the address
>> space.  As a result the i2c-i801 driver will not load.  To workaround this, we
>> have users use the kernel parameter "acpi_enforce_resources=lax".  This,
>> isn't a good solution as I've seen other conflicts on some systems that are
>> also overriden.  I thought about implementing an i2c-core kernel parameter and
>> a wrapper function for acpi_check_resource_conflict() but that seems rather
>> clunky and doesn't resolve the issue of the shared resource between the ACPI
>> and the device.
>>
>> There isn't any documentaton on Intel's website about the SBUS device but from
>> reading the acpidump it looks like the operations are straightforward.
>>
>> SSXB
>>      transmit one byte
>> SRXB
>>      receive one byte
>> SWRB
>>      write one byte
>> SRDB
>>      read one byte
>> SWRW
>>      write one word
>> SRDW
>>      read one word
>> SBLW
>>      write block
>> SBRW
>>      read block
>>
>> I've implemented these as an i2c algorithm so that users who cannot load the
>> regular i801 i2c driver can at least get the functionality they are looking
>> for.
> 
> Writing a driver for the ACPI interface to the SMBus is IMHO a very
> good idea, thanks for doing that.
> 
> However I have two technical concerns with your approach:
> 
> 1* What you wrote is NOT an "i2c algo". i2c "algorithms" are abstracted
> I2C implementations, not correlated with any hardware or BIOS specific
> interfaces. If you check other drivers under i2c/algos you'll see they
> do NOT call i2c_add_adapter (although they may implement helper
> wrappers around that function.) Hardware-specific drivers which build
> on top of the algo driver are responsible for that.
> 
> What you wrote is much more like i2c/busses/i2c-scmi.c, so it is
> actually an i2c _bus_ driver.
> 
> 2* You are creating a link between i2c-i801 and your driver, where IMHO
> there should not be any. Both drivers are independent, and from the
> kernel's perspective, they are not even for the same hardware. In your
> case the ACPI interface is backed by an i801-like chip, but the same
> interface could totally be implemented on top of any other chip.
> 
> So I invite you to make your driver an independent i2c bus driver much
> like i2c-scmi.

Hey Jean -- thanks for the valuable feedback.  This is exactly why I RFC'd it :)
before I got in too deep :)

I'll rework the patch with your suggestions.  I may have (possibly dumb)
questions and I hope that's okay ..

P.
> 
> Thanks,
> 

  reply	other threads:[~2014-04-09 16:57 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-09 16:22 [PATCH RFC] i2c algo, Add i2c-algo-i801 driver [v1] Prarit Bhargava
     [not found] ` <1397060563-30431-1-git-send-email-prarit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-04-09 16:36   ` Matthew Garrett
2014-04-09 17:02     ` Prarit Bhargava
     [not found]       ` <53457D0D.7020805-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-04-09 17:09         ` Matthew Garrett
2014-04-09 17:34           ` Prarit Bhargava
     [not found]             ` <5345849F.6070909-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-04-09 17:37               ` Matthew Garrett
2014-04-09 17:55                 ` Prarit Bhargava
     [not found]                   ` <53458992.4060003-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-04-09 17:59                     ` Matthew Garrett
2014-04-09 18:02                       ` Prarit Bhargava
     [not found]                         ` <53458B2A.30003-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-04-09 18:27                           ` Matthew Garrett
2014-04-09 19:22                       ` Jean Delvare
2014-04-09 19:24                         ` Matthew Garrett
2014-04-09 19:01           ` Jean Delvare
2014-04-09 19:05             ` Matthew Garrett
2014-04-10 19:15           ` Prarit Bhargava
2014-04-10 20:26             ` Matthew Garrett
2014-04-11 17:47               ` Prarit Bhargava
     [not found]                 ` <53482AC2.2060605-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-04-11 18:55                   ` Matthew Garrett
2014-04-09 18:56     ` Jean Delvare
2014-04-09 18:58       ` Matthew Garrett
2014-04-09 20:25         ` Jean Delvare
2014-04-09 16:37   ` Jean Delvare
2014-04-09 16:57     ` Prarit Bhargava [this message]
     [not found]       ` <53457C00.1030400-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2014-04-09 20:27         ` Jean Delvare

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=53457C00.1030400@redhat.com \
    --to=prarit@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=janet.morgan@intel.com \
    --cc=jdelvare@suse.de \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=matthew.garrett@nebula.com \
    --cc=mstowe@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=seth.heasley@intel.com \
    /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).