iio: ST clean-ups and new sensor support
Subsystems (3)
v3 cover iio: ST clean-ups and new sensor support
Hi Jonathan,
Sorry for the continued development and resubmission. I won't write anymore patches now. At least until these have been accepted.
This patch-set includes a few clean-ups surrounding error handling and non-mandatory functionality along with regulator support and the addition of a new pressure/temperature sensor (LPS001WP) and extended support for a new magnetometer sensor (LSM303DLH).
Everything has been tested with Device Tree.
v2:
- Rebased onto Linux -next as requested by Jonathan
- Reworked clean-up patch to address Jonathan's concerns
- Added binding document (inc regulators)
- Extended regulator support in the driver
- Re-worked Data Ready pin handling
v3:
- Standardise sensor names: <model>_<sensor-type>
- Added error handling clean-ups
- More binding documents; for magn, accel and gyro
- Message on successful sensor bring-up; for press, magn, accel and gyro
- More device enablement for ux500 by way of CONFIGs
- New neat reorder/grouping of patches
Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt | 21 ++++++++ Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt | 21 ++++++++ Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt | 21 ++++++++ Documentation/devicetree/bindings/iio/pressure/lps001wp.txt | 21 ++++++++ arch/arm/boot/dts/ste-dbx5x0.dtsi | 5 -- arch/arm/boot/dts/ste-snowball.dts | 34 ++++++++++++ arch/arm/configs/u8500_defconfig | 5 ++ drivers/iio/accel/st_accel.h | 4 +- drivers/iio/accel/st_accel_core.c | 28 +++++----- drivers/iio/common/st_sensors/st_sensors_core.c | 79 +++++++++++++++------------- drivers/iio/gyro/st_gyro.h | 8 +-- drivers/iio/gyro/st_gyro_core.c | 24 +++++---- drivers/iio/magnetometer/st_magn.h | 3 +- drivers/iio/magnetometer/st_magn_core.c | 27 +++++----- drivers/iio/pressure/st_pressure.h | 3 +- drivers/iio/pressure/st_pressure_core.c | 303 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------------------------- drivers/iio/pressure/st_pressure_i2c.c | 1 + include/linux/iio/common/st_sensors.h | 6 +++ 18 files changed, 453 insertions(+), 161 deletions(-)
PATCH v3 1/38 ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
Turns out that they're actually not required and the driver probes just fine without them. The ID is incorrect at the moment anyway. They actually currently specify the stn8815.
--- arch/arm/boot/dts/ste-dbx5x0.dtsi | 5 ----- 1 file changed, 5 deletions(-)
arch/arm/boot/dts/ste-dbx5x0.dtsi +0 -5
@@ -559,7 +559,6 @@ compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; reg = <0x80004000 0x1000>; interrupts = <0 21 IRQ_TYPE_LEVEL_HIGH>; - arm,primecell-periphid = <0x180024>; #address-cells = <1>; #size-cells = <0>;
@@ -572,7 +571,6 @@ compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; reg = <0x80122000 0x1000>; interrupts = <0 22 IRQ_TYPE_LEVEL_HIGH>; - arm,primecell-periphid = <0x180024>; #address-cells = <1>; #size-cells = <0>;
@@ -585,7 +583,6 @@ compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; reg = <0x80128000 0x1000>; interrupts = <0 55 IRQ_TYPE_LEVEL_HIGH>; - arm,primecell-periphid = <0x180024>; #address-cells = <1>; #size-cells = <0>;
@@ -598,7 +595,6 @@ compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; reg = <0x80110000 0x1000>; interrupts = <0 12 IRQ_TYPE_LEVEL_HIGH>; - arm,primecell-periphid = <0x180024>; #address-cells = <1>; #size-cells = <0>;
@@ -611,7 +607,6 @@ compatible = "stericsson,db8500-i2c", "st,nomadik-i2c", "arm,primecell"; reg = <0x8012a000 0x1000>; interrupts = <0 51 IRQ_TYPE_LEVEL_HIGH>; - arm,primecell-periphid = <0x180024>; #address-cells = <1>; #size-cells = <0>;
Signature · 1 line
1.8.1.2
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
Hi,
Quoted 5 lines · Lee Jones
Turns out that they're actually not required and the driver probes just fine without them. The ID is incorrect at the moment anyway. They actually currently specify the stn8815.
Signed-off-by Lee Jones <[email protected]>
How did you test this patch? What hardware did you boot it on and with what config?
Thanks!
-Olof
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
Quoted 9 lines · Lee Jones
Quoted 5 lines
Turns out that they're actually not required and the driver probes just fine without them. The ID is incorrect at the moment anyway. They actually currently specify the stn8815.
Signed-off-by Lee Jones <[email protected]>How did you test this patch? What hardware did you boot it on and with what config?
Snowball, u8500_defconfig.
Why? Don't you have the same result with yours?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
[pruning out the iio list/people]
Quoted 5 lines · Lee Jones
Quoted 5 lines · Lee Jones
Quoted 4 lines
Turns out that they're actually not required and the driver probes just fine without them. The ID is incorrect at the moment anyway. They actually currently specify the stn8815.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Lee Jones <[email protected]>How did you test this patch? What hardware did you boot it on and with what config?
Snowball,
u8500_defconfig.Why? Don't you have the same result with yours?
I have a very weird experience with snowball right now. I noticed this yesterday when I decided to look at why multi_v7_defconfig doesn't boot on it:
* u8500_defconfig doesn't boot as a DT kernel, since the machine ID is still enabled. If I disable the machine ID, it doesn't boot.
* Same for multi_v7_defconfig, since that is only DT: It doesn't boot.
Unfortunately I can't get to my home network right now to double-check boot logs to see if this has changed behavior recently, I'll have to do that later today. It'd be interesting to hear if you have the same experience w.r.t. DT on u8500_defconfig though.
-Olof
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
Quoted 7 lines · Olof Johansson
I have a very weird experience with snowball right now. I noticed this yesterday when I decided to look at why
multi_v7_defconfigdoesn't boot on it:*
u8500_defconfigdoesn't boot as a DT kernel, since the machine ID is still enabled. If I disable the machine ID, it doesn't boot.
* Same formulti_v7_defconfig, since that is only DT: It doesn't boot.
Weird, yeah there is something wrong on Torvalds' HEAD, with earlyprint it says:
Uncompressing Linux... done, booting the kernel.
Error: unrecognized/unsupported processor variant (0x412fc091). This comes from arch/arm/kernel/head-common.S
I'm trying to bisect and find out what is causing this...
Yours,
Linus Walleij
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
Quoted 10 lines · Linus Walleij
Quoted 7 lines · Olof Johansson
I have a very weird experience with snowball right now. I noticed this yesterday when I decided to look at why
multi_v7_defconfigdoesn't boot on it:*
u8500_defconfigdoesn't boot as a DT kernel, since the machine ID is still enabled. If I disable the machine ID, it doesn't boot.
* Same formulti_v7_defconfig, since that is only DT: It doesn't boot.
Quoted 8 lines
Weird, yeah there is something wrong on Torvalds' HEAD, with earlyprint it says:
Uncompressing Linux... done, booting the kernel.
Error: unrecognized/unsupported processor variant (0x412fc091). This comes fromarch/arm/kernel/head-common.SI'm trying to bisect and find out what is causing this...
Ah nice. Keep us informed of any progress.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
Quoted 5 lines · Lee Jones
Quoted 3 lines · Linus Walleij
Weird, yeah there is something wrong on Torvalds' HEAD, with earlyprint it says:
Quoted 7 lines
Quoted 5 lines
Uncompressing Linux... done, booting the kernel.
Error: unrecognized/unsupported processor variant (0x412fc091). This comes fromarch/arm/kernel/head-common.SI'm trying to bisect and find out what is causing this...
Ah nice. Keep us informed of any progress.
No it was something transient, after a clean rebuild it boots just fine. :-/
I'll see if I can boot the same uImage on the Snowball too.
Linus Walleij
A message that is not in the archive (sent off-list or not yet received): CAF2Aj3iPdqM-+FQ7R9MZ-6jV1Q1me9TG1P4cEGA7fSBBYH92zA@mail.gmail.com
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
Quoted 6 lines · Lee Jones
Quoted 4 lines · Linus Walleij
No it was something transient, after a clean rebuild it boots just fine. :-/
I'll see if I can boot the same uImage on the Snowball too.
Yeah Snowball boots the same DT image with just some random dmesg noise from Torvalds HEAD:
U8500 $ mmc rescan 1 ; fat load mmc 1 0x0 /uImage ; bootm 0x0 Partition info retrieved
Reading /uImage
8997342 bytes read
## Booting kernel from Legacy Image at 00000000 ...
Image Name: Ux500 Device Tree kernel Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 8997278 Bytes = 8.6 MB
Load Address: 00008000
Entry Point: 00008000
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x300
Linux version 3.11.0-09031-ga22a0fd (linus at localhost.localdomain) (gcc version 4.8.2 20130805 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.08 - Linaro GCC 2013.08) ) #48 SMP PREEMPT Wed
Sep 11 11:14:36 CEST 2013
CPU: ARMv7 Processor [412fc091] revision 1 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: ST-Ericsson Ux5x0 platform (Device Tree Support), model:
ST-Ericsson HREF (v60+) platform with Device Tree
Only cachepolicy=writeback supported on ARMv6 and later Memory policy: ECC disabled, Data cache writealloc
DB8500 v2.1 [0x008500b1]
(...)
I don't know what is the problem with Olof's machine :-/
Olof do you want a copy of my uImage?
Yours,
Linus Walleij
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
Quoted 42 lines · Linus Walleij
Quoted 6 lines · Lee Jones
Quoted 4 lines · Linus Walleij
No it was something transient, after a clean rebuild it boots just fine. :-/
I'll see if I can boot the same uImage on the Snowball too.
Yeah Snowball boots the same DT image with just some random dmesg noise from Torvalds HEAD:
U8500 $ mmc rescan 1 ; fat load mmc 1
0x0/uImage ; bootm0x0Partition info retrieved
Reading /uImage8997342 bytes read
## Booting kernel from Legacy Image at 00000000 ...Image Name: Ux500 Device Tree kernel Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 8997278 Bytes = 8.6 MBLoad Address: 00008000
Entry Point: 00008000
Loading Kernel Image ... OK
OKStarting kernel ...
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU0x300
Linux version 3.11.0-09031-ga22a0fd (linus at localhost.localdomain) (gcc version 4.8.2 20130805 (prerelease) (crosstool-NG linaro-1.13.1-4.8-2013.08 - Linaro GCC 2013.08) ) #48 SMP PREEMPT WedSep 11 11:14:36 CEST 2013CPU: ARMv7 Processor [
412fc091] revision 1 (ARMv7), cr=10c5387d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine: ST-Ericsson Ux5x0 platform (Device Tree Support), model:
ST-Ericsson HREF (v60+) platform with Device Tree
Only cachepolicy=writeback supported on ARMv6 and later Memory policy: ECC disabled, Data cache writealloc
DB8500 v2.1 [0x008500b1]
(...)
Quoted 1 line
I don't know what is the problem with Olof's machine :-/
Oh! Well, to start with apparantly u8500_defconfig doesn't have APPENDED_DTB enabled, which explains some of the confusion here.
With that fixed (and the appropriate options to get the bootargs from the atags), I get as far as console probing where output stops, if I have DEBUG_LL on. With it disabled I get all the way up.
Not sure what was going on earlier here. Maybe just as in your case it was a matter of cleaning out and starting fresh.
multi_v7_defconfig still doesn't boot though, but the failure seems to be lower level than any of the others, no output with DEBUG_LL on.
-Olof
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
Quoted 5 lines · Olof Johansson
[Me]
Quoted 1 line
I don't know what is the problem with Olof's machine :-/
Oh! Well, to start with apparantly
u8500_defconfigdoesn't haveAPPENDED_DTBenabled, which explains some of the confusion here.
Oh. Well honestly I think we will never be able to rewrite the U8500 bootloaders, so maybe I should just send a patch adding this to the defconfig by default.
Quoted 3 lines
With that fixed (and the appropriate options to get the bootargs from the atags), I get as far as console probing where output stops, if I have
DEBUG_LLon. With it disabled I get all the way up.
Yeah somewhere the bit-banging from the LL-prints that just hammer the hardware start conflicting with the kernel control over the same port. I guess it's the same for all users of the PL011.
Quoted 2 lines
Not sure what was going on earlier here. Maybe just as in your case it was a matter of cleaning out and starting fresh.
Yeah, it's scary :-/
Quoted 2 lines
multi_v7_defconfigstill doesn't boot though, but the failure seems to be lower level than any of the others, no output withDEBUG_LLon.
Probably the usual case where one system is screwing up for another system. We'll need to look into this.
Yours,
Linus Walleij
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
Quoted 4 lines · Linus Walleij
Yeah somewhere the bit-banging from the LL-prints that just hammer the hardware start conflicting with the kernel control over the same port. I guess it's the same for all users of the PL011.
That shouldn't happen, unless the port becomes disabled (eg, you're not using the LL-debug port as your console, and its then placed into a low power mode.)
Again, let me re-interate what LL-debug is for: it's there to assist getting the early boot up and running. Once the early boot is working, it should *not* be used.
Re: [PATCH 01/38] ARM: ux500: Remove PrimeCell IDs from Nomadik I2C DT nodes
In reply to Olof JohanssonQuoted 17 lines · Olof Johansson
[pruning out the iio list/people]
Quoted 5 lines · Lee Jones
Quoted 5 lines · Lee Jones
Quoted 4 lines
Turns out that they're actually not required and the driver probes just fine without them. The ID is incorrect at the moment anyway. They actually currently specify the stn8815.
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Lee Jones <[email protected]>How did you test this patch? What hardware did you boot it on and with what config?
Snowball,
u8500_defconfig.Why? Don't you have the same result with yours?
Quoted 7 lines
I have a very weird experience with snowball right now. I noticed this yesterday when I decided to look at why
multi_v7_defconfigdoesn't boot on it:*
u8500_defconfigdoesn't boot as a DT kernel, since the machine ID is still enabled. If I disable the machine ID, it doesn't boot.
* Same formulti_v7_defconfig, since that is only DT: It doesn't boot.
I'm not entirely sure what you mean by this, as I have Snowball booting as a Device Tree only platform:
http://www.spinics.net/lists/kernel/msg1590759.html
The Machine ID should be all F's for DT I think.
Quoted 4 lines
Unfortunately I can't get to my home network right now to double-check boot logs to see if this has changed behavior recently, I'll have to do that later today. It'd be interesting to hear if you have the same experience w.r.t. DT on
u8500_defconfigthough.
I just changed SNOWBALL's machine ID to 9999 and it still boots just fine with DT (ATAGs boot hangs). So what did you do? Can you send me a patch of what you did, so I might reproduce your build please?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v3 2/38 ARM: ux500: Enable the LPS001WP Pressure & Temperature sensor from DT
In reply to Lee JonesAfter applying this node the LPS001WP sensor chip should probe successfully once the driver support has also been applied.
--- arch/arm/boot/dts/ste-snowball.dts | 10 ++++++++++ 1 file changed, 10 insertions(+)
arch/arm/boot/dts/ste-snowball.dts +10 -0
@@ -153,6 +153,16 @@ status = "okay"; }; + i2c at 80128000 { + lps001wp_press at 5c { + compatible = "st,lps001wp_press"; + reg = <0x5c>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; + }; + uart at 80120000 { status = "okay"; };
Signature · 1 line
1.8.1.2
PATCH v3 3/38 ARM: ux500: Enable the LSM303DLH Accelerator sensor from DT
In reply to Lee JonesAfter applying this node the LSM303DLH sensor chip should probe successfully once the driver support has also been applied.
--- arch/arm/boot/dts/ste-snowball.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/ste-snowball.dts +8 -0
@@ -161,6 +161,14 @@ vdd-supply = <&ab8500_ldo_aux1_reg>; vddio-supply = <&db8500_vsmps2_reg>; }; + + lsm303dlh_accel at 19 { + compatible = "st,lsm303dlh_accel"; + reg = <0x19>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; }; uart at 80120000 {
Signature · 1 line
1.8.1.2
PATCH v3 4/38 ARM: ux500: Enable the LSM303DLH Magnetometer sensor from DT
In reply to Lee JonesAfter applying this node the LSM303DLH sensor chip should probe successfully once the driver support has also been applied.
--- arch/arm/boot/dts/ste-snowball.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/ste-snowball.dts +8 -0
@@ -169,6 +169,14 @@ vdd-supply = <&ab8500_ldo_aux1_reg>; vddio-supply = <&db8500_vsmps2_reg>; }; + + lsm303dlh_magn at 1e { + compatible = "st,lsm303dlh_magn"; + reg = <0x1e>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; }; uart at 80120000 {
Signature · 1 line
1.8.1.2
PATCH v3 5/38 ARM: ux500: Enable the L3G4200D Gyroscope sensor from DT
In reply to Lee JonesAfter applying this node the L3G4200D sensor chip should probe successfully once the driver support has also been applied.
--- arch/arm/boot/dts/ste-snowball.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/boot/dts/ste-snowball.dts +8 -0
@@ -177,6 +177,14 @@ vdd-supply = <&ab8500_ldo_aux1_reg>; vddio-supply = <&db8500_vsmps2_reg>; }; + + l3g4200d_gyro at 68 { + compatible = "st,l3g4200d_gyro"; + reg = <0x68>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; }; uart at 80120000 {
Signature · 1 line
1.8.1.2
PATCH v3 6/38 ARM: ux500: CONFIG: Enable ST's IIO Pressure Sensors by default
In reply to Lee Jones--- arch/arm/configs/u8500_defconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/configs/u8500_defconfig +2 -0
@@ -37,6 +37,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=65536 CONFIG_SENSORS_BH1780=y +CONFIG_IIO=y +CONFIG_IIO_ST_PRESS=y CONFIG_NETDEVICES=y CONFIG_SMSC911X=y CONFIG_SMSC_PHY=y
Signature · 1 line
1.8.1.2
PATCH v3 7/38 ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
In reply to Lee Jones--- arch/arm/configs/u8500_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/u8500_defconfig +1 -0
@@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536 CONFIG_SENSORS_BH1780=y CONFIG_IIO=y CONFIG_IIO_ST_PRESS=y +CONFIG_IIO_ST_ACCEL_3AXIS=y CONFIG_NETDEVICES=y CONFIG_SMSC911X=y CONFIG_SMSC_PHY=y
Signature · 1 line
1.8.1.2
Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
Quoted 10 lines · Lee Jones
Signed-off-by Lee Jones <[email protected]>--- arch/arm/configs/u8500_defconfig | 1 + 1 file changed, 1 insertion(+)arch/arm/configs/u8500_defconfig +0
-0
arch/arm/configs/u8500_defconfig CONFIG_BLK_DEV_RAM_SIZE=65536 · line 45
Quoted 7 lines
arch/arm/configs/u8500_defconfig +1
-0@@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536 CONFIG_SENSORS_BH1780=y CONFIG_IIO=y CONFIG_IIO_ST_PRESS=y +CONFIG_IIO_ST_ACCEL_3AXIS=y CONFIG_NETDEVICES=y CONFIG_SMSC911X=y CONFIG_SMSC_PHY=y
This is ridiculous.
I know lwn.net's patch author statistics are fun to be on, but splitting this and the other config update into two patches? Really?
-Olof
Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
Quoted 21 lines · Olof Johansson
Quoted 10 lines · Lee Jones
Signed-off-by Lee Jones <[email protected]>--- arch/arm/configs/u8500_defconfig | 1 + 1 file changed, 1 insertion(+)arch/arm/configs/u8500_defconfig +0
-0arch/arm/configs/u8500_defconfig CONFIG_BLK_DEV_RAM_SIZE=65536 · line 45
Quoted 7 lines
arch/arm/configs/u8500_defconfig +1
-0@@ -39,6 +39,7 @@ CONFIG_BLK_DEV_RAM_SIZE=65536 CONFIG_SENSORS_BH1780=y CONFIG_IIO=y CONFIG_IIO_ST_PRESS=y +CONFIG_IIO_ST_ACCEL_3AXIS=y CONFIG_NETDEVICES=y CONFIG_SMSC911X=y CONFIG_SMSC_PHY=yThis is ridiculous.
Quoted 1 line
I know lwn.net's patch author statistics are fun to be on, but
Jealousy won't get you anywhere... ;)
Quoted 1 line
splitting this and the other config update into two patches? Really?
I haven't split anything. I created the patches as I was enabling/testing the drivers, which was at completely different times. The only reason they're close together in the set is because I reorganised it and didn't think it was necessary to squash them together.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
Quoted 7 lines · Lee Jones
Quoted 1 line
splitting this and the other config update into two patches? Really?
I haven't split anything. I created the patches as I was enabling/testing the drivers, which was at completely different times. The only reason they're close together in the set is because I reorganised it and didn't think it was necessary to squash them together.
In this case, squashing makes a lot of sense. But you could even have LinusW do that for you when he pulls in the various config updates for next release.
-Olof
Re: [PATCH 07/38] ARM: ux500: CONFIG: Enable ST's IIO Accelerometer Sensors by default
Quoted 11 lines · Olof Johansson
Quoted 7 lines · Lee Jones
Quoted 1 line
splitting this and the other config update into two patches? Really?
I haven't split anything. I created the patches as I was enabling/testing the drivers, which was at completely different times. The only reason they're close together in the set is because I reorganised it and didn't think it was necessary to squash them together.
In this case, squashing makes a lot of sense.
No problem. That's all you had to say. I'll do it right away.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v3 8/38 ARM: ux500: CONFIG: Enable ST's IIO Magnetometer Sensors by default
In reply to Lee Jones--- arch/arm/configs/u8500_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/u8500_defconfig +1 -0
@@ -40,6 +40,7 @@ CONFIG_SENSORS_BH1780=y CONFIG_IIO=y CONFIG_IIO_ST_PRESS=y CONFIG_IIO_ST_ACCEL_3AXIS=y +CONFIG_IIO_ST_MAGN_3AXIS=y CONFIG_NETDEVICES=y CONFIG_SMSC911X=y CONFIG_SMSC_PHY=y
Signature · 1 line
1.8.1.2
PATCH v3 9/38 ARM: ux500: CONFIG: Enable ST's IIO Gyroscope Sensors by default
In reply to Lee Jones--- arch/arm/configs/u8500_defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/configs/u8500_defconfig +1 -0
@@ -41,6 +41,7 @@ CONFIG_IIO=y CONFIG_IIO_ST_PRESS=y CONFIG_IIO_ST_ACCEL_3AXIS=y CONFIG_IIO_ST_MAGN_3AXIS=y +CONFIG_IIO_ST_GYRO_3AXIS=y CONFIG_NETDEVICES=y CONFIG_SMSC911X=y CONFIG_SMSC_PHY=y
Signature · 1 line
1.8.1.2
PATCH v3 10/38 Documentation: dt: iio: Add binding for LPS001WP
In reply to Lee JonesLPS001WP is a Pressure and Temperature sensor.
--- .../devicetree/bindings/iio/pressure/lps001wp.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/pressure/lps001wp.txt
Documentation/devicetree/bindings/iio/pressure/lps001wp.txt new file +21 -0
@@ -0,0 +1,21 @@ +* STMicroelectronics Pressure Sensor + +Required properties: + - compatible: Should be "st,lps001wp_press" + - reg: The I2C address of the sensor + +Optional properties: + - vdd-supply: Phandle to the Vdd supply regulator + - vddio-supply: Phandle to the Vdd-IO supply regulator + +Example: + +i2c at 80128000 { + lps001wp at 5c { + compatible = "st,lps001wp_press"; + reg = <0x5c>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; +};
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 10/38] Documentation: dt: iio: Add binding for LPS001WP
added devicetree list cc.
Quoted 37 lines · Lee Jones
LPS001WP is a Pressure and Temperature sensor.
Signed-off-by Lee Jones <[email protected]>--- .../devicetree/bindings/iio/pressure/lps001wp.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/pressure/lps001wp.txtDocumentation/devicetree/bindings/iio/pressure/lps001wp.txt new file +21
-1@@ -0,0 +1,21 @@ +* STMicroelectronics Pressure Sensor + +Required properties: + - compatible: Should be "st,lps001wp_press" + - reg: The I2C address of the sensor + +Optional properties: + - vdd-supply: Phandle to the Vdd supply regulator + - vddio-supply: Phandle to the Vdd-IO supply regulator + +Example: + +i2c@80128000 { + lps001wp@5c { + compatible = "st,lps001wp_press"; + reg = <0x5c>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; +}; -- 1.8.1.2 -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to[email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 11/38 Documentation: dt: iio: Add binding for LSM303DLH
In reply to Lee JonesLSM303DLH is a Accelerometer Sensor
--- .../devicetree/bindings/iio/accel/lsm303dlh.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt
Documentation/devicetree/bindings/iio/accel/lsm303dlh.txt new file +21 -0
@@ -0,0 +1,21 @@ +* STMicroelectronics Accelerometer Sensor + +Required properties: + - compatible: Should be "st,lsm303dlh_accel" + - reg: The I2C address of the sensor + +Optional properties: + - vdd-supply: Phandle to the Vdd supply regulator + - vddio-supply: Phandle to the Vdd-IO supply regulator + +Example: + +i2c at 80128000 { + lsm303dlh_accel at 19 { + compatible = "st,lsm303dlh_accel"; + reg = <0x19>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; +};
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 11/38] Documentation: dt: iio: Add binding for LSM303DLH
add devicetree list cc
Quoted 36 lines · Lee Jones
LSM303DLH is a Accelerometer Sensor
Signed-off-by Lee Jones <[email protected]>--- .../devicetree/bindings/iio/accel/lsm303dlh.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/accel/lsm303dlh.txtDocumentation/devicetree/bindings/iio/accel/lsm303dlh.txt new file +21
-0@@ -0,0 +1,21 @@ +* STMicroelectronics Accelerometer Sensor + +Required properties: + - compatible: Should be "st,lsm303dlh_accel" + - reg: The I2C address of the sensor + +Optional properties: + - vdd-supply: Phandle to the Vdd supply regulator + - vddio-supply: Phandle to the Vdd-IO supply regulator + +Example: + +i2c@80128000 { + lsm303dlh_accel@19 { + compatible = "st,lsm303dlh_accel"; + reg = <0x19>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; +};
PATCH v3 12/38 Documentation: dt: iio: Add binding for L3G4200D
In reply to Lee JonesL3G4200D is a Gyroscope Sensor
--- .../devicetree/bindings/iio/gyro/l3g4200d.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt
Documentation/devicetree/bindings/iio/gyro/l3g4200d.txt new file +21 -0
@@ -0,0 +1,21 @@ +* STMicroelectronics Gyroscope Sensor + +Required properties: + - compatible: Should be "st,l3g4200d_gyro" + - reg: The I2C address of the sensor + +Optional properties: + - vdd-supply: Phandle to the Vdd supply regulator + - vddio-supply: Phandle to the Vdd-IO supply regulator + +Example: + +i2c at 80128000 { + l3g4200d_gyro at 68 { + compatible = "st,l3g4200d_gyro"; + reg = <0x68>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; +};
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 12/38] Documentation: dt: iio: Add binding for L3G4200D
Add devicetree list cc
Quoted 36 lines · Lee Jones
L3G4200D is a Gyroscope Sensor
Signed-off-by Lee Jones <[email protected]>--- .../devicetree/bindings/iio/gyro/l3g4200d.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/gyro/l3g4200d.txtDocumentation/devicetree/bindings/iio/gyro/l3g4200d.txt new file +21
-0@@ -0,0 +1,21 @@ +* STMicroelectronics Gyroscope Sensor + +Required properties: + - compatible: Should be "st,l3g4200d_gyro" + - reg: The I2C address of the sensor + +Optional properties: + - vdd-supply: Phandle to the Vdd supply regulator + - vddio-supply: Phandle to the Vdd-IO supply regulator + +Example: + +i2c@80128000 { + l3g4200d_gyro@68 { + compatible = "st,l3g4200d_gyro"; + reg = <0x68>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; +};
PATCH v3 13/38 Documentation: dt: iio: Add binding for LSM303DLH
In reply to Lee JonesLSM303DLH is a Magnetometer Sensor
--- .../bindings/iio/magnetometer/lsm303dlh.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt
Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt new file +21 -0
@@ -0,0 +1,21 @@ +* STMicroelectronics Magnetometer Sensor + +Required properties: + - compatible: Should be "st,lsm303dlh_magn" + - reg: The I2C address of the sensor + +Optional properties: + - vdd-supply: Phandle to the Vdd supply regulator + - vddio-supply: Phandle to the Vdd-IO supply regulator + +Example: + +i2c at 80128000 { + lsm303dlh_magn at 1e { + compatible = "st,lsm303dlh_magn"; + reg = <0x1e>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; +};
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 13/38] Documentation: dt: iio: Add binding for LSM303DLH
Add devicetree list cc.
Quoted 36 lines · Lee Jones
LSM303DLH is a Magnetometer Sensor
Signed-off-by Lee Jones <[email protected]>--- .../bindings/iio/magnetometer/lsm303dlh.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txtDocumentation/devicetree/bindings/iio/magnetometer/lsm303dlh.txt new file +21
-0@@ -0,0 +1,21 @@ +* STMicroelectronics Magnetometer Sensor + +Required properties: + - compatible: Should be "st,lsm303dlh_magn" + - reg: The I2C address of the sensor + +Optional properties: + - vdd-supply: Phandle to the Vdd supply regulator + - vddio-supply: Phandle to the Vdd-IO supply regulator + +Example: + +i2c@80128000 { + lsm303dlh_magn@1e { + compatible = "st,lsm303dlh_magn"; + reg = <0x1e>; + + vdd-supply = <&ab8500_ldo_aux1_reg>; + vddio-supply = <&db8500_vsmps2_reg>; + }; +};
PATCH v3 14/38 iio: accel: st: Append _accel to accelerator sensor device names
In reply to Lee JonesSome of ST's sensors are appended with their sensor type and some are not. For consistency we're extending the same naming convention throughout.
--- drivers/iio/accel/st_accel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/st_accel.h +2 -2
@@ -15,11 +15,11 @@#include <linux/iio/common/st_sensors.h> #define LSM303DLHC_ACCEL_DEV_NAME "lsm303dlhc_accel" -#define LIS3DH_ACCEL_DEV_NAME "lis3dh" +#define LIS3DH_ACCEL_DEV_NAME "lis3dh_accel"#define LSM330D_ACCEL_DEV_NAME "lsm330d_accel"#define LSM330DL_ACCEL_DEV_NAME "lsm330dl_accel"#define LSM330DLC_ACCEL_DEV_NAME "lsm330dlc_accel" -#define LIS331DLH_ACCEL_DEV_NAME "lis331dlh" +#define LIS331DLH_ACCEL_DEV_NAME "lis331dlh_accel"#define LSM303DL_ACCEL_DEV_NAME "lsm303dl_accel"#define LSM303DLH_ACCEL_DEV_NAME "lsm303dlh_accel"#define LSM303DLM_ACCEL_DEV_NAME "lsm303dlm_accel"
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
Quoted 5 lines · Lee Jones
Some of ST's sensors are appended with their sensor type and some are not. For consistency we're extending the same naming convention throughout.
Signed-off-by Lee Jones <[email protected]>
Honestly I don't care either way on these, but consistency would definitely be good so applied to the togreg branch of iio.git
Thanks,
Quoted 23 lines
--- drivers/iio/accel/st_accel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/accel/st_accel.h +2
-2@@ -15,11 +15,11 @@#include <linux/iio/common/st_sensors.h> #define LSM303DLHC_ACCEL_DEV_NAME "lsm303dlhc_accel" -#define LIS3DH_ACCEL_DEV_NAME "lis3dh" +#define LIS3DH_ACCEL_DEV_NAME "lis3dh_accel"#define LSM330D_ACCEL_DEV_NAME "lsm330d_accel"#define LSM330DL_ACCEL_DEV_NAME "lsm330dl_accel"#define LSM330DLC_ACCEL_DEV_NAME "lsm330dlc_accel" -#define LIS331DLH_ACCEL_DEV_NAME "lis331dlh" +#define LIS331DLH_ACCEL_DEV_NAME "lis331dlh_accel"#define LSM303DL_ACCEL_DEV_NAME "lsm303dl_accel"#define LSM303DLH_ACCEL_DEV_NAME "lsm303dlh_accel"#define LSM303DLM_ACCEL_DEV_NAME "lsm303dlm_accel"
Jonathan Cameron
maintainerRe: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
Quoted 10 lines · Jonathan Cameron
Quoted 5 lines · Lee Jones
Some of ST's sensors are appended with their sensor type and some are not. For consistency we're extending the same naming convention throughout.
Signed-off-by Lee Jones <[email protected]>Honestly I don't care either way on these, but consistency would definitely be good so applied to the togreg branch of iio.git
Thanks,
Actually change of plan. I'm going to hold off on these as this an ABI change. Iritating though having these as completely inconsistent is, changing this will change device identification from userspace which is not a good idea.
Sorry Lee, but we really shouldn't do this. I should have picked up on this in the original driver reviews but that's hindsight for you.
Quoted 28 lines
Quoted 13 lines
--- drivers/iio/accel/st_accel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/accel/st_accel.h +0
-0@@ -15,11 +15,11 @@#include <linux/iio/common/st_sensors.h> #define LSM303DLHC_ACCEL_DEV_NAME "lsm303dlhc_accel"drivers/iio/accel/st_accel.h line 25
Quoted 10 lines
drivers/iio/accel/st_accel.h +2
-2-#define LIS3DH_ACCEL_DEV_NAME "lis3dh" +#define LIS3DH_ACCEL_DEV_NAME "lis3dh_accel"#define LSM330D_ACCEL_DEV_NAME "lsm330d_accel"#define LSM330DL_ACCEL_DEV_NAME "lsm330dl_accel"#define LSM330DLC_ACCEL_DEV_NAME "lsm330dlc_accel" -#define LIS331DLH_ACCEL_DEV_NAME "lis331dlh" +#define LIS331DLH_ACCEL_DEV_NAME "lis331dlh_accel"#define LSM303DL_ACCEL_DEV_NAME "lsm303dl_accel"#define LSM303DLH_ACCEL_DEV_NAME "lsm303dlh_accel"#define LSM303DLM_ACCEL_DEV_NAME "lsm303dlm_accel"--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
Quoted 10 lines · Jonathan Cameron
Quoted 9 lines · Jonathan Cameron
Quoted 5 lines · Lee Jones
Some of ST's sensors are appended with their sensor type and some are not. For consistency we're extending the same naming convention throughout.
Signed-off-by Lee Jones <[email protected]>Honestly I don't care either way on these, but consistency would definitely be good so applied to the togreg branch of iio.git
Quoted 8 lines
Quoted 1 line
Thanks,
Actually change of plan. I'm going to hold off on these as this an ABI change. Iritating though having these as completely inconsistent is, changing this will change device identification from userspace which is not a good idea.
Sorry Lee, but we really shouldn't do this. I should have picked up on this in the original driver reviews but that's hindsight for you.
I think those with the suffix are the ones where you have accel and gyro in the same package, the ones without the suffix are pure accelerometers.
- Lars
Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
Hi Lars,
Quoted 12 lines · Jonathan Cameron
Quoted 11 lines · Jonathan Cameron
Quoted 10 lines · Lee Jones
Quoted 5 lines
Some of ST's sensors are appended with their sensor type and some are not. For consistency we're extending the same naming convention throughout.
Signed-off-by Lee Jones <[email protected]>Honestly I don't care either way on these, but consistency would definitely be good so applied to the togreg branch of iio.git
Thanks,
Quoted 8 lines
Quoted 6 lines
Actually change of plan. I'm going to hold off on these as this an ABI change. Iritating though having these as completely inconsistent is, changing this will change device identification from userspace which is not a good idea.
Sorry Lee, but we really shouldn't do this. I should have picked up on this in the original driver reviews but that's hindsight for you.
I think those with the suffix are the ones where you have accel and gyro in the same package, the ones without the suffix are pure accelerometers.
Yes You are right. I've used this kind of logic... What do you think about?
Denis
Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
Quoted 17 lines · Denis CIOCCA
Hi Lars,
Quoted 16 lines · Jonathan Cameron
Quoted 15 lines · Jonathan Cameron
Quoted 10 lines · Lee Jones
Quoted 5 lines
Some of ST's sensors are appended with their sensor type and some are not. For consistency we're extending the same naming convention throughout.
Signed-off-by Lee Jones <[email protected]>Honestly I don't care either way on these, but consistency would definitely be good so applied to the togreg branch of iio.git
Thanks,
Actually change of plan. I'm going to hold off on these as this an ABI change. Iritating though having these as completely inconsistent is, changing this will change device identification from userspace which is not a good idea.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Sorry Lee, but we really shouldn't do this. I should have picked up on this in the original driver reviews but that's hindsight for you.
I think those with the suffix are the ones where you have accel and gyro in the same package, the ones without the suffix are pure accelerometers.
Yes You are right. I've used this kind of logic... What do you think about?
Denis
Seems sensible to me.
Jonathan Cameron
maintainerRe: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
Quoted 20 lines · Lars-Peter Clausen
Quoted 19 lines · Denis CIOCCA
Hi Lars,
Quoted 18 lines · Jonathan Cameron
Quoted 17 lines · Jonathan Cameron
Quoted 10 lines · Lee Jones
Quoted 5 lines
Some of ST's sensors are appended with their sensor type and some are not. For consistency we're extending the same naming convention throughout.
Signed-off-by Lee Jones <[email protected]>Honestly I don't care either way on these, but consistency would definitely be good so applied to the togreg branch of iio.git
Thanks,
Actually change of plan. I'm going to hold off on these as this an ABI change. Iritating though having these as completely inconsistent is, changing this will change device identification from userspace which is not a good idea.
Sorry Lee, but we really shouldn't do this. I should have picked up on this in the original driver reviews but that's hindsight for you.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
I think those with the suffix are the ones where you have accel and gyro in the same package, the ones without the suffix are pure accelerometers.
Yes You are right. I've used this kind of logic... What do you think about?
Denis
Seems sensible to me.
How about a comment to this effect in the code so that we keep it like this?
Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
In reply to Jonathan CameronQuoted 2 lines
Honestly I don't care either way on these, but consistency would definitely be good so applied to the togreg branch of iio.git
For clarification, is togreg due for the v3.12 merge window or will be get a settling period in -next?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
Quoted 6 lines · Lee Jones
Quoted 2 lines
Honestly I don't care either way on these, but consistency would definitely be good so applied to the togreg branch of iio.git
For clarification, is togreg due for the v3.12 merge window or will be get a settling period in -next?
Well everything up to the 'iio-for-3.12c' tag will be in v3.12, everything else not.
- Lars
Jonathan Cameron
maintainerRe: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
Quoted 4 lines · Lars-Peter Clausen
Quoted 3 lines · Lee Jones
Quoted 2 lines
Honestly I don't care either way on these, but consistency would definitely be good so applied to the togreg branch of iio.git
Quoted 9 lines
Quoted 3 lines
For clarification, is togreg due for the v3.12 merge window or will be get a settling period in -next?
Well everything up to the 'iio-for-3.12c' tag will be in v3.12, everything else not.
- Lars
Yes. At the moment IIO is routed through Greg KHs staging tree. His merge window closes 1 week before Linus opens the main one (when Greg can figure out what Linus is intending!) Hence I close the IIO one whenever I manage to get a last pull request in before that.
Hence all 3.13 for the current togreg branch.
Jonathan
Re: [PATCH 14/38] iio: accel: st: Append _accel to accelerator sensor device names
Quoted 12 lines · Jonathan Cameron
Quoted 11 lines · Lars-Peter Clausen
Quoted 6 lines · Lee Jones
Quoted 2 lines
Honestly I don't care either way on these, but consistency would definitely be good so applied to the togreg branch of iio.git
For clarification, is togreg due for the v3.12 merge window or will be get a settling period in -next?
Well everything up to the 'iio-for-3.12c' tag will be in v3.12, everything else not.
Quoted 8 lines
Quoted 2 lines
- Lars
Yes. At the moment IIO is routed through Greg KHs staging tree. His merge window closes 1 week before Linus opens the main one (when Greg can figure out what Linus is intending!) Hence I close the IIO one whenever I manage to get a last pull request in before that.
Hence all 3.13 for the current togreg branch.
Perfect, thanks both of you.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v3 15/38 iio: gyro: st: Append _gyro to gyroscope sensor device names
In reply to Lee JonesSome of ST's sensors are appended with their sensor type and some are not. For consistency we're extending the same naming convention throughout.
--- drivers/iio/gyro/st_gyro.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/gyro/st_gyro.h +4 -4
@@ -14,13 +14,13 @@#include <linux/types.h> #include <linux/iio/common/st_sensors.h> -#define L3G4200D_GYRO_DEV_NAME "l3g4200d" +#define L3G4200D_GYRO_DEV_NAME "l3g4200d_gyro"#define LSM330D_GYRO_DEV_NAME "lsm330d_gyro"#define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro"#define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro" -#define L3GD20_GYRO_DEV_NAME "l3gd20" -#define L3GD20H_GYRO_DEV_NAME "l3gd20h" -#define L3G4IS_GYRO_DEV_NAME "l3g4is_ui" +#define L3GD20_GYRO_DEV_NAME "l3gd20_gyro" +#define L3GD20H_GYRO_DEV_NAME "l3gd20h_gyro" +#define L3G4IS_GYRO_DEV_NAME "l3g4is_ui_gyro"#define LSM330_GYRO_DEV_NAME "lsm330_gyro"/**
Signature · 1 line
1.8.1.2
PATCH v3 16/38 iio: magn: st: Append _magn to magnetometer sensor device names
In reply to Lee JonesSome of ST's sensors are appended with their sensor type and some are not. For consistency we're extending the same naming convention throughout.
--- drivers/iio/magnetometer/st_magn.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/magnetometer/st_magn.h +1 -1
@@ -16,7 +16,7 @@#define LSM303DLHC_MAGN_DEV_NAME "lsm303dlhc_magn"#define LSM303DLM_MAGN_DEV_NAME "lsm303dlm_magn" -#define LIS3MDL_MAGN_DEV_NAME "lis3mdl" +#define LIS3MDL_MAGN_DEV_NAME "lis3mdl_magn"int st_magn_common_probe (struct iio_dev *indio_dev,struct st_sensors_platform_data *pdata);
Signature · 1 line
1.8.1.2
PATCH v3 17/38 iio: press: st: Append _press to pressure sensor device names
In reply to Lee JonesSome of ST's sensors are appended with their sensor type and some are not. For consistency we're extending the same naming convention throughout.
--- drivers/iio/pressure/st_pressure.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/pressure/st_pressure.h +1 -1
@@ -14,7 +14,7 @@#include <linux/types.h> #include <linux/iio/common/st_sensors.h> -#define LPS331AP_PRESS_DEV_NAME "lps331ap" +#define LPS331AP_PRESS_DEV_NAME "lps331ap_press"/** * struct st_sensors_platform_data - default press platform data
Signature · 1 line
1.8.1.2
PATCH v3 18/38 iio: sensors-core: st: Allow full-scale to be an optional feature
In reply to Lee JonesSome chips either don't support it or fail to provide adequate documentation, so sometimes it's impossible to enable the feature even if it is supported.
--- drivers/iio/common/st_sensors/st_sensors_core.c | 11 +++++++---- drivers/iio/pressure/st_pressure_core.c | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-)
drivers/iio/common/st_sensors/st_sensors_core.c +7 -4
@@ -235,10 +235,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,if (err <0 ) goto init_error; - err =st_sensors_set_fullscale (indio_dev, - sdata->current_fullscale->num); -if (err <0 ) - goto init_error; +if (sdata->current_fullscale) { + err =st_sensors_set_fullscale (indio_dev, + sdata->current_fullscale->num); +if (err <0 ) + goto init_error; + }else +dev_info (&indio_dev->dev,"Full-scale not possible\n" ); err =st_sensors_set_odr (indio_dev, sdata->odr);if (err <0 )
drivers/iio/pressure/st_pressure_core.c +4 -2
@@ -226,8 +226,10 @@ int st_press_common_probe(struct iio_dev *indio_dev, indio_dev->channels = pdata->sensor->ch; indio_dev->num_channels =ARRAY_SIZE (st_press_channels); - pdata->current_fullscale = (struct st_sensor_fullscale_avl *) - &pdata->sensor->fs.fs_avl[0 ]; +if (pdata->sensor->fs.addr !=0 ) + pdata->current_fullscale = (struct st_sensor_fullscale_avl *) + &pdata->sensor->fs.fs_avl[0 ]; + pdata->odr = pdata->sensor->odr.odr_avl[0 ].hz;if (!plat_data)
Signature · 1 line
1.8.1.2
Re: [PATCH 18/38] iio: sensors-core: st: Allow full-scale to be an optional feature
Quoted 4 lines · Lee Jones
Some chips either don't support it or fail to provide adequate documentation, so sometimes it's impossible to enable the feature even if it is supported.
Signed-off-by Lee Jones <[email protected]>
Applied to the togreg branch of iio.git
Thanks
Quoted 45 lines
--- drivers/iio/common/st_sensors/st_sensors_core.c | 11 +++++++---- drivers/iio/pressure/st_pressure_core.c | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-)drivers/iio/common/st_sensors/st_sensors_core.c +7
-4@@ -235,10 +235,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,if (err <0 ) goto init_error; - err =st_sensors_set_fullscale (indio_dev, - sdata->current_fullscale->num); -if (err <0 ) - goto init_error; +if (sdata->current_fullscale) { + err =st_sensors_set_fullscale (indio_dev, + sdata->current_fullscale->num); +if (err <0 ) + goto init_error; + }else +dev_info (&indio_dev->dev,"Full-scale not possible\n" ); err =st_sensors_set_odr (indio_dev, sdata->odr);if (err <0 )drivers/iio/pressure/st_pressure_core.c +4
-2@@ -226,8 +226,10 @@ int st_press_common_probe(struct iio_dev *indio_dev, indio_dev->channels = pdata->sensor->ch; indio_dev->num_channels =ARRAY_SIZE (st_press_channels); - pdata->current_fullscale = (struct st_sensor_fullscale_avl *) - &pdata->sensor->fs.fs_avl[0 ]; +if (pdata->sensor->fs.addr !=0 ) + pdata->current_fullscale = (struct st_sensor_fullscale_avl *) + &pdata->sensor->fs.fs_avl[0 ]; + pdata->odr = pdata->sensor->odr.odr_avl[0 ].hz;if (!plat_data)
Jonathan Cameron
maintainerRe: [PATCH 18/38] iio: sensors-core: st: Allow full-scale to be an optional feature
Quoted 7 lines · Jonathan Cameron
Quoted 4 lines · Lee Jones
Some chips either don't support it or fail to provide adequate documentation, so sometimes it's impossible to enable the feature even if it is supported.
Signed-off-by Lee Jones <[email protected]>Applied to the togreg branch of iio.git
Note that Denis Acked this in v1 and it hasn't changed substantially that I can see. Hence you should have added that ack to this reposting. I nearly missed it.
Quoted 51 lines
Thanks
Quoted 35 lines
--- drivers/iio/common/st_sensors/st_sensors_core.c | 11 +++++++---- drivers/iio/pressure/st_pressure_core.c | 6 ++++-- 2 files changed, 11 insertions(+), 6 deletions(-)drivers/iio/common/st_sensors/st_sensors_core.c +7
-4@@ -235,10 +235,13 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev,if (err <0 ) goto init_error; - err =st_sensors_set_fullscale (indio_dev, - sdata->current_fullscale->num); -if (err <0 ) - goto init_error; +if (sdata->current_fullscale) { + err =st_sensors_set_fullscale (indio_dev, + sdata->current_fullscale->num); +if (err <0 ) + goto init_error; + }else +dev_info (&indio_dev->dev,"Full-scale not possible\n" ); err =st_sensors_set_odr (indio_dev, sdata->odr);if (err <0 )drivers/iio/pressure/st_pressure_core.c +0
-0@@ -226,8 +226,10 @@ int st_press_common_probe(struct iio_dev *indio_dev, indio_dev->channels = pdata->sensor->ch; indio_dev->num_channels =ARRAY_SIZE (st_press_channels);drivers/iio/pressure/st_pressure_core.c int st_press_common_probe(struct iio_dev *indio_dev, · line 235
Quoted 10 lines
drivers/iio/pressure/st_pressure_core.c +4
-2- pdata->current_fullscale = (struct st_sensor_fullscale_avl *) - &pdata->sensor->fs.fs_avl[0 ]; +if (pdata->sensor->fs.addr !=0 ) + pdata->current_fullscale = (struct st_sensor_fullscale_avl *) + &pdata->sensor->fs.fs_avl[0 ]; + pdata->odr = pdata->sensor->odr.odr_avl[0 ].hz;if (!plat_data)--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 19/38 iio: sensors-core: st: Support sensors which don't have a Data Ready pin
In reply to Lee JonesNot all ST's sensors support data ready, so let's make the declaration of one conditional.
--- drivers/iio/common/st_sensors/st_sensors_core.c | 24 +++++++++++++++++++----- drivers/iio/pressure/st_pressure_core.c | 3 ++- 2 files changed, 21 insertions(+), 6 deletions(-)
drivers/iio/common/st_sensors/st_sensors_core.c +19 -5
@@ -198,14 +198,11 @@ int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable) }EXPORT_SYMBOL (st_sensors_set_axis_enable); -int st_sensors_init_sensor (struct iio_dev *indio_dev, -struct st_sensors_platform_data *pdata) +int st_sensors_set_drdy_int_pin (struct iio_dev *indio_dev, +struct st_sensors_platform_data *pdata) { -int err;struct st_sensor_data *sdata =iio_priv (indio_dev); -mutex_init (&sdata->tb.buf_lock); -switch (pdata->drdy_int_pin) {case 1 :if (sdata->sensor->drdy_irq.mask_int1 ==0 ) {
@@ -231,6 +228,20 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, goto init_error; } +return 0 ; +} + +int st_sensors_init_sensor (struct iio_dev *indio_dev, +struct st_sensors_platform_data *pdata) +{ +int err =0 ; +struct st_sensor_data *sdata =iio_priv (indio_dev); + +mutex_init (&sdata->tb.buf_lock); + +if (pdata) + err =st_sensors_set_drdy_int_pin (indio_dev, pdata); + err =st_sensors_set_enable (indio_dev, false);if (err <0 ) goto init_error;
@@ -266,6 +277,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)u8 drdy_mask;struct st_sensor_data *sdata =iio_priv (indio_dev); +if (!sdata->sensor->drdy_irq.addr) +return 0 ; +/* Enable/Disable the interrupt generator 1. */ if (sdata->sensor->drdy_irq.ig1.en_addr >0 ) { err = st_sensors_write_data_with_mask(indio_dev,
drivers/iio/pressure/st_pressure_core.c +2 -1
@@ -232,7 +232,8 @@ int st_press_common_probe(struct iio_dev *indio_dev, pdata->odr = pdata->sensor->odr.odr_avl[0 ].hz; -if (!plat_data) +/* Some devices don't support a data ready pin. */ +if (!plat_data && pdata->sensor->drdy_irq.addr) plat_data = (struct st_sensors_platform_data *)&default_press_pdata;
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 19/38] iio: sensors-core: st: Support sensors which don't have a Data Ready pin
Quoted 4 lines · Lee Jones
Not all ST's sensors support data ready, so let's make the declaration of one conditional.
Signed-off-by Lee Jones <[email protected]>
Hi Lee,
This one doesn't actually build:
CC [M] drivers/iio/common/st_sensors/st_sensors_core.odrivers/iio/common/st_sensors/st_sensors_core.c: In function 'st_sensors_set_drdy_int_pin':drivers/iio/common/st_sensors/st_sensors_core.c:211:4: error: 'err' undeclared (first use in this function) drivers/iio/common/st_sensors/st_sensors_core.c:211:4: note: each undeclared identifier is reported only once for each function it appears indrivers/iio/common/st_sensors/st_sensors_core.c:228:3: error: label 'init_error' used but not defined make[4]: *** [drivers/iio/common/st_sensors/st_sensors_core.o] Error 1
The following patch gets rid of these lines so I'm guessing you reorganised your patch series then didn't check buildling them in the new order.
Please fix this up before reposting the remainder of the series.
Quoted 72 lines
--- drivers/iio/common/st_sensors/st_sensors_core.c | 24 +++++++++++++++++++----- drivers/iio/pressure/st_pressure_core.c | 3 ++- 2 files changed, 21 insertions(+), 6 deletions(-)drivers/iio/common/st_sensors/st_sensors_core.c +19
-5@@ -198,14 +198,11 @@ int st_sensors_set_axis_enable(struct iio_dev *indio_dev, u8 axis_enable) }EXPORT_SYMBOL (st_sensors_set_axis_enable); -int st_sensors_init_sensor (struct iio_dev *indio_dev, -struct st_sensors_platform_data *pdata) +int st_sensors_set_drdy_int_pin (struct iio_dev *indio_dev, +struct st_sensors_platform_data *pdata) { -int err;struct st_sensor_data *sdata =iio_priv (indio_dev); -mutex_init (&sdata->tb.buf_lock); -switch (pdata->drdy_int_pin) {case 1 :if (sdata->sensor->drdy_irq.mask_int1 ==0 ) {@@ -231,6 +228,20 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, goto init_error; } +return 0 ; +} + +int st_sensors_init_sensor (struct iio_dev *indio_dev, +struct st_sensors_platform_data *pdata) +{ +int err =0 ; +struct st_sensor_data *sdata =iio_priv (indio_dev); + +mutex_init (&sdata->tb.buf_lock); + +if (pdata) + err =st_sensors_set_drdy_int_pin (indio_dev, pdata); + err =st_sensors_set_enable (indio_dev, false);if (err <0 ) goto init_error;@@ -266,6 +277,9 @@ int st_sensors_set_dataready_irq(struct iio_dev *indio_dev, bool enable)u8 drdy_mask;struct st_sensor_data *sdata =iio_priv (indio_dev); +if (!sdata->sensor->drdy_irq.addr) +return 0 ; +/* Enable/Disable the interrupt generator 1. */ if (sdata->sensor->drdy_irq.ig1.en_addr >0 ) { err = st_sensors_write_data_with_mask(indio_dev,drivers/iio/pressure/st_pressure_core.c +2
-1@@ -232,7 +232,8 @@ int st_press_common_probe(struct iio_dev *indio_dev, pdata->odr = pdata->sensor->odr.odr_avl[0 ].hz; -if (!plat_data) +/* Some devices don't support a data ready pin. */ +if (!plat_data && pdata->sensor->drdy_irq.addr) plat_data = (struct st_sensors_platform_data *)&default_press_pdata;
PATCH v3 20/38 iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor()
In reply to Lee JonesStrip out all those unnecessary gotos and just return the error right away.
Aids to simplicity and reduces code.
--- drivers/iio/common/st_sensors/st_sensors_core.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/iio/common/st_sensors/st_sensors_core.c +7 -11
@@ -208,8 +208,7 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,if (sdata->sensor->drdy_irq.mask_int1 ==0 ) {dev_err (&indio_dev->dev,"DRDY on INT1 not available.\n" ); - err = -EINVAL ; - goto init_error; +return -EINVAL ; } sdata->drdy_int_pin =1 ;break ;
@@ -217,15 +216,13 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,if (sdata->sensor->drdy_irq.mask_int2 ==0 ) {dev_err (&indio_dev->dev,"DRDY on INT2 not available.\n" ); - err = -EINVAL ; - goto init_error; +return -EINVAL ; } sdata->drdy_int_pin =2 ;break ;default :dev_err (&indio_dev->dev,"DRDY on pdata not valid.\n" ); - err = -EINVAL ; - goto init_error; +return -EINVAL ; }return 0 ;
@@ -244,29 +241,28 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, err =st_sensors_set_enable (indio_dev, false);if (err <0 ) - goto init_error; +return err;if (sdata->current_fullscale) { err =st_sensors_set_fullscale (indio_dev, sdata->current_fullscale->num);if (err <0 ) - goto init_error; +return err; }else dev_info (&indio_dev->dev,"Full-scale not possible\n" ); err =st_sensors_set_odr (indio_dev, sdata->odr);if (err <0 ) - goto init_error; +return err;/* set BDU */ err =st_sensors_write_data_with_mask (indio_dev, sdata->sensor->bdu.addr, sdata->sensor->bdu.mask, true);if (err <0 ) - goto init_error; +return err; err =st_sensors_set_axis_enable (indio_dev,ST_SENSORS_ENABLE_ALL_AXIS ); -init_error:return err; }EXPORT_SYMBOL (st_sensors_init_sensor);
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 20/38] iio: sensors-core: st: Clean-up error handling in st_sensors_init_sensor()
Quoted 5 lines · Lee Jones
Strip out all those unnecessary gotos and just return the error right away.
Aids to simplicity and reduces code.
Signed-off-by Lee Jones <[email protected]>
This is fine except in that it is intertwined with the previous patch.
Quoted 71 lines
--- drivers/iio/common/st_sensors/st_sensors_core.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)drivers/iio/common/st_sensors/st_sensors_core.c +7
-11@@ -208,8 +208,7 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,if (sdata->sensor->drdy_irq.mask_int1 ==0 ) {dev_err (&indio_dev->dev,"DRDY on INT1 not available.\n" ); - err = -EINVAL ; - goto init_error; +return -EINVAL ; } sdata->drdy_int_pin =1 ;break ;@@ -217,15 +216,13 @@ int st_sensors_set_drdy_int_pin(struct iio_dev *indio_dev,if (sdata->sensor->drdy_irq.mask_int2 ==0 ) {dev_err (&indio_dev->dev,"DRDY on INT2 not available.\n" ); - err = -EINVAL ; - goto init_error; +return -EINVAL ; } sdata->drdy_int_pin =2 ;break ;default :dev_err (&indio_dev->dev,"DRDY on pdata not valid.\n" ); - err = -EINVAL ; - goto init_error; +return -EINVAL ; }return 0 ;@@ -244,29 +241,28 @@ int st_sensors_init_sensor(struct iio_dev *indio_dev, err =st_sensors_set_enable (indio_dev, false);if (err <0 ) - goto init_error; +return err;if (sdata->current_fullscale) { err =st_sensors_set_fullscale (indio_dev, sdata->current_fullscale->num);if (err <0 ) - goto init_error; +return err; }else dev_info (&indio_dev->dev,"Full-scale not possible\n" ); err =st_sensors_set_odr (indio_dev, sdata->odr);if (err <0 ) - goto init_error; +return err;/* set BDU */ err =st_sensors_write_data_with_mask (indio_dev, sdata->sensor->bdu.addr, sdata->sensor->bdu.mask, true);if (err <0 ) - goto init_error; +return err; err =st_sensors_set_axis_enable (indio_dev,ST_SENSORS_ENABLE_ALL_AXIS ); -init_error:return err; }EXPORT_SYMBOL (st_sensors_init_sensor);
PATCH v3 21/38 iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
In reply to Lee JonesGets rid of those unnecessary gotos.
--- drivers/iio/common/st_sensors/st_sensors_core.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)
drivers/iio/common/st_sensors/st_sensors_core.c +7 -10
@@ -331,26 +331,23 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,unsigned int byte_for_channel = ch->scan_type.storagebits >>3 ; outdata =kmalloc (byte_for_channel,GFP_KERNEL ); -if (!outdata) { - err = -EINVAL ; - goto st_sensors_read_axis_data_error; - } +if (!outdata) +return -ENOMEM ; err = sdata->tf->read_multiple_byte (&sdata->tb, sdata->dev, ch->address, byte_for_channel, outdata, sdata->multiread_bit); -if (err <0 ) - goto st_sensors_free_memory; +if (err <0 ) { +kfree (outdata); +return err; + }if (byte_for_channel ==2 ) *data = (s16 )get_unaligned_le16 (outdata);else if (byte_for_channel ==3 ) *data = (s32 )st_sensors_get_unaligned_le24 (outdata); -st_sensors_free_memory: -kfree (outdata); -st_sensors_read_axis_data_error: -return err; +return 0 ; } int st_sensors_read_info_raw(struct iio_dev *indio_dev,
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 21/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
Quoted 1 line · Lee Jones
Gets rid of those unnecessary gotos.
Unfortunately it introduced a bug whilst it is at it. Sometimes those gotos are necessary and the 'right' way to do things.
Quoted 11 lines
Signed-off-by Lee Jones <[email protected]>--- drivers/iio/common/st_sensors/st_sensors_core.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)drivers/iio/common/st_sensors/st_sensors_core.c +0
-0
drivers/iio/common/st_sensors/st_sensors_core.c static int st_sensors_read_axis_data(struct iio_dev *indio_dev, · line 335
Quoted 9 lines
drivers/iio/common/st_sensors/st_sensors_core.c +2
-4@@ -331,26 +331,23 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,unsigned int byte_for_channel = ch->scan_type.storagebits >>3 ; outdata =kmalloc (byte_for_channel,GFP_KERNEL ); -if (!outdata) { - err = -EINVAL ; - goto st_sensors_read_axis_data_error; - } +if (!outdata) +return -ENOMEM ;
I agree this change makes complete sense.
drivers/iio/common/st_sensors/st_sensors_core.c static int st_sensors_read_axis_data(struct iio_dev *indio_dev, · line 343
Quoted 10 lines
drivers/iio/common/st_sensors/st_sensors_core.c +4
-2err = sdata->tf->read_multiple_byte (&sdata->tb, sdata->dev, ch->address, byte_for_channel, outdata, sdata->multiread_bit); -if (err <0 ) - goto st_sensors_free_memory; +if (err <0 ) { +kfree (outdata); +return err; + }
I don't like this change as....
drivers/iio/common/st_sensors/st_sensors_core.c static int st_sensors_read_axis_data(struct iio_dev *indio_dev, · line 351
Quoted 8 lines
drivers/iio/common/st_sensors/st_sensors_core.c +0
-2if (byte_for_channel ==2 ) *data = (s16 )get_unaligned_le16 (outdata);else if (byte_for_channel ==3 ) *data = (s32 )st_sensors_get_unaligned_le24 (outdata); -st_sensors_free_memory: -kfree (outdata);
you now don't free out data in the case of no error. This is precisely the case where a goto is the correct way to handle things as the free need to occur whether or not the error occurs.
Quoted 7 lines
drivers/iio/common/st_sensors/st_sensors_core.c +1
-2-st_sensors_read_axis_data_error: -return err; +return 0 ; } int st_sensors_read_info_raw(struct iio_dev *indio_dev,
Re: [PATCH 21/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_axis_data()
Quoted 43 lines · Jonathan Cameron
Quoted 1 line · Lee Jones
Gets rid of those unnecessary gotos.
Unfortunately it introduced a bug whilst it is at it. Sometimes those gotos are necessary and the 'right' way to do things.
Quoted 11 lines
Signed-off-by Lee Jones <[email protected]>--- drivers/iio/common/st_sensors/st_sensors_core.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)drivers/iio/common/st_sensors/st_sensors_core.c +0
-0drivers/iio/common/st_sensors/st_sensors_core.c static int st_sensors_read_axis_data(struct iio_dev *indio_dev, · line 335
Quoted 9 lines
drivers/iio/common/st_sensors/st_sensors_core.c +2
-4@@ -331,26 +331,23 @@ static int st_sensors_read_axis_data(struct iio_dev *indio_dev,unsigned int byte_for_channel = ch->scan_type.storagebits >>3 ; outdata =kmalloc (byte_for_channel,GFP_KERNEL ); -if (!outdata) { - err = -EINVAL ; - goto st_sensors_read_axis_data_error; - } +if (!outdata) +return -ENOMEM ;I agree this change makes complete sense.
drivers/iio/common/st_sensors/st_sensors_core.c static int st_sensors_read_axis_data(struct iio_dev *indio_dev, · line 343
Quoted 10 lines
drivers/iio/common/st_sensors/st_sensors_core.c +4
-2err = sdata->tf->read_multiple_byte (&sdata->tb, sdata->dev, ch->address, byte_for_channel, outdata, sdata->multiread_bit); -if (err <0 ) - goto st_sensors_free_memory; +if (err <0 ) { +kfree (outdata); +return err; + }I don't like this change as....
Quoted 6 lines
drivers/iio/common/st_sensors/st_sensors_core.c +0
-0if (byte_for_channel ==2 ) *data = (s16 )get_unaligned_le16 (outdata);else if (byte_for_channel ==3 ) *data = (s32 )st_sensors_get_unaligned_le24 (outdata);
Quoted 5 lines
drivers/iio/common/st_sensors/st_sensors_core.c static int st_sensors_read_axis_data(struct iio_dev *indio_dev, · line 351
Quoted 2 lines
drivers/iio/common/st_sensors/st_sensors_core.c +0
-2-st_sensors_free_memory: -kfree (outdata);you now don't free out data in the case of no error. This is precisely the case where a goto is the correct way to handle things as the free need to occur whether or not the error occurs.
Ah, you're quite right. I'll fix up.
Quoted 7 lines
Quoted 7 lines
drivers/iio/common/st_sensors/st_sensors_core.c +1
-2-st_sensors_read_axis_data_error: -return err; +return 0 ; } int st_sensors_read_info_raw(struct iio_dev *indio_dev,
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v3 22/38 iio: sensors-core: st: Clean-up error handling in st_sensors_read_info_raw()
In reply to Lee JonesSaving a few lines of code.
--- drivers/iio/common/st_sensors/st_sensors_core.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/iio/common/st_sensors/st_sensors_core.c +4 -7
@@ -359,28 +359,25 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,mutex_lock (&indio_dev->mlock);if (indio_dev->currentmode ==INDIO_BUFFER_TRIGGERED ) { err = -EBUSY ; - goto read_error; + goto out; }else { err =st_sensors_set_enable (indio_dev, true);if (err <0 ) - goto read_error; + goto out;msleep ((sdata->sensor->bootime *1000 ) / sdata->odr); err =st_sensors_read_axis_data (indio_dev, ch, val);if (err <0 ) - goto read_error; + goto out; *val = *val >> ch->scan_type.shift; err =st_sensors_set_enable (indio_dev, false); } +out:mutex_unlock (&indio_dev->mlock);return err; - -read_error: -mutex_unlock (&indio_dev->mlock); -return err; }EXPORT_SYMBOL (st_sensors_read_info_raw);
Signature · 1 line
1.8.1.2
Re: [PATCH 22/38] iio: sensors-core: st: Clean-up error handling in st_sensors_read_info_raw()
Quoted 3 lines · Lee Jones
Saving a few lines of code.
Signed-off-by Lee Jones <[email protected]>
Applied to the togreg branch of iio.git.
To my mind the key thing here is that the error paths were previous inconsistent in that all but the last one went via a separate cleanup path whereas the last one went straight through.
Now they are consistent and that is more important than saving a few lines of code.
Thanks,
Quoted 42 lines
--- drivers/iio/common/st_sensors/st_sensors_core.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)drivers/iio/common/st_sensors/st_sensors_core.c +4
-7@@ -359,28 +359,25 @@ int st_sensors_read_info_raw(struct iio_dev *indio_dev,mutex_lock (&indio_dev->mlock);if (indio_dev->currentmode ==INDIO_BUFFER_TRIGGERED ) { err = -EBUSY ; - goto read_error; + goto out; }else { err =st_sensors_set_enable (indio_dev, true);if (err <0 ) - goto read_error; + goto out;msleep ((sdata->sensor->bootime *1000 ) / sdata->odr); err =st_sensors_read_axis_data (indio_dev, ch, val);if (err <0 ) - goto read_error; + goto out; *val = *val >> ch->scan_type.shift; err =st_sensors_set_enable (indio_dev, false); } +out:mutex_unlock (&indio_dev->mlock);return err; - -read_error: -mutex_unlock (&indio_dev->mlock); -return err; }EXPORT_SYMBOL (st_sensors_read_info_raw);
PATCH v3 23/38 iio: pressure-core: st: Describe LPS331AP defines by name
In reply to Lee JonesThey're currently named *_1_*, for 'Sensor 1', but the code will be much more readable if we use the naming convention *_LPS331AP_* instead.
--- drivers/iio/pressure/st_pressure_core.c | 94 ++++++++++++++++----------------- 1 file changed, 46 insertions(+), 48 deletions(-)
drivers/iio/pressure/st_pressure_core.c +46 -48
@@ -36,94 +36,92 @@ ST_PRESS_LSB_PER_CELSIUS)#define ST_PRESS_NUMBER_DATA_CHANNELS 1 -/* DEFAULT VALUE FOR SENSORS */ -#define ST_PRESS_DEFAULT_OUT_XL_ADDR 0x28 -#define ST_TEMP_DEFAULT_OUT_L_ADDR 0x2b -/* FULLSCALE */ #define ST_PRESS_FS_AVL_1260MB 1260 -/* CUSTOM VALUES FOR SENSOR 1 */ -#define ST_PRESS_1_WAI_EXP 0xbb -#define ST_PRESS_1_ODR_ADDR 0x20 -#define ST_PRESS_1_ODR_MASK 0x70 -#define ST_PRESS_1_ODR_AVL_1HZ_VAL 0x01 -#define ST_PRESS_1_ODR_AVL_7HZ_VAL 0x05 -#define ST_PRESS_1_ODR_AVL_13HZ_VAL 0x06 -#define ST_PRESS_1_ODR_AVL_25HZ_VAL 0x07 -#define ST_PRESS_1_PW_ADDR 0x20 -#define ST_PRESS_1_PW_MASK 0x80 -#define ST_PRESS_1_FS_ADDR 0x23 -#define ST_PRESS_1_FS_MASK 0x30 -#define ST_PRESS_1_FS_AVL_1260_VAL 0x00 -#define ST_PRESS_1_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE -#define ST_PRESS_1_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE -#define ST_PRESS_1_BDU_ADDR 0x20 -#define ST_PRESS_1_BDU_MASK 0x04 -#define ST_PRESS_1_DRDY_IRQ_ADDR 0x22 -#define ST_PRESS_1_DRDY_IRQ_INT1_MASK 0x04 -#define ST_PRESS_1_DRDY_IRQ_INT2_MASK 0x20 -#define ST_PRESS_1_MULTIREAD_BIT true -#define ST_PRESS_1_TEMP_OFFSET 42500 +/* CUSTOM VALUES FOR LPS331AP SENSOR */ +#define ST_PRESS_LPS331AP_WAI_EXP 0xbb +#define ST_PRESS_LPS331AP_ODR_ADDR 0x20 +#define ST_PRESS_LPS331AP_ODR_MASK 0x70 +#define ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL 0x01 +#define ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL 0x05 +#define ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL 0x06 +#define ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL 0x07 +#define ST_PRESS_LPS331AP_PW_ADDR 0x20 +#define ST_PRESS_LPS331AP_PW_MASK 0x80 +#define ST_PRESS_LPS331AP_FS_ADDR 0x23 +#define ST_PRESS_LPS331AP_FS_MASK 0x30 +#define ST_PRESS_LPS331AP_FS_AVL_1260_VAL 0x00 +#define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE +#define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE +#define ST_PRESS_LPS331AP_BDU_ADDR 0x20 +#define ST_PRESS_LPS331AP_BDU_MASK 0x04 +#define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR 0x22 +#define ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK 0x04 +#define ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK 0x20 +#define ST_PRESS_LPS331AP_MULTIREAD_BIT true +#define ST_PRESS_LPS331AP_TEMP_OFFSET 42500 +#define ST_PRESS_LPS331AP_OUT_XL_ADDR 0x28 +#define ST_TEMP_LPS331AP_OUT_L_ADDR 0x2bstatic const struct iio_chan_spec st_press_channels[] = {ST_SENSORS_LSM_CHANNELS (IIO_PRESSURE ,BIT (IIO_CHAN_INFO_RAW ) |BIT (IIO_CHAN_INFO_SCALE ),ST_SENSORS_SCAN_X ,0 ,IIO_NO_MOD ,'u' ,IIO_LE ,24 ,24 , -ST_PRESS_DEFAULT_OUT_XL_ADDR ), +ST_PRESS_LPS331AP_OUT_XL_ADDR ),ST_SENSORS_LSM_CHANNELS (IIO_TEMP ,BIT (IIO_CHAN_INFO_RAW ) |BIT (IIO_CHAN_INFO_SCALE ) |BIT (IIO_CHAN_INFO_OFFSET ),-1 ,0 ,IIO_NO_MOD ,'s' ,IIO_LE ,16 ,16 , -ST_TEMP_DEFAULT_OUT_L_ADDR ), +ST_TEMP_LPS331AP_OUT_L_ADDR ),IIO_CHAN_SOFT_TIMESTAMP (1 ) };static const struct st_sensors st_press_sensors[] = { { - .wai =ST_PRESS_1_WAI_EXP , + .wai =ST_PRESS_LPS331AP_WAI_EXP , .sensors_supported = { [0 ] =LPS331AP_PRESS_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_press_channels, .odr = { - .addr =ST_PRESS_1_ODR_ADDR , - .mask =ST_PRESS_1_ODR_MASK , + .addr =ST_PRESS_LPS331AP_ODR_ADDR , + .mask =ST_PRESS_LPS331AP_ODR_MASK , .odr_avl = { - {1 ,ST_PRESS_1_ODR_AVL_1HZ_VAL , }, - {7 ,ST_PRESS_1_ODR_AVL_7HZ_VAL , }, - {13 ,ST_PRESS_1_ODR_AVL_13HZ_VAL , }, - {25 ,ST_PRESS_1_ODR_AVL_25HZ_VAL , }, + {1 ,ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL , }, + {7 ,ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL , }, + {13 ,ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL , }, + {25 ,ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL , }, }, }, .pw = { - .addr =ST_PRESS_1_PW_ADDR , - .mask =ST_PRESS_1_PW_MASK , + .addr =ST_PRESS_LPS331AP_PW_ADDR , + .mask =ST_PRESS_LPS331AP_PW_MASK , .value_on =ST_SENSORS_DEFAULT_POWER_ON_VALUE , .value_off =ST_SENSORS_DEFAULT_POWER_OFF_VALUE , }, .fs = { - .addr =ST_PRESS_1_FS_ADDR , - .mask =ST_PRESS_1_FS_MASK , + .addr =ST_PRESS_LPS331AP_FS_ADDR , + .mask =ST_PRESS_LPS331AP_FS_MASK , .fs_avl = { [0 ] = { .num =ST_PRESS_FS_AVL_1260MB , - .value =ST_PRESS_1_FS_AVL_1260_VAL , - .gain =ST_PRESS_1_FS_AVL_1260_GAIN , - .gain2 =ST_PRESS_1_FS_AVL_TEMP_GAIN , + .value =ST_PRESS_LPS331AP_FS_AVL_1260_VAL , + .gain =ST_PRESS_LPS331AP_FS_AVL_1260_GAIN , + .gain2 =ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN , }, }, }, .bdu = { - .addr =ST_PRESS_1_BDU_ADDR , - .mask =ST_PRESS_1_BDU_MASK , + .addr =ST_PRESS_LPS331AP_BDU_ADDR , + .mask =ST_PRESS_LPS331AP_BDU_MASK , }, .drdy_irq = { - .addr =ST_PRESS_1_DRDY_IRQ_ADDR , - .mask_int1 =ST_PRESS_1_DRDY_IRQ_INT1_MASK , - .mask_int2 =ST_PRESS_1_DRDY_IRQ_INT2_MASK , + .addr =ST_PRESS_LPS331AP_DRDY_IRQ_ADDR , + .mask_int1 =ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK , + .mask_int2 =ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK , }, - .multi_read_bit =ST_PRESS_1_MULTIREAD_BIT , + .multi_read_bit =ST_PRESS_LPS331AP_MULTIREAD_BIT , .bootime =2 , }, };
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 23/38] iio: pressure-core: st: Describe LPS331AP defines by name
Quoted 4 lines · Lee Jones
They're currently named *_1_*, for 'Sensor 1', but the code will be much more readable if we use the naming convention *_LPS331AP_* instead.
Signed-off-by Lee Jones <[email protected]>
Very happy to see this patch. The _1_ stuff should never have gotten through the initial review of the driver (oops). Even in cases where it might be shared by multiple devices, it is better to have it named after one choice.
Anyhow, applied to the togreg branch of iio.git
Thanks
Quoted 150 lines
--- drivers/iio/pressure/st_pressure_core.c | 94 ++++++++++++++++----------------- 1 file changed, 46 insertions(+), 48 deletions(-)drivers/iio/pressure/st_pressure_core.c +46
-48@@ -36,94 +36,92 @@ ST_PRESS_LSB_PER_CELSIUS)#define ST_PRESS_NUMBER_DATA_CHANNELS 1 -/* DEFAULT VALUE FOR SENSORS */ -#define ST_PRESS_DEFAULT_OUT_XL_ADDR 0x28 -#define ST_TEMP_DEFAULT_OUT_L_ADDR 0x2b -/* FULLSCALE */ #define ST_PRESS_FS_AVL_1260MB 1260 -/* CUSTOM VALUES FOR SENSOR 1 */ -#define ST_PRESS_1_WAI_EXP 0xbb -#define ST_PRESS_1_ODR_ADDR 0x20 -#define ST_PRESS_1_ODR_MASK 0x70 -#define ST_PRESS_1_ODR_AVL_1HZ_VAL 0x01 -#define ST_PRESS_1_ODR_AVL_7HZ_VAL 0x05 -#define ST_PRESS_1_ODR_AVL_13HZ_VAL 0x06 -#define ST_PRESS_1_ODR_AVL_25HZ_VAL 0x07 -#define ST_PRESS_1_PW_ADDR 0x20 -#define ST_PRESS_1_PW_MASK 0x80 -#define ST_PRESS_1_FS_ADDR 0x23 -#define ST_PRESS_1_FS_MASK 0x30 -#define ST_PRESS_1_FS_AVL_1260_VAL 0x00 -#define ST_PRESS_1_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE -#define ST_PRESS_1_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE -#define ST_PRESS_1_BDU_ADDR 0x20 -#define ST_PRESS_1_BDU_MASK 0x04 -#define ST_PRESS_1_DRDY_IRQ_ADDR 0x22 -#define ST_PRESS_1_DRDY_IRQ_INT1_MASK 0x04 -#define ST_PRESS_1_DRDY_IRQ_INT2_MASK 0x20 -#define ST_PRESS_1_MULTIREAD_BIT true -#define ST_PRESS_1_TEMP_OFFSET 42500 +/* CUSTOM VALUES FOR LPS331AP SENSOR */ +#define ST_PRESS_LPS331AP_WAI_EXP 0xbb +#define ST_PRESS_LPS331AP_ODR_ADDR 0x20 +#define ST_PRESS_LPS331AP_ODR_MASK 0x70 +#define ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL 0x01 +#define ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL 0x05 +#define ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL 0x06 +#define ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL 0x07 +#define ST_PRESS_LPS331AP_PW_ADDR 0x20 +#define ST_PRESS_LPS331AP_PW_MASK 0x80 +#define ST_PRESS_LPS331AP_FS_ADDR 0x23 +#define ST_PRESS_LPS331AP_FS_MASK 0x30 +#define ST_PRESS_LPS331AP_FS_AVL_1260_VAL 0x00 +#define ST_PRESS_LPS331AP_FS_AVL_1260_GAIN ST_PRESS_KPASCAL_NANO_SCALE +#define ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN ST_PRESS_CELSIUS_NANO_SCALE +#define ST_PRESS_LPS331AP_BDU_ADDR 0x20 +#define ST_PRESS_LPS331AP_BDU_MASK 0x04 +#define ST_PRESS_LPS331AP_DRDY_IRQ_ADDR 0x22 +#define ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK 0x04 +#define ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK 0x20 +#define ST_PRESS_LPS331AP_MULTIREAD_BIT true +#define ST_PRESS_LPS331AP_TEMP_OFFSET 42500 +#define ST_PRESS_LPS331AP_OUT_XL_ADDR 0x28 +#define ST_TEMP_LPS331AP_OUT_L_ADDR 0x2bstatic const struct iio_chan_spec st_press_channels[] = {ST_SENSORS_LSM_CHANNELS (IIO_PRESSURE ,BIT (IIO_CHAN_INFO_RAW ) |BIT (IIO_CHAN_INFO_SCALE ),ST_SENSORS_SCAN_X ,0 ,IIO_NO_MOD ,'u' ,IIO_LE ,24 ,24 , -ST_PRESS_DEFAULT_OUT_XL_ADDR ), +ST_PRESS_LPS331AP_OUT_XL_ADDR ),ST_SENSORS_LSM_CHANNELS (IIO_TEMP ,BIT (IIO_CHAN_INFO_RAW ) |BIT (IIO_CHAN_INFO_SCALE ) |BIT (IIO_CHAN_INFO_OFFSET ),-1 ,0 ,IIO_NO_MOD ,'s' ,IIO_LE ,16 ,16 , -ST_TEMP_DEFAULT_OUT_L_ADDR ), +ST_TEMP_LPS331AP_OUT_L_ADDR ),IIO_CHAN_SOFT_TIMESTAMP (1 ) };static const struct st_sensors st_press_sensors[] = { { - .wai =ST_PRESS_1_WAI_EXP , + .wai =ST_PRESS_LPS331AP_WAI_EXP , .sensors_supported = { [0 ] =LPS331AP_PRESS_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_press_channels, .odr = { - .addr =ST_PRESS_1_ODR_ADDR , - .mask =ST_PRESS_1_ODR_MASK , + .addr =ST_PRESS_LPS331AP_ODR_ADDR , + .mask =ST_PRESS_LPS331AP_ODR_MASK , .odr_avl = { - {1 ,ST_PRESS_1_ODR_AVL_1HZ_VAL , }, - {7 ,ST_PRESS_1_ODR_AVL_7HZ_VAL , }, - {13 ,ST_PRESS_1_ODR_AVL_13HZ_VAL , }, - {25 ,ST_PRESS_1_ODR_AVL_25HZ_VAL , }, + {1 ,ST_PRESS_LPS331AP_ODR_AVL_1HZ_VAL , }, + {7 ,ST_PRESS_LPS331AP_ODR_AVL_7HZ_VAL , }, + {13 ,ST_PRESS_LPS331AP_ODR_AVL_13HZ_VAL , }, + {25 ,ST_PRESS_LPS331AP_ODR_AVL_25HZ_VAL , }, }, }, .pw = { - .addr =ST_PRESS_1_PW_ADDR , - .mask =ST_PRESS_1_PW_MASK , + .addr =ST_PRESS_LPS331AP_PW_ADDR , + .mask =ST_PRESS_LPS331AP_PW_MASK , .value_on =ST_SENSORS_DEFAULT_POWER_ON_VALUE , .value_off =ST_SENSORS_DEFAULT_POWER_OFF_VALUE , }, .fs = { - .addr =ST_PRESS_1_FS_ADDR , - .mask =ST_PRESS_1_FS_MASK , + .addr =ST_PRESS_LPS331AP_FS_ADDR , + .mask =ST_PRESS_LPS331AP_FS_MASK , .fs_avl = { [0 ] = { .num =ST_PRESS_FS_AVL_1260MB , - .value =ST_PRESS_1_FS_AVL_1260_VAL , - .gain =ST_PRESS_1_FS_AVL_1260_GAIN , - .gain2 =ST_PRESS_1_FS_AVL_TEMP_GAIN , + .value =ST_PRESS_LPS331AP_FS_AVL_1260_VAL , + .gain =ST_PRESS_LPS331AP_FS_AVL_1260_GAIN , + .gain2 =ST_PRESS_LPS331AP_FS_AVL_TEMP_GAIN , }, }, }, .bdu = { - .addr =ST_PRESS_1_BDU_ADDR , - .mask =ST_PRESS_1_BDU_MASK , + .addr =ST_PRESS_LPS331AP_BDU_ADDR , + .mask =ST_PRESS_LPS331AP_BDU_MASK , }, .drdy_irq = { - .addr =ST_PRESS_1_DRDY_IRQ_ADDR , - .mask_int1 =ST_PRESS_1_DRDY_IRQ_INT1_MASK , - .mask_int2 =ST_PRESS_1_DRDY_IRQ_INT2_MASK , + .addr =ST_PRESS_LPS331AP_DRDY_IRQ_ADDR , + .mask_int1 =ST_PRESS_LPS331AP_DRDY_IRQ_INT1_MASK , + .mask_int2 =ST_PRESS_LPS331AP_DRDY_IRQ_INT2_MASK , }, - .multi_read_bit =ST_PRESS_1_MULTIREAD_BIT , + .multi_read_bit =ST_PRESS_LPS331AP_MULTIREAD_BIT , .bootime =2 , }, };
PATCH v3 24/38 iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor
In reply to Lee JonesDue to the MACRO used, the task of reading, understanding and maintaining the LPS331AP's channel descriptor is substantially difficult. This patch is based on the view that it's better to have easy to read, maintainable code than to save a few lines here and there. For that reason we're expanding the array so initialisation is completed in full.
--- drivers/iio/pressure/st_pressure_core.c | 45 +++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 11 deletions(-)
drivers/iio/pressure/st_pressure_core.c +34 -11
@@ -64,16 +64,39 @@#define ST_PRESS_LPS331AP_OUT_XL_ADDR 0x28#define ST_TEMP_LPS331AP_OUT_L_ADDR 0x2b -static const struct iio_chan_spec st_press_channels[] = { -ST_SENSORS_LSM_CHANNELS (IIO_PRESSURE , +static const struct iio_chan_spec st_press_lps331ap_channels[] = { + { + .type =IIO_PRESSURE , + .channel2 =IIO_NO_MOD , + .address =ST_PRESS_LPS331AP_OUT_XL_ADDR , + .scan_index =ST_SENSORS_SCAN_X , + .scan_type = { + .sign ='u' , + .realbits =24 , + .storagebits =24 , + .endianness =IIO_LE , + }, + .info_mask_separate =BIT (IIO_CHAN_INFO_RAW ) |BIT (IIO_CHAN_INFO_SCALE ), -ST_SENSORS_SCAN_X ,0 ,IIO_NO_MOD ,'u' ,IIO_LE ,24 ,24 , -ST_PRESS_LPS331AP_OUT_XL_ADDR ), -ST_SENSORS_LSM_CHANNELS (IIO_TEMP , -BIT (IIO_CHAN_INFO_RAW ) |BIT (IIO_CHAN_INFO_SCALE ) | -BIT (IIO_CHAN_INFO_OFFSET ), --1 ,0 ,IIO_NO_MOD ,'s' ,IIO_LE ,16 ,16 , -ST_TEMP_LPS331AP_OUT_L_ADDR ), + .modified =0 , + }, + { + .type =IIO_TEMP , + .channel2 =IIO_NO_MOD , + .address =ST_TEMP_LPS331AP_OUT_L_ADDR , + .scan_index =-1 , + .scan_type = { + .sign ='u' , + .realbits =16 , + .storagebits =16 , + .endianness =IIO_LE , + }, + .info_mask_separate = +BIT (IIO_CHAN_INFO_RAW ) | +BIT (IIO_CHAN_INFO_SCALE ) | +BIT (IIO_CHAN_INFO_OFFSET ), + .modified =0 , + },IIO_CHAN_SOFT_TIMESTAMP (1 ) };
@@ -83,7 +106,7 @@ static const struct st_sensors st_press_sensors[] = { .sensors_supported = { [0] = LPS331AP_PRESS_DEV_NAME, }, - .ch = (struct iio_chan_spec *)st_press_channels, + .ch = (struct iio_chan_spec *)st_press_lps331ap_channels, .odr = { .addr = ST_PRESS_LPS331AP_ODR_ADDR, .mask = ST_PRESS_LPS331AP_ODR_MASK,
@@ -222,7 +245,7 @@ int st_press_common_probe(struct iio_dev *indio_dev, pdata->num_data_channels =ST_PRESS_NUMBER_DATA_CHANNELS ; pdata->multiread_bit = pdata->sensor->multi_read_bit; indio_dev->channels = pdata->sensor->ch; - indio_dev->num_channels =ARRAY_SIZE (st_press_channels); + indio_dev->num_channels =ARRAY_SIZE (st_press_lps331ap_channels);if (pdata->sensor->fs.addr !=0 ) pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
Signature · 1 line
1.8.1.2
Re: [PATCH 24/38] iio: pressure-core: st: Expand and rename LPS331AP's channel descriptor
Quoted 7 lines · Lee Jones
Due to the MACRO used, the task of reading, understanding and maintaining the LPS331AP's channel descriptor is substantially difficult. This patch is based on the view that it's better to have easy to read, maintainable code than to save a few lines here and there. For that reason we're expanding the array so initialisation is completed in full.
Signed-off-by Lee Jones <[email protected]>
Agreed that in this case it is clearer not to use a macro. When you have lots of repeats (e.g. an adc with 16 channels) they can make sense, but here as you say a few extra lines of code make it much easier to follow.
My only slight addition here would be to drop the IIO_NO_MOD and modified=0 bits on the basis those are both the obvious defaults (and happen to be equal to 0). Perhaps worth leaving them in this case as it makes the patch more obviously correct.
Applied to the togreg branch of iio.git
Thanks,
Jonathan
Quoted 76 lines
--- drivers/iio/pressure/st_pressure_core.c | 45 +++++++++++++++++++++++++-------- 1 file changed, 34 insertions(+), 11 deletions(-)drivers/iio/pressure/st_pressure_core.c +34
-11@@ -64,16 +64,39 @@#define ST_PRESS_LPS331AP_OUT_XL_ADDR 0x28#define ST_TEMP_LPS331AP_OUT_L_ADDR 0x2b -static const struct iio_chan_spec st_press_channels[] = { -ST_SENSORS_LSM_CHANNELS (IIO_PRESSURE , +static const struct iio_chan_spec st_press_lps331ap_channels[] = { + { + .type =IIO_PRESSURE , + .channel2 =IIO_NO_MOD , + .address =ST_PRESS_LPS331AP_OUT_XL_ADDR , + .scan_index =ST_SENSORS_SCAN_X , + .scan_type = { + .sign ='u' , + .realbits =24 , + .storagebits =24 , + .endianness =IIO_LE , + }, + .info_mask_separate =BIT (IIO_CHAN_INFO_RAW ) |BIT (IIO_CHAN_INFO_SCALE ), -ST_SENSORS_SCAN_X ,0 ,IIO_NO_MOD ,'u' ,IIO_LE ,24 ,24 , -ST_PRESS_LPS331AP_OUT_XL_ADDR ), -ST_SENSORS_LSM_CHANNELS (IIO_TEMP , -BIT (IIO_CHAN_INFO_RAW ) |BIT (IIO_CHAN_INFO_SCALE ) | -BIT (IIO_CHAN_INFO_OFFSET ), --1 ,0 ,IIO_NO_MOD ,'s' ,IIO_LE ,16 ,16 , -ST_TEMP_LPS331AP_OUT_L_ADDR ), + .modified =0 , + }, + { + .type =IIO_TEMP , + .channel2 =IIO_NO_MOD , + .address =ST_TEMP_LPS331AP_OUT_L_ADDR , + .scan_index =-1 , + .scan_type = { + .sign ='u' , + .realbits =16 , + .storagebits =16 , + .endianness =IIO_LE , + }, + .info_mask_separate = +BIT (IIO_CHAN_INFO_RAW ) | +BIT (IIO_CHAN_INFO_SCALE ) | +BIT (IIO_CHAN_INFO_OFFSET ), + .modified =0 , + },IIO_CHAN_SOFT_TIMESTAMP (1 ) };@@ -83,7 +106,7 @@ static const struct st_sensors st_press_sensors[] = { .sensors_supported = { [0] = LPS331AP_PRESS_DEV_NAME, }, - .ch = (struct iio_chan_spec *)st_press_channels, + .ch = (struct iio_chan_spec *)st_press_lps331ap_channels, .odr = { .addr = ST_PRESS_LPS331AP_ODR_ADDR, .mask = ST_PRESS_LPS331AP_ODR_MASK,@@ -222,7 +245,7 @@ int st_press_common_probe(struct iio_dev *indio_dev, pdata->num_data_channels =ST_PRESS_NUMBER_DATA_CHANNELS ; pdata->multiread_bit = pdata->sensor->multi_read_bit; indio_dev->channels = pdata->sensor->ch; - indio_dev->num_channels =ARRAY_SIZE (st_press_channels); + indio_dev->num_channels =ARRAY_SIZE (st_press_lps331ap_channels);if (pdata->sensor->fs.addr !=0 ) pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
PATCH v3 25/38 iio: pressure-core: st: Allow for number of channels to vary
In reply to Lee JonesAt the moment the number of channels specified is dictated by the first sensor supported by the driver. As we add support for more sensors this is likely to vary. Instead of using the ARRAY_SIZE() of the LPS331AP's channel specifier we'll use a new adaptable 'struct st_sensors' element instead.
--- drivers/iio/pressure/st_pressure_core.c | 3 ++- include/linux/iio/common/st_sensors.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/iio/pressure/st_pressure_core.c +2 -1
@@ -107,6 +107,7 @@ static const struct st_sensors st_press_sensors[] = { [0 ] =LPS331AP_PRESS_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_press_lps331ap_channels, + .num_ch = ARRAY_SIZE(st_press_lps331ap_channels), .odr = { .addr =ST_PRESS_LPS331AP_ODR_ADDR , .mask =ST_PRESS_LPS331AP_ODR_MASK ,
@@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev *indio_dev, pdata->num_data_channels =ST_PRESS_NUMBER_DATA_CHANNELS ; pdata->multiread_bit = pdata->sensor->multi_read_bit; indio_dev->channels = pdata->sensor->ch; - indio_dev->num_channels =ARRAY_SIZE (st_press_lps331ap_channels); + indio_dev->num_channels = pdata->sensor->num_ch;if (pdata->sensor->fs.addr !=0 ) pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
include/linux/iio/common/st_sensors.h +1 -0
@@ -184,6 +184,7 @@ struct st_sensors {u8 wai;char sensors_supported[ST_SENSORS_MAX_4WAI ][ST_SENSORS_MAX_NAME ];struct iio_chan_spec *ch; +int num_ch;struct st_sensor_odr odr;struct st_sensor_power pw;struct st_sensor_axis enable_axis;
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
Quoted 7 lines · Lee Jones
At the moment the number of channels specified is dictated by the first sensor supported by the driver. As we add support for more sensors this is likely to vary. Instead of using the
ARRAY_SIZE()of the LPS331AP's channel specifier we'll use a new adaptable 'structst_sensors' element instead.Signed-off-by Lee Jones <[email protected]>
Applied with Denis ack (again it should have been here)
Quoted 39 lines
--- drivers/iio/pressure/st_pressure_core.c | 3 ++- include/linux/iio/common/st_sensors.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)drivers/iio/pressure/st_pressure_core.c +2
-1@@ -107,6 +107,7 @@ static const struct st_sensors st_press_sensors[] = { [0 ] =LPS331AP_PRESS_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_press_lps331ap_channels, + .num_ch = ARRAY_SIZE(st_press_lps331ap_channels), .odr = { .addr =ST_PRESS_LPS331AP_ODR_ADDR , .mask =ST_PRESS_LPS331AP_ODR_MASK ,@@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev *indio_dev, pdata->num_data_channels =ST_PRESS_NUMBER_DATA_CHANNELS ; pdata->multiread_bit = pdata->sensor->multi_read_bit; indio_dev->channels = pdata->sensor->ch; - indio_dev->num_channels =ARRAY_SIZE (st_press_lps331ap_channels); + indio_dev->num_channels = pdata->sensor->num_ch;if (pdata->sensor->fs.addr !=0 ) pdata->current_fullscale = (struct st_sensor_fullscale_avl *)include/linux/iio/common/st_sensors.h +1
-0@@ -184,6 +184,7 @@ struct st_sensors {u8 wai;char sensors_supported[ST_SENSORS_MAX_4WAI ][ST_SENSORS_MAX_NAME ];struct iio_chan_spec *ch; +int num_ch;struct st_sensor_odr odr;struct st_sensor_power pw;struct st_sensor_axis enable_axis;
Re: [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
Quoted 9 lines · Jonathan Cameron
Quoted 7 lines · Lee Jones
At the moment the number of channels specified is dictated by the first sensor supported by the driver. As we add support for more sensors this is likely to vary. Instead of using the
ARRAY_SIZE()of the LPS331AP's channel specifier we'll use a new adaptable 'structst_sensors' element instead.Signed-off-by Lee Jones <[email protected]>Applied with Denis ack (again it should have been here)
Ah, you're going to take the patches one-by-one?
After amending the drivers as per your review I was going to send a final time with all Acks applied. Then, once all maintainer Acks were obtained I was going to send you a pull-request.
Perhaps I should have communicated the intent sooner.
Future submissions will have all Acks applied in this case.
Quoted 39 lines
Quoted 39 lines
--- drivers/iio/pressure/st_pressure_core.c | 3 ++- include/linux/iio/common/st_sensors.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)drivers/iio/pressure/st_pressure_core.c +2
-1@@ -107,6 +107,7 @@ static const struct st_sensors st_press_sensors[] = { [0 ] =LPS331AP_PRESS_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_press_lps331ap_channels, + .num_ch = ARRAY_SIZE(st_press_lps331ap_channels), .odr = { .addr =ST_PRESS_LPS331AP_ODR_ADDR , .mask =ST_PRESS_LPS331AP_ODR_MASK ,@@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev *indio_dev, pdata->num_data_channels =ST_PRESS_NUMBER_DATA_CHANNELS ; pdata->multiread_bit = pdata->sensor->multi_read_bit; indio_dev->channels = pdata->sensor->ch; - indio_dev->num_channels =ARRAY_SIZE (st_press_lps331ap_channels); + indio_dev->num_channels = pdata->sensor->num_ch;if (pdata->sensor->fs.addr !=0 ) pdata->current_fullscale = (struct st_sensor_fullscale_avl *)include/linux/iio/common/st_sensors.h +1
-0@@ -184,6 +184,7 @@ struct st_sensors {u8 wai;char sensors_supported[ST_SENSORS_MAX_4WAI ][ST_SENSORS_MAX_NAME ];struct iio_chan_spec *ch; +int num_ch;struct st_sensor_odr odr;struct st_sensor_power pw;struct st_sensor_axis enable_axis;
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Jonathan Cameron
maintainerRe: [PATCH 25/38] iio: pressure-core: st: Allow for number of channels to vary
Quoted 18 lines · Lee Jones
Quoted 2 lines · Jonathan Cameron
Quoted 1 line · Lee Jones
At the moment the number of channels specified is dictated by the
first
Quoted 1 line
Quoted 1 line
sensor supported by the driver. As we add support for more sensors
this
Quoted 1 line
Quoted 1 line
is likely to vary. Instead of using the
ARRAY_SIZE()of theLPS331AP's
Quoted 1 line
Quoted 1 line
channel specifier we'll use a new adaptable 'struct
st_sensors'element
Quoted 4 lines
Quoted 3 lines
instead.
Signed-off-by Lee Jones <[email protected]>Applied with Denis ack (again it should have been here)
Ah, you're going to take the patches one-by-one?
Quoted 7 lines
After amending the drivers as per your review I was going to send a final time with all Acks applied. Then, once all maintainer Acks were obtained I was going to send you a pull-request.
Perhaps I should have communicated the intent sooner.
Future submissions will have all Acks applied in this case.
Quite a few of this series stood alone just fine so I grabbed them :)
Quoted 44 lines
Quoted 7 lines
Review
Quoted 7 lines
--- drivers/iio/pressure/st_pressure_core.c | 3 ++- include/linux/iio/common/st_sensors.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-)(quoted diff) +0
-0
b/drivers/iio/pressure/st_pressure_core.cQuoted 4 lines
drivers/iio/pressure/st_pressure_core.c static const struct st_sensors
Quoted 4 lines
index 60c2ee4..3abada2 100644
drivers/iio/pressure/st_pressure_core.c +0
-0@@ -107,6 +107,7 @@ static const struct st_sensorsst_press_sensors[] = {
Quoted 8 lines
drivers/iio/pressure/st_pressure_core.c int st_press_common_probe(struct iio_dev
Quoted 8 lines
drivers/iio/pressure/st_pressure_core.c +1
-0[0 ] =LPS331AP_PRESS_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_press_lps331ap_channels, + .num_ch = ARRAY_SIZE(st_press_lps331ap_channels), .odr = { .addr =ST_PRESS_LPS331AP_ODR_ADDR , .mask =ST_PRESS_LPS331AP_ODR_MASK ,@@ -245,7 +246,7 @@ int st_press_common_probe(struct iio_dev
*indio_dev,Quoted 9 lines
Review
Quoted 9 lines
drivers/iio/pressure/st_pressure_core.c +1
-1pdata->num_data_channels =ST_PRESS_NUMBER_DATA_CHANNELS ; pdata->multiread_bit = pdata->sensor->multi_read_bit; indio_dev->channels = pdata->sensor->ch; - indio_dev->num_channels =ARRAY_SIZE (st_press_lps331ap_channels); + indio_dev->num_channels = pdata->sensor->num_ch;if (pdata->sensor->fs.addr !=0 ) pdata->current_fullscale = (struct st_sensor_fullscale_avl *)(quoted diff) +0
-0
b/include/linux/iio/common/st_sensors.hQuoted 12 lines
Quoted 12 lines
index e51f654..e732fda 100644
include/linux/iio/common/st_sensors.h +1
-0@@ -184,6 +184,7 @@ struct st_sensors {u8 wai;char sensors_supported[ST_SENSORS_MAX_4WAI ][ST_SENSORS_MAX_NAME ];struct iio_chan_spec *ch; +int num_ch;struct st_sensor_odr odr;struct st_sensor_power pw;struct st_sensor_axis enable_axis;
Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
PATCH v3 26/38 iio: pressure-core: st: Clean-up probe() function
In reply to Lee JonesThis patch contains some pretty basic clean-ups in probe() pertaining to the simplification of error handling and a couple of readability adaptions.
--- drivers/iio/pressure/st_pressure_core.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
drivers/iio/pressure/st_pressure_core.c +16 -16
@@ -232,21 +232,23 @@ static const struct iio_trigger_ops st_press_trigger_ops = {int st_press_common_probe (struct iio_dev *indio_dev,struct st_sensors_platform_data *plat_data) { -int err;struct st_sensor_data *pdata =iio_priv (indio_dev); +int irq = pdata->get_irq_data_ready (indio_dev); +int err; indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->info = &press_info; err =st_sensors_check_device_support (indio_dev, -ARRAY_SIZE (st_press_sensors), st_press_sensors); +ARRAY_SIZE (st_press_sensors), + st_press_sensors);if (err <0 ) - goto st_press_common_probe_error; +return err; pdata->num_data_channels =ST_PRESS_NUMBER_DATA_CHANNELS ; - pdata->multiread_bit = pdata->sensor->multi_read_bit; - indio_dev->channels = pdata->sensor->ch; - indio_dev->num_channels = pdata->sensor->num_ch; + pdata->multiread_bit = pdata->sensor->multi_read_bit; + indio_dev->channels = pdata->sensor->ch; + indio_dev->num_channels = pdata->sensor->num_ch;if (pdata->sensor->fs.addr !=0 ) pdata->current_fullscale = (struct st_sensor_fullscale_avl *)
@@ -261,32 +263,30 @@ int st_press_common_probe(struct iio_dev *indio_dev, err =st_sensors_init_sensor (indio_dev, plat_data);if (err <0 ) - goto st_press_common_probe_error; +return err; -if (pdata->get_irq_data_ready (indio_dev) >0 ) { +if (irq >0 ) { err =st_press_allocate_ring (indio_dev);if (err <0 ) - goto st_press_common_probe_error; +return err; err =st_sensors_allocate_trigger (indio_dev, -ST_PRESS_TRIGGER_OPS ); +ST_PRESS_TRIGGER_OPS );if (err <0 ) goto st_press_probe_trigger_error; } err =iio_device_register (indio_dev); -if (err) +if (err && irq >0 ) goto st_press_device_register_error;return err; st_press_device_register_error: -if (pdata->get_irq_data_ready (indio_dev) >0 ) -st_sensors_deallocate_trigger (indio_dev); +st_sensors_deallocate_trigger (indio_dev); st_press_probe_trigger_error: -if (pdata->get_irq_data_ready (indio_dev) >0 ) -st_press_deallocate_ring (indio_dev); -st_press_common_probe_error: +st_press_deallocate_ring (indio_dev); +return err; }EXPORT_SYMBOL (st_press_common_probe);
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
Quoted 61 lines · Lee Jones
This patch contains some pretty basic clean-ups in
probe()pertaining to
the simplification of error handling and a couple of readability adaptions.Signed-off-by Lee Jones <[email protected]>---
drivers/iio/pressure/st_pressure_core.c| 32
++++++++++++++++----------------1 file changed, 16 insertions(+), 16 deletions(-)drivers/iio/pressure/st_pressure_core.c +8
-6@@ -232,21 +232,23 @@ static const struct iio_trigger_ops st_press_trigger_ops = {int st_press_common_probe (struct iio_dev *indio_dev,struct st_sensors_platform_data *plat_data) { -int err;struct st_sensor_data *pdata =iio_priv (indio_dev); +int irq = pdata->get_irq_data_ready (indio_dev); +int err; indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->info = &press_info; err =st_sensors_check_device_support (indio_dev, -ARRAY_SIZE (st_press_sensors), st_press_sensors); +ARRAY_SIZE (st_press_sensors), + st_press_sensors);if (err <0 ) - goto st_press_common_probe_error; +return err; pdata->num_data_channels =ST_PRESS_NUMBER_DATA_CHANNELS ; - pdata->multiread_bit = pdata->sensor->multi_read_bit; - indio_dev->channels = pdata->sensor->ch; - indio_dev->num_channels = pdata->sensor->num_ch; + pdata->multiread_bit = pdata->sensor->multi_read_bit; + indio_dev->channels = pdata->sensor->ch; + indio_dev->num_channels = pdata->sensor->num_ch;if (pdata->sensor->fs.addr !=0 )pdata->current_fullscale = (struct st_sensor_fullscale_avl *)drivers/iio/pressure/st_pressure_core.c +3
-3@@ -261,32 +263,30 @@ int st_press_common_probe(struct iio_dev *indio_dev, err =st_sensors_init_sensor (indio_dev, plat_data);if (err <0 ) - goto st_press_common_probe_error; +return err; -if (pdata->get_irq_data_ready (indio_dev) >0 ) { +if (irq >0 ) { err =st_press_allocate_ring (indio_dev);if (err <0 ) - goto st_press_common_probe_error; +return err;
drivers/iio/pressure/st_pressure_core.c int st_press_common_probe(struct iio_dev · line 279
Quoted 10 lines
drivers/iio/pressure/st_pressure_core.c +1
-2err =st_sensors_allocate_trigger (indio_dev, -ST_PRESS_TRIGGER_OPS ); +ST_PRESS_TRIGGER_OPS );if (err <0 ) goto st_press_probe_trigger_error; } err =iio_device_register (indio_dev); -if (err)
This bit of handling is confusing. I would much rather see the if IRQ at the goto. Here the first thought is why is it not an error if there is no IRQ!
Quoted 18 lines
drivers/iio/pressure/st_pressure_core.c +1
-0+if (err && irq >0 ) goto st_press_device_register_error;return err;
st_press_device_register_error:drivers/iio/pressure/st_pressure_core.c +1
-2-if (pdata->get_irq_data_ready (indio_dev) >0 ) -st_sensors_deallocate_trigger (indio_dev); +st_sensors_deallocate_trigger (indio_dev);
st_press_probe_trigger_error:drivers/iio/pressure/st_pressure_core.c +2
-3-if (pdata->get_irq_data_ready (indio_dev) >0 ) -st_press_deallocate_ring (indio_dev); -st_press_common_probe_error: +st_press_deallocate_ring (indio_dev); +return err; }
EXPORT_SYMBOL(st_press_common_probe);
Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
Re: [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
Quoted 19 lines
Quoted 19 lines
err = st_sensors_init_sensor(indio_dev, plat_data); if (err < 0)drivers/iio/pressure/st_pressure_core.c +2
-2- goto st_press_common_probe_error; +return err; -if (pdata->get_irq_data_ready (indio_dev) >0 ) { +if (irq >0 ) {err = st_press_allocate_ring(indio_dev); if (err < 0)(quoted diff) +1
-1- goto st_press_common_probe_error; + return err;err = st_sensors_allocate_trigger(indio_dev,
drivers/iio/pressure/st_pressure_core.c +1
-1- ST_PRESS_TRIGGER_OPS); + ST_PRESS_TRIGGER_OPS);if (err < 0) goto st_press_probe_trigger_error; }
Quoted 4 lines
drivers/iio/pressure/st_pressure_core.c int st_press_common_probe(struct iio_dev *indio_dev, · line 278
Quoted 2 lines
err = iio_device_register(indio_dev);drivers/iio/pressure/st_pressure_core.c +0
-1-if (err)This bit of handling is confusing. I would much rather see the if IRQ at the goto. Here the first thought is why is it not an error if there is no IRQ!
I certainly see your point. But surely anyone would see after a second or two that we're returning err and not 0 in this case, so the error would still be returned, we're not ignoring it. Adding this extra comparison saves several lines of code.
If you think it's 'too' confusing, I'll revert the change.
Or perhaps a comment:
/* Only deallocate_[trigger|ring] if they were allocated. */ or
/* Only deallocate_[trigger|ring] if we have an IRQ line. */ or
/* If no IRQ was specified, just return the error. */
Quoted 19 lines
Quoted 18 lines
drivers/iio/pressure/st_pressure_core.c +1
-0+if (err && irq >0 )goto st_press_device_register_error; return err;
st_press_device_register_error:drivers/iio/pressure/st_pressure_core.c +1
-2-if (pdata->get_irq_data_ready (indio_dev) >0 ) -st_sensors_deallocate_trigger (indio_dev); +st_sensors_deallocate_trigger (indio_dev);
st_press_probe_trigger_error:drivers/iio/pressure/st_pressure_core.c +2
-3-if (pdata->get_irq_data_ready (indio_dev) >0 ) -st_press_deallocate_ring (indio_dev); -st_press_common_probe_error: +st_press_deallocate_ring (indio_dev); +return err; }
EXPORT_SYMBOL(st_press_common_probe);
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Jonathan Cameron
maintainerRe: [PATCH 26/38] iio: pressure-core: st: Clean-up probe() function
Quoted 31 lines · Lee Jones
Quoted 19 lines
Quoted 19 lines
err = st_sensors_init_sensor(indio_dev, plat_data); if (err < 0)drivers/iio/pressure/st_pressure_core.c +2
-2- goto st_press_common_probe_error; +return err; -if (pdata->get_irq_data_ready (indio_dev) >0 ) { +if (irq >0 ) {err = st_press_allocate_ring(indio_dev); if (err < 0)(quoted diff) +1
-1- goto st_press_common_probe_error; + return err;err = st_sensors_allocate_trigger(indio_dev,
drivers/iio/pressure/st_pressure_core.c +1
-1- ST_PRESS_TRIGGER_OPS); + ST_PRESS_TRIGGER_OPS);if (err < 0) goto st_press_probe_trigger_error; }Quoted 4 lines
drivers/iio/pressure/st_pressure_core.c int st_press_common_probe(struct iio_dev *indio_dev, · line 278
Quoted 2 lines
err = iio_device_register(indio_dev);drivers/iio/pressure/st_pressure_core.c +0
-1-if (err)This bit of handling is confusing. I would much rather see the if IRQ at the goto. Here the first thought is why is it not an error if there is no IRQ!
I certainly see your point. But surely anyone would see after a second or two that we're returning err and not 0 in this case, so the error would still be returned, we're not ignoring it. Adding this extra comparison saves several lines of code.
If you think it's 'too' confusing, I'll revert the change.
Quoted 8 lines
Or perhaps a comment:
/* Only deallocate_[trigger|ring] if they were allocated. */ or
/* Only deallocate_[trigger|ring] if we have an IRQ line. */ or
/* If no IRQ was specified, just return the error. */
Revert the change. Whilst not complex to follow it is non obvious to save only a couple of lines. Adding a comment would take almost as much space as just doing it the 'easy way'.
Quoted 20 lines
Quoted 19 lines
Quoted 18 lines
drivers/iio/pressure/st_pressure_core.c +1
-0+if (err && irq >0 )goto st_press_device_register_error; return err;
st_press_device_register_error:drivers/iio/pressure/st_pressure_core.c +1
-2-if (pdata->get_irq_data_ready (indio_dev) >0 ) -st_sensors_deallocate_trigger (indio_dev); +st_sensors_deallocate_trigger (indio_dev);
st_press_probe_trigger_error:drivers/iio/pressure/st_pressure_core.c +2
-3-if (pdata->get_irq_data_ready (indio_dev) >0 ) -st_press_deallocate_ring (indio_dev); -st_press_common_probe_error: +st_press_deallocate_ring (indio_dev); +return err; }
EXPORT_SYMBOL(st_press_common_probe);
PATCH v3 27/38 iio: pressure-core: st: Give some indication if device probing was successful
In reply to Lee JonesAt the moment the driver is silent in some error cases and if successful. Prior to this patch there was no clear way to know if the driver succeeded or not without looking deep into sysfs.
--- drivers/iio/pressure/st_pressure_core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iio/pressure/st_pressure_core.c +3 -0
@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev *indio_dev,if (err && irq >0 ) goto st_press_device_register_error; +if (!err) +dev_info (&indio_dev->dev,"Successfully registered\n" ); +return err; st_press_device_register_error:
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
Quoted 17 lines · Lee Jones
At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.Signed-off-by Lee Jones <[email protected]>---
drivers/iio/pressure/st_pressure_core.c| 3 +++1 file changed, 3 insertions(+)drivers/iio/pressure/st_pressure_core.c +0
-0
drivers/iio/pressure/st_pressure_core.c int st_press_common_probe(struct iio_dev · line 286
Quoted 7 lines
drivers/iio/pressure/st_pressure_core.c +3
-0@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev *indio_dev, if (err && irq > 0) goto st_press_device_register_error; +if (!err) +dev_info (&indio_dev->dev,"Successfully registered\n" ); +
Not keen. That to my mind is pointless noise. If this made sense then it would be in the driver core not here.
Quoted 3 lines
drivers/iio/pressure/st_pressure_core.c +0
-0return err;
st_press_device_register_error:
Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
Quoted 22 lines · Jonathan Cameron
Quoted 21 lines · Lee Jones
At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.Signed-off-by Lee Jones <[email protected]>---
drivers/iio/pressure/st_pressure_core.c| 3 +++1 file changed, 3 insertions(+)drivers/iio/pressure/st_pressure_core.c +0
-0@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev *indio_dev, if (err && irq > 0) goto st_press_device_register_error;
Quoted 4 lines
drivers/iio/pressure/st_pressure_core.c int st_press_common_probe(struct iio_dev *indio_dev, · line 285
Quoted 3 lines
drivers/iio/pressure/st_pressure_core.c +3
-0+if (!err) +dev_info (&indio_dev->dev,"Successfully registered\n" ); +Not keen. That to my mind is pointless noise.
I think it needs to be somewhere. IIO provides no indication whether these chips are probed/registered/whathaveyou, or even if the subsystem is in use.
One line per hardware component is not noise, IMO it's indicative of key functionality which is now available:
Bootlog:
<snip>
iio iio: lsm303dlh_accel: Successfully registered
iio iio: l3g4200d_gyro: Successfully registered
iio iio: lps001wp_press: Successfully registered
iio iio: lsm303dlhc_magn: Successfully registered
<snip>
Quoted 1 line
If this made sense then it would be in the driver core not here.
Also fine. Just anything but silence/NULL reporting.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
Quoted 43 lines · Lee Jones
Quoted 22 lines · Jonathan Cameron
Quoted 21 lines · Lee Jones
At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.Signed-off-by Lee Jones <[email protected]>---
drivers/iio/pressure/st_pressure_core.c| 3 +++1 file changed, 3 insertions(+)drivers/iio/pressure/st_pressure_core.c +0
-0@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev *indio_dev, if (err && irq > 0) goto st_press_device_register_error;Quoted 4 lines
drivers/iio/pressure/st_pressure_core.c int st_press_common_probe(struct iio_dev *indio_dev, · line 285
Quoted 3 lines
drivers/iio/pressure/st_pressure_core.c +3
-0+if (!err) +dev_info (&indio_dev->dev,"Successfully registered\n" ); +Not keen. That to my mind is pointless noise.
I think it needs to be somewhere. IIO provides no indication whether these chips are probed/registered/whathaveyou, or even if the subsystem is in use.
One line per hardware component is not noise, IMO it's indicative of key functionality which is now available:
Bootlog:
<snip>
iio iio:lsm303dlh_accel: Successfully registered
iio iio:l3g4200d_gyro: Successfully registered
iio iio:lps001wp_press: Successfully registered
iio iio:lsm303dlhc_magn: Successfully registered
<snip>
Quoted 3 lines
Quoted 1 line
If this made sense then it would be in the driver core not here.
Also fine. Just anything but silence/NULL reporting.
Silence means everything is good, a message means there is an error. If every device that gets probed would spit out a message the log would be scrolling forever and you wouldn't be able to see the error messages.
- Lars
Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
Quoted 44 lines · Lars-Peter Clausen
Quoted 43 lines · Lee Jones
Quoted 22 lines · Jonathan Cameron
Quoted 21 lines · Lee Jones
At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.Signed-off-by Lee Jones <[email protected]>---
drivers/iio/pressure/st_pressure_core.c| 3 +++1 file changed, 3 insertions(+)drivers/iio/pressure/st_pressure_core.c +0
-0@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev *indio_dev, if (err && irq > 0) goto st_press_device_register_error;Quoted 4 lines
drivers/iio/pressure/st_pressure_core.c int st_press_common_probe(struct iio_dev *indio_dev, · line 285
Quoted 3 lines
drivers/iio/pressure/st_pressure_core.c +3
-0+if (!err) +dev_info (&indio_dev->dev,"Successfully registered\n" ); +Not keen. That to my mind is pointless noise.
I think it needs to be somewhere. IIO provides no indication whether these chips are probed/registered/whathaveyou, or even if the subsystem is in use.
One line per hardware component is not noise, IMO it's indicative of key functionality which is now available:
Bootlog:
<snip>
iio iio:lsm303dlh_accel: Successfully registered
iio iio:l3g4200d_gyro: Successfully registered
iio iio:lps001wp_press: Successfully registered
iio iio:lsm303dlhc_magn: Successfully registered
<snip>
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
If this made sense then it would be in the driver core not here.
Also fine. Just anything but silence/NULL reporting.
Silence means everything is good, a message means there is an error. If every device that gets probed would spit out a message the log would be scrolling forever and you wouldn't be able to see the error messages.
Only if you print out every regulator, clock, GPIO pin and things of this nature. Key hardware blocks such as; SD, Flash, USB, Eth, HDMI, Audio, UART, GPIO and I2C controllers and Sensors I think deserve a one line "I'm here and working" message.
I'll not fight this for too long. This is based my experience as a user. I tried to look at the bootlog for the sensors I'd just enabled and there was nothing. Some of them had probed, some hadn't and there was no clear way to distinguish between them without digging into sysfs.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
Quoted 4 lines · Lee Jones
Only if you print out every regulator, clock, GPIO pin and things of this nature. Key hardware blocks such as; SD, Flash, USB, Eth, HDMI, Audio, UART, GPIO and I2C controllers and Sensors I think deserve a one line "I'm here and working" message.
The usual rule people apply with this stuff is if the driver has read
back information it can display from the hardware (eg, a revision) then
that's OK. Things that are likely to crash the system if they fail tend
to also be OK (this is why the regualtor API is quite chatty for
example, a lot of the things it does can cause an immediate crash).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130911/235abe2c/attachment.sig>
RE: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
In reply to Lee JonesQuoted 9 lines · Lee Jones
Quoted 7 lines · Lars-Peter Clausen
Quoted 2 lines · Lee Jones
Quoted 1 line · Jonathan Cameron
Lee Jones <[email protected]> wrote:
Silence means everything is good, a message means there is an error. If every device that gets probed would spit out a message the log would be scrolling forever and you wouldn't be able to see the error messages.
Quoted 4 lines
Only if you print out every regulator, clock, GPIO pin and things of this nature. Key hardware blocks such as; SD, Flash, USB, Eth, HDMI, Audio, UART, GPIO and I2C controllers and Sensors I think deserve a one line "I'm here and working" message.
In many embedded systems -- there are lots and lots of IIO devices, and I'm not sure I would consider very many "key". It really depends on the board.
To me it's a matter of boot time. Even memcpy to msgbuf takes time. Sometimes unnecessary time.
Quoted 4 lines
I'll not fight this for too long. This is based my experience as a user. I tried to look at the bootlog for the sensors I'd just enabled and there was nothing. Some of them had probed, some hadn't and there was no clear way to distinguish between them without digging into sysfs.
echo "working:"
cat /sys/bus/iio/devices/*/name
isn't too much digging. If you really want to do that on your machine - do so in rc.local
for many other subsystems, it's just not that easy, and printing from the driver is necessary.
-Robin
Re: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
Quoted 4 lines
echo "working:"
cat/sys/bus/iio/devices/*/nameisn't too much digging. If you really want to do that on your machine - do so in rc.local
Okay, I was going round the long way, which is why is was difficult:
/sys/class/i2c-adapter/i2c-2/2-005c/iio\:device2/name
I will revert the "registered" patches.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Jonathan Cameron
maintainerRe: [PATCH 27/38] iio: pressure-core: st: Give some indication if device probing was successful
In reply to Lars-Peter ClausenQuoted 44 lines · Lars-Peter Clausen
Quoted 43 lines · Lee Jones
Quoted 22 lines · Jonathan Cameron
Quoted 21 lines · Lee Jones
At the moment the driver is silent in some error cases and if successful.
Prior to this patch there was no clear way to know if the driver succeeded
or not without looking deep into sysfs.Signed-off-by Lee Jones <[email protected]>---
drivers/iio/pressure/st_pressure_core.c| 3 +++1 file changed, 3 insertions(+)drivers/iio/pressure/st_pressure_core.c +0
-0@@ -280,6 +280,9 @@ int st_press_common_probe(struct iio_dev *indio_dev, if (err && irq > 0) goto st_press_device_register_error;Quoted 4 lines
drivers/iio/pressure/st_pressure_core.c int st_press_common_probe(struct iio_dev *indio_dev, · line 285
Quoted 3 lines
drivers/iio/pressure/st_pressure_core.c +3
-0+if (!err) +dev_info (&indio_dev->dev,"Successfully registered\n" ); +Not keen. That to my mind is pointless noise.
I think it needs to be somewhere. IIO provides no indication whether these chips are probed/registered/whathaveyou, or even if the subsystem is in use.
One line per hardware component is not noise, IMO it's indicative of key functionality which is now available:
Bootlog:
<snip>
iio iio:lsm303dlh_accel: Successfully registered
iio iio:l3g4200d_gyro: Successfully registered
iio iio:lps001wp_press: Successfully registered
iio iio:lsm303dlhc_magn: Successfully registered
<snip>
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
If this made sense then it would be in the driver core not here.
Also fine. Just anything but silence/NULL reporting.
Silence means everything is good, a message means there is an error. If every device that gets probed would spit out a message the log would be scrolling forever and you wouldn't be able to see the error messages.
Exactly. If you really think this is worthwhile, then propose it is added to the relevant place in drivers/base/ (possibly bus.c) I've just been lax in persuading people not to put it in existing drivers rather than the other way around.
Quoted 3 lines
- Lars
PATCH v3 28/38 iio: pressure: st: Add support for new LPS001WP pressure sensor
In reply to Lee JonesHere we use existing practices to introduce support for another pressure/temperature sensor, the LPS001WP.
--- drivers/iio/pressure/st_pressure.h | 1 + drivers/iio/pressure/st_pressure_core.c | 84 +++++++++++++++++++++++++++++++++ drivers/iio/pressure/st_pressure_i2c.c | 1 + 3 files changed, 86 insertions(+)
drivers/iio/pressure/st_pressure.h +1 -0
@@ -15,6 +15,7 @@#include <linux/iio/common/st_sensors.h> #define LPS331AP_PRESS_DEV_NAME "lps331ap_press" +#define LPS001WP_PRESS_DEV_NAME "lps001wp_press"/** * struct st_sensors_platform_data - default press platform data
drivers/iio/pressure/st_pressure_core.c +84 -0
102 lines not on this page · raw message
drivers/iio/pressure/st_pressure_i2c.c +1 -0
@@ -50,6 +50,7 @@ static int st_press_i2c_remove(struct i2c_client *client)static const struct i2c_device_id st_press_id_table[] = { {LPS331AP_PRESS_DEV_NAME }, + {LPS001WP_PRESS_DEV_NAME }, {}, };MODULE_DEVICE_TABLE (i2c, st_press_id_table);
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 28/38] iio: pressure: st: Add support for new LPS001WP pressure sensor
Quoted 4 lines · Lee Jones
Here we use existing practices to introduce support for another pressure/temperature sensor, the LPS001WP.
Signed-off-by Lee Jones <[email protected]>
Looks fine to me, will pick this up when the precursors are all sorted.
Quoted 140 lines
--- drivers/iio/pressure/st_pressure.h | 1 + drivers/iio/pressure/st_pressure_core.c | 84 +++++++++++++++++++++++++++++++++ drivers/iio/pressure/st_pressure_i2c.c | 1 + 3 files changed, 86 insertions(+)drivers/iio/pressure/st_pressure.h +1
-0@@ -15,6 +15,7 @@#include <linux/iio/common/st_sensors.h> #define LPS331AP_PRESS_DEV_NAME "lps331ap_press" +#define LPS001WP_PRESS_DEV_NAME "lps001wp_press"/** * struct st_sensors_platform_data - default press platform data drivers/iio/pressure/st_pressure_core.c +84
-0@@ -64,6 +64,21 @@#define ST_PRESS_LPS331AP_OUT_XL_ADDR 0x28#define ST_TEMP_LPS331AP_OUT_L_ADDR 0x2b +/* CUSTOM VALUES FOR LPS001WP SENSOR */ +#define ST_PRESS_LPS001WP_WAI_EXP 0xba +#define ST_PRESS_LPS001WP_ODR_ADDR 0x20 +#define ST_PRESS_LPS001WP_ODR_MASK 0x30 +#define ST_PRESS_LPS001WP_ODR_AVL_1HZ_VAL 0x01 +#define ST_PRESS_LPS001WP_ODR_AVL_7HZ_VAL 0x02 +#define ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL 0x03 +#define ST_PRESS_LPS001WP_PW_ADDR 0x20 +#define ST_PRESS_LPS001WP_PW_MASK 0x40 +#define ST_PRESS_LPS001WP_BDU_ADDR 0x20 +#define ST_PRESS_LPS001WP_BDU_MASK 0x04 +#define ST_PRESS_LPS001WP_MULTIREAD_BIT true +#define ST_PRESS_LPS001WP_OUT_L_ADDR 0x28 +#define ST_TEMP_LPS001WP_OUT_L_ADDR 0x2a +static const struct iio_chan_spec st_press_lps331ap_channels[] = { { .type =IIO_PRESSURE ,@@ -100,6 +115,40 @@ static const struct iio_chan_spec st_press_lps331ap_channels[] = {IIO_CHAN_SOFT_TIMESTAMP (1 ) }; +static const struct iio_chan_spec st_press_lps001wp_channels[] = { + { + .type =IIO_PRESSURE , + .channel2 =IIO_NO_MOD , + .address =ST_PRESS_LPS001WP_OUT_L_ADDR , + .scan_index =ST_SENSORS_SCAN_X , + .scan_type = { + .sign ='u' , + .realbits =16 , + .storagebits =16 , + .endianness =IIO_LE , + }, + .info_mask_separate =BIT (IIO_CHAN_INFO_RAW ), + .modified =0 , + }, + { + .type =IIO_TEMP , + .channel2 =IIO_NO_MOD , + .address =ST_TEMP_LPS001WP_OUT_L_ADDR , + .scan_index =-1 , + .scan_type = { + .sign ='u' , + .realbits =16 , + .storagebits =16 , + .endianness =IIO_LE , + }, + .info_mask_separate = +BIT (IIO_CHAN_INFO_RAW ) | +BIT (IIO_CHAN_INFO_OFFSET ), + .modified =0 , + }, +IIO_CHAN_SOFT_TIMESTAMP (1 ) +}; +static const struct st_sensors st_press_sensors[] = { { .wai =ST_PRESS_LPS331AP_WAI_EXP ,@@ -148,6 +197,41 @@ static const struct st_sensors st_press_sensors[] = { .multi_read_bit = ST_PRESS_LPS331AP_MULTIREAD_BIT, .bootime = 2, }, + { + .wai = ST_PRESS_LPS001WP_WAI_EXP, + .sensors_supported = { + [0] = LPS001WP_PRESS_DEV_NAME, + }, + .ch = (struct iio_chan_spec *)st_press_lps001wp_channels, + .num_ch = ARRAY_SIZE(st_press_lps001wp_channels), + .odr = { + .addr = ST_PRESS_LPS001WP_ODR_ADDR, + .mask = ST_PRESS_LPS001WP_ODR_MASK, + .odr_avl = { + { 1, ST_PRESS_LPS001WP_ODR_AVL_1HZ_VAL, }, + { 7, ST_PRESS_LPS001WP_ODR_AVL_7HZ_VAL, }, + { 13, ST_PRESS_LPS001WP_ODR_AVL_13HZ_VAL, }, + }, + }, + .pw = { + .addr =ST_PRESS_LPS001WP_PW_ADDR , + .mask = ST_PRESS_LPS001WP_PW_MASK, + .value_on = ST_SENSORS_DEFAULT_POWER_ON_VALUE, + .value_off = ST_SENSORS_DEFAULT_POWER_OFF_VALUE, + }, + .fs = { + .addr = 0, + }, + .bdu = { + .addr =ST_PRESS_LPS001WP_BDU_ADDR , + .mask = ST_PRESS_LPS001WP_BDU_MASK, + }, + .drdy_irq = { + .addr = 0, + }, + .multi_read_bit =ST_PRESS_LPS001WP_MULTIREAD_BIT , + .bootime = 2, + }, }; static int st_press_read_raw(struct iio_dev *indio_dev,drivers/iio/pressure/st_pressure_i2c.c +1
-0@@ -50,6 +50,7 @@ static int st_press_i2c_remove(struct i2c_client *client)static const struct i2c_device_id st_press_id_table[] = { {LPS331AP_PRESS_DEV_NAME }, + {LPS001WP_PRESS_DEV_NAME }, {}, };MODULE_DEVICE_TABLE (i2c, st_press_id_table);
PATCH v3 29/38 iio: pressure-core: st: Provide support for the Vdd power supply
In reply to Lee JonesThe power to some of the sensors are controlled by regulators. In most cases these are 'always on', but if not they will fail to work until the regulator is enabled using the relevant APIs. This patch allows for the Vdd power supply to be specified by either platform data or Device Tree.
--- drivers/iio/pressure/st_pressure_core.c | 28 ++++++++++++++++++++++++++++ include/linux/iio/common/st_sensors.h | 3 +++ 2 files changed, 31 insertions(+)
drivers/iio/pressure/st_pressure_core.c +28 -0
@@ -23,6 +23,7 @@#include <linux/iio/sysfs.h> #include <linux/iio/trigger.h> #include <linux/iio/buffer.h> +#include <linux/regulator/consumer.h> #include <asm/unaligned.h> #include <linux/iio/common/st_sensors.h>
@@ -313,6 +314,29 @@ static const struct iio_trigger_ops st_press_trigger_ops = {#define ST_PRESS_TRIGGER_OPS NULL#endif +void st_press_power_enable (struct iio_dev *indio_dev) +{ +struct st_sensor_data *pdata =iio_priv (indio_dev); +int err; + +/* Regulators not mandatory, but if requested we should enable it. */ + pdata->vdd =devm_regulator_get_optional (&indio_dev->dev,"vdd" ); +if (!IS_ERR (pdata->vdd)) { + err =regulator_enable (pdata->vdd); +if (err !=0 ) +dev_warn (&indio_dev->dev, +"Failed to enable specified Vdd supply\n" ); + } +} + +void st_press_power_disable (struct iio_dev *indio_dev) +{ +struct st_sensor_data *pdata =iio_priv (indio_dev); + +if (!IS_ERR (pdata->vdd)) +regulator_disable (pdata->vdd); +} +int st_press_common_probe (struct iio_dev *indio_dev,struct st_sensors_platform_data *plat_data) {
@@ -323,6 +347,8 @@ int st_press_common_probe(struct iio_dev *indio_dev, indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->info = &press_info; +st_press_power_enable (indio_dev); + err =st_sensors_check_device_support (indio_dev,ARRAY_SIZE (st_press_sensors), st_press_sensors);
@@ -382,6 +408,8 @@ void st_press_common_remove(struct iio_dev *indio_dev) {struct st_sensor_data *pdata =iio_priv (indio_dev); +st_press_power_disable (indio_dev); +iio_device_unregister (indio_dev);if (pdata->get_irq_data_ready (indio_dev) >0 ) {st_sensors_deallocate_trigger (indio_dev);
include/linux/iio/common/st_sensors.h +3 -0
@@ -16,6 +16,7 @@#include <linux/irqreturn.h> #include <linux/iio/trigger.h> #include <linux/bitops.h> +#include <linux/regulator/consumer.h> #include <linux/platform_data/st_sensors_pdata.h>
@@ -201,6 +202,7 @@ struct st_sensors {* @trig: The trigger in use by the core driver. * @sensor: Pointer to the current sensor struct in use. * @current_fullscale: Maximum range of measure by the sensor. +* @vdd: Pointer to sensor's Vdd power supply * @enabled: Status of the sensor (false->off, true->on). * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. * @buffer_data: Data used by buffer part.
@@ -216,6 +218,7 @@ struct st_sensor_data {struct iio_trigger *trig;struct st_sensors *sensor;struct st_sensor_fullscale_avl *current_fullscale; +struct regulator *vdd;bool enabled;bool multiread_bit;
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 29/38] iio: pressure-core: st: Provide support for the Vdd power supply
Quoted 7 lines · Lee Jones
The power to some of the sensors are controlled by regulators. In most cases these are 'always on', but if not they will fail to work until the regulator is enabled using the relevant APIs. This patch allows for the Vdd power supply to be specified by either platform data or Device Tree.
Signed-off-by Lee Jones <[email protected]>
Fine, will pick up with the rest. This optional regulator stuff is nice as it gets around the annoying platform specific callbacks that tend to do stuff like this.
If anyone is bored, I suspect there are quite a few cases where this makes sense in other IIO drivers!
Quoted 94 lines
--- drivers/iio/pressure/st_pressure_core.c | 28 ++++++++++++++++++++++++++++ include/linux/iio/common/st_sensors.h | 3 +++ 2 files changed, 31 insertions(+)drivers/iio/pressure/st_pressure_core.c +28
-0@@ -23,6 +23,7 @@#include <linux/iio/sysfs.h> #include <linux/iio/trigger.h> #include <linux/iio/buffer.h> +#include <linux/regulator/consumer.h> #include <asm/unaligned.h> #include <linux/iio/common/st_sensors.h> @@ -313,6 +314,29 @@ static const struct iio_trigger_ops st_press_trigger_ops = {#define ST_PRESS_TRIGGER_OPS NULL#endif +void st_press_power_enable (struct iio_dev *indio_dev) +{ +struct st_sensor_data *pdata =iio_priv (indio_dev); +int err; + +/* Regulators not mandatory, but if requested we should enable it. */ + pdata->vdd =devm_regulator_get_optional (&indio_dev->dev,"vdd" ); +if (!IS_ERR (pdata->vdd)) { + err =regulator_enable (pdata->vdd); +if (err !=0 ) +dev_warn (&indio_dev->dev, +"Failed to enable specified Vdd supply\n" ); + } +} + +void st_press_power_disable (struct iio_dev *indio_dev) +{ +struct st_sensor_data *pdata =iio_priv (indio_dev); + +if (!IS_ERR (pdata->vdd)) +regulator_disable (pdata->vdd); +} +int st_press_common_probe (struct iio_dev *indio_dev,struct st_sensors_platform_data *plat_data) {@@ -323,6 +347,8 @@ int st_press_common_probe(struct iio_dev *indio_dev, indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->info = &press_info; +st_press_power_enable (indio_dev); + err =st_sensors_check_device_support (indio_dev,ARRAY_SIZE (st_press_sensors), st_press_sensors);@@ -382,6 +408,8 @@ void st_press_common_remove(struct iio_dev *indio_dev) {struct st_sensor_data *pdata =iio_priv (indio_dev); +st_press_power_disable (indio_dev); +iio_device_unregister (indio_dev);if (pdata->get_irq_data_ready (indio_dev) >0 ) {st_sensors_deallocate_trigger (indio_dev);include/linux/iio/common/st_sensors.h +3
-0@@ -16,6 +16,7 @@#include <linux/irqreturn.h> #include <linux/iio/trigger.h> #include <linux/bitops.h> +#include <linux/regulator/consumer.h> #include <linux/platform_data/st_sensors_pdata.h> @@ -201,6 +202,7 @@ struct st_sensors {* @trig: The trigger in use by the core driver. * @sensor: Pointer to the current sensor struct in use. * @current_fullscale: Maximum range of measure by the sensor. +* @vdd: Pointer to sensor's Vdd power supply * @enabled: Status of the sensor (false->off, true->on). * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. * @buffer_data: Data used by buffer part. @@ -216,6 +218,7 @@ struct st_sensor_data {struct iio_trigger *trig;struct st_sensors *sensor;struct st_sensor_fullscale_avl *current_fullscale; +struct regulator *vdd;bool enabled;bool multiread_bit;
PATCH v3 30/38 iio: pressure-core: st: Provide support for the Vdd_IO power supply
In reply to Lee JonesThe power to some of the sensors are controlled by regulators. In most cases these are 'always on', but if not they will fail to work until the regulator is enabled using the relevant APIs. This patch allows for the Vdd_IO power supply to be specified by either platform data or Device Tree.
--- drivers/iio/pressure/st_pressure_core.c | 13 ++++++++++++- include/linux/iio/common/st_sensors.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-)
drivers/iio/pressure/st_pressure_core.c +12 -1
@@ -319,7 +319,7 @@ void st_press_power_enable(struct iio_dev *indio_dev)struct st_sensor_data *pdata =iio_priv (indio_dev);int err; -/* Regulators not mandatory, but if requested we should enable it. */ +/* Regulators not mandatory, but if requested we should enable them. */ pdata->vdd =devm_regulator_get_optional (&indio_dev->dev,"vdd" );if (!IS_ERR (pdata->vdd)) { err =regulator_enable (pdata->vdd);
@@ -327,6 +327,14 @@ void st_press_power_enable(struct iio_dev *indio_dev)dev_warn (&indio_dev->dev,"Failed to enable specified Vdd supply\n" ); } + + pdata->vdd_io =devm_regulator_get_optional (&indio_dev->dev,"vddio" ); +if (!IS_ERR (pdata->vdd_io)) { + err =regulator_enable (pdata->vdd_io); +if (err !=0 ) +dev_warn (&indio_dev->dev, +"Failed to enable specified Vdd_IO supply\n" ); + } }void st_press_power_disable (struct iio_dev *indio_dev)
@@ -335,6 +343,9 @@ void st_press_power_disable(struct iio_dev *indio_dev)if (!IS_ERR (pdata->vdd))regulator_disable (pdata->vdd); + +if (!IS_ERR (pdata->vdd_io)) +regulator_disable (pdata->vdd_io); } int st_press_common_probe(struct iio_dev *indio_dev,
include/linux/iio/common/st_sensors.h +2 -0
@@ -203,6 +203,7 @@ struct st_sensors {* @sensor: Pointer to the current sensor struct in use. * @current_fullscale: Maximum range of measure by the sensor. * @vdd: Pointer to sensor's Vdd power supply +* @vdd_io: Pointer to sensor's Vdd-IO power supply * @enabled: Status of the sensor (false->off, true->on). * @multiread_bit: Use or not particular bit for [I2C/SPI] multiread. * @buffer_data: Data used by buffer part.
@@ -219,6 +220,7 @@ struct st_sensor_data {struct st_sensors *sensor;struct st_sensor_fullscale_avl *current_fullscale;struct regulator *vdd; +struct regulator *vdd_io;bool enabled;bool multiread_bit;
Signature · 1 line
1.8.1.2
PATCH v3 31/38 iio: accel-core: st: Clean up error handling in probe()
In reply to Lee JonesReduce the amount of those unnecessary goto calls, as in most cases we can simply return immediately. We also only call for the IRQ number once and use that value throughout.
--- drivers/iio/accel/st_accel_core.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/iio/accel/st_accel_core.c +10 -11
@@ -452,8 +452,9 @@ static const struct iio_trigger_ops st_accel_trigger_ops = {int st_accel_common_probe (struct iio_dev *indio_dev,struct st_sensors_platform_data *plat_data) { -int err;struct st_sensor_data *adata =iio_priv (indio_dev); +int irq = adata->get_irq_data_ready (indio_dev); +int err; indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->info = &accel_info;
@@ -461,7 +462,7 @@ int st_accel_common_probe(struct iio_dev *indio_dev, err =st_sensors_check_device_support (indio_dev,ARRAY_SIZE (st_accel_sensors), st_accel_sensors);if (err <0 ) - goto st_accel_common_probe_error; +return err; adata->num_data_channels =ST_ACCEL_NUMBER_DATA_CHANNELS ; adata->multiread_bit = adata->sensor->multi_read_bit;
@@ -478,12 +479,12 @@ int st_accel_common_probe(struct iio_dev *indio_dev, err =st_sensors_init_sensor (indio_dev, plat_data);if (err <0 ) - goto st_accel_common_probe_error; +return err; -if (adata->get_irq_data_ready (indio_dev) >0 ) { +if (irq >0 ) { err =st_accel_allocate_ring (indio_dev);if (err <0 ) - goto st_accel_common_probe_error; +return err; err =st_sensors_allocate_trigger (indio_dev,ST_ACCEL_TRIGGER_OPS );
@@ -492,18 +493,16 @@ int st_accel_common_probe(struct iio_dev *indio_dev, } err =iio_device_register (indio_dev); -if (err) +if (err && irq >0 ) goto st_accel_device_register_error;return err; st_accel_device_register_error: -if (adata->get_irq_data_ready (indio_dev) >0 ) -st_sensors_deallocate_trigger (indio_dev); +st_sensors_deallocate_trigger (indio_dev); st_accel_probe_trigger_error: -if (adata->get_irq_data_ready (indio_dev) >0 ) -st_accel_deallocate_ring (indio_dev); -st_accel_common_probe_error: +st_accel_deallocate_ring (indio_dev); +return err; }EXPORT_SYMBOL (st_accel_common_probe);
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 31/38] iio: accel-core: st: Clean up error handling in probe()
Quoted 5 lines · Lee Jones
Reduce the amount of those unnecessary goto calls, as in most cases we can simply return immediately. We also only call for the IRQ number once and use that value throughout.
Signed-off-by Lee Jones <[email protected]>
...
Quoted 10 lines
drivers/iio/accel/st_accel_core.c +2
-2-if (adata->get_irq_data_ready (indio_dev) >0 ) { +if (irq >0 ) { err =st_accel_allocate_ring (indio_dev);if (err <0 ) - goto st_accel_common_probe_error; +return err; err =st_sensors_allocate_trigger (indio_dev,ST_ACCEL_TRIGGER_OPS );
drivers/iio/accel/st_accel_core.c int st_accel_common_probe(struct iio_dev *indio_dev, · line 497
Quoted 6 lines
drivers/iio/accel/st_accel_core.c +1
-1@@ -492,18 +493,16 @@ int st_accel_common_probe(struct iio_dev *indio_dev, } err =iio_device_register (indio_dev); -if (err) +if (err && irq >0 ) goto st_accel_device_register_error;
This is the same structure I moaned about earlier. Again, put the if (irq > 0) in the error handling not here.
Quoted 17 lines
drivers/iio/accel/st_accel_core.c +3
-5return err; st_accel_device_register_error: -if (adata->get_irq_data_ready (indio_dev) >0 ) -st_sensors_deallocate_trigger (indio_dev); +st_sensors_deallocate_trigger (indio_dev); st_accel_probe_trigger_error: -if (adata->get_irq_data_ready (indio_dev) >0 ) -st_accel_deallocate_ring (indio_dev); -st_accel_common_probe_error: +st_accel_deallocate_ring (indio_dev); +return err; }EXPORT_SYMBOL (st_accel_common_probe);
PATCH v3 32/38 iio: accel-core: st: Move LSM303DLH into correct group
In reply to Lee JonesThe LSM303DLH's WAI (WhoAmI) is 0x33, meaning it should be enabled by Accel Sensor group one. For the device to probe without error, we'll need to ensure it's registered with the correct WAI.
--- drivers/iio/accel/st_accel_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/accel/st_accel_core.c +2 -2
@@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = { [2] = LSM330D_ACCEL_DEV_NAME, [3] = LSM330DL_ACCEL_DEV_NAME, [4] = LSM330DLC_ACCEL_DEV_NAME, + [5 ] =LSM303DLH_ACCEL_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = {
@@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = { .sensors_supported = { [0] = LIS331DLH_ACCEL_DEV_NAME, [1] = LSM303DL_ACCEL_DEV_NAME, - [2] = LSM303DLH_ACCEL_DEV_NAME, - [3] = LSM303DLM_ACCEL_DEV_NAME, + [2] = LSM303DLM_ACCEL_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = {
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
Quoted 5 lines · Lee Jones
The LSM303DLH's WAI (WhoAmI) is
0x33, meaning it should be enabled by Accel Sensor group one. For the device to probe without error, we'll need to ensure it's registered with the correct WAI.Signed-off-by Lee Jones <[email protected]>
You clearly have a better datasheet than I have as for that part it doesn't even claim to have the relevant register to read a who am I from.
Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally was in these tables.
http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
I haven't checked other elements...
I'm confused but suspect we may need another type entry to deal with this one.
Quoted 27 lines
--- drivers/iio/accel/st_accel_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/accel/st_accel_core.c +2
-2@@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = { [2] = LSM330D_ACCEL_DEV_NAME, [3] = LSM330DL_ACCEL_DEV_NAME, [4] = LSM330DLC_ACCEL_DEV_NAME, + [5 ] =LSM303DLH_ACCEL_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = {@@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = { .sensors_supported = { [0] = LIS331DLH_ACCEL_DEV_NAME, [1] = LSM303DL_ACCEL_DEV_NAME, - [2] = LSM303DLH_ACCEL_DEV_NAME, - [3] = LSM303DLM_ACCEL_DEV_NAME, + [2] = LSM303DLM_ACCEL_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = {
Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
Quoted 9 lines · Jonathan Cameron
Quoted 5 lines · Lee Jones
The LSM303DLH's WAI (WhoAmI) is
0x33, meaning it should be enabled by Accel Sensor group one. For the device to probe without error, we'll need to ensure it's registered with the correct WAI.Signed-off-by Lee Jones <[email protected]>You clearly have a better datasheet than I have as for that part it doesn't even claim to have the relevant register to read a who am I from.
Quoted 8 lines
Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally was in these tables.
http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
I haven't checked other elements...
I'm confused but suspect we may need another type entry to deal with this one.
Hmmm... on initial thought, I don't know how we can handle this one. I assumed the WAIs were a one-stop-shop for device identification. I also thought that they would only match if the functionality and register maps would be the same.
I'll touch base with Denis on this, perhaps he can shed some light.
Quoted 27 lines
Quoted 27 lines
--- drivers/iio/accel/st_accel_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/accel/st_accel_core.c +2
-2@@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = { [2] = LSM330D_ACCEL_DEV_NAME, [3] = LSM330DL_ACCEL_DEV_NAME, [4] = LSM330DLC_ACCEL_DEV_NAME, + [5 ] =LSM303DLH_ACCEL_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = {@@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = { .sensors_supported = { [0] = LIS331DLH_ACCEL_DEV_NAME, [1] = LSM303DL_ACCEL_DEV_NAME, - [2] = LSM303DLH_ACCEL_DEV_NAME, - [3] = LSM303DLM_ACCEL_DEV_NAME, + [2] = LSM303DLM_ACCEL_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = {
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
Hi Lee,
Quoted 16 lines
Quoted 16 lines · Lee Jones
Quoted 5 lines
The LSM303DLH's WAI (WhoAmI) is
0x33, meaning it should be enabled by Accel Sensor group one. For the device to probe without error, we'll need to ensure it's registered with the correct WAI.Signed-off-by Lee Jones <[email protected]>You clearly have a better datasheet than I have as for that part it doesn't even claim to have the relevant register to read a who am I from.
Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally was in these tables.
http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
I haven't checked other elements...
Quoted 8 lines
Quoted 1 line
I'm confused but suspect we may need another type entry to deal with this one.
Hmmm... on initial thought, I don't know how we can handle this one. I assumed the WAIs were a one-stop-shop for device identification. I also thought that they would only match if the functionality and register maps would be the same.
I'll touch base with Denis on this, perhaps he can shed some light.
I've just checked, the WAI is 0x32. It was correct...Are you sure that you use the LSM303DLH?
Denis
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
--- drivers/iio/accel/st_accel_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/accel/st_accel_core.c +2
-2@@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = { [2] = LSM330D_ACCEL_DEV_NAME, [3] = LSM330DL_ACCEL_DEV_NAME, [4] = LSM330DLC_ACCEL_DEV_NAME, + [5 ] =LSM303DLH_ACCEL_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = {@@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = { .sensors_supported = { [0] = LIS331DLH_ACCEL_DEV_NAME, [1] = LSM303DL_ACCEL_DEV_NAME, - [2] = LSM303DLH_ACCEL_DEV_NAME, - [3] = LSM303DLM_ACCEL_DEV_NAME, + [2] = LSM303DLM_ACCEL_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = {
Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
Quoted 23 lines · Denis CIOCCA
Hi Lee,
Quoted 22 lines
Quoted 9 lines · Lee Jones
Quoted 5 lines
The LSM303DLH's WAI (WhoAmI) is
0x33, meaning it should be enabled by Accel Sensor group one. For the device to probe without error, we'll need to ensure it's registered with the correct WAI.Signed-off-by Lee Jones <[email protected]>You clearly have a better datasheet than I have as for that part it doesn't even claim to have the relevant register to read a who am I from.
Quoted 8 lines
Now that datasheet does list odr values as 50, 100, 400 1000 which would put it where it originally was in these tables.
http://www.st.com/web/en/resource/technical/document/datasheet/CD00260288.pdf
I haven't checked other elements...
I'm confused but suspect we may need another type entry to deal with this one.
Hmmm... on initial thought, I don't know how we can handle this one. I assumed the WAIs were a one-stop-shop for device identification. I also thought that they would only match if the functionality and register maps would be the same.
Quoted 4 lines
Quoted 2 lines
I'll touch base with Denis on this, perhaps he can shed some light.
I've just checked, the WAI is
0x32. It was correct...Are you sure that you use the LSM303DLH?
That's what the datasheet for the board says. Perhaps it's that that's incorrect? Annoyingly, instead of printing the device name on the package, ST put some non-Googleable nonsense is there instead (probably the serial number).
Nevertheless, I'll revert the patch and work something else out.
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
--- drivers/iio/accel/st_accel_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/iio/accel/st_accel_core.c +2
-2@@ -170,6 +170,7 @@ static const struct st_sensors st_accel_sensors[] = { [2] = LSM330D_ACCEL_DEV_NAME, [3] = LSM330DL_ACCEL_DEV_NAME, [4] = LSM330DLC_ACCEL_DEV_NAME, + [5 ] =LSM303DLH_ACCEL_DEV_NAME , }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = {@@ -238,8 +239,7 @@ static const struct st_sensors st_accel_sensors[] = { .sensors_supported = { [0] = LIS331DLH_ACCEL_DEV_NAME, [1] = LSM303DL_ACCEL_DEV_NAME, - [2] = LSM303DLH_ACCEL_DEV_NAME, - [3] = LSM303DLM_ACCEL_DEV_NAME, + [2] = LSM303DLM_ACCEL_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_accel_12bit_channels, .odr = {
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
Hi Lee,
Quoted 5 lines
That's what the datasheet for the board says. Perhaps it's that that's incorrect? Annoyingly, instead of printing the device name on the package, ST put some non-Googleable nonsense is there instead (probably the serial number). Nevertheless, I'll revert the patch and work something else out.
I've tried with real device...Unfortunately, you are right for name on the package...
So, are you using the LSM303DLHC?
Denis
Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
Quoted 9 lines
Quoted 5 lines
That's what the datasheet for the board says. Perhaps it's that that's incorrect? Annoyingly, instead of printing the device name on the package, ST put some non-Googleable nonsense is there instead (probably the serial number). Nevertheless, I'll revert the patch and work something else out.
I've tried with real device...Unfortunately, you are right for name on the package...
So, are you using the LSM303DLHC?
According to my datasheet [1], I have the LSM303DLH.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
Quoted 7 lines
Quoted 3 lines
I've tried with real device...Unfortunately, you are right for name on the package...
So, are you using the LSM303DLHC?According to my datasheet [1], I have the LSM303DLH.
Mhh...I saw the LSM303DLHC...
The LSM303DLH is not populated, there is only the footprint but is not soldered...
Denis
Re: [PATCH 32/38] iio: accel-core: st: Move LSM303DLH into correct group
Quoted 10 lines · Denis CIOCCA
Quoted 7 lines
Quoted 3 lines
I've tried with real device...Unfortunately, you are right for name on the package...
So, are you using the LSM303DLHC?According to my datasheet [1], I have the LSM303DLH.
Mhh...I saw the LSM303DLHC...
The LSM303DLH is not populated, there is only the footprint but is not soldered...
The documentation says is the other way round.
See the big "Not populated" box around the LSM303DLHC?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
PATCH v3 33/38 iio: accel-core: st: Give some indication if device probing was successful
In reply to Lee JonesAt the moment the driver is silent in some error cases and if successful. Prior to this patch there was no clear way to know if the driver succeeded or not without looking deep into sysfs.
--- drivers/iio/accel/st_accel_core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iio/accel/st_accel_core.c +3 -0
@@ -496,6 +496,9 @@ int st_accel_common_probe(struct iio_dev *indio_dev,if (err && irq >0 ) goto st_accel_device_register_error; +if (!err) +dev_info (&indio_dev->dev,"Successfully registered\n" ); +return err; st_accel_device_register_error:
Signature · 1 line
1.8.1.2
PATCH v3 34/38 iio: gyro-core: st: Clean up error handling in probe()
In reply to Lee JonesReduce the amount of those unnecessary goto calls, as in most cases we can simply return immediately. We also only call for the IRQ number once and use that value throughout.
--- drivers/iio/gyro/st_gyro_core.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/iio/gyro/st_gyro_core.c +10 -11
@@ -305,8 +305,9 @@ static const struct iio_trigger_ops st_gyro_trigger_ops = {int st_gyro_common_probe (struct iio_dev *indio_dev,struct st_sensors_platform_data *pdata) { -int err;struct st_sensor_data *gdata =iio_priv (indio_dev); +int irq = gdata->get_irq_data_ready (indio_dev); +int err; indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->info = &gyro_info;
@@ -314,7 +315,7 @@ int st_gyro_common_probe(struct iio_dev *indio_dev, err =st_sensors_check_device_support (indio_dev,ARRAY_SIZE (st_gyro_sensors), st_gyro_sensors);if (err <0 ) - goto st_gyro_common_probe_error; +return err; gdata->num_data_channels =ST_GYRO_NUMBER_DATA_CHANNELS ; gdata->multiread_bit = gdata->sensor->multi_read_bit;
@@ -327,12 +328,12 @@ int st_gyro_common_probe(struct iio_dev *indio_dev, err =st_sensors_init_sensor (indio_dev, pdata);if (err <0 ) - goto st_gyro_common_probe_error; +return err; -if (gdata->get_irq_data_ready (indio_dev) >0 ) { +if (irq >0 ) { err =st_gyro_allocate_ring (indio_dev);if (err <0 ) - goto st_gyro_common_probe_error; +return err; err =st_sensors_allocate_trigger (indio_dev,ST_GYRO_TRIGGER_OPS );
@@ -341,18 +342,16 @@ int st_gyro_common_probe(struct iio_dev *indio_dev, } err =iio_device_register (indio_dev); -if (err) +if (err && irq >0 ) goto st_gyro_device_register_error;return err; st_gyro_device_register_error: -if (gdata->get_irq_data_ready (indio_dev) >0 ) -st_sensors_deallocate_trigger (indio_dev); +st_sensors_deallocate_trigger (indio_dev); st_gyro_probe_trigger_error: -if (gdata->get_irq_data_ready (indio_dev) >0 ) -st_gyro_deallocate_ring (indio_dev); -st_gyro_common_probe_error: +st_gyro_deallocate_ring (indio_dev); +return err; }EXPORT_SYMBOL (st_gyro_common_probe);
Signature · 1 line
1.8.1.2
PATCH v3 35/38 iio: gyro-core: st: Give some indication if device probing was successful
In reply to Lee JonesAt the moment the driver is silent in some error cases and if successful. Prior to this patch there was no clear way to know if the driver succeeded or not without looking deep into sysfs.
--- drivers/iio/gyro/st_gyro_core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iio/gyro/st_gyro_core.c +3 -0
@@ -345,6 +345,9 @@ int st_gyro_common_probe(struct iio_dev *indio_dev,if (err && irq >0 ) goto st_gyro_device_register_error; +if (!err) +dev_info (&indio_dev->dev,"Successfully registered\n" ); +return err; st_gyro_device_register_error:
Signature · 1 line
1.8.1.2
PATCH v3 36/38 iio: magn-core: st: Clean up error handling in probe()
In reply to Lee JonesReduce the amount of those unnecessary goto calls, as in most cases we can simply return immediately. We also only call for the IRQ number once and use that value throughout.
--- drivers/iio/magnetometer/st_magn_core.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/iio/magnetometer/st_magn_core.c +10 -11
@@ -348,8 +348,9 @@ static const struct iio_info magn_info = {int st_magn_common_probe (struct iio_dev *indio_dev,struct st_sensors_platform_data *pdata) { -int err;struct st_sensor_data *mdata =iio_priv (indio_dev); +int irq = mdata->get_irq_data_ready (indio_dev); +int err; indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->info = &magn_info;
@@ -357,7 +358,7 @@ int st_magn_common_probe(struct iio_dev *indio_dev, err =st_sensors_check_device_support (indio_dev,ARRAY_SIZE (st_magn_sensors), st_magn_sensors);if (err <0 ) - goto st_magn_common_probe_error; +return err; mdata->num_data_channels =ST_MAGN_NUMBER_DATA_CHANNELS ; mdata->multiread_bit = mdata->sensor->multi_read_bit;
@@ -370,30 +371,28 @@ int st_magn_common_probe(struct iio_dev *indio_dev, err =st_sensors_init_sensor (indio_dev, pdata);if (err <0 ) - goto st_magn_common_probe_error; +return err; -if (mdata->get_irq_data_ready (indio_dev) >0 ) { +if (irq >0 ) { err =st_magn_allocate_ring (indio_dev);if (err <0 ) - goto st_magn_common_probe_error; +return err; err =st_sensors_allocate_trigger (indio_dev,NULL );if (err <0 ) goto st_magn_probe_trigger_error; } err =iio_device_register (indio_dev); -if (err) +if (err && irq >0 ) goto st_magn_device_register_error;return err; st_magn_device_register_error: -if (mdata->get_irq_data_ready (indio_dev) >0 ) -st_sensors_deallocate_trigger (indio_dev); +st_sensors_deallocate_trigger (indio_dev); st_magn_probe_trigger_error: -if (mdata->get_irq_data_ready (indio_dev) >0 ) -st_magn_deallocate_ring (indio_dev); -st_magn_common_probe_error: +st_magn_deallocate_ring (indio_dev); +return err; }EXPORT_SYMBOL (st_magn_common_probe);
Signature · 1 line
1.8.1.2
PATCH v3 37/38 iio: magn-core: st: Give some indication if device probing was successful
In reply to Lee JonesAt the moment the driver is silent in some error cases and if successful. Prior to this patch there was no clear way to know if the driver succeeded or not without looking deep into sysfs.
--- drivers/iio/magnetometer/st_magn_core.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/iio/magnetometer/st_magn_core.c +3 -0
@@ -386,6 +386,9 @@ int st_magn_common_probe(struct iio_dev *indio_dev,if (err && irq >0 ) goto st_magn_device_register_error; +if (!err) +dev_info (&indio_dev->dev,"Successfully registered\n" ); +return err; st_magn_device_register_error:
Signature · 1 line
1.8.1.2
PATCH v3 38/38 iio: magn-core: st: Provide support for the LSM303DLH
In reply to Lee JonesTrivial patch adding the LSM303DLH to the list of already supported Magnetometer Sensors.
--- drivers/iio/magnetometer/st_magn.h | 1 + drivers/iio/magnetometer/st_magn_core.c | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/iio/magnetometer/st_magn.h +1 -0
@@ -15,6 +15,7 @@#include <linux/iio/common/st_sensors.h> #define LSM303DLHC_MAGN_DEV_NAME "lsm303dlhc_magn" +#define LSM303DLH_MAGN_DEV_NAME "lsm303dlh_magn"#define LSM303DLM_MAGN_DEV_NAME "lsm303dlm_magn"#define LIS3MDL_MAGN_DEV_NAME "lis3mdl_magn"
drivers/iio/magnetometer/st_magn_core.c +2 -1
@@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = { .wai = ST_MAGN_1_WAI_EXP, .sensors_supported = { [0] = LSM303DLHC_MAGN_DEV_NAME, - [1] = LSM303DLM_MAGN_DEV_NAME, + [1] = LSM303DLH_MAGN_DEV_NAME, + [0] = LSM303DLM_MAGN_DEV_NAME, }, .ch = (struct iio_chan_spec *)st_magn_16bit_channels, .odr = {
Signature · 1 line
1.8.1.2
Jonathan Cameron
maintainerRe: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
Quoted 4 lines · Lee Jones
Trivial patch adding the LSM303DLH to the list of already supported Magnetometer Sensors.
Signed-off-by Lee Jones <[email protected]>
err.
drivers/iio/magnetometer/st_magn_core.c static const struct st_sensors st_magn_sensors[] = { · line 155
Quoted 10 lines
index 12e7e79..b2e2917 100644
drivers/iio/magnetometer/st_magn_core.c +2
-1@@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = { .wai = ST_MAGN_1_WAI_EXP, .sensors_supported = { [0] = LSM303DLHC_MAGN_DEV_NAME, - [1] = LSM303DLM_MAGN_DEV_NAME, + [1] = LSM303DLH_MAGN_DEV_NAME, + [0] = LSM303DLM_MAGN_DEV_NAME,
[2]?
Quoted 4 lines
drivers/iio/magnetometer/st_magn_core.c +0
-0}, .ch = (struct iio_chan_spec *)st_magn_16bit_channels, .odr = {
Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
Quoted 6 lines · Jonathan Cameron
Quoted 4 lines · Lee Jones
Trivial patch adding the LSM303DLH to the list of already supported Magnetometer Sensors.
Signed-off-by Lee Jones <[email protected]>err.
?
Quoted 11 lines
drivers/iio/magnetometer/st_magn_core.c static const struct st_sensors st_magn_sensors[] = { · line 155
Quoted 10 lines
index 12e7e79..b2e2917 100644
drivers/iio/magnetometer/st_magn_core.c +2
-1@@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = { .wai = ST_MAGN_1_WAI_EXP, .sensors_supported = { [0] = LSM303DLHC_MAGN_DEV_NAME, - [1] = LSM303DLM_MAGN_DEV_NAME, + [1] = LSM303DLH_MAGN_DEV_NAME, + [0] = LSM303DLM_MAGN_DEV_NAME,[2]?
Yes, good spot, thanks.
Quoted 4 lines
Quoted 4 lines
drivers/iio/magnetometer/st_magn_core.c +0
-0}, .ch = (struct iio_chan_spec *)st_magn_16bit_channels, .odr = {
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
Hi Lee,
drivers/iio/magnetometer/st_magn_core.c static const struct st_sensors st_magn_sensors[] = { · line 155
Quoted 10 lines
index 12e7e79..b2e2917 100644
drivers/iio/magnetometer/st_magn_core.c +2
-1@@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = { .wai = ST_MAGN_1_WAI_EXP, .sensors_supported = { [0] = LSM303DLHC_MAGN_DEV_NAME, - [1] = LSM303DLM_MAGN_DEV_NAME, + [1] = LSM303DLH_MAGN_DEV_NAME, + [0] = LSM303DLM_MAGN_DEV_NAME,
Are you sure that it works?
Because LSM303DLH magnetometer use different kind of WAI registers. This driver read 0x0f and in this case the value is 0 and the driver do not probe...You have to read the identification registers (0x0a, 0x0b, 0x0c) in that case.
Denis
Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
Quoted 12 lines · Denis CIOCCA
Hi Lee,
drivers/iio/magnetometer/st_magn_core.c static const struct st_sensors st_magn_sensors[] = { · line 155
Quoted 10 lines
index 12e7e79..b2e2917 100644
drivers/iio/magnetometer/st_magn_core.c +2
-1@@ -151,7 +151,8 @@ static const struct st_sensors st_magn_sensors[] = { .wai = ST_MAGN_1_WAI_EXP, .sensors_supported = { [0] = LSM303DLHC_MAGN_DEV_NAME, - [1] = LSM303DLM_MAGN_DEV_NAME, + [1] = LSM303DLH_MAGN_DEV_NAME, + [0] = LSM303DLM_MAGN_DEV_NAME,Are you sure that it works?
Well I have tested it working.
Quoted 4 lines
Because LSM303DLH magnetometer use different kind of WAI registers. This driver read
0x0fand in this case the value is 0 and the driver do not probe...You have to read the identification registers (0x0a,0x0b,0x0c) in that case.
The driver mentions that the first group of sensors have a WAI of 0x3c:
#define ST_MAGN_1_WAI_EXP 0x3c
And when I print out the WAI read from the device:
Requested device: lsm303dlh_magn - read WAI: 0x3c
I guess I could have been lied to again by the board's datasheet again and the attached device isn't actually a LSM303DLH, but how can I tell for sure?
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
Hi Lee,
Quoted 6 lines
The driver mentions that the first group of sensors have a WAI of
0x3c: #defineST_MAGN_1_WAI_EXP0x3cAnd when I print out the WAI read from the device: Requested device:lsm303dlh_magn- read WAI:0x3cI guess I could have been lied to again by the board's datasheet again and the attached device isn't actually a LSM303DLH, but how can I tell for sure?
On LSM303DLH you have to read 0x0a 0x0b and 0x0c registers, you have to find 0x48, 0x34 and 0x33. I think in the snowball there is the LSM303DLHC.
Denis
Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
Quoted 10 lines · Denis CIOCCA
Hi Lee,
Quoted 6 lines
The driver mentions that the first group of sensors have a WAI of
0x3c: #defineST_MAGN_1_WAI_EXP0x3cAnd when I print out the WAI read from the device: Requested device:lsm303dlh_magn- read WAI:0x3cI guess I could have been lied to again by the board's datasheet again and the attached device isn't actually a LSM303DLH, but how can I tell for sure?On LSM303DLH you have to read
0x0a0x0band0x0cregisters, you have to find0x48,0x34and0x33. I think in the snowball there is the LSM303DLHC.
I'm inclined to agree with you. I'll make the necessary changes.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Re: [PATCH 38/38] iio: magn-core: st: Provide support for the LSM303DLH
In reply to Denis CIOCCAQuoted 10 lines · Denis CIOCCA
Hi Lee,
Quoted 6 lines
The driver mentions that the first group of sensors have a WAI of
0x3c: #defineST_MAGN_1_WAI_EXP0x3cAnd when I print out the WAI read from the device: Requested device:lsm303dlh_magn- read WAI:0x3cI guess I could have been lied to again by the board's datasheet again and the attached device isn't actually a LSM303DLH, but how can I tell for sure?On LSM303DLH you have to read
0x0a0x0band0x0cregisters, you have to find0x48,0x34and0x33. I think in the snowball there is the LSM303DLHC.
I just did that too:
Device: lsm303dlh_magn: WAI: (0x3c) st_magn_common_probe(): IR: ID1 (0x48) ID2 (0x34) ID3 (0x33)
It appears the LSM303DLH does have a populated WAI register after all.
Now what? :)
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org ? Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog