Skip to contentSkip to conversation

Driver lis3lv02d_i2c not working on Nokia RX-51

DISCUSSION Pali Rohár 4 participants 17 messages Feb 16, 2013 – Mar 28, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hello,

Accelerometer driver lis3lv02d_i2c not working on Nokia RX-51 with linux kernel 3.8-rc3. Probing for i2c device failing.

I tried to compile older version and it working without problem. Then I bisected commit which broke support for RX-51.

That commit is ec400c9fab99d16a491cea17d27d0c6a5780b97c "lis3lv02d: make regulator API usage unconditional"

CCing everybody who signed off that commit. When I reverted that commit on top of 3.8-rc3, lis3lv02d working without problem.

It looks like driver is trying to use some regulator, but there is nothing defined for RX-51.

Any idea what to do?

Signature · 2 lines
Pali Rohár
[email protected]
#1 lore raw
Quoted 9 lines · Pali Rohár

Accelerometer driver lis3lv02d_i2c not working on Nokia RX-51 with linux kernel 3.8-rc3. Probing for i2c device failing.

I tried to compile older version and it working without problem. Then I bisected commit which broke support for RX-51.

That commit is ec400c9fab99d16a491cea17d27d0c6a5780b97c "lis3lv02d: make regulator API usage unconditional"

Quoted 7 lines

CCing everybody who signed off that commit. When I reverted that commit on top of 3.8-rc3, lis3lv02d working without problem.

It looks like driver is trying to use some regulator, but there is nothing defined for RX-51.

Any idea what to do?

It would be helpful to provide some more detailed information on the problem you are seeing than "the probe is failing". Are there any error messages or other indications as to where in the probe the error occurs?

#2 lore raw
Quoted 19 lines · On Sunday 17 February 2013 17:25:24 Mark Brown wrote:
Quoted 18 lines · Pali Rohár

Accelerometer driver lis3lv02d_i2c not working on Nokia RX-51 with linux kernel 3.8-rc3. Probing for i2c device failing.

I tried to compile older version and it working without problem. Then I bisected commit which broke support for RX-51.

That commit is ec400c9fab99d16a491cea17d27d0c6a5780b97c "lis3lv02d: make regulator API usage unconditional"

CCing everybody who signed off that commit. When I reverted that commit on top of 3.8-rc3, lis3lv02d working without problem.

It looks like driver is trying to use some regulator, but there is nothing defined for RX-51.

Quoted 6 lines
Quoted 1 line

Any idea what to do?

It would be helpful to provide some more detailed information on the problem you are seeing than "the probe is failing". Are there any error messages or other indications as to where in the probe the error occurs?

I booted kernel without reverted that commit and here is dmesg output:

$ dmesg | grep lis3
[  110.454345] lis3lv02d_i2c 3-001d: Failed to get supply 'Vdd': -517
[  110.457397] i2c 3-001d: Driver lis3lv02d_i2c requests probe deferral
[  111.507415] lis3lv02d_i2c 3-001d: Failed to get supply 'Vdd': -517
[  111.510528] i2c 3-001d: Driver lis3lv02d_i2c requests probe deferral
[  126.720458] lis3lv02d_i2c 3-001d: Failed to get supply 'Vdd': -517
[  126.728149] i2c 3-001d: Driver lis3lv02d_i2c requests probe deferral
[  135.842803] lis3lv02d_i2c 3-001d: Failed to get supply 'Vdd': -517
[  135.856292] i2c 3-001d: Driver lis3lv02d_i2c requests probe deferral
Signature · 2 lines
Pali Rohár
[email protected]
#3 lore raw
Quoted 9 lines · Pali Rohár
$ dmesg | grep lis3
[  110.454345] lis3lv02d_i2c 3-001d: Failed to get supply 'Vdd': -517
[  110.457397] i2c 3-001d: Driver lis3lv02d_i2c requests probe deferral
[  111.507415] lis3lv02d_i2c 3-001d: Failed to get supply 'Vdd': -517
[  111.510528] i2c 3-001d: Driver lis3lv02d_i2c requests probe deferral
[  126.720458] lis3lv02d_i2c 3-001d: Failed to get supply 'Vdd': -517
[  126.728149] i2c 3-001d: Driver lis3lv02d_i2c requests probe deferral
[  135.842803] lis3lv02d_i2c 3-001d: Failed to get supply 'Vdd': -517
[  135.856292] i2c 3-001d: Driver lis3lv02d_i2c requests probe deferral

