[alsa-devel] [PATCH v3 07/15] ASoC: hdac_hdmi: create dais based on number of streams
Takashi Iwai
tiwai at suse.de
Mon Dec 7 17:11:01 CET 2015
On Mon, 07 Dec 2015 22:24:21 +0100,
Subhransu S. Prusty wrote:
>
> A stream is mapped to a converter. So based on the converters
> queried, dais are created.
>
> The streams can be dynamically routed to any converter. For
> now it is mapped statically. The dynamic mapping of stream
> to converter will be added when required.
>
> Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty at intel.com>
> Signed-off-by: Vinod Koul <vinod.koul at intel.com>
> ---
> sound/soc/codecs/hdac_hdmi.c | 108 ++++++++++++++++++++++++++++++-------------
> 1 file changed, 76 insertions(+), 32 deletions(-)
>
> diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c
> index 27d1a54..01d063e 100644
> --- a/sound/soc/codecs/hdac_hdmi.c
> +++ b/sound/soc/codecs/hdac_hdmi.c
> @@ -30,6 +30,8 @@
> #include <sound/pcm_drm_eld.h>
> #include "../../hda/local.h"
>
> +#define NAME_SIZE 32
> +
> #define AMP_OUT_MUTE 0xb080
> #define AMP_OUT_UNMUTE 0xb000
> #define PIN_OUT (AC_PINCTL_OUT_EN)
> @@ -685,11 +687,67 @@ static void hdac_hdmi_skl_enable_dp12(struct hdac_device *hdac)
>
> }
>
> +static struct snd_soc_dai_ops hdmi_dai_ops = {
> + .startup = hdac_hdmi_pcm_open,
> + .shutdown = hdac_hdmi_pcm_close,
> + .hw_params = hdac_hdmi_set_hw_params,
> + .prepare = hdac_hdmi_playback_prepare,
> + .hw_free = hdac_hdmi_playback_cleanup,
> +};
> +
> +static int hdac_hdmi_create_dais(struct hdac_device *hdac,
> + struct snd_soc_dai_driver **dais,
> + struct hdac_hdmi_priv *hdmi, int num_dais)
> +{
> + struct snd_soc_dai_driver *hdmi_dais;
> + struct hdac_hdmi_cvt *cvt;
> + char name[NAME_SIZE], dai_name[NAME_SIZE];
> + int i = 0;
> + u32 rates, bps;
> + unsigned int rate_max = 384000, rate_min = 8000;
> + u64 formats;
> + int ret;
> +
> + hdmi_dais = devm_kzalloc(&hdac->dev, (sizeof(*hdmi_dais) * num_dais),
> + GFP_KERNEL);
> + if (!hdmi_dais)
> + return -ENOMEM;
> +
> + list_for_each_entry(cvt, &hdmi->cvt_list, head) {
> + ret = snd_hdac_query_supported_pcm(hdac, cvt->nid, &rates,
> + &formats, &bps);
> + if (ret)
> + return ret;
> +
> + sprintf(dai_name, "intel-hdmi-hifi%d", i+1);
> + hdmi_dais[i].name = devm_kstrdup(&hdac->dev, dai_name,
> + GFP_KERNEL);
> +
Missing NULL check.
> + snprintf(name, sizeof(name), "hifi%d", i+1);
> + hdmi_dais[i].playback.stream_name =
> + devm_kstrdup(&hdac->dev, name, GFP_KERNEL);
Ditto.
Takashi
More information about the Alsa-devel
mailing list