mbox series

[v3,0/3] ALSA: hda/tas2781: Add tas2781 driver for SPI.

Message ID 20240418040240.2337-1-baojun.xu@ti.com (mailing list archive)
Headers show
Series ALSA: hda/tas2781: Add tas2781 driver for SPI. | expand

Message

Baojun Xu April 18, 2024, 4:02 a.m. UTC
This patch was used to add TAS2781 devices on SPI support in sound/pci/hda.
It use ACPI node descript about parameters of TAS2781 on SPI, it like:
    Scope (_SB.PC00.SPI0)
    {
        Device (GSPK)
        {
            Name (_HID, "TXNW2781")  // _HID: Hardware ID
            Method (_CRS, 0, NotSerialized)
            {
                Name (RBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (...)
                    SpiSerialBusV2 (...)
                }
            }
        }
    }

And in platform/x86/serial-multi-instantiate.c, those spi devices will be
added into system as a single SPI device, so TAS2781 SPI driver will
probe twice for every single SPI device. And driver will also parser
mono DSP firmware binary and RCA binary for itself.

Signed-off-by: Baojun Xu <baojun.xu@ti.com>

Baojun Xu (3):
  ALSA: hda/tas2781: Modification for add tas2781 driver for SPI
  ALSA: hda/tas2781: Main code of tas2781 driver for SPI
  ALSA: hda/tas2781: Firmware load for tas2781 driver for SPI

 drivers/acpi/scan.c                           |    1 +
 .../platform/x86/serial-multi-instantiate.c   |   10 +
 sound/pci/hda/Kconfig                         |   15 +
 sound/pci/hda/Makefile                        |    2 +
 sound/pci/hda/patch_realtek.c                 |   13 +
 sound/pci/hda/tas2781-spi.h                   |  165 ++
 sound/pci/hda/tas2781_hda_spi.c               | 1305 ++++++++++
 sound/pci/hda/tas2781_spi_fwlib.c             | 2272 +++++++++++++++++
 8 files changed, 3783 insertions(+)
 create mode 100644 sound/pci/hda/tas2781-spi.h
 create mode 100644 sound/pci/hda/tas2781_hda_spi.c
 create mode 100644 sound/pci/hda/tas2781_spi_fwlib.c

Comments

Baojun Xu April 25, 2024, 7:54 a.m. UTC | #1
Hi Andy,

Thanks for your feedback.

> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Sent: 18 April 2024 19:56
> To: Xu, Baojun
> Cc: tiwai@suse.de; robh+dt@kernel.org; lgirdwood@gmail.com; perex@perex.cz; pierre-louis.bossart@linux.intel.com; Lu, Kevin; Ding, Shenghao; Navada Kanyana, Mukund; 13916275206@139.com; P O, Vijeth; Holalu Yogendra, Niranjan; alsa-devel@alsa-project.org; linux-kernel@vger.kernel.org; liam.r.girdwood@intel.com; yung-chuan.liao@linux.intel.com; broonie@kernel.org; soyer@irl.hu
> Subject: [EXTERNAL] Re: [PATCH v3 1/3] ALSA: hda/tas2781: Modification for add tas2781 driver for SPI
> 
> On Thu, Apr 18, 2024 at 12: 02: 37PM +0800, Baojun Xu wrote: > Integrate tas2781 configs for HP Laptops. Every tas2781 in the laptop > will work as a single speaker on SPI bus. The code support realtek as Realtek > the primary codec. 
> ZjQcmQRYFpfptBannerStart
> This message was sent from outside of Texas Instruments.
> Do not click links or open attachments unless you recognize the source of this email and know the content is safe. If you wish to report this message to IT Security, please forward the message as an attachment to phishing@list.ti.com
> 
> ZjQcmQRYFpfptBannerEnd
> 
> On Thu, Apr 18, 2024 at 12:02:37PM +0800, Baojun Xu wrote:
> > Integrate tas2781 configs for HP Laptops. Every tas2781 in the laptop
> > will work as a single speaker on SPI bus. The code support realtek as
> 
> Realtek
> 
> > the primary codec.
> 
> ...
> 
> >  sound/pci/hda/Kconfig                           | 15 +++++++++++++++
> >  sound/pci/hda/Makefile                          |  2 ++
> 
> Is this correct? You are adding a dead "code", isn't it?
> 

What's mean "dead code"? After add CONFIG_SND_HDA_SCODEC_TAS2781_SPI=m
in my config file, the whole patch code has worked.

> ...
> 
> The rest LGTM.
> 
> --
> With Best Regards,
> Andy Shevchenko
> 