This just looks like a basic error in the board hookup - the supplies are not mapped for the device. Add the supply mappings and you should be fine. This should have been done when the device was added, the commit doing that looks like it was never tested in mainline as the driver problem was fixed in October 2011 but the RX51 didn't start using the device until May 2012.

#4 lore raw
Quoted 13 lines · On Sunday 17 February 2013 19:17:59 Mark Brown wrote:
Quoted 11 lines · Pali Rohár
$ dmesg | grep lis3
[  110.454345] lis3lv02d_i2c 3-001d: Failed to get supply
'Vdd': -517 [  110.457397] i2c 3-001d: Driver lis3lv02d_i2c
requests probe deferral [  111.507415] lis3lv02d_i2c
3-001d: Failed to get supply 'Vdd': -517 [  111.510528] i2c
3-001d: Driver lis3lv02d_i2c requests probe deferral [ 
126.720458] lis3lv02d_i2c 3-001d: Failed to get supply
'Vdd': -517 [  126.728149] i2c 3-001d: Driver lis3lv02d_i2c
requests probe deferral [  135.842803] lis3lv02d_i2c
3-001d: Failed to get supply 'Vdd': -517 [  135.856292] i2c
3-001d: Driver lis3lv02d_i2c requests probe deferral
Quoted 7 lines

This just looks like a basic error in the board hookup - the supplies are not mapped for the device. Add the supply mappings and you should be fine. This should have been done when the device was added, the commit doing that looks like it was never tested in mainline as the driver problem was fixed in October 2011 but the RX51 didn't start using the device until May 2012.

There is no regulator 'Vdd' supply in board rx51 files. Can you look at code how it can be fixed?
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/mach-omap2/board-rx51-peripherals.c#n86

Signature · 2 lines
Pali Rohár
[email protected]
#5 lore raw
Quoted 2 lines · Pali Rohár

There is no regulator 'Vdd' supply in board rx51 files. Can you look at code how it can be fixed?

You need to look at the schematics rather than the code here - the code just needs to say what regulator supplies Vdd on the device.

#6 lore raw
Quoted 7 lines · On Sunday 24 March 2013 22:21:49 Mark Brown wrote:
Quoted 2 lines · Pali Rohár

There is no regulator 'Vdd' supply in board rx51 files. Can you look at code how it can be fixed?

You need to look at the schematics rather than the code here - the code just needs to say what regulator supplies Vdd on the device.

This is problem, there is no info about regulator supplies for this device...

Signature · 2 lines
Pali Rohár
[email protected]
#7 lore raw
Quoted 8 lines · Pali Rohár
Quoted 3 lines · On Sunday 24 March 2013 22:21:49 Mark Brown wrote:

You need to look at the schematics rather than the code here - the code just needs to say what regulator supplies Vdd on the device.

This is problem, there is no info about regulator supplies for this device...

