All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Javier Martinez Canillas <javier.martinez@collabora.co.uk>,
	Doug Anderson <dianders@chromium.org>
Cc: alsa-devel@alsa-project.org,
	linux-samsung-soc <linux-samsung-soc@vger.kernel.org>,
	Sangbeom Kim <sbkim73@samsung.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Vincent Palatin <vpalatin@chromium.org>,
	Tomasz Figa <tomasz.figa@gmail.com>,
	Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>
Subject: Re: [PATCH 1/6] ASoC: max98088: Document DT bindings
Date: Fri, 20 Feb 2015 01:36:56 +0100	[thread overview]
Message-ID: <54E681A8.6040702@suse.de> (raw)
In-Reply-To: <54E64C09.5000505@collabora.co.uk>

Am 19.02.2015 um 21:48 schrieb Javier Martinez Canillas:
> On 02/19/2015 07:54 PM, Andreas Färber wrote:
>> Am 19.02.2015 um 19:40 schrieb Andreas Färber:
>>> I updated max98088 and had it working on first boot, but on
>>> second boot it complained about the frequency:
>>>
>>> [    7.896834] max98088 7-0010: revision A
>>> [    7.912776] snow-audio sound: HiFi <-> 3830000.i2s mapping ok
>>> [    7.919367] max98088 7-0010: Invalid master clock frequency
>>> [    7.919429] snow-audio sound: ASoC: Spring-I2S-MAX98089 late_probe()
>>> failed: -22
>>> [    7.920019] snow-audio sound: snd_soc_register_card failed (-22)
>>> [    7.920109] snow-audio: probe of sound failed with error -22
>>
> 
> I had the same error on Snow but even on the first boot and after doing some
> code archeology, I found the following commit [0] in a Samsung downstream
> tree that solves the issue.
> 
> The problem is that clk_round_rate(max98095->mclk, freq) returns 0 as the
> rounded rate if XCLOUT is not allowed to be re-parented on rate change.

Same on Spring:

diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index 1aa81321afba..46dc64675c26 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -1365,6 +1365,7 @@ static int max98088_dai_set_sysclk(struct
snd_soc_dai *dai,

        if (!IS_ERR(max98088->mclk)) {
                freq = clk_round_rate(max98088->mclk, freq);
+               dev_warn(codec->dev, "freq = %u\n", freq);
                clk_set_rate(max98088->mclk, freq);
        }


> With Tushar's patch I see that clk_round_rate() returns 24000000 (24MHz)
> so the codec driver setups the correct PLL clock.

Ditto. With the clkout reparenting patch, clk_round_rate() returns 24MHz
just like when double-beep-initialized. However when not
double-beep-initialized, the driver initializes, but no audible output,
so there must be another missing puzzle piece.

>> On a suspicion, the fourth boot I waited for the double-beep of the
>> firmware (waiting for Ctrl+d/u), and then it did work.
>>
>> So it seems the mclk is not always set up properly by the kernel,
>> relying on firmware. Who's in charge of setting that clock up?
> 
> Right, it seems audio is only working due the firmware doing some previous
> setup. Probably it works on every boot if you have "sound init" as a part of
> the u-boot boot commands?

Indeed it does, 24 MHz without the reparenting patch, and sound working.

'sound init' code:
https://github.com/afaerber/u-boot/blob/spring/drivers/sound/max98088.c

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG Nürnberg)

WARNING: multiple messages have this Message-ID (diff)
From: afaerber@suse.de (Andreas Färber)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/6] ASoC: max98088: Document DT bindings
Date: Fri, 20 Feb 2015 01:36:56 +0100	[thread overview]
Message-ID: <54E681A8.6040702@suse.de> (raw)
In-Reply-To: <54E64C09.5000505@collabora.co.uk>

