Re: [alsa-devel] [PATCHv2 1/4] ASoC: simple-card: add asoc_simple_card_fmt_master() to simplify the code.

From: Kuninori Morimoto
Date: Tue Sep 02 2014 - 20:27:08 EST



Hi Xiubo

I was very surprised about this patch
because the idea is same as my local patch
(I was planned to send it to ML :)

I attached my local patch to sharing idea.

> +static inline unsigned int
> +asoc_simple_card_fmt_master(struct device_node *np,
> + struct device_node *bitclkmaster,
> + struct device_node *framemaster)
> +{
> + switch (((np == bitclkmaster) << 4) | (np == framemaster)) {
> + case 0x11:
> + return SND_SOC_DAIFMT_CBS_CFS;
> + case 0x10:
> + return SND_SOC_DAIFMT_CBS_CFM;
> + case 0x01:
> + return SND_SOC_DAIFMT_CBM_CFS;
> + default:
> + return SND_SOC_DAIFMT_CBM_CFM;
> + }
> +
> + /* Shouldn't be here */
> + return -EINVAL;
> +}

I think this concept is nice,
but setting all fmt in this function is good for me
see my local patch

----------