Well, you should seek support from the board vendor then. Or try things like continuity tests (the regulator will have external components, most likely there's at least a decoupling cap you can probe at the device end too).

#8 lore raw
Quoted 10 lines · On Sunday 24 March 2013 23:14:46 Mark Brown wrote:
Quoted 7 lines · Pali Rohár
Quoted 3 lines · On Sunday 24 March 2013 22:21:49 Mark Brown wrote:

You need to look at the schematics rather than the code here - the code just needs to say what regulator supplies Vdd on the device.

This is problem, there is no info about regulator supplies for this device...

Well, you should seek support from the board vendor then.

Not possible. Nokia is already using Windows Phones and life cycle for Nokia N900 phone is at the end. And Nokia never released any HW documentations to community...

Quoted 3 lines

Or try things like continuity tests (the regulator will have external components, most likely there's at least a decoupling cap you can probe at the device end too).

Disassembling this mobile phone is not simple and I dubt that it will help me...

Another question: what was reason for that commit ec400c9fab99d16a491cea17d27d0c6a5780b97c "lis3lv02d: make regulator API usage unconditional" ?

I think that for N900 support is reverting above commit needed, I do not see other solution...

Signature · 2 lines
Pali Rohár
[email protected]
#9 lore raw
Quoted 7 lines · Pali Rohár
Quoted 1 line · On Sunday 24 March 2013 23:14:46 Mark Brown wrote:

Well, you should seek support from the board vendor then.

Not possible. Nokia is already using Windows Phones and life cycle for Nokia N900 phone is at the end. And Nokia never released any HW documentations to community...

There may well still be people with the required information, though in general this sort of thing is always going to be a hazard when working on undocumented hardware.

Quoted 3 lines

Another question: what was reason for that commit ec400c9fab99d16a491cea17d27d0c6a5780b97c "lis3lv02d: make regulator API usage unconditional" ?

Failing to provide power to a device is typically a very serious problem for device operation but the code that was there handles such errors by ignoring them. This isn't a robust way forwards and such code should never have been merged in the first place, as the changelog says the regulator core provides a number of facilities for stubbing itself out when it is not required which boards should use.

Handling the possibility that supplies may not be there not only creates needless repetitive complexity in device drivers but also decreases the robustness of the system since error handling for access to powered down devices often isn't very pretty and other drivers or the core may disrupt the operation of the device by for example powering it down due to not thinking it's in use.

Quoted 2 lines

I think that for N900 support is reverting above commit needed, I do not see other solution...

If you're convinced that the regulator is kept on for some reason you could always just provide a fake supply, though obviously it would be better to hook up the real regulator since this may break if at some point the kernel decides that whatever is actually providing the supply is unused and can be turned off.

#10 lore raw
Quoted 35 lines · On Monday 25 March 2013 00:04:37 Mark Brown wrote:
Quoted 6 lines · Pali Rohár
Quoted 1 line · On Sunday 24 March 2013 23:14:46 Mark Brown wrote:

Well, you should seek support from the board vendor then.

Not possible. Nokia is already using Windows Phones and life cycle for Nokia N900 phone is at the end. And Nokia never released any HW documentations to community...

There may well still be people with the required information, though in general this sort of thing is always going to be a hazard when working on undocumented hardware.

Quoted 3 lines

Another question: what was reason for that commit ec400c9fab99d16a491cea17d27d0c6a5780b97c "lis3lv02d: make regulator API usage unconditional" ?

Failing to provide power to a device is typically a very serious problem for device operation but the code that was there handles such errors by ignoring them. This isn't a robust way forwards and such code should never have been merged in the first place, as the changelog says the regulator core provides a number of facilities for stubbing itself out when it is not required which boards should use.

Handling the possibility that supplies may not be there not only creates needless repetitive complexity in device drivers but also decreases the robustness of the system since error handling for access to powered down devices often isn't very pretty and other drivers or the core may disrupt the operation of the device by for example powering it down due to not thinking it's in use.

Quoted 2 lines

I think that for N900 support is reverting above commit needed, I do not see other solution...

Quoted 6 lines

If you're convinced that the regulator is kept on for some reason you could always just provide a fake supply, though obviously it would be better to hook up the real regulator since this may break if at some point the kernel decides that whatever is actually providing the supply is unused and can be turned off.

CCing Aaro and Tony. Look at this thread on:
https://lkml.org/lkml/2013/2/16/152

What do you think how to fix this problem? I do not know about any HW regulator for n900 accelerometer and possible solutions could be revert that commit or adding fake regulator to board code...

Signature · 2 lines
Pali Rohár
[email protected]
#11 lore raw
Quoted 3 lines · Pali Rohár

What do you think how to fix this problem? I do not know about any HW regulator for n900 accelerometer and possible solutions could be revert that commit or adding fake regulator to board code...

Reverting the fix is not an option, this is a clear bug in the platform.

There will be a regulator here, the device needs power.

#12 lore raw
Quoted 9 lines · Mark Brown
Quoted 3 lines · Pali Rohár

What do you think how to fix this problem? I do not know about any HW regulator for n900 accelerometer and possible solutions could be revert that commit or adding fake regulator to board code...

Reverting the fix is not an option, this is a clear bug in the platform.

There will be a regulator here, the device needs power.

Bullshit.

This is a regression, and it needs to be fixed. The "device needs power" crap is just that - crap. Nobody cares. OF COURSE all devices need power, but that is totally irrelevant for a driver. The SSD in my system "needs power", but I have absolutely zero regulator information for it NOR DO I F*CKING NEED ANY!

Claiming that we need to know the power regulator for an accelerometer is total utter idiocy and crap.

I'm going to revert that commit unless you can fix it some other way (dummy regulators when you can't find a real one or whatever). The notion that you have to have regulator information in order to use some random device is insanity. I don't understand how you can even start to make excuses like that. It's so obviously bogus that it's not even funny.

Why do I have to explain the "no regressions" to long-time kernel maintainers EVERY SINGLE RELEASE? What the f*ck is *wrong* with you people? Seriously?

Linus

#13 lore raw
Quoted 1 line · Linus Torvalds

This is a regression, and it needs to be fixed. The "device needs

This isn't a regression, the commit they're complaining about (ec400c) was added in October 2011 with a note about all the in-tree users having been looked after and then the commit adding the registration of the device (3b511201) was added in May 2012 - the device has just never, ever worked in mainline on this board as far as I can tell. It's not like this was even two commits going in in the same release cycle.

As far as I can tell what's happened here is that someone got round to testing what was sent upstream for the board and noticed that it never worked.

Quoted 4 lines

power" crap is just that - crap. Nobody cares. OF COURSE all devices need power, but that is totally irrelevant for a driver. The SSD in my system "needs power", but I have absolutely zero regulator information for it NOR DO I F*CKING NEED ANY!

Right, and this is why the core provides facilities for stubbing things out. There's no point in every single driver going and implementing the same code for handling this stuff, it's repetitive at best.

Quoted 2 lines

I'm going to revert that commit unless you can fix it some other way (dummy regulators when you can't find a real one or whatever). The

