Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1565250

Re: [PATCH v2] ASoC: mxs-saif: add mclk enable/disable ops

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Mark Brown <broonie@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2] ASoC: mxs-saif: add mclk enable/disable ops
Date Mon, 23 Jan 2017 20:10:01 +0100
Message-ID <t2Sa5-1ST-9@gated-at.bofh.it> (permalink)
References <sReSJ-3uM-19@gated-at.bofh.it>
MIME-Version 1.0
Content-Type multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qhyg5xsg6yr6ozrr"
Content-Disposition inline
X-Cookie A man's best friend is his dogma.
User-Agent NeoMutt/20161126 (1.7.1)
X-Sa-Exim-Connect-IP 2001:470:1f1d:6b5::3
X-Sa-Exim-Mail-From broonie@sirena.org.uk
X-Sa-Exim-Version 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000)
X-Sa-Exim-Scanned No (on mezzanine.sirena.org.uk); Unknown failure
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 63
Organization linux.* mail to news gateway
X-Original-Cc alsa-devel@alsa-project.org, Liam Girdwood <lgirdwood@gmail.com>, Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>, linux-kernel@vger.kernel.org, Jörg Krause <joerg.krause@embedded.rocks>
X-Original-Date Mon, 23 Jan 2017 19:07:01 +0000
X-Original-Message-ID <20170123190701.hva43ac4ceo6xxla@sirena.org.uk>
X-Original-References <20161222164926.19621-1-mans@mansr.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1565250

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Thu, Dec 22, 2016 at 04:49:26PM +0000, Mans Rullgard wrote:

>  int mxs_saif_put_mclk(unsigned int saif_id)
>  {
> -	struct mxs_saif *saif = mxs_saif[saif_id];
> -	u32 stat;
> +	struct clk *clk;
>  
> -	if (!saif)
> -		return -EINVAL;
> +	clk = clk_get(NULL, "mxs_saif_mclk");
> +	if (IS_ERR(clk))
> +		return PTR_ERR(clk);

So, this *is* an in place refactoring but it's only half done in that
we don't have any followup patches that move the clk_get() to device
probe where it should be.

> +static void mxs_saif_mclk_disable(struct clk_hw *hw)
> +{
> +	struct mxs_saif *saif = to_mxs_saif(hw);
> +
> +	if (!saif->ongoing)
> +		__raw_writel(BM_SAIF_CTRL_RUN,
> +			     saif->base + SAIF_CTRL + MXS_CLR_ADDR);
> +
> +	saif->mclk_in_use = 0;
> +}

We silently ignore disables if the clock is in use?  That seems error
prone.  I'd expect us to at least warn in that case.

> +static unsigned long mxs_saif_mclk_recalc_rate(struct clk_hw *hw,
> +					       unsigned long parent_rate)
> +{
> +	return clk_divider_ops.recalc_rate(hw, parent_rate);
> +}

Can't we just assign these ops directly?  Having to write wrapper
functions like this looks like we're doing something wrong here.

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH v2] ASoC: mxs-saif: add mclk enable/disable ops Mark Brown <broonie@kernel.org> - 2017-01-23 20:10 +0100

csiph-web