[PATCH v2 10/26] ALSA: hda: hda_cs_dsp_ctl: Add Library to support CS_DSP ALSA controls
Charles Keepax
ckeepax at opensource.cirrus.com
Wed May 11 16:02:17 CEST 2022
On Mon, May 09, 2022 at 10:46:47PM +0100, Vitaly Rodionov wrote:
> From: Stefan Binding <sbinding at opensource.cirrus.com>
>
> The cs35l41 part contains a DSP which is able to run firmware.
> The cs_dsp library can be used to control the DSP.
> These controls can be exposed to userspace using ALSA controls.
> This library adds apis to be able to interface between
> cs_dsp and hda drivers and expose the relevant controls as
> ALSA controls.
>
> Signed-off-by: Stefan Binding <sbinding at opensource.cirrus.com>
> Signed-off-by: Vitaly Rodionov <vitalyr at opensource.cirrus.com>
> ---
> +static int hda_cs_dsp_coeff_info(struct snd_kcontrol *kctl, struct snd_ctl_elem_info *uinfo)
> +{
> + struct soc_bytes_ext *bytes_ext =
> + (struct soc_bytes_ext *)kctl->private_value;
> + struct hda_cs_dsp_coeff_ctl *ctl = bytes_ext_to_ctl(bytes_ext);
> + struct cs_dsp_coeff_ctl *cs_ctl = ctl->cs_ctl;
> +
> + switch (cs_ctl->type) {
> + case WMFW_CTL_TYPE_ACKED:
> + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
> + uinfo->value.integer.min = CS_DSP_ACKED_CTL_MIN_VALUE;
> + uinfo->value.integer.max = CS_DSP_ACKED_CTL_MAX_VALUE;
> + uinfo->value.integer.step = 1;
> + uinfo->count = 1;
> + break;
With the ACKED controls as well as the TLVs it would be worth
verifing if any of the relevant firmwares actually require these,
if we are going to duplicate a bunch of the wm_adsp code into HDA
lets duplicate only exactly what we need.
> + switch (cs_dsp->fw_ver) {
> + case 0:
> + case 1:
> + ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
> + "%s %s %s %x", info->amp_name, cs_dsp->name, region_name,
> + cs_ctl->alg_region.alg);
> + break;
> + case 2:
> + ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
> + "%s %s%c %.12s %x", info->amp_name, cs_dsp->name, *region_name,
> + hda_cs_dsp_fw_text[info->fw_type], cs_ctl->alg_region.alg);
> + break;
> + default:
> + ret = scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN,
> + "%s %s %.12s %x", info->amp_name, cs_dsp->name,
> + hda_cs_dsp_fw_text[info->fw_type], cs_ctl->alg_region.alg);
> + break;
> + }
Do we actually need to support all the historical fw_versions?
ADSP does since CODECs using it have been around forever, but I
would suggest it is quite like this stuff only needs to support
the latest version.
Thanks,
Charles
More information about the Alsa-devel
mailing list