That's pretty much what I'm telling them to do - put the stub regulators in if they don't know how things are connected on their board (there's helpers to make this easier).

There is also an existing Kconfig option to just stub out any missing regulator which people can use but it's not recommended for production since it confuses things that may really have optional supplies and want to handle that.

Quoted 4 lines

notion that you have to have regulator information in order to use some random device is insanity. I don't understand how you can even start to make excuses like that. It's so obviously bogus that it's not even funny.

There's definitely room for improving the stubs, I would like to see something which lets boards say "these specific regulators are mapped, these supplies don't exist and stub anything else out with a dummy", but users like rx51 should be well enough catered for at the minute.

maintainer
#14 lore raw
In reply to Pali Rohár

Hi,

Quoted 6 lines · Pali Rohár

CCing Aaro and Tony. Look at this thread on:
https://lkml.org/lkml/2013/2/16/152

What do you think how to fix this problem? I do not know about any HW regulator for n900 accelerometer and possible solutions could be revert that commit or adding fake regulator to board code...

I think the following should work:

...

From: Aaro Koskinen <[email protected]>
Date: Tue, 26 Mar 2013 21:34:22 +0200
Subject: [PATCH] OMAP: RX-51: add missing regulator supply definitions for lis3lv02d

Add missing regulator definitions for lis3lv02d accelerometer. Fixes the following probe issue:

[   57.737518] lis3lv02d_i2c 3-001d: Failed to get supply 'Vdd': -517
[   57.747100] i2c 3-001d: Driver lis3lv02d_i2c requests probe deferral
---
 arch/arm/mach-omap2/board-rx51-peripherals.c |    4 ++++
 1 file changed, 4 insertions(+)
