[alsa-devel] [RFC 2/4] ASoC: Intel: Add merrifield machine driver

Vinod Koul vinod.koul at intel.com
Wed May 7 06:51:17 CEST 2014


On Tue, May 06, 2014 at 08:17:18PM +0200, Lars-Peter Clausen wrote:
> On 05/06/2014 06:58 PM, Vinod Koul wrote:
> >On Tue, May 06, 2014 at 05:54:53PM +0200, Lars-Peter Clausen wrote:
> >>On 05/05/2014 08:01 PM, Vinod Koul wrote:
> >>[...]
> >>>+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> >>>+
> >>>+#include <linux/module.h>
> >>>+#include <linux/init.h>
> >>>+#include <linux/device.h>
> >>>+#include <linux/slab.h>
> >>>+#include <linux/io.h>
> >>>+#include <linux/async.h>
> >>>+#include <linux/delay.h>
> >>>+#include <linux/gpio.h>
> >>>+#include <sound/pcm.h>
> >>>+#include <sound/pcm_params.h>
> >>>+#include <sound/soc.h>
> >>>+#include <sound/jack.h>
> >>>+#include <linux/input.h>
> >>>+
> >>>+#include <linux/mfd/wm8994/core.h>
> >>>+#include <linux/mfd/wm8994/registers.h>
> >>>+#include <linux/mfd/wm8994/pdata.h>
> >>>+#include "../../codecs/wm8994.h"
> >>>+#include "../platform-libs/controls_v2.h"
> >>
> >>I don't think that include exists in upstream.
> >which one ../platform-libs/controls_v2.h is part of this patch.
> 
> I just saw it's part of patch 4 of this series. But still, it should
> added before the user is added.
Yes :)

And i dont use in below code so would remove for now...
Later additions to thsi would use these defines so would amke sense to add then.

> 
> [..]
> >>
> >>>+static struct snd_soc_dai *find_codec_dai(struct snd_soc_card *card, const char *dai_name)
> >>>+{
> >>>+	int i;
> >>>+	for (i = 0; i < card->num_rtd; i++) {
> >>>+		if (!strcmp(card->rtd[i].codec_dai->name, dai_name))
> >>>+			return card->rtd[i].codec_dai;
> >>>+	}
> >>>+	pr_err("%s: unable to find codec dai\n", __func__);
> >>>+	/* this should never occur */
> >>>+	WARN_ON(1);
> >>>+	return NULL;
> >>>+}
> >>
> >>The proper way to do this is to implement the init callback for the
> >>dai link. There you get a pointer to the codec and the dai and
> >>everything else. If you need one for later store them in the private
> >>struct of the card driver.
> >again the driver would need to store the pointers to cards (we multi codec
> >systems) and multi dais. Somehow I dont feel this might be worth thr trouble.
> >Earlier we always had card->codec pointing to _one_ codec but with multi-codec
> >systems that is not the case, so we need ot lookup, but yes am not sure if above
> >is best way or something else..
> 
> Another thing you could do is just use card->rtd[X].codec_dai. The
> rtds are in the same order as the DAI links so you know which rtd is
> for which DAI.
that should work too..
Mark, Any comments on these approaches before I modify the code?

-- 
~Vinod


More information about the Alsa-devel mailing list