From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Brent Lu <brent.lu@intel.com>, alsa-devel@alsa-project.org
Cc: Oder Chiou <oder_chiou@realtek.com>,
Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>,
Cezary Rojewski <cezary.rojewski@intel.com>,
Dharageswari R <dharageswari.r@intel.com>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Jie Yang <yang.jie@linux.intel.com>,
linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.com>,
Fred Oh <fred.oh@linux.intel.com>,
Tzung-Bi Shih <tzungbi@google.com>,
Mark Brown <broonie@kernel.org>,
Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Libin Yang <libin.yang@linux.intel.com>,
Rander Wang <rander.wang@linux.intel.com>,
Yong Zhi <yong.zhi@intel.com>
Subject: Re: [PATCH] ASoC: Intel: sof_rt5682: Add rt1015p speaker amp support
Date: Mon, 15 Mar 2021 09:26:26 -0500 [thread overview]
Message-ID: <7ec5763b-29cb-4846-6ff8-3899c2ff1248@linux.intel.com> (raw)
In-Reply-To: <20210313134038.5577-1-brent.lu@intel.com>
I am not a big fan of the code partition you've selected.
> +void sof_rt1015p_set_share_en_spk(void)
> +{
> + /* Two amps share one en pin so there is only one device in acpi
> + * table
> + */
> + rt1015p_quirk |= RT1015P_SHARE_EN_SPK;
> +}
This is a function now used in the machine driver, see below [1]
This adds a new interface between machine and realtek common code, which
we are trying to move to a module with well-defined APIs.
> +void sof_rt1015p_dai_link(struct snd_soc_dai_link *link)
> +{
> + link->codecs = rt1015p_dai_link_components;
> + if (rt1015p_quirk & RT1015P_SHARE_EN_SPK)
> + link->num_codecs = 1;
> + else
> + link->num_codecs = ARRAY_SIZE(rt1015p_dai_link_components);
> + link->init = rt1015p_init;
> + link->ops = &rt1015p_ops;
> +}
> +
> +void sof_rt1015p_codec_conf(struct snd_soc_card *card)
> +{
> + if (rt1015p_quirk & RT1015P_SHARE_EN_SPK)
> + return;
> +
> + card->codec_conf = rt1015p_codec_confs;
> + card->num_configs = ARRAY_SIZE(rt1015p_codec_confs);
> +}
could we not handle this quirk inside one of the two dai_link or
codec_conf functions above?
The machine driver does not care about this RT1015P_SHARE_EN_SPK quirk,
it's only used in those two functions so should be set in this scope.
There's no need to make it visible to the machine driver, is there?
> + /* setup amp quirk if any */
> + if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) {
> + /* There may be only one device instance if two amps
> + * sharing one en pin
> + */
> + if (!acpi_dev_present("RTL1015", "1", -1)) {
> + dev_dbg(&pdev->dev, "Device %s not exist\n",
> + RT1015P_DEV1_NAME);
> + sof_rt1015p_set_share_en_spk();
> + }
> + }
> +
[1]
I see no problem using the _UID (Unique ID) to check if a second
amplifier is present or not. This seems to follow the ACPI spec Section
6.1.12, as long as "the _UID must be unique across all devices with
either a common _HID or _CID"
> + else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT)
> + sof_rt1015p_codec_conf(&sof_audio_card_rt5682);
WARNING: multiple messages have this Message-ID (diff)
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Brent Lu <brent.lu@intel.com>, alsa-devel@alsa-project.org
Cc: Oder Chiou <oder_chiou@realtek.com>,
Cezary Rojewski <cezary.rojewski@intel.com>,
Dharageswari R <dharageswari.r@intel.com>,
Sathyanarayana Nujella <sathyanarayana.nujella@intel.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>,
linux-kernel@vger.kernel.org, Jie Yang <yang.jie@linux.intel.com>,
Takashi Iwai <tiwai@suse.com>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Fred Oh <fred.oh@linux.intel.com>,
Tzung-Bi Shih <tzungbi@google.com>,
Mark Brown <broonie@kernel.org>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Libin Yang <libin.yang@linux.intel.com>,
Rander Wang <rander.wang@linux.intel.com>,
Yong Zhi <yong.zhi@intel.com>
Subject: Re: [PATCH] ASoC: Intel: sof_rt5682: Add rt1015p speaker amp support
Date: Mon, 15 Mar 2021 09:26:26 -0500 [thread overview]
Message-ID: <7ec5763b-29cb-4846-6ff8-3899c2ff1248@linux.intel.com> (raw)
In-Reply-To: <20210313134038.5577-1-brent.lu@intel.com>
I am not a big fan of the code partition you've selected.
> +void sof_rt1015p_set_share_en_spk(void)
> +{
> + /* Two amps share one en pin so there is only one device in acpi
> + * table
> + */
> + rt1015p_quirk |= RT1015P_SHARE_EN_SPK;
> +}
This is a function now used in the machine driver, see below [1]
This adds a new interface between machine and realtek common code, which
we are trying to move to a module with well-defined APIs.
> +void sof_rt1015p_dai_link(struct snd_soc_dai_link *link)
> +{
> + link->codecs = rt1015p_dai_link_components;
> + if (rt1015p_quirk & RT1015P_SHARE_EN_SPK)
> + link->num_codecs = 1;
> + else
> + link->num_codecs = ARRAY_SIZE(rt1015p_dai_link_components);
> + link->init = rt1015p_init;
> + link->ops = &rt1015p_ops;
> +}
> +
> +void sof_rt1015p_codec_conf(struct snd_soc_card *card)
> +{
> + if (rt1015p_quirk & RT1015P_SHARE_EN_SPK)
> + return;
> +
> + card->codec_conf = rt1015p_codec_confs;
> + card->num_configs = ARRAY_SIZE(rt1015p_codec_confs);
> +}
could we not handle this quirk inside one of the two dai_link or
codec_conf functions above?
The machine driver does not care about this RT1015P_SHARE_EN_SPK quirk,
it's only used in those two functions so should be set in this scope.
There's no need to make it visible to the machine driver, is there?
> + /* setup amp quirk if any */
> + if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT) {
> + /* There may be only one device instance if two amps
> + * sharing one en pin
> + */
> + if (!acpi_dev_present("RTL1015", "1", -1)) {
> + dev_dbg(&pdev->dev, "Device %s not exist\n",
> + RT1015P_DEV1_NAME);
> + sof_rt1015p_set_share_en_spk();
> + }
> + }
> +
[1]
I see no problem using the _UID (Unique ID) to check if a second
amplifier is present or not. This seems to follow the ACPI spec Section
6.1.12, as long as "the _UID must be unique across all devices with
either a common _HID or _CID"
> + else if (sof_rt5682_quirk & SOF_RT1015P_SPEAKER_AMP_PRESENT)
> + sof_rt1015p_codec_conf(&sof_audio_card_rt5682);
next prev parent reply other threads:[~2021-03-15 15:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-13 13:40 [PATCH] ASoC: Intel: sof_rt5682: Add rt1015p speaker amp support Brent Lu
2021-03-13 13:40 ` Brent Lu
2021-03-13 14:04 ` Lu, Brent
2021-03-13 14:04 ` Lu, Brent
2021-03-15 14:26 ` Pierre-Louis Bossart [this message]
2021-03-15 14:26 ` Pierre-Louis Bossart
2021-03-16 10:00 ` Lu, Brent
2021-03-16 10:00 ` Lu, Brent
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=7ec5763b-29cb-4846-6ff8-3899c2ff1248@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=brent.lu@intel.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=dharageswari.r@intel.com \
--cc=fred.oh@linux.intel.com \
--cc=guennadi.liakhovetski@linux.intel.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=libin.yang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=rander.wang@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sathyanarayana.nujella@intel.com \
--cc=tiwai@suse.com \
--cc=tzungbi@google.com \
--cc=yang.jie@linux.intel.com \
--cc=yong.zhi@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 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.