arch/arm/mach-omap2/board-rx51-peripherals.c +4 -0
index 3a077df..1a88467 100644
@@ -547,12 +547,16 @@ static struct regulator_consumer_supply rx51_vio_supplies[] = {
 	REGULATOR_SUPPLY("DVDD", "2-0019"),
 	/* Si4713 IO supply */
 	REGULATOR_SUPPLY("vio", "2-0063"),
+	/* lis3lv02d */
+	REGULATOR_SUPPLY("Vdd_IO", "3-001d"),
 };
 
 static struct regulator_consumer_supply rx51_vaux1_consumers[] = {
 	REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
 	/* Si4713 supply */
 	REGULATOR_SUPPLY("vdd", "2-0063"),
+	/* lis3lv02d */
+	REGULATOR_SUPPLY("Vdd", "3-001d"),
 };
 
 static struct regulator_init_data rx51_vaux1 = {
Signature · 3 lines
1.7.10.4

A.
Reviewed-by
#15 lore raw
Quoted 6 lines · Aaro Koskinen

From: Aaro Koskinen <[email protected]>
Date: Tue, 26 Mar 2013 21:34:22 +0200
Subject: [PATCH] OMAP: RX-51: add missing regulator supply definitions for lis3lv02d

Add missing regulator definitions for lis3lv02d accelerometer. Fixes the following probe issue:

This is exactly the sort of thing I'd expect to see the board doing.

#16 lore raw
In reply to Aaro Koskinen
Quoted 54 lines · On Tuesday 26 March 2013 21:53:19 Aaro Koskinen wrote:

Hi,

Quoted 7 lines · Pali Rohár

CCing Aaro and Tony. Look at this thread on:
https://lkml.org/lkml/2013/2/16/152

What do you think how to fix this problem? I do not know about any HW regulator for n900 accelerometer and possible solutions could be revert that commit or adding fake regulator to board code...

I think the following should work:

...

From: Aaro Koskinen <[email protected]>
Date: Tue, 26 Mar 2013 21:34:22 +0200
Subject: [PATCH] OMAP: RX-51: add missing regulator supply definitions for lis3lv02d

Add missing regulator definitions for lis3lv02d accelerometer. Fixes the following probe issue:

[   57.737518] lis3lv02d_i2c 3-001d: Failed to get supply

'Vdd': -517 [ 57.747100] i2c 3-001d: Driver lis3lv02d_i2c
requests probe deferral

---
 arch/arm/mach-omap2/board-rx51-peripherals.c |    4 ++++
 1 file changed, 4 insertions(+)
(quoted diff) +0 -0

b/arch/arm/mach-omap2/board-rx51-peripherals.c index 3a077df..1a88467 100644

arch/arm/mach-omap2/board-rx51-peripherals.c +4 -0
@@ -547,12 +547,16 @@ static struct regulator_consumer_supply
 rx51_vio_supplies[] = { REGULATOR_SUPPLY("DVDD", "2-0019"),
 	/* Si4713 IO supply */
 	REGULATOR_SUPPLY("vio", "2-0063"),
+	/* lis3lv02d */
+	REGULATOR_SUPPLY("Vdd_IO", "3-001d"),
 };
 
 static struct regulator_consumer_supply
 rx51_vaux1_consumers[] = { REGULATOR_SUPPLY("vdds_sdi",
 "omapdss"),
 	/* Si4713 supply */
 	REGULATOR_SUPPLY("vdd", "2-0063"),
+	/* lis3lv02d */
+	REGULATOR_SUPPLY("Vdd", "3-001d"),
 };
 
Quoted 1 line

static struct regulator_init_data rx51_vaux1 = {

Hi, on #maemo IRC channel we have found some accelerometer regulators and I wrote this patch which is working fine with 3.8:

@@ -728,12 +730,16 @@ static struct regulator_consumer_supply rx51_vio_supplies[] = {
REGULATOR_SUPPLY("DVDD", "2-0019"),
/* Si4713 IO supply */ REGULATOR_SUPPLY("vio", "2-0063"),
+ /* lis3lv02d IO supply */
+ REGULATOR_SUPPLY("Vdd_IO", "3-001d"),
};

static struct regulator_consumer_supply rx51_vaux1_consumers[] =
{
REGULATOR_SUPPLY("vdds_sdi", "omapdss"),
/* Si4713 supply */
REGULATOR_SUPPLY("vdd", "2-0063"),
+ /* lis3lv02d supply */
+ REGULATOR_SUPPLY("Vdd", "3-001d"),
};

static struct regulator_init_data rx51_vaux1 = {

Now I see that patch is same as Aaro's :-) so please include it.

Signature · 2 lines
Pali Rohár
[email protected]