From: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
To: "Sebastian Reichel" <sre@kernel.org>,
"Pali Rohár" <pali.rohar@gmail.com>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.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: Wed, 16 Mar 2016 20:21:31 +0200 [thread overview]
Message-ID: <56E9A42B.3010209@gmail.com> (raw)
In-Reply-To: <20160316144709.GA3389@earth>
Hi,
On 16.03.2016 16:47, Sebastian Reichel wrote:
> Hi,
>
> On Wed, Mar 16, 2016 at 02:33:19PM +0100, Pali Rohár wrote:
>> Hi! We found out that tpa6130a2 device is being initialized before
>> i2c_2 bus is initialized. So that is reason why tpa6130a2 fails...
>
> What do you mean by initialize? A call to tpa6130a2_probe()? In that
> case I wonder about client->adapter. Is it NULL?
>
This is (a part of) the log when tpa6130a2 fails to initialize:
Jan 1 08:03:07 Nokia-N900 kernel: [ 1.928344] twl 1-0048: PIH (irq 23) chaining IRQs 340..348
Jan 1 08:03:07 Nokia-N900 kernel: [ 1.934326] twl 1-0048: power (irq 345) chaining IRQs 348..355
Jan 1 08:03:07 Nokia-N900 kernel: [ 2.498504] twl4030_gpio twl4030-gpio: gpio (irq 340) chaining IRQs 356..373
Jan 1 08:03:07 Nokia-N900 kernel: [ 2.858215] twl4030_usb 48070000.i2c:twl@48:twl4030-usb: Initialized TWL4030 USB module
Jan 1 08:03:07 Nokia-N900 kernel: [ 2.888702] input: twl4030_pwrbutton as /devices/platform/68000000.ocp/48070000.i2c/i2c-1/1-0048/48070000.i2c:twl@48:pwrbutton/input/input0
Jan 1 08:03:07 Nokia-N900 kernel: [ 2.903594] input: TWL4030 Keypad as /devices/platform/68000000.ocp/48070000.i2c/i2c-1/1-0048/48070000.i2c:twl@48:keypad/input/input1
Jan 1 08:03:07 Nokia-N900 kernel: [ 3.148040] 48070000.i2c:twl@48:madc supply vusb3v1 not found, using dummy regulator
Jan 1 08:03:07 Nokia-N900 kernel: [ 6.997985] omap_i2c 48070000.i2c: bus 1 rev3.3 at 2200 kHz
Jan 1 08:03:07 Nokia-N900 kernel: [ 7.010528] tpa6130a2 2-0060: Write failed
Jan 1 08:03:07 Nokia-N900 kernel: [ 7.015563] omap_i2c 48072000.i2c: bus 2 rev3.3 at 100 kHz
Jan 1 08:03:07 Nokia-N900 kernel: [ 7.023742] omap_i2c 48060000.i2c: bus 3 rev3.3 at 400 kHz
Now, it is either tpa6130a2 probe() is called before i2c-2 is
initialized or i2c driver first probes devices on the bus and only then
logs successful probe ("omap_i2c 48072000.i2c: bus 2 rev3.3 at 100 kHz")
in our case.
> ---------------
>
> I just had another look at the driver and I think there is a race
> condition for tpa6130a2_add_controls() and tpa6130a2_stereo_enable().
>
> As far as I can see both functions check for "tpa6130a2_client !=
> NULL". tpa6130a2_client is set before the probe function has finished,
> though. Simplified probe:
>
> ...
> tpa6130a2_client = client;
> set_default_regs();
> acquire_power_gpio();
> acquire_regulator();
> tpa6130a2_power(1); // needs tpa6130a2_client
> check_device();
> tpa6130a2_power(0); // needs tpa6130a2_client
> ...
>
> If tpa6130a2_add_controls() or tpa6130a2_stereo_enable() is called
> after tpa6130a2 probe has started, but before probe has completed,
> tpa6130a2_client is set, but not yet initialized. The race condition
> can be fixed easily by moving the tpa6130a2_client assignment directly
> after the regulator acquisition.
>
I'll try that, thanks.
Regards,
Ivo
next prev parent reply other threads:[~2016-03-16 18:21 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 [this message]
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
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=56E9A42B.3010209@gmail.com \
--to=ivo.g.dimitrov.75@gmail.com \
--cc=aaro.koskinen@iki.fi \
--cc=jarkko.nikula@bitmer.com \
--cc=lars@metafoo.de \
--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=sre@kernel.org \
--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.