On Sat, Oct 29, 2022 at 12:07:33AM +0800, Ajye Huang wrote:
> +static const char * const dmic_mux_text[] = {
> + "FrontMic",
> + "RearMic",
> +};
> + ret = snd_soc_dapm_new_controls(&card->dapm, dmic_widgets,
> + ARRAY_SIZE(dmic_widgets));
> + if (ret) {
> + dev_err(card->dev, "DMic widget addition failed: %d\n", ret);
> + /* Don't need to add routes if widget addition failed */
> + return ret;
> + }
> + if (of_property_read_bool(pdev->dev.of_node, "dmic-gpios")) {
> + mach_priv->dmic_sel = devm_gpiod_get_optional(&pdev->dev,
> + "dmic", GPIOD_OUT_LOW);
My prior comments about it being nicer to make the addition of the
control depend on the property being there and the description of the
options configurable do stand (I appreciate that the other driver might
not have done this which was probably an oversight).
Also do we really need the of_property_read_bool() there? I'd have
expected that devm_gpiod_get_optional() would be handling that for us.
Hi Mark Brown,
On Sat, Oct 29, 2022 at 12:17 AM Mark Brown <[email protected]> wrote:
> Also do we really need the of_property_read_bool() there? I'd have
> expected that devm_gpiod_get_optional() would be handling that for us.
You are right, it is unnecessary to use of_property_read_bool() there
, I will remove and send the v2 version, thank you.