Best Regards
Jim
Andy Shevchenko May 2, 2024, 10:22 a.m. UTC | #2
On Thu, Apr 25, 2024 at 07:54:41AM +0000, Xu, Baojun wrote:
> > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Sent: 18 April 2024 19:56
> > On Thu, Apr 18, 2024 at 12: 02: 37PM +0800, Baojun Xu wrote:
> > On Thu, Apr 18, 2024 at 12:02:37PM +0800, Baojun Xu wrote:

...

> > >  sound/pci/hda/Kconfig                           | 15 +++++++++++++++
> > >  sound/pci/hda/Makefile                          |  2 ++
> > 
> > Is this correct? You are adding a dead "code", isn't it?
> 
> What's mean "dead code"? After add CONFIG_SND_HDA_SCODEC_TAS2781_SPI=m
> in my config file, the whole patch code has worked.

Is that file already in the repository?
If not, I don't see it in this patch either --> dead code.
Baojun Xu May 6, 2024, 7:44 a.m. UTC | #3
Hi Andy

Thanks for your comments, answer in line:

> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Sent: 02 May 2024 18:22
> To: Xu, Baojun
> Cc: tiwai@suse.de; robh+dt@kernel.org; lgirdwood@gmail.com; perex@perex.cz; pierre-louis.bossart@linux.intel.com; Lu, Kevin; Ding, Shenghao; Navada Kanyana, Mukund; 13916275206@139.com; P O, Vijeth; Holalu Yogendra, Niranjan; alsa-devel@alsa-project.org; linux-kernel@vger.kernel.org; liam.r.girdwood@intel.com; yung-chuan.liao@linux.intel.com; broonie@kernel.org; soyer@irl.hu
> Subject: Re: [EXTERNAL] Re: [PATCH v3 1/3] ALSA: hda/tas2781: Modification for add tas2781 driver for SPI
> 
> On Thu, Apr 25, 2024 at 07: 54: 41AM +0000, Xu, Baojun wrote: > > From: Andy Shevchenko <andriy. shevchenko@ linux. intel. com> > > Sent: 18 April 2024 19: 56 > > On Thu, Apr 18, 2024 at 12: 02: 37PM +0800, Baojun Xu wrote: 
> ZjQcmQRYFpfptBannerStart
> This message was sent from outside of Texas Instruments.
> Do not click links or open attachments unless you recognize the source of this email and know the content is safe. If you wish to report this message to IT Security, please forward the message as an attachment to phishing@list.ti.com
> 
> ZjQcmQRYFpfptBannerEnd
> 
> On Thu, Apr 25, 2024 at 07:54:41AM +0000, Xu, Baojun wrote:
> > > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Sent: 18 April 2024 19:56
> > > On Thu, Apr 18, 2024 at 12: 02: 37PM +0800, Baojun Xu wrote:
> > > On Thu, Apr 18, 2024 at 12:02:37PM +0800, Baojun Xu wrote:
> 
> ...
> 
> > > >  sound/pci/hda/Kconfig                           | 15 +++++++++++++++
> > > >  sound/pci/hda/Makefile                          |  2 ++
> > >
> > Is this correct? You are adding a dead "code", isn't it?
> >
> > What's mean "dead code"? After add CONFIG_SND_HDA_SCODEC_TAS2781_SPI=m
> > in my config file, the whole patch code has worked.
> 
> Is that file already in the repository?
> If not, I don't see it in this patch either --> dead code.

When I integrated CONFIG_SND_HDA_SCODEC_TAS2781_SPI and compiled the whole kernel,
it used to popup the following message for TAS2781 SPI module in first compile:
 
 Build TAS2781 HD-audio side codec support for SPI Bus (SND_HDA_SCODEC_TAS2781_SPI) [N/m/?] (NEW) 

Normally, selected m. And TAS2781 SPI module would be compiled.

> 
> --
> With Best Regards,
> Andy Shevchenko
> 
>
Andy Shevchenko May 6, 2024, 8:44 a.m. UTC | #4
On Mon, May 06, 2024 at 07:44:05AM +0000, Xu, Baojun wrote:
> > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Sent: 02 May 2024 18:22
> > To: Xu, Baojun
> > On Thu, Apr 25, 2024 at 07: 54: 41AM +0000, Xu, Baojun wrote:
> > On Thu, Apr 25, 2024 at 07:54:41AM +0000, Xu, Baojun wrote:
> > > > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > > Sent: 18 April 2024 19:56
> > > > On Thu, Apr 18, 2024 at 12: 02: 37PM +0800, Baojun Xu wrote:
> > > > On Thu, Apr 18, 2024 at 12:02:37PM +0800, Baojun Xu wrote:

