From: Mark Brown <broonie@kernel.org>
To: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Cc: linux-rockchip@lists.infradead.org,
Jaroslav Kysela <perex@perex.cz>,
devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
Heiko Stuebner <heiko@sntech.de>,
linux-kernel@vger.kernel.org, Kumar Gala <galak@codeaurora.org>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Takashi Iwai <tiwai@suse.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Pawel Moll <pawel.moll@arm.com>, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Russell King <linux@arm.linux.org.uk>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 2/4] ASoC: rockchip: Add rockchip SPDIF transceiver driver
Date: Fri, 7 Aug 2015 14:03:11 +0100 [thread overview]
Message-ID: <20150807130311.GW20873@sirena.org.uk> (raw)
In-Reply-To: <1438947854-3743-3-git-send-email-sjoerd.simons@collabora.co.uk>
[-- Attachment #1: Type: text/plain, Size: 2125 bytes --]
On Fri, Aug 07, 2015 at 01:44:12PM +0200, Sjoerd Simons wrote:
> Changes in v2:
> - Remove platform: module alias as it was unused
Ugh, I see Paul Bolle replied to one of your earlier patches :/ Please
just ignore him, he doesn't understand that we don't require machine
definitions to be in tree. A platform: module alias is useful for any
platform device.
> +static inline struct rk_spdif_dev *to_info(struct snd_soc_dai *dai)
> +{
> + return snd_soc_dai_get_drvdata(dai);
> +}
I'm not sure this is adding much to the two users but whatever.
> +static int rk_spdif_snd_txctrl(struct rk_spdif_dev *spdif, int on)
> +{
> + int ret;
> +
> + if (on) {
> + ret = regmap_update_bits(spdif->regmap, SPDIF_DMACR,
> + SPDIF_DMACR_TDE_ENABLE,
> + SPDIF_DMACR_TDE_ENABLE);
> +
> + if (ret != 0)
> + goto bail;
> +
> + ret = regmap_update_bits(spdif->regmap, SPDIF_XFER,
> + SPDIF_XFER_TXS_START,
> + SPDIF_XFER_TXS_START);
This function has no common code, just two branches in an if/else that
share nothing and is called from a single location. Why not just inline
this into the trigger function?
> + /* Set clock and calculate divider */
> + clk_set_rate(spdif->mclk, mclk);
We should check the return value of clk_set_rate().
> + spdif->hclk = devm_clk_get(&pdev->dev, "spdif_hclk");
> + if (IS_ERR(spdif->hclk)) {
> + dev_err(&pdev->dev, "Can't retrieve rk_spdif bus clock\n");
> + return PTR_ERR(spdif->hclk);
> + }
> + ret = clk_prepare_enable(spdif->hclk);
> + if (ret) {
> + dev_err(spdif->dev, "hclock enable failed %d\n", ret);
> + return ret;
> + }
I notice that we don't manage the hclk over suspend/resume - should we
perhaps be using regmap_init_mmio_clk() together with runtime PM to
manage it?
> + pm_runtime_enable(&pdev->dev);
> + if (!pm_runtime_enabled(&pdev->dev)) {
> + ret = rk_spdif_runtime_resume(&pdev->dev);
> + if (ret)
> + goto err_pm_disable;
> + }
The normal pattern with this is to start the device powered up then idle
it - this does mean we need to bounce the power on but fitting in with
the common pattern is good and it's less conditional code.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2015-08-07 13:03 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-07 11:44 [PATCH v3 0/4] Add SPDIF support for rockchip Sjoerd Simons
2015-08-07 11:44 ` [PATCH v3 1/4] ASoC: dt-bindings: add rockchip tranceiver bindings Sjoerd Simons
2015-08-07 13:05 ` Mark Brown
2015-08-07 11:44 ` [PATCH v3 2/4] ASoC: rockchip: Add rockchip SPDIF transceiver driver Sjoerd Simons
2015-08-07 13:03 ` Mark Brown [this message]
2015-08-18 18:25 ` Heiko Stuebner
2015-08-19 6:56 ` Sjoerd Simons
2015-08-19 7:28 ` Heiko Stuebner
2015-08-07 11:44 ` [PATCH v3 3/4] ARM: dts: rockchip: Add SPDIF transceiver for RK3188 Sjoerd Simons
2015-08-07 11:44 ` [PATCH v3 4/4] ARM: dts: rockchip: Add SPDIF optical out on Radxa Rock Sjoerd Simons
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=20150807130311.GW20873@sirena.org.uk \
--to=broonie@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=heiko@sntech.de \
--cc=ijc+devicetree@hellion.org.uk \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=sjoerd.simons@collabora.co.uk \
--cc=tiwai@suse.com \
/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
all inboxes | Powered by JetHome®