All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	<alsa-devel@alsa-project.org>
Cc: "Huajun Li" <huajun.li@intel.com>,
	tiwai@suse.de, "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>,
	"Nikolai Kostrigin" <nickel@altlinux.org>,
	broonie@kernel.org, "Mauro Carvalho Chehab" <mchehab@kernel.org>,
	"Bard Liao" <yung-chuan.liao@linux.intel.com>
Subject: Re: [PATCH 04/20] ALSA: intel-nhlt: add helper to detect SSP link mask
Date: Wed, 9 Mar 2022 18:01:23 +0100	[thread overview]
Message-ID: <e12a2a8d-7f96-5055-1168-2ced05d00751@intel.com> (raw)
In-Reply-To: <20220308192610.392950-5-pierre-louis.bossart@linux.intel.com>

On 2022-03-08 8:25 PM, Pierre-Louis Bossart wrote:
> The NHLT information can be used to figure out which SSPs are enabled
> in a platform.
> 
> The 'SSP' link type is too broad for machine drivers, since it can
> cover the Bluetooth sideband and the analog audio codec connections,
> so this helper exposes a parameter to filter with the device
> type (DEVICE_I2S refers to analog audio codec in NHLT parlance).
> 
> The helper returns a mask, since more than one SSP may be used for
> analog audio, e.g. the NHLT spec describes the use of SSP0 for
> amplifiers and SSP1 for headset codec. Note that if more than one bit
> is set, it's impossible to determine which SSP is connected to what
> external component. Additional platform-specific information based on
> e.g. DMI quirks would still be required in the machine driver to
> configure the relevant dailinks.

...

> diff --git a/sound/hda/intel-nhlt.c b/sound/hda/intel-nhlt.c
> index 128476aa7c61..4063da378283 100644
> --- a/sound/hda/intel-nhlt.c
> +++ b/sound/hda/intel-nhlt.c
> @@ -130,6 +130,28 @@ bool intel_nhlt_has_endpoint_type(struct nhlt_acpi_table *nhlt, u8 link_type)
>   }
>   EXPORT_SYMBOL(intel_nhlt_has_endpoint_type);
>   
> +int intel_nhlt_ssp_endpoint_mask(struct nhlt_acpi_table *nhlt, u8 device_type)
> +{
> +	struct nhlt_endpoint *epnt;
> +	int ssp_mask = 0;
> +	int i;
> +
> +	if (!nhlt || (device_type != NHLT_DEVICE_BT && device_type != NHLT_DEVICE_I2S))

The '!nhlt' safety is superfluous in my opinion. Kernel core API e.g.: 
device one assumes caller is sane in basically all cases.

> +		return 0;
> +
> +	epnt = (struct nhlt_endpoint *)nhlt->desc;
> +	for (i = 0; i < nhlt->endpoint_count; i++) {
> +		if (epnt->linktype == NHLT_LINK_SSP && epnt->device_type == device_type) {
> +			/* for SSP the virtual bus id is the SSP port */
> +			ssp_mask |= BIT(epnt->virtual_bus_id);
> +		}
> +		epnt = (struct nhlt_endpoint *)((u8 *)epnt + epnt->length);
> +	}
> +
> +	return ssp_mask;
> +}
> +EXPORT_SYMBOL(intel_nhlt_ssp_endpoint_mask);

Since this is a *public* API - not direct part of any driver, really - 
providing kernel-doc is recommended.


Regards,
Czarek

  parent reply	other threads:[~2022-03-09 17:08 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-08 19:25 [PATCH 00/20] ALSA/ASoC/SOF/Intel: improve support for ES8336-based platforms Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 01/20] ASoC: soc-acpi: fix kernel-doc descriptor Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 02/20] ASoC: soc-acpi: add information on I2S/TDM link mask Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 03/20] ASoC: SOF: Intel: hda: retrieve DMIC number for I2S boards Pierre-Louis Bossart
2022-03-09 16:49   ` Cezary Rojewski
2022-03-09 17:10     ` Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 04/20] ALSA: intel-nhlt: add helper to detect SSP link mask Pierre-Louis Bossart
2022-03-09 10:03   ` Takashi Iwai
2022-03-09 17:01   ` Cezary Rojewski [this message]
2022-03-09 17:24     ` Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 05/20] ASoC: SOF: Intel: hda: report SSP link mask to machine driver Pierre-Louis Bossart
2022-03-09 16:59   ` Cezary Rojewski
2022-03-09 17:16     ` Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 06/20] ASoC: Intel: soc-acpi: quirk topology filename dynamically Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 07/20] ALSA: intel-dsp-config: add more ACPI HIDs for ES83x6 devices Pierre-Louis Bossart
2022-03-09 10:04   ` Takashi Iwai
2022-03-08 19:25 ` [PATCH 08/20] ASoC: Intel: soc-acpi: " Pierre-Louis Bossart
2022-03-08 19:25 ` [PATCH 09/20] ALSA: intel-dspconfig: add ES8336 support for CNL Pierre-Louis Bossart
2022-03-09 10:04   ` Takashi Iwai
2022-03-08 19:26 ` [PATCH 10/20] ASoC: Intel: soc-acpi: add ESSX8336 support on Cannon Lake machines Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 11/20] ASoC: Intel: sof_es8336: make gpio optional Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 12/20] ASoC: Intel: sof_es8336: get codec device with ACPI instead of bus search Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 13/20] ASoC: Intel: Revert "ASoC: Intel: sof_es8336: add quirk for Huawei D15 2021" Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 14/20] ASoC: Intel: sof_es8336: use NHLT information to set dmic and SSP Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 15/20] ASoC: Intel: sof_es8336: log all quirks Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 16/20] ASoC: Intel: sof_es8336: move comment to the right place Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 17/20] ASoC: Intel: sof_es8336: add support for JD inverted quirk Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 18/20] ASoC: Intel: sof_es8336: extend machine driver to support ES8326 codec Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 19/20] ASoC: Intel: sof_es8336: add cfg-dmics component for UCM support Pierre-Louis Bossart
2022-03-08 19:26 ` [PATCH 20/20] ASoC: Intel: bytcht_es8316: move comment to the right place Pierre-Louis Bossart
2022-03-10 11:35 ` [PATCH 00/20] ALSA/ASoC/SOF/Intel: improve support for ES8336-based platforms Mark Brown

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=e12a2a8d-7f96-5055-1168-2ced05d00751@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=huajun.li@intel.com \
    --cc=mchehab@kernel.org \
    --cc=nickel@altlinux.org \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=yung-chuan.liao@linux.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.