Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1399276
| From | Mark Brown <broonie@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] ASoC: MAX9860: new driver |
| Date | 2016-05-11 17:40 +0200 |
| Message-ID | <rxEoW-2BM-35@gated-at.bofh.it> (permalink) |
| References | <rxhsm-4N0-25@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
[Multipart message — attachments visible in raw view] - view raw
On Tue, May 10, 2016 at 05:06:37PM +0200, Peter Rosin wrote:
> + if (master) {
> + switch (max9860->pclk_rate) {
> + case 12000000:
> + sysclk = MAX9860_FREQ_12MHZ;
> + break;
> + case 13000000:
> + sysclk = MAX9860_FREQ_13MHZ;
> + break;
> + case 19200000:
> + sysclk = MAX9860_FREQ_19_2MHZ;
> + break;
> + }
What if we have another PCLK rate?
> +#ifdef CONFIG_PM
> +static int max9860_suspend(struct device *dev)
> +{
> + struct max9860_priv *max9860 = dev_get_drvdata(dev);
> + int ret;
> +
> + ret = regmap_update_bits(max9860->regmap, MAX9860_SYSCLK,
> + MAX9860_PSCLK, MAX9860_PSCLK_OFF);
> + if (ret) {
> + dev_err(dev, "Failed to disable clock: %d\n", ret);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
> +static int max9860_resume(struct device *dev)
> +{
> + struct max9860_priv *max9860 = dev_get_drvdata(dev);
> + int ret;
> +
> + regcache_cache_only(max9860->regmap, false);
> + ret = regcache_sync(max9860->regmap);
We didn't go into cache only mode on suspend? I'd also expect to see
the regulators disabled over suspend and some system PM ops.
> +static int max9860_mclk_rate(struct device *dev, unsigned long *mclk_rate)
> +{
> + struct clk *mclk = clk_get(dev, "mclk");
Request resources on probe, not at some random point in driver
execution. That will mean probe deferral works properly and that we
don't get broken devices instantiated in userspace.
> + ret = clk_prepare_enable(mclk);
> + if (ret) {
> + dev_err(dev, "Failed to enable MCLK: %d\n", ret);
> + clk_put(mclk);
> + return ret;
> + }
> +
> + *mclk_rate = clk_get_rate(mclk);
> +
> + clk_disable_unprepare(mclk);
This is definitely confused too. Enabling the clock to read the
programmed frequency is at best odd, and obviously if we do get the rate
this will ensure that MCLK is disabled which probably isn't ideal.
> +err_pm:
> + pm_runtime_disable(dev);
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(max9860_probe);
I've no idea why this is exported...
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] ASoC: MAX9860: new driver Peter Rosin <peda@axentia.se> - 2016-05-10 17:10 +0200
Re: [PATCH] ASoC: MAX9860: new driver Mark Brown <broonie@kernel.org> - 2016-05-11 17:20 +0200
Re: [PATCH] ASoC: MAX9860: new driver Mark Brown <broonie@kernel.org> - 2016-05-11 23:00 +0200
Re: [PATCH] ASoC: MAX9860: new driver Peter Rosin <peda@axentia.se> - 2016-05-12 10:00 +0200
Re: [PATCH] ASoC: MAX9860: new driver Mark Brown <broonie@kernel.org> - 2016-05-12 13:10 +0200
Re: [PATCH] ASoC: MAX9860: new driver Peter Rosin <peda@axentia.se> - 2016-05-11 23:50 +0200
Re: [PATCH] ASoC: MAX9860: new driver Mark Brown <broonie@kernel.org> - 2016-05-11 17:40 +0200
Re: [PATCH] ASoC: MAX9860: new driver Peter Rosin <peda@axentia.se> - 2016-05-11 22:30 +0200
Re: [PATCH] ASoC: MAX9860: new driver Mark Brown <broonie@kernel.org> - 2016-05-11 23:00 +0200
Re: [PATCH] ASoC: MAX9860: new driver Peter Rosin <peda@axentia.se> - 2016-05-12 10:30 +0200
Re: [PATCH] ASoC: MAX9860: new driver Mark Brown <broonie@kernel.org> - 2016-05-12 13:00 +0200
csiph-web