From: Mark Brown <broonie@kernel.org>
To: Jianqun <jay.xu@rock-chips.com>
Cc: robh+dt@kernel.org, pawel.moll@arm.com, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
heiko@sntech.de, lgirdwood@gmail.com, perex@perex.cz,
tiwai@suse.de, grant.likely@linaro.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, huangtao@rock-chips.com,
cf@rock-chips.com
Subject: Re: [PATCH] ASoC: rockchip-max98090: add driver for rockchip board using a max98090
Date: Fri, 12 Sep 2014 14:52:47 +0100 [thread overview]
Message-ID: <20140912135247.GU7960@sirena.org.uk> (raw)
In-Reply-To: <1410507588-15719-1-git-send-email-jay.xu@rock-chips.com>
[-- Attachment #1: Type: text/plain, Size: 2255 bytes --]
On Fri, Sep 12, 2014 at 03:39:48PM +0800, Jianqun wrote:
> +#define RK_PLAT_CLK_12M 12000000
I'm not sure a define is adding anything here... it's just a define
saying 12MHz that has the value 12MHz.
> + struct snd_soc_dai *codec_dai = rtd->codec_dai;
> +
> +/* Set max98090 as master, i2s clock output 12MHz for max98090 */
> + ret = snd_soc_dai_set_sysclk(cpu_dai, 0,
Coding style, comments aren't aligned with the code.
> + ret = snd_soc_add_card_controls(card, rk_mc_controls,
> + ARRAY_SIZE(rk_mc_controls));
> + if (ret) {
> + pr_err("unable to add card controls\n");
> + return ret;
> + }
Use card->controls.
> + snd_soc_dapm_enable_pin(dapm, "Headset Mic");
> + snd_soc_dapm_enable_pin(dapm, "Headphone");
> + snd_soc_dapm_enable_pin(dapm, "Ext Spk");
> + snd_soc_dapm_enable_pin(dapm, "Int Mic");
> +
> + snd_soc_dapm_sync(dapm);
All pins are enabled by default and sync doesn't do anything during
init.
> +#ifdef CONFIG_PM_SLEEP
> +static int snd_rk_prepare(struct device *dev)
> +{
> + struct snd_soc_card *card = dev_get_drvdata(dev);
> + struct rk_mc_private *drv = snd_soc_card_get_drvdata(card);
> +
> + snd_soc_jack_free_gpios(&drv->hp_jack, 1, &hp_jack_gpio);
> + snd_soc_jack_free_gpios(&drv->mic_jack, 1, &mic_jack_gpio);
> +
> + return snd_soc_suspend(dev);
> +}
Why are you freeing the GPIOs over suspend, that doesn't seem good?
> + hp_jack_gpio.gpio = of_get_named_gpio(np, "rockchip,hp-det-gpios", 0);
> + if (hp_jack_gpio.gpio == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
> +
> + mic_jack_gpio.gpio = of_get_named_gpio(np, "rockchip,mic-det-gpios", 0);
> + if (mic_jack_gpio.gpio == -EPROBE_DEFER)
> + return -EPROBE_DEFER;
This ignores errors other than probe deferral but the init code assumed
that these would've succeeded. Either the init code should handle
failure or all errors should be treated as fatal.
> + platform_set_drvdata(pdev, &card);
> +
> + ret = snd_soc_of_parse_card_name(card, "rockchip,model");
> + if (ret)
> + return ret;
These need to happen before we register the card since they could be
used as soon as we probe.
> + snd_soc_card_set_drvdata(soc_card, NULL);
No need to clear driver data, the core will do it anyway and anything
relying on pre-set driver data is broken.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-09-13 15:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-12 7:26 [PATCH 0/2] rockchip-max98090: add driver for rockchip board with max98090 Jianqun
2014-09-12 7:30 ` [PATCH 1/2] ASoC: rockchip-max98090: add documentation for rockchip-max98090 driver Jianqun
2014-09-12 9:10 ` Jianqun
2014-09-12 10:04 ` Heiko Stübner
2014-09-12 10:12 ` Jianqun
2014-09-12 13:44 ` Mark Brown
2014-09-28 0:54 ` Jianqun
2014-09-28 10:48 ` Mark Brown
2014-09-28 11:05 ` Jianqun
2014-09-12 7:32 ` [PATCH 2/2] ASoC: rockchip-max98090: add driver for rockchip board using a max98090 Jianqun
2014-09-12 7:39 ` [PATCH] " Jianqun
2014-09-12 13:52 ` Mark Brown [this message]
2014-10-02 8:06 ` Jianqun
2014-09-12 7:43 ` [PATCH 2/2] " Jianqun
2014-10-02 8:36 ` [PATCH v2 " Jianqun
2014-10-02 10:22 ` Mark Brown
2014-09-12 13:42 ` [PATCH 0/2] rockchip-max98090: add driver for rockchip board with max98090 Mark Brown
2014-09-14 3:00 ` Jianqun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140912135247.GU7960@sirena.org.uk \
--to=broonie@kernel.org \
--cc=cf@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=heiko@sntech.de \
--cc=huangtao@rock-chips.com \
--cc=ijc+devicetree@hellion.org.uk \
--cc=jay.xu@rock-chips.com \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox