lis3lv02d: update DT binding for use with Nokia N900
v2 cover lis3lv02d: update DT binding for use with Nokia N900
Hi,
The lis302 has already a DT binding described in [0], which descibes misc. hardware properties. The current binding does not support all values needed to convert the Nokia N900's platform data to DT, though.
This patchset introduces support for describing inverted axis, configuration of second wakeup unit and wakeup threshold support.
The series is based on top of v4.0-rc1 and has been tested on my Nokia N900.
[0] Documentation/devicetree/bindings/misc/lis302.txt
-- Sebastian
Sebastian Reichel (4):
lis3lv02d: DT: use s32 to support negative values
lis3lv02d: DT: add wakeup unit 2 and wakeup threshold
Documentation: DT: lis302: update wakeup binding
DTS: ARM: OMAP3-N900: Add lis3lv02d support
Documentation/devicetree/bindings/misc/lis302.txt | 9 +++- arch/arm/boot/dts/omap3-n900.dts | 52 +++++++++++++++++++++ drivers/misc/lis3lv02d/lis3lv02d.c | 56 +++++++++++++++-------- 3 files changed, 97 insertions(+), 20 deletions(-)
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1426969145-4478-1-git-send-email-sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
PATCH v2 1/4 lis3lv02d: DT: use s32 to support negative values
From: Sebastian Reichel <[email protected]>
st,axis-{x,y,z} can be negative to imply inverted
axis.
Apart from that the minimal and maximal threshold
may be negative.
--- drivers/misc/lis3lv02d/lis3lv02d.c | 39 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-)
drivers/misc/lis3lv02d/lis3lv02d.c +20 -19
@@ -950,6 +950,7 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)struct lis3lv02d_platform_data *pdata;struct device_node *np = lis3->of_node;u32 val; +s32 sval;if (!lis3->of_node)return 0 ;
@@ -1054,29 +1055,29 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3)if (of_get_property (np,"st,hipass2-disable" ,NULL )) pdata->hipass_ctrl |=LIS3_HIPASS2_DISABLE ; -if (of_get_property (np,"st,axis-x" , &val)) - pdata->axis_x = val; -if (of_get_property (np,"st,axis-y" , &val)) - pdata->axis_y = val; -if (of_get_property (np,"st,axis-z" , &val)) - pdata->axis_z = val; +if (of_property_read_s32 (np,"st,axis-x" , &sval) ==0 ) + pdata->axis_x = sval; +if (of_property_read_s32 (np,"st,axis-y" , &sval) ==0 ) + pdata->axis_y = sval; +if (of_property_read_s32 (np,"st,axis-z" , &sval) ==0 ) + pdata->axis_z = sval;if (of_get_property (np,"st,default-rate" ,NULL )) pdata->default_rate = val; -if (of_get_property (np,"st,min-limit-x" , &val)) - pdata->st_min_limits[0 ] = val; -if (of_get_property (np,"st,min-limit-y" , &val)) - pdata->st_min_limits[1 ] = val; -if (of_get_property (np,"st,min-limit-z" , &val)) - pdata->st_min_limits[2 ] = val; - -if (of_get_property (np,"st,max-limit-x" , &val)) - pdata->st_max_limits[0 ] = val; -if (of_get_property (np,"st,max-limit-y" , &val)) - pdata->st_max_limits[1 ] = val; -if (of_get_property (np,"st,max-limit-z" , &val)) - pdata->st_max_limits[2 ] = val; +if (of_property_read_s32 (np,"st,min-limit-x" , &sval) ==0 ) + pdata->st_min_limits[0 ] = sval; +if (of_property_read_s32 (np,"st,min-limit-y" , &sval) ==0 ) + pdata->st_min_limits[1 ] = sval; +if (of_property_read_s32 (np,"st,min-limit-z" , &sval) ==0 ) + pdata->st_min_limits[2 ] = sval; + +if (of_property_read_s32 (np,"st,max-limit-x" , &sval) ==0 ) + pdata->st_max_limits[0 ] = sval; +if (of_property_read_s32 (np,"st,max-limit-y" , &sval) ==0 ) + pdata->st_max_limits[1 ] = sval; +if (of_property_read_s32 (np,"st,max-limit-z" , &sval) ==0 ) + pdata->st_max_limits[2 ] = sval; lis3->pdata = pdata;
Signature · 6 lines
2.1.4 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 2/4 lis3lv02d: DT: add wakeup unit 2 and wakeup threshold
In reply to Sebastian ReichelFrom: Sebastian Reichel <[email protected]>
This adds support for the the wakeup threshold and support for the second wakeup unit to the DT based setup.
--- drivers/misc/lis3lv02d/lis3lv02d.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/misc/lis3lv02d/lis3lv02d.c +17 -0
@@ -1032,6 +1032,23 @@ int lis3lv02d_init_dt(struct lis3lv02d *lis3) pdata->wakeup_flags |=LIS3_WAKEUP_Z_LO ;if (of_get_property (np,"st,wakeup-z-hi" ,NULL )) pdata->wakeup_flags |=LIS3_WAKEUP_Z_HI ; +if (of_get_property (np,"st,wakeup-threshold" , &val)) + pdata->wakeup_thresh = val; + +if (of_get_property (np,"st,wakeup2-x-lo" ,NULL )) + pdata->wakeup_flags2 |=LIS3_WAKEUP_X_LO ; +if (of_get_property (np,"st,wakeup2-x-hi" ,NULL )) + pdata->wakeup_flags2 |=LIS3_WAKEUP_X_HI ; +if (of_get_property (np,"st,wakeup2-y-lo" ,NULL )) + pdata->wakeup_flags2 |=LIS3_WAKEUP_Y_LO ; +if (of_get_property (np,"st,wakeup2-y-hi" ,NULL )) + pdata->wakeup_flags2 |=LIS3_WAKEUP_Y_HI ; +if (of_get_property (np,"st,wakeup2-z-lo" ,NULL )) + pdata->wakeup_flags2 |=LIS3_WAKEUP_Z_LO ; +if (of_get_property (np,"st,wakeup2-z-hi" ,NULL )) + pdata->wakeup_flags2 |=LIS3_WAKEUP_Z_HI ; +if (of_get_property (np,"st,wakeup2-threshold" , &val)) + pdata->wakeup_thresh2 = val;if (!of_property_read_u32 (np,"st,highpass-cutoff-hz" , &val)) {switch (val) {
Signature · 1 line
2.1.4
PATCH v2 3/4 Documentation: DT: lis302: update wakeup binding
In reply to Sebastian ReichelFrom: Sebastian Reichel <[email protected]>
This updated the documentation of the DT binding to describe the added wakeup threshold and second wakeup engine.
It also adds a note, that the axis values may be
negative.
--- Documentation/devicetree/bindings/misc/lis302.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/misc/lis302.txt +8 -1
@@ -46,11 +46,18 @@ Optional properties for all bus drivers: interrupt 2 - st,wakeup-{x,y,z}-{lo,hi}: set wakeup condition on x/y/z axis for upper/lower limit + - st,wakeup-threshold: set wakeup threshold + - st,wakeup2-{x,y,z}-{lo,hi}: set wakeup condition on x/y/z axis for + upper/lower limit for second wakeup + engine. + - st,wakeup2-threshold: set wakeup threshold for second wakeup + engine. - st,highpass-cutoff-hz=: 1, 2, 4 or 8 for 1Hz, 2Hz, 4Hz or 8Hz of highpass cut-off frequency - st,hipass{1,2}-disable: disable highpass 1/2. - st,default-rate=: set the default rate - - st,axis-{x,y,z}=: set the axis to map to the three coordinates + - st,axis-{x,y,z}=: set the axis to map to the three coordinates. + Negative values can be used for inverted axis. - st,{min,max}-limit-{x,y,z} set the min/max limits for x/y/z axis (used by self-test)
Signature · 1 line
2.1.4
PATCH v2 4/4 DTS: ARM: OMAP3-N900: Add lis3lv02d support
In reply to Sebastian ReichelFrom: Sebastian Reichel <[email protected]>
This adds support for the N900's accelerometer to
the Nokia N900 DTS file.
--- arch/arm/boot/dts/omap3-n900.dts | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)
arch/arm/boot/dts/omap3-n900.dts +52 -0
@@ -602,6 +602,58 @@ pinctrl-0 = <&i2c3_pins>; clock-frequency = <400000>; + + lis302dl: lis3lv02d@1d { + compatible = "st,lis3lv02d"; + reg = <0x1d>; + + Vdd-supply = <&vaux1>; + Vdd_IO-supply = <&vio>; + + interrupt-parent = <&gpio6>; + interrupts = <21 20>; /* 181 and 180 */ + + /* click flags */ + st,click-single-x; + st,click-single-y; + st,click-single-z; + + /* Limits are 0.5g * value */ + st,click-threshold-x = <8>; + st,click-threshold-y = <8>; + st,click-threshold-z = <10>; + + /* Click must be longer than time limit */ + st,click-time-limit = <9>; + + /* Kind of debounce filter */ + st,click-latency = <50>; + + /* Interrupt line 2 for click detection */ + st,irq2-click; + + st,wakeup-x-hi; + st,wakeup-y-hi; + st,wakeup-threshold = <(800/18)>; /* millig-value / 18 to get HW values */ + + st,wakeup2-z-hi; + st,wakeup2-threshold = <(900/18)>; /* millig-value / 18 to get HW values */ + + st,hipass1-disable; + st,hipass2-disable; + + st,axis-x = <1>; /* LIS3_DEV_X */ + st,axis-y = <(-2)>; /* LIS3_INV_DEV_Y */ + st,axis-z = <(-3)>; /* LIS3_INV_DEV_Z */ + + st,min-limit-x = <(-32)>; + st,min-limit-y = <3>; + st,min-limit-z = <3>; + + st,max-limit-x = <(-3)>; + st,max-limit-y = <32>; + st,max-limit-z = <32>; + }; }; &mmc1 {
Signature · 1 line
2.1.4
Re: [PATCHv2 4/4] DTS: ARM: OMAP3-N900: Add lis3lv02d support
Quoted 6 lines · Sebastian Reichel
From: Sebastian Reichel <[email protected]>
This adds support for the N900's accelerometer to
the Nokia N900 DTS file.Signed-off-by Sebastian Reichel <[email protected]>
This at least currently does not conflict with anything I have queued, so I suggest you try to get Greg to take the whole set:
Quoted 70 lines
--- arch/arm/boot/dts/omap3-n900.dts | 52 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+)arch/arm/boot/dts/omap3-n900.dts +52
-0@@ -602,6 +602,58 @@ pinctrl-0 = <&i2c3_pins>; clock-frequency = <400000>; + + lis302dl: lis3lv02d@1d { + compatible = "st,lis3lv02d"; + reg = <0x1d>; + + Vdd-supply = <&vaux1>; + Vdd_IO-supply = <&vio>; + + interrupt-parent = <&gpio6>; + interrupts = <21 20>; /* 181 and 180 */ + + /* click flags */ + st,click-single-x; + st,click-single-y; + st,click-single-z; + + /* Limits are 0.5g * value */ + st,click-threshold-x = <8>; + st,click-threshold-y = <8>; + st,click-threshold-z = <10>; + + /* Click must be longer than time limit */ + st,click-time-limit = <9>; + + /* Kind of debounce filter */ + st,click-latency = <50>; + + /* Interrupt line 2 for click detection */ + st,irq2-click; + + st,wakeup-x-hi; + st,wakeup-y-hi; + st,wakeup-threshold = <(800/18)>; /* millig-value / 18 to get HW values */ + + st,wakeup2-z-hi; + st,wakeup2-threshold = <(900/18)>; /* millig-value / 18 to get HW values */ + + st,hipass1-disable; + st,hipass2-disable; + + st,axis-x = <1>; /* LIS3_DEV_X */ + st,axis-y = <(-2)>; /* LIS3_INV_DEV_Y */ + st,axis-z = <(-3)>; /* LIS3_INV_DEV_Z */ + + st,min-limit-x = <(-32)>; + st,min-limit-y = <3>; + st,min-limit-z = <3>; + + st,max-limit-x = <(-3)>; + st,max-limit-y = <32>; + st,max-limit-z = <32>; + }; }; &mmc1 {Signature · 1 line
2.1.4