linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Binding <sbinding@opensource.cirrus.com>
To: "'Rafael J. Wysocki'" <rafael@kernel.org>
Cc: 'Mark Brown' <broonie@kernel.org>, 'Len Brown' <lenb@kernel.org>,
	'Hans de Goede' <hdegoede@redhat.com>,
	'Mark Gross' <markgross@kernel.org>,
	'Jaroslav Kysela' <perex@perex.cz>,
	'Takashi Iwai' <tiwai@suse.com>,
	"'moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER
	MANAGEM...'"  <alsa-devel@alsa-project.org>,
	'Linux Kernel Mailing List' <linux-kernel@vger.kernel.org>,
	'linux-spi' <linux-spi@vger.kernel.org>,
	'ACPI Devel Maling List' <linux-acpi@vger.kernel.org>,
	'Platform Driver' <platform-driver-x86@vger.kernel.org>,
	<patches@opensource.cirrus.com>
Subject: RE: [PATCH v5 7/9] platform/x86: serial-multi-instantiate: Add SPI support
Date: Fri, 21 Jan 2022 16:55:10 +0000	[thread overview]
Message-ID: <019901d80ee7$a6bf2a90$f43d7fb0$@opensource.cirrus.com> (raw)
In-Reply-To: <CAJZ5v0gK=-SXUDekg_2DtOuMsn6Ls4gS+nymei2Qa9ZEFvqGcA@mail.gmail.com>

Hi,

> -----Original Message-----
> From: Rafael J. Wysocki <rafael@kernel.org>
> Sent: 21 January 2022 15:31
> To: Stefan Binding <sbinding@opensource.cirrus.com>
> Cc: Mark Brown <broonie@kernel.org>; Rafael J . Wysocki
> <rafael@kernel.org>; Len Brown <lenb@kernel.org>; Hans de Goede
> <hdegoede@redhat.com>; Mark Gross <markgross@kernel.org>; Jaroslav
> Kysela <perex@perex.cz>; Takashi Iwai <tiwai@suse.com>; moderated
> list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM... <alsa-
> devel@alsa-project.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>; linux-spi <linux-spi@vger.kernel.org>; ACPI Devel
> Maling List <linux-acpi@vger.kernel.org>; Platform Driver <platform-driver-
> x86@vger.kernel.org>; patches@opensource.cirrus.com
> Subject: Re: [PATCH v5 7/9] platform/x86: serial-multi-instantiate: Add SPI
> support
> 


> > diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> > index 5b65d687f046..28f5bbf0f27a 100644
> > --- a/drivers/platform/x86/Kconfig
> > +++ b/drivers/platform/x86/Kconfig
> > @@ -991,12 +991,12 @@ config TOPSTAR_LAPTOP
> >           If you have a Topstar laptop, say Y or M here.
> >
> >  config SERIAL_MULTI_INSTANTIATE
> > -       tristate "I2C multi instantiate pseudo device driver"
> > -       depends on I2C && ACPI
> > +       tristate "I2C and SPI multi instantiate pseudo device driver"
> > +       depends on I2C && SPI && ACPI
> 
> Should this be (I2C || SPI) && ACPI ?

We made it dependent on both I2C and SPI because of how interconnected the
serial-multi-instantiate driver is with both SPI and I2C. We felt attempting to make
the driver compatible with one without the other would end up very complicated.

> > @@ -146,7 +247,21 @@ static int smi_probe(struct platform_device *pdev)
> >
> >         platform_set_drvdata(pdev, smi);
> >
> > -       return smi_i2c_probe(pdev, adev, smi, inst_array);
> > +       switch (node->bus_type) {
> > +       case SMI_I2C:
> > +               return smi_i2c_probe(pdev, adev, smi, node->instances);
> > +       case SMI_SPI:
> > +               return smi_spi_probe(pdev, adev, smi, node->instances);
> > +       case SMI_AUTO_DETECT:
> > +               if (i2c_acpi_client_count(adev) > 0)
> > +                       return smi_i2c_probe(pdev, adev, smi, node->instances);
> > +               else
> > +                       return smi_spi_probe(pdev, adev, smi, node->instances);
> > +       default:
> > +               break;
> 
> Why is this needed?

This return code is attempting to ensure that we don’t try to guess whether we
expect devices to be I2C or SPI - especially with regards to existing devices.
We wanted to maintain compatibility with existing devices, which would all be
I2C.
For the device for which we are adding, the same HID is used by both the same
chip for both I2C and SPI, so we also needed a way to support both.

Thanks,
Stefan


  reply	other threads:[~2022-01-21 16:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-21 14:32 [PATCH v5 0/9] Support Spi in i2c-multi-instantiate driver Stefan Binding
2022-01-21 14:32 ` [PATCH v5 1/9] spi: Make spi_alloc_device and spi_add_device public again Stefan Binding
2022-01-21 14:32 ` [PATCH v5 2/9] spi: Create helper API to lookup ACPI info for spi device Stefan Binding
2022-01-21 14:32 ` [PATCH v5 3/9] spi: Support selection of the index of the ACPI Spi Resource before alloc Stefan Binding
2022-01-21 14:32 ` [PATCH v5 4/9] spi: Add API to count spi acpi resources Stefan Binding
2022-01-21 14:32 ` [PATCH v5 5/9] platform/x86: i2c-multi-instantiate: Rename it for a generic serial driver name Stefan Binding
2022-01-21 15:12   ` Rafael J. Wysocki
2022-01-21 14:32 ` [PATCH v5 6/9] platform/x86: serial-multi-instantiate: Reorganize I2C functions Stefan Binding
2022-01-21 15:27   ` Rafael J. Wysocki
2022-01-21 14:32 ` [PATCH v5 7/9] platform/x86: serial-multi-instantiate: Add SPI support Stefan Binding
2022-01-21 15:31   ` Rafael J. Wysocki
2022-01-21 16:55     ` Stefan Binding [this message]
2022-01-21 17:14       ` Rafael J. Wysocki
2022-01-26 15:19         ` Stefan Binding
2022-01-21 14:32 ` [PATCH v5 8/9] ALSA: hda/realtek: Add support for HP Laptops Stefan Binding
2022-01-21 14:44   ` Takashi Iwai
2022-01-21 14:32 ` [PATCH v5 9/9] ACPI / scan: Create platform device for CS35L41 Stefan Binding
2022-01-21 16:02   ` Rafael J. Wysocki

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='019901d80ee7$a6bf2a90$f43d7fb0$@opensource.cirrus.com' \
    --to=sbinding@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=perex@perex.cz \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=tiwai@suse.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).