All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Cc: "Mark Brown" <broonie@kernel.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Peter Ujfalusi" <peter.ujfalusi@ti.com>,
	"Grygorii Strashko" <grygorii.strashko@ti.com>,
	"Pali Rohár" <pali.rohar@gmail.com>,
	"Jarkko Nikula" <jarkko.nikula@bitmer.com>,
	"Tony Lindgren" <tony@atomide.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org,
	"Pavel Machek" <pavel@ucw.cz>,
	"Aaro Koskinen" <aaro.koskinen@iki.fi>,
	"Nishanth Menon" <nm@ti.com>,
	merlijn@wizzup.org
Subject: Re: Nokia N900 - audio TPA6130A2 problems
Date: Mon, 21 Mar 2016 02:40:50 +0100	[thread overview]
Message-ID: <20160321014050.GA25916@earth> (raw)
In-Reply-To: <20160321000417.GA21902@earth>

[-- Attachment #1: Type: text/plain, Size: 6113 bytes --]

Hi,

On Mon, Mar 21, 2016 at 01:04:18AM +0100, Sebastian Reichel wrote:
> On Sun, Mar 20, 2016 at 09:43:11PM +0200, Ivaylo Dimitrov wrote:
> > On 20.03.2016 07:17, Sebastian Reichel wrote:
> > >On Sat, Mar 19, 2016 at 10:49:57AM +0200, Ivaylo Dimitrov wrote:
> > >>On 18.03.2016 17:04, Sebastian Reichel wrote:
> > >>>On Fri, Mar 18, 2016 at 03:45:26PM +0200, Ivaylo Dimitrov wrote:
> > >>>>On 18.03.2016 15:36, Sebastian Reichel wrote:
> > >>>>Regulator is V28_A, which is always-on, so it is enabled no matter what
> > >>>>probe does. Anyway, I added a various delays after regulator_enable(), to no
> > >>>>success.
> > >>
> > >>I guess we're getting closer - I put some printks in various functions in
> > >>the twl-regulator.c, here is the result:
> > >>
> > >>on power-up:
> > >>
> > >>[    2.378601] twl4030ldo_get_voltage_sel VMMC2 vsel 0x00000008
> > >>[    2.384948] twl4030reg_enable VMMC2 grp 0x00000020
> > >>[    2.408416] twl4030ldo_get_voltage_sel VMMC2 vsel 0x00000008
> > >>[    7.196685] twl4030reg_is_enabled VMMC2 state 0x0000002e
> > >>[    7.202819] twl4030reg_is_enabled VMMC2 state 0x0000002e
> > >>[    7.209777] twl4030reg_is_enabled VMMC2 state 0x0000002e
> > >>[    7.215728] twl4030reg_is_enabled VMMC2 state 0x0000002e
> > >>[    7.223205] twl4030reg_is_enabled VMMC2 state 0x0000002e
> > >
> > >Ok, so normal power up results in running VMMC2 (always-on works),
> > >but voltage is not configured correctly. 2.6V is default according
> > >to the TRM. I think this is a "bug" in the regulator framework. It
> > >should setup the minimum allowed voltage before enabling the
> > >always-on regulator.
> > >
> > 
> > /sys/kernel/debug/regulator/regulator_summary shows 2850mV for V28_A, so I
> > would remove the quotes. Also, always-on is because if V28_A regulator is
> > turned off, there is a leakage through tlv320aic34 VIO. BTW one of the
> > things I did while trying to find the problem, was to remove that always-on
> > property from the DTS - it didn't help.
> 
> Right thinking about it, the voltage must also be configured for the
> non always-on cases. So it's not a problem with the regulator
> framework, but with twl-regulator's probe function, that should take
> care of this.
> 
> > >In case of the tpa6130a2/tpa6140a2 driver it may also be nice to add
> > >something like this to the driver (Vdd may be between 2.5V and 5.5V
> > >according to both datasheets):
> > >
> > >if (regulator_can_change_voltage(data->supply))
> > >     regulator_set_voltage(data->supply, 2500000, 5500000);
> > >
> > 
> > and add DT property for that voltage range, as max output power and
> > harmonics depend on the supply voltage.
> 
> I guess that's 2nd step.
> 
> > >>after restart from stock kernel:
> > >>
> > >>[    2.388610] twl4030ldo_get_voltage_sel VMMC2 vsel 0x0000000a
> > >>[    2.394958] twl4030reg_enable VMMC2 grp 0x00000028
> > >
> > >I had a quick glance at this. I think stock kernel put VMMC2
> > >into sleep mode. Mainline kernel does not expect sleep mode
> > >being set and does not disable it.
> > >
> > 
> > Well, one would think that kernel should not have expectations on what would
> > be the state of the hardware by the time it takes control over it, but setup
> > everything needed instead.
> 
> I thought it's obvious, that this is not the desired behaviour :)
> 
> > >>[    2.418426] twl4030ldo_get_voltage_sel VMMC2 vsel 0x0000000a
> > >>[    7.186645] twl4030reg_is_enabled VMMC2 state 0x00000020
> > >>[    7.192718] twl4030reg_is_enabled VMMC2 state 0x00000020
> > >>[    7.199615] twl4030reg_is_enabled VMMC2 state 0x00000020
> > >>[    7.205535] twl4030reg_is_enabled VMMC2 state 0x00000020
> > >>[    7.212951] twl4030reg_is_enabled VMMC2 state 0x00000020
> > >>
> > >>I don't see twl4030ldo_set_voltage_sel() for VMMC2(V28_A) regulator, though
> > >>there are calls for VMMC1 and VAUX3.
> > >
> > >I guess that's because the voltage is only configured if at least
> > >one regulator consumer requests anything specific.
> > >
> > 
> > But then the board DTS is simply ignored. Doesn't look good :)
> >
> > >>So, it seems to me that V28_A is not enabled or correctly set-up
> > >>and all devices connected to it does not function. And it looks
> > >>like even after power-on VMMC2 is not correctly set-up - it is
> > >>supposed to have voltage of 2.85V (10) but kernel leaves it to
> > >>2.60V (8). However my twl-fu ends here so any help is appreciated.
> > >
> > >So in case of reboot from stock kernel voltage is already configured
> > >to 2.8V, but it does not work, because of the sleep mode.
> > >
> > 
> > Yeah, that sleep is pretty clear, I was rather asking - "any idea how to fix
> > that?". Or it is someone else expected to fix it?
> 
> You may have noticed, that I included Mark and Liam. I hope they
> can give some feedback. I think there are two bugs:
> 
> 1. twl_probe() should setup a default voltage based on DT
>    information.

I just had a look at the regulator core code. I think the voltage
should be set automatically during regulator_register():

regulator_register()
-> set_machine_constraints()
--> machine_constraints_voltage()
---> _regulator_do_set_voltage()
----> _regulator_call_set_voltage()
-----> ops->set_voltage()

Looks like this currently only works automatically, if DT specifies
min-voltage = max-voltage. Adding this to twl-regulator's probe
function before devm_regulator_register()) should enable the voltage
setting:

init_data->constraints.apply_uV = 1;

I hope Mark can tell us why this only done, when the voltage is fixed.

> 2. if regulator is in sleep mode, regulator enable should
>    disable sleep mode.

Stroke that. It should be disabled in probe of course, since
it can be modified later using regulator_set_mode(). Actually
it is already supported by adding this to the omap3-n900.dts:

&vmmc2 {
    regulator-initial-mode = <2>;
};

Ivo, Can you try if this fixes your problems with tpa6130a2 after
rebooting from Nokia kernel?

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  reply	other threads:[~2016-03-21  1:40 UTC|newest]

Thread overview: 58+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-25 10:28 Nokia N900 - audio TPA6130A2 problems Pali Rohár
2015-07-25 10:28 ` Pali Rohár
2015-07-25 13:17 ` Lars-Peter Clausen
2015-08-01 10:18   ` Pali Rohár
2015-08-03 18:03     ` Jarkko Nikula
2015-08-03 18:17       ` Pali Rohár
2015-08-03 18:48         ` Jarkko Nikula
2015-08-03 18:55           ` Pali Rohár
2015-08-04  7:02           ` Peter Ujfalusi
2015-08-04  7:02             ` Peter Ujfalusi
2016-01-04 23:34             ` Pali Rohár
2016-03-06 15:23               ` Sebastian Reichel
2016-03-07 11:59                 ` Pali Rohár
2016-03-08  6:45                   ` Ivaylo Dimitrov
2016-03-12 12:39                     ` Pali Rohár
2016-03-12 12:42                 ` Pali Rohár
2016-03-14  9:59                   ` Peter Ujfalusi
2016-03-14  9:59                     ` Peter Ujfalusi
2016-03-14 17:05                     ` Ivaylo Dimitrov
2016-03-16 13:33                     ` Pali Rohár
2016-03-16 14:47                       ` Sebastian Reichel
2016-03-16 18:21                         ` Ivaylo Dimitrov
2016-03-16 18:32                           ` Grygorii Strashko
2016-03-16 18:32                             ` Grygorii Strashko
2016-03-16 19:50                             ` Ivaylo Dimitrov
2016-03-17  0:49                               ` Sebastian Reichel
2016-03-17  7:56                                 ` Ivaylo Dimitrov
2016-03-17 13:01                                   ` Pali Rohár
2016-03-17 13:11                                     ` Ivaylo Dimitrov
2016-03-17 13:33                                       ` Tony Lindgren
2016-03-17 13:50                                         ` Ivaylo Dimitrov
2016-03-17 14:32                                           ` Tony Lindgren
2016-03-17 14:58                                             ` Ivaylo Dimitrov
2016-03-17  7:53                               ` Peter Ujfalusi
2016-03-17  7:53                                 ` Peter Ujfalusi
2016-03-17 17:26                                 ` Ivaylo Dimitrov
2016-03-18 10:33                                   ` Peter Ujfalusi
2016-03-18 10:33                                     ` Peter Ujfalusi
2016-03-18 13:13                                     ` Ивайло Димитров
2016-03-18 13:36                                       ` Sebastian Reichel
2016-03-18 13:45                                         ` Ivaylo Dimitrov
2016-03-18 15:04                                           ` Sebastian Reichel
2016-03-18 15:56                                             ` Ivaylo Dimitrov
2016-03-19  8:49                                             ` Ivaylo Dimitrov
2016-03-20  5:17                                               ` Sebastian Reichel
2016-03-20 19:43                                                 ` Ivaylo Dimitrov
2016-03-21  0:04                                                   ` Sebastian Reichel
2016-03-21  1:40                                                     ` Sebastian Reichel [this message]
2016-03-21 12:03                                                     ` Mark Brown
2016-03-21 11:45                                                 ` Mark Brown
2016-03-21 13:39                                                   ` Ivaylo Dimitrov
2016-03-21 13:45                                                     ` Mark Brown
2016-03-21 14:53                                                       ` Sebastian Reichel
2016-03-21 19:34                                                         ` Ivaylo Dimitrov
2016-03-22  8:02                                                           ` Ivaylo Dimitrov
2016-04-01 10:43                         ` Race condition in TPA6130A2 (Was: Re: Nokia N900 - audio TPA6130A2 problems) Pali Rohár
2015-08-14 20:46         ` Nokia N900 - audio TPA6130A2 problems Pavel Machek
2015-08-14 20:54           ` Pali Rohár

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=20160321014050.GA25916@earth \
    --to=sre@kernel.org \
    --cc=aaro.koskinen@iki.fi \
    --cc=broonie@kernel.org \
    --cc=grygorii.strashko@ti.com \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=jarkko.nikula@bitmer.com \
    --cc=lars@metafoo.de \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=merlijn@wizzup.org \
    --cc=nm@ti.com \
    --cc=pali.rohar@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=peter.ujfalusi@ti.com \
    --cc=tony@atomide.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 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.