Am 19.02.2015 um 21:48 schrieb Javier Martinez Canillas:
> On 02/19/2015 07:54 PM, Andreas F?rber wrote:
>> Am 19.02.2015 um 19:40 schrieb Andreas F?rber:
>>> I updated max98088 and had it working on first boot, but on
>>> second boot it complained about the frequency:
>>>
>>> [    7.896834] max98088 7-0010: revision A
>>> [    7.912776] snow-audio sound: HiFi <-> 3830000.i2s mapping ok
>>> [    7.919367] max98088 7-0010: Invalid master clock frequency
>>> [    7.919429] snow-audio sound: ASoC: Spring-I2S-MAX98089 late_probe()
>>> failed: -22
>>> [    7.920019] snow-audio sound: snd_soc_register_card failed (-22)
>>> [    7.920109] snow-audio: probe of sound failed with error -22
>>
> 
> I had the same error on Snow but even on the first boot and after doing some
> code archeology, I found the following commit [0] in a Samsung downstream
> tree that solves the issue.
> 
> The problem is that clk_round_rate(max98095->mclk, freq) returns 0 as the
> rounded rate if XCLOUT is not allowed to be re-parented on rate change.

Same on Spring:

diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index 1aa81321afba..46dc64675c26 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -1365,6 +1365,7 @@ static int max98088_dai_set_sysclk(struct
snd_soc_dai *dai,

        if (!IS_ERR(max98088->mclk)) {
                freq = clk_round_rate(max98088->mclk, freq);
+               dev_warn(codec->dev, "freq = %u\n", freq);
                clk_set_rate(max98088->mclk, freq);
        }


> With Tushar's patch I see that clk_round_rate() returns 24000000 (24MHz)
> so the codec driver setups the correct PLL clock.

Ditto. With the clkout reparenting patch, clk_round_rate() returns 24MHz
just like when double-beep-initialized. However when not
double-beep-initialized, the driver initializes, but no audible output,
so there must be another missing puzzle piece.

>> On a suspicion, the fourth boot I waited for the double-beep of the
>> firmware (waiting for Ctrl+d/u), and then it did work.
>>
>> So it seems the mclk is not always set up properly by the kernel,
>> relying on firmware. Who's in charge of setting that clock up?
> 
> Right, it seems audio is only working due the firmware doing some previous
> setup. Probably it works on every boot if you have "sound init" as a part of
> the u-boot boot commands?

Indeed it does, 24 MHz without the reparenting patch, and sound working.

'sound init' code:
https://github.com/afaerber/u-boot/blob/spring/drivers/sound/max98088.c

Regards,
Andreas

-- 
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Jennifer Guild, Dilip Upmanyu,
Graham Norton; HRB 21284 (AG N?rnberg)

  reply	other threads:[~2015-02-20  0:36 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18 18:25 [PATCH 0/6] ASoC: samsung: Spring sound support Andreas Färber
2015-02-18 18:25 ` Andreas Färber
2015-02-18 18:25 ` Andreas Färber
2015-02-18 18:25 ` [PATCH 1/6] ASoC: max98088: Document DT bindings Andreas Färber
2015-02-18 18:25   ` Andreas Färber
2015-02-19 13:55   ` Javier Martinez Canillas
2015-02-19 13:55     ` Javier Martinez Canillas
2015-02-19 14:13     ` Andreas Färber
2015-02-19 14:13       ` Andreas Färber
2015-02-19 17:48       ` Doug Anderson
2015-02-19 17:48         ` Doug Anderson
2015-02-19 18:40         ` Andreas Färber
2015-02-19 18:40           ` Andreas Färber
2015-02-19 18:54           ` Andreas Färber
2015-02-19 18:54             ` Andreas Färber
2015-02-19 20:48             ` Javier Martinez Canillas
2015-02-19 20:48               ` Javier Martinez Canillas
2015-02-20  0:36               ` Andreas Färber [this message]
2015-02-20  0:36                 ` Andreas Färber
2015-02-20 12:12                 ` Sylwester Nawrocki
2015-02-20 12:12                   ` Sylwester Nawrocki
2015-02-23 16:46                   ` Javier Martinez Canillas
2015-02-23 16:46                     ` Javier Martinez Canillas
2015-02-18 18:25 ` [PATCH 2/6] ASoC: max98088: Add " Andreas Färber
2015-02-18 18:25   ` Andreas Färber
2015-02-18 19:08   ` Sergei Shtylyov
2015-02-18 19:08     ` Sergei Shtylyov
2015-02-18 19:17     ` Andreas Färber
2015-02-18 19:17       ` Andreas Färber
2015-02-19 19:18   ` [PATCH] ASoC: max98088: Add master clock handling Andreas Färber
2015-02-19 19:18     ` Andreas Färber
2015-02-20  3:27     ` [alsa-devel] " Tushar Behera
2015-02-20  3:27       ` Tushar Behera
2015-02-23  8:29       ` Javier Martinez Canillas
2015-02-23  8:29         ` Javier Martinez Canillas
     [not found]         ` <54EAE4DF.3040607-ZGY8ohtN/8pPYcu2f3hruQ@public.gmane.org>
2015-02-23 12:23           ` Andreas Färber
2015-02-23 12:23             ` Andreas Färber
2015-02-23 12:23             ` Andreas Färber
2015-02-18 18:25 ` [PATCH 3/6] ARM: dts: Add max98089 to exynos5250-spring Andreas Färber
2015-02-18 18:25   ` Andreas Färber
2015-02-18 18:25   ` Andreas Färber
2015-02-18 18:25 ` [PATCH 4/6] ASoC: samsung: Document binding for max98089 based Snow driver Andreas Färber
2015-02-18 18:25   ` Andreas Färber
     [not found]   ` <1424283959-16289-5-git-send-email-afaerber-l3A5Bk7waGM@public.gmane.org>
2015-02-19  3:49     ` [alsa-devel] " Tushar Behera
2015-02-19  3:49       ` Tushar Behera
2015-02-19  3:49       ` Tushar Behera
2015-02-18 18:25 ` [PATCH 5/6] ASoC: samsung: Extend Snow driver to support max98089 Andreas Färber
2015-02-18 18:25   ` Andreas Färber
2015-02-18 18:25   ` Andreas Färber
2015-02-19  9:44   ` Mark Brown
2015-02-19  9:44     ` Mark Brown
2015-02-19  9:44     ` Mark Brown
2015-02-19 12:33     ` Andreas Färber
2015-02-19 12:33       ` Andreas Färber
     [not found]     ` <20150219094425.GB3198-bheZrs9scGb3/WHNxyQH9YN0K6Il/+VY@public.gmane.org>
2015-02-19 17:44       ` Doug Anderson
2015-02-19 17:44         ` Doug Anderson
2015-02-19 17:44         ` Doug Anderson
2015-02-19 17:56         ` Andreas Färber
2015-02-19 17:56           ` Andreas Färber
     [not found]           ` <54E623C9.7070001-l3A5Bk7waGM@public.gmane.org>
2015-02-19 19:01             ` Doug Anderson
2015-02-19 19:01               ` Doug Anderson
2015-02-19 19:01               ` Doug Anderson
2015-02-21  2:40         ` Mark Brown
2015-02-21  2:40           ` Mark Brown
2015-02-18 18:25 ` [PATCH 6/6] ARM: dts: Add sound support to exynos5250-spring Andreas Färber
2015-02-18 18:25   ` Andreas Färber
2015-02-18 18:25   ` Andreas Färber
2015-02-19 14:05   ` Javier Martinez Canillas
2015-02-19 14:05     ` Javier Martinez Canillas

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=54E681A8.6040702@suse.de \
    --to=afaerber@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dianders@chromium.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=javier.martinez@collabora.co.uk \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sbkim73@samsung.com \
    --cc=tomasz.figa@gmail.com \
    --cc=vpalatin@chromium.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.