mbox series

[v1,0/2] ALSA: cs35l41: prevent old firmwares using unsupported commands

Message ID 20230922142818.2021103-1-sbinding@opensource.cirrus.com (mailing list archive)
Headers show
Series ALSA: cs35l41: prevent old firmwares using unsupported commands | expand

Message

Stefan Binding Sept. 22, 2023, 2:28 p.m. UTC
Some systems use older firmware which does not support newer commands
which are used to enable external boost. For those systems, we can
workaround this by writing the registers directly.

We can use the firmware version, stored inside cs_dsp, to determine
whether or not the command is supported.
To achieve this, it requires a cleanup in the api, to pass the cs_dsp
struct into the function.

We can also remove the redundant boolean firmware_running from the HDA
driver, and use the equivalent state inside cs_dsp.

This chain is based on Mark's branch, since the api change was made to
the function in sound/soc/codecs/cs35l41-lib.c.

Stefan Binding (2):
  ALSA: hda: cs35l41: Remove unnecessary boolean state variable
    firmware_running
  ALSA: cs35l41: Fix for old systems which do not support command

 include/sound/cs35l41.h        |  2 +-
 sound/pci/hda/cs35l41_hda.c    | 28 ++++++++++++----------------
 sound/pci/hda/cs35l41_hda.h    |  1 -
 sound/soc/codecs/cs35l41-lib.c |  6 ++++--
 sound/soc/codecs/cs35l41.c     |  4 ++--
 5 files changed, 19 insertions(+), 22 deletions(-)

Comments

Takashi Iwai Sept. 22, 2023, 2:35 p.m. UTC | #1
On Fri, 22 Sep 2023 16:28:16 +0200,
Stefan Binding wrote:
> 
> Some systems use older firmware which does not support newer commands
> which are used to enable external boost. For those systems, we can
> workaround this by writing the registers directly.
> 
> We can use the firmware version, stored inside cs_dsp, to determine
> whether or not the command is supported.
> To achieve this, it requires a cleanup in the api, to pass the cs_dsp
> struct into the function.
> 
> We can also remove the redundant boolean firmware_running from the HDA
> driver, and use the equivalent state inside cs_dsp.

So those are fixes needed for 6.6 kernel?  Or they are something new?

> This chain is based on Mark's branch, since the api change was made to
> the function in sound/soc/codecs/cs35l41-lib.c.

I'd need a PR from Mark before applying those, then.


thanks,

Takashi
Mark Brown Sept. 22, 2023, 2:38 p.m. UTC | #2
On Fri, Sep 22, 2023 at 04:35:45PM +0200, Takashi Iwai wrote:
> Stefan Binding wrote:

> > This chain is based on Mark's branch, since the api change was made to

The term is patch series.

> > the function in sound/soc/codecs/cs35l41-lib.c.

> I'd need a PR from Mark before applying those, then.

Or if they're 6.7 stuff I guess I could just carry them.
Takashi Iwai Sept. 22, 2023, 2:42 p.m. UTC | #3
On Fri, 22 Sep 2023 16:38:28 +0200,
Mark Brown wrote:
> 
> On Fri, Sep 22, 2023 at 04:35:45PM +0200, Takashi Iwai wrote:
> > Stefan Binding wrote:
> 
> > > This chain is based on Mark's branch, since the api change was made to
> 
> The term is patch series.
> 
> > > the function in sound/soc/codecs/cs35l41-lib.c.
> 
> > I'd need a PR from Mark before applying those, then.
> 
> Or if they're 6.7 stuff I guess I could just carry them.

Yes, that's another option.  But there are already changes for HDA
cs35l41 stuff for 6.7, and you might need to pull from my for-next
branch beforehand.  A bit messy in either way.


thanks,

Takashi
Stefan Binding Sept. 22, 2023, 2:44 p.m. UTC | #4
> -----Original Message-----
> From: Takashi Iwai <tiwai@suse.de>
> Sent: Friday, September 22, 2023 3:36 PM
> To: Stefan Binding <sbinding@opensource.cirrus.com>
> Cc: Mark Brown <broonie@kernel.org>; Jaroslav Kysela
> <perex@perex.cz>; Takashi Iwai <tiwai@suse.com>; alsa-devel@alsa-
> project.org; linux-kernel@vger.kernel.org;
> patches@opensource.cirrus.com
> Subject: Re: [PATCH v1 0/2] ALSA: cs35l41: prevent old firmwares
using
> unsupported commands
> 
> On Fri, 22 Sep 2023 16:28:16 +0200,
> Stefan Binding wrote:
> >
> > Some systems use older firmware which does not support newer
> commands
> > which are used to enable external boost. For those systems, we can
> > workaround this by writing the registers directly.
> >
> > We can use the firmware version, stored inside cs_dsp, to
determine
> > whether or not the command is supported.
> > To achieve this, it requires a cleanup in the api, to pass the
cs_dsp
> > struct into the function.
> >
> > We can also remove the redundant boolean firmware_running from the
> HDA
> > driver, and use the equivalent state inside cs_dsp.
> 
> So those are fixes needed for 6.6 kernel?  Or they are something
new?

These are to fix the issue that was reported on the Lenovo Legion 7
16ACHg6,
which was introduced after the fixes to CS35L41 HDA System Suspend.

Thanks,
Stefan

> 
> > This chain is based on Mark's branch, since the api change was
made to
> > the function in sound/soc/codecs/cs35l41-lib.c.
> 
> I'd need a PR from Mark before applying those, then.
> 
> 
> thanks,
> 
> Takashi
Mark Brown Sept. 22, 2023, 2:48 p.m. UTC | #5
On Fri, Sep 22, 2023 at 03:44:30PM +0100, Stefan Binding wrote:

> > So those are fixes needed for 6.6 kernel?  Or they are something
> new?

> These are to fix the issue that was reported on the Lenovo Legion 7
> 16ACHg6,
> which was introduced after the fixes to CS35L41 HDA System Suspend.

Could you be more specific about which fixes these are and which tree
they're in?  If they're fixes then I don't have anything queued for 6.6
so I'm confused about why you say there's a dependency on my tree.
Takashi Iwai Sept. 22, 2023, 2:53 p.m. UTC | #6
On Fri, 22 Sep 2023 16:48:03 +0200,
Mark Brown wrote:
> 
> On Fri, Sep 22, 2023 at 03:44:30PM +0100, Stefan Binding wrote:
> 
> > > So those are fixes needed for 6.6 kernel?  Or they are something
> > new?
> 
> > These are to fix the issue that was reported on the Lenovo Legion 7
> > 16ACHg6,
> > which was introduced after the fixes to CS35L41 HDA System Suspend.
> 
> Could you be more specific about which fixes these are and which tree
> they're in?  If they're fixes then I don't have anything queued for 6.6
> so I'm confused about why you say there's a dependency on my tree.

Yeah.  The suspend fix has been landed in 6.6-rc1, so it's for 6.6, I
suppose.

Stefan, if it's a fix for a known commit, please put Fixes tag at the
next time.


thanks,

Takashi