...

> > > > >  sound/pci/hda/Kconfig                           | 15 +++++++++++++++
> > > > >  sound/pci/hda/Makefile                          |  2 ++
> > > >
> > > Is this correct? You are adding a dead "code", isn't it?
> > >
> > > What's mean "dead code"? After add CONFIG_SND_HDA_SCODEC_TAS2781_SPI=m
> > > in my config file, the whole patch code has worked.
> > 
> > Is that file already in the repository?
> > If not, I don't see it in this patch either --> dead code.
> 
> When I integrated CONFIG_SND_HDA_SCODEC_TAS2781_SPI and compiled the whole kernel,
> it used to popup the following message for TAS2781 SPI module in first compile:
>  
>  Build TAS2781 HD-audio side codec support for SPI Bus (SND_HDA_SCODEC_TAS2781_SPI) [N/m/?] (NEW) 
> 
> Normally, selected m. And TAS2781 SPI module would be compiled.

The above is a dead code if this SPI driver is not yet in the kernel. Is it?
What is the path to it in the current kernel source tree?
Takashi Iwai May 6, 2024, 11:16 a.m. UTC | #5
On Mon, 06 May 2024 09:44:05 +0200,
Xu, Baojun wrote:
> 
> Hi Andy
> 
> Thanks for your comments, answer in line:
> 
> > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Sent: 02 May 2024 18:22
> > To: Xu, Baojun
> > Cc: tiwai@suse.de; robh+dt@kernel.org; lgirdwood@gmail.com; perex@perex.cz; pierre-louis.bossart@linux.intel.com; Lu, Kevin; Ding, Shenghao; Navada Kanyana, Mukund; 13916275206@139.com; P O, Vijeth; Holalu Yogendra, Niranjan; alsa-devel@alsa-project.org; linux-kernel@vger.kernel.org; liam.r.girdwood@intel.com; yung-chuan.liao@linux.intel.com; broonie@kernel.org; soyer@irl.hu
> > Subject: Re: [EXTERNAL] Re: [PATCH v3 1/3] ALSA: hda/tas2781: Modification for add tas2781 driver for SPI
> > 
> > On Thu, Apr 25, 2024 at 07: 54: 41AM +0000, Xu, Baojun wrote: > > From: Andy Shevchenko <andriy. shevchenko@ linux. intel. com> > > Sent: 18 April 2024 19: 56 > > On Thu, Apr 18, 2024 at 12: 02: 37PM +0800, Baojun Xu wrote: 
> > ZjQcmQRYFpfptBannerStart
> > This message was sent from outside of Texas Instruments.
> > Do not click links or open attachments unless you recognize the source of this email and know the content is safe. If you wish to report this message to IT Security, please forward the message as an attachment to phishing@list.ti.com
> > 
> > ZjQcmQRYFpfptBannerEnd
> > 
> > On Thu, Apr 25, 2024 at 07:54:41AM +0000, Xu, Baojun wrote:
> > > > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > > Sent: 18 April 2024 19:56
> > > > On Thu, Apr 18, 2024 at 12: 02: 37PM +0800, Baojun Xu wrote:
> > > > On Thu, Apr 18, 2024 at 12:02:37PM +0800, Baojun Xu wrote:
> > 
> > ...
> > 
> > > > >  sound/pci/hda/Kconfig                           | 15 +++++++++++++++
> > > > >  sound/pci/hda/Makefile                          |  2 ++
> > > >
> > > Is this correct? You are adding a dead "code", isn't it?
> > >
> > > What's mean "dead code"? After add CONFIG_SND_HDA_SCODEC_TAS2781_SPI=m
> > > in my config file, the whole patch code has worked.
> > 
> > Is that file already in the repository?
> > If not, I don't see it in this patch either --> dead code.
> 
> When I integrated CONFIG_SND_HDA_SCODEC_TAS2781_SPI and compiled the whole kernel,
> it used to popup the following message for TAS2781 SPI module in first compile:
>  
>  Build TAS2781 HD-audio side codec support for SPI Bus (SND_HDA_SCODEC_TAS2781_SPI) [N/m/?] (NEW) 
> 
> Normally, selected m. And TAS2781 SPI module would be compiled.

At each patch / commit, the build must be kept successful.
In your case, in the patch 1, you introduced the new driver stuff to
Kconfig and Makefile while there is no actual code for that yet (which
will be added in later patches).  This breaks the build at this
commit (lacking tas2781_hda_spi.c and co), and it's not acceptable.

You have to split patches in sensible manners; those to be logically
split, and yet they must not break builds.


thanks,

Takashi