From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH v3 07/15] ASoC: hdac_hdmi: create dais based on number of streams Date: Mon, 07 Dec 2015 17:11:01 +0100 Message-ID: References: <1449523078-4311-1-git-send-email-subhransu.s.prusty@intel.com> <1449523469-4395-1-git-send-email-subhransu.s.prusty@intel.com> <1449523469-4395-7-git-send-email-subhransu.s.prusty@intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id BB7D126070C for ; Mon, 7 Dec 2015 17:11:02 +0100 (CET) In-Reply-To: <1449523469-4395-7-git-send-email-subhransu.s.prusty@intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: "Subhransu S. Prusty" Cc: patches.audio@intel.com, Vinod Koul , alsa-devel@alsa-project.org, broonie@kernel.org, lgirdwood@gmail.com List-Id: alsa-devel@alsa-project.org 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 > Signed-off-by: Vinod Koul > --- > 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 > #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