Re: [PATCH v5 2/2] ASoC: qcom: add apq8016 sound card support

From: Mark Brown
Date: Tue Jun 09 2015 - 13:08:04 EST


On Tue, Jun 09, 2015 at 01:59:36PM +0100, Srinivas Kandagatla wrote:

> + if (cpu_dai->id == MI2S_QUATERNARY) {
> + /* Configure the Quat MI2S to TLMM */
> + writel(readl(pdata->mic_iomux) |
> + MIC_CTRL_QUA_WS_SLAVE_SEL_10 |
> + MIC_CTRL_TLMM_SCLK_EN,
> + pdata->mic_iomux);
> +
> + return 0;
> + } else if (cpu_dai->id == MI2S_PRIMARY) {
> + writel(readl(pdata->spkr_iomux) |
> + SPKR_CTL_PRI_WS_SLAVE_SEL_11,
> + pdata->spkr_iomux);
> +
> + return 0;
> + }

Why not just do these one time at probe, we don't undo them when we shut
the DAI down?

> +
> + dev_err(card->dev, "unsupported cpu dai configuration\n");
> +
> + return -EINVAL;

It'd be clearer if this were part of the above code (which should still
be written as a switch statement) - I was just asking myself what
happens if we fall off the end of the if/else chain.

> + /**
> + * External codec is ADV7533
> + * and internal codec digital part is inside apq8016
> + * and analog part is in PMIC PM8916
> + **/
> + if (of_property_read_bool(np, "external"))
> + name = "ADV7533";
> + else
> + name = "WCD";

If this is all the property is doing why not just put a link name
property in the DT rather than this? That makes the driver a bit more
general and is more idiomatic.

> + dai_link->name = dai_link->stream_name = name;

Write two assignment statements, it's clearer and more idiomatic.

Attachment: signature.asc
Description: Digital signature