All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Binding <sbinding@opensource.cirrus.com>
To: 'Pierre-Louis Bossart' <pierre-louis.bossart@linux.intel.com>,
	"'Mark Brown'" <broonie@kernel.org>,
	'Liam Girdwood' <lgirdwood@gmail.com>,
	"'Brent Lu'" <brent.lu@intel.com>, 'xliu' <xiang.liu@cirrus.com>
Cc: 'Vitaly Rodionov' <vitalyr@opensource.cirrus.com>,
	<patches@opensource.cirrus.com>, <alsa-devel@alsa-project.org>,
	<linux-kernel@vger.kernel.org>
Subject: RE: [PATCH v2] ASoC: Intel: cirrus-common: Use UID to map correct amp to prefix
Date: Fri, 29 Jul 2022 15:24:42 +0100	[thread overview]
Message-ID: <001c01d8a356$f1b4e9f0$d51ebdd0$@opensource.cirrus.com> (raw)
In-Reply-To: <69713155-39b0-5492-4966-73dfdacd1fc1@linux.intel.com>

Hi,

> -----Original Message-----
> From: Alsa-devel <alsa-devel-bounces@alsa-project.org> On Behalf Of
> Pierre-Louis Bossart
> Sent: 27 July 2022 17:37
> To: Stefan Binding <sbinding@opensource.cirrus.com>; Mark Brown
> <broonie@kernel.org>; Liam Girdwood <lgirdwood@gmail.com>;
> Brent Lu <brent.lu@intel.com>; xliu <xiang.liu@cirrus.com>
> Cc: Vitaly Rodionov <vitalyr@opensource.cirrus.com>;
> patches@opensource.cirrus.com; alsa-devel@alsa-project.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH v2] ASoC: Intel: cirrus-common: Use UID to map
> correct amp to prefix
> 
> 
> 
> 
> > +/*
> > + * Expected UIDs are integers (stored as strings).
> > + * UID Mapping is fixed:
> > + * UID 0x0 -> WL
> > + * UID 0x1 -> WR
> > + * UID 0x2 -> TL
> > + * UID 0x3 -> TR
> > + * Note: If there are less than 4 Amps, UIDs still map to
> WL/WR/TL/TR. Dynamic code will only create
> > + * dai links for UIDs which exist, and ignore non-existant ones.
> 
> is this intentional to support all variations of 1,2,3 and 4 amplifiers
> being present?
> 
> Or is the intent to really support 2 or 4?

The intent was to support 2 or 4, rather than any number of amps, in
case something was released with 2 amps.

> 
> > + * Return number of codecs found.
> > + */
> > +static int cs35l41_compute_codec_conf(void)
> > +{
> > +	const char * const uid_strings[] = { "0", "1", "2", "3" };
> > +	unsigned int uid, sz = 0;
> > +	struct acpi_device *adev;
> > +	struct device *physdev;
> > +
> > +	for (uid = 0; uid < CS35L41_MAX_AMPS; uid++) {
> > +		adev = acpi_dev_get_first_match_dev(CS35L41_HID,
> uid_strings[uid], -1);
> > +		if (!adev) {
> > +			pr_warn("Cannot find match for HID %s UID
> %u (%s)\n", CS35L41_HID, uid,
> > +				cs35l41_name_prefixes[uid]);
> 
> A warning is a bit strong if some valid configurations don't expose all
> 4 codecs.

I'll change this to a debug message, but also add an error if there is not
2 or 4 amps found.

> 
> > +			continue;
> > +		}
> > +		physdev =
> get_device(acpi_get_first_physical_node(adev));
> > +		cs35l41_components[sz].name = dev_name(physdev);
> > +		cs35l41_components[sz].dai_name =
> CS35L41_CODEC_DAI;
> > +		cs35l41_codec_conf[sz].dlc.name =
> dev_name(physdev);
> > +		cs35l41_codec_conf[sz].name_prefix =
> cs35l41_name_prefixes[uid];
> > +		acpi_dev_put(adev);
> > +		sz++;
> > +	}
> > +	return sz;

Thanks,
Stefan


WARNING: multiple messages have this Message-ID (diff)
From: Stefan Binding <sbinding@opensource.cirrus.com>
To: 'Pierre-Louis Bossart' <pierre-louis.bossart@linux.intel.com>,
	"'Mark Brown'" <broonie@kernel.org>,
	'Liam Girdwood' <lgirdwood@gmail.com>,
	"'Brent Lu'" <brent.lu@intel.com>, 'xliu' <xiang.liu@cirrus.com>
Cc: 'Vitaly Rodionov' <vitalyr@opensource.cirrus.com>,
	patches@opensource.cirrus.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Subject: RE: [PATCH v2] ASoC: Intel: cirrus-common: Use UID to map correct amp to prefix
Date: Fri, 29 Jul 2022 15:24:42 +0100	[thread overview]
Message-ID: <001c01d8a356$f1b4e9f0$d51ebdd0$@opensource.cirrus.com> (raw)
In-Reply-To: <69713155-39b0-5492-4966-73dfdacd1fc1@linux.intel.com>

Hi,

> -----Original Message-----
> From: Alsa-devel <alsa-devel-bounces@alsa-project.org> On Behalf Of
> Pierre-Louis Bossart
> Sent: 27 July 2022 17:37
> To: Stefan Binding <sbinding@opensource.cirrus.com>; Mark Brown
> <broonie@kernel.org>; Liam Girdwood <lgirdwood@gmail.com>;
> Brent Lu <brent.lu@intel.com>; xliu <xiang.liu@cirrus.com>
> Cc: Vitaly Rodionov <vitalyr@opensource.cirrus.com>;
> patches@opensource.cirrus.com; alsa-devel@alsa-project.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH v2] ASoC: Intel: cirrus-common: Use UID to map
> correct amp to prefix
> 
> 
> 
> 
> > +/*
> > + * Expected UIDs are integers (stored as strings).
> > + * UID Mapping is fixed:
> > + * UID 0x0 -> WL
> > + * UID 0x1 -> WR
> > + * UID 0x2 -> TL
> > + * UID 0x3 -> TR
> > + * Note: If there are less than 4 Amps, UIDs still map to
> WL/WR/TL/TR. Dynamic code will only create
> > + * dai links for UIDs which exist, and ignore non-existant ones.
> 
> is this intentional to support all variations of 1,2,3 and 4 amplifiers
> being present?
> 
> Or is the intent to really support 2 or 4?

The intent was to support 2 or 4, rather than any number of amps, in
case something was released with 2 amps.

> 
> > + * Return number of codecs found.
> > + */
> > +static int cs35l41_compute_codec_conf(void)
> > +{
> > +	const char * const uid_strings[] = { "0", "1", "2", "3" };
> > +	unsigned int uid, sz = 0;
> > +	struct acpi_device *adev;
> > +	struct device *physdev;
> > +
> > +	for (uid = 0; uid < CS35L41_MAX_AMPS; uid++) {
> > +		adev = acpi_dev_get_first_match_dev(CS35L41_HID,
> uid_strings[uid], -1);
> > +		if (!adev) {
> > +			pr_warn("Cannot find match for HID %s UID
> %u (%s)\n", CS35L41_HID, uid,
> > +				cs35l41_name_prefixes[uid]);
> 
> A warning is a bit strong if some valid configurations don't expose all
> 4 codecs.

I'll change this to a debug message, but also add an error if there is not
2 or 4 amps found.

> 
> > +			continue;
> > +		}
> > +		physdev =
> get_device(acpi_get_first_physical_node(adev));
> > +		cs35l41_components[sz].name = dev_name(physdev);
> > +		cs35l41_components[sz].dai_name =
> CS35L41_CODEC_DAI;
> > +		cs35l41_codec_conf[sz].dlc.name =
> dev_name(physdev);
> > +		cs35l41_codec_conf[sz].name_prefix =
> cs35l41_name_prefixes[uid];
> > +		acpi_dev_put(adev);
> > +		sz++;
> > +	}
> > +	return sz;

Thanks,
Stefan


  reply	other threads:[~2022-07-29 14:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-27 16:00 [PATCH v2] ASoC: Intel: cirrus-common: Use UID to map correct amp to prefix Stefan Binding
2022-07-27 16:00 ` Stefan Binding
2022-07-27 16:36 ` Pierre-Louis Bossart
2022-07-27 16:36   ` Pierre-Louis Bossart
2022-07-29 14:24   ` Stefan Binding [this message]
2022-07-29 14:24     ` Stefan Binding

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='001c01d8a356$f1b4e9f0$d51ebdd0$@opensource.cirrus.com' \
    --to=sbinding@opensource.cirrus.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=brent.lu@intel.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=vitalyr@opensource.cirrus.com \
    --cc=xiang.liu@cirrus.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.