* [PATCH 1/4] of: introduce of_property_read_s32
[not found] ` <1386968094-24554-1-git-send-email-sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
@ 2013-12-13 20:54 ` Sebastian Reichel
2013-12-13 20:54 ` [PATCH 2/4] lis3lv02d: DT: use s32 to support negative values Sebastian Reichel
` (3 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2013-12-13 20:54 UTC (permalink / raw)
To: Sebastian Reichel, Eric Piel, Daniel Mack,
devicetree-u79uwXL29TY76Z2rM5mHXA, Stephen Warren
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Sebastian Reichel
Introduce signed 32bit integer of_property_read method.
Signed-off-by: Sebastian Reichel <sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
---
include/linux/of.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/include/linux/of.h b/include/linux/of.h
index 276c546..24cac04 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -601,6 +601,13 @@ static inline int of_property_read_u32(const struct device_node *np,
return of_property_read_u32_array(np, propname, out_value, 1);
}
+static inline int of_property_read_s32(const struct device_node *np,
+ const char *propname,
+ s32 *out_value)
+{
+ return of_property_read_u32(np, propname, (u32*) out_value);
+}
+
#define of_property_for_each_u32(np, propname, prop, p, u) \
for (prop = of_find_property(np, propname, NULL), \
p = of_prop_next_u32(prop, NULL, &u); \
--
1.8.5.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 2/4] lis3lv02d: DT: use s32 to support negative values
[not found] ` <1386968094-24554-1-git-send-email-sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
2013-12-13 20:54 ` [PATCH 1/4] of: introduce of_property_read_s32 Sebastian Reichel
@ 2013-12-13 20:54 ` Sebastian Reichel
2013-12-13 20:54 ` [PATCH 3/4] lis3lv02d: DT: add wakeup unit 2 and wakeup threshold Sebastian Reichel
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2013-12-13 20:54 UTC (permalink / raw)
To: Sebastian Reichel, Eric Piel, Daniel Mack,
devicetree-u79uwXL29TY76Z2rM5mHXA, Stephen Warren
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Sebastian Reichel
st,axis-{x,y,z} can be negative to imply inverted
axis.
Apart from that the minimal and maximal threshold
may be negative.
Signed-off-by: Sebastian Reichel <sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
---
drivers/misc/lis3lv02d/lis3lv02d.c | 39 +++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
index 036effe..dc4f5c7 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -951,6 +951,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;
@@ -1055,29 +1056,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;
--
1.8.5.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 3/4] lis3lv02d: DT: add wakeup unit 2 and wakeup threshold
[not found] ` <1386968094-24554-1-git-send-email-sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
2013-12-13 20:54 ` [PATCH 1/4] of: introduce of_property_read_s32 Sebastian Reichel
2013-12-13 20:54 ` [PATCH 2/4] lis3lv02d: DT: use s32 to support negative values Sebastian Reichel
@ 2013-12-13 20:54 ` Sebastian Reichel
2013-12-13 20:54 ` [PATCH 4/4] Documentation: DT: lis302: update wakeup binding Sebastian Reichel
2013-12-13 22:31 ` [PATCH 0/4] lis3lv02d: update DT binding for use with Nokia N900 Éric Piel
4 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2013-12-13 20:54 UTC (permalink / raw)
To: Sebastian Reichel, Eric Piel, Daniel Mack,
devicetree-u79uwXL29TY76Z2rM5mHXA, Stephen Warren
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Sebastian Reichel
This adds support for the the wakeup threshold and
support for the second wakeup unit to the DT based
setup.
Signed-off-by: Sebastian Reichel <sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
---
drivers/misc/lis3lv02d/lis3lv02d.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/misc/lis3lv02d/lis3lv02d.c b/drivers/misc/lis3lv02d/lis3lv02d.c
index dc4f5c7..aa61627 100644
--- a/drivers/misc/lis3lv02d/lis3lv02d.c
+++ b/drivers/misc/lis3lv02d/lis3lv02d.c
@@ -1033,6 +1033,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) {
--
1.8.5.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread* [PATCH 4/4] Documentation: DT: lis302: update wakeup binding
[not found] ` <1386968094-24554-1-git-send-email-sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
` (2 preceding siblings ...)
2013-12-13 20:54 ` [PATCH 3/4] lis3lv02d: DT: add wakeup unit 2 and wakeup threshold Sebastian Reichel
@ 2013-12-13 20:54 ` Sebastian Reichel
2013-12-13 22:31 ` [PATCH 0/4] lis3lv02d: update DT binding for use with Nokia N900 Éric Piel
4 siblings, 0 replies; 8+ messages in thread
From: Sebastian Reichel @ 2013-12-13 20:54 UTC (permalink / raw)
To: Sebastian Reichel, Eric Piel, Daniel Mack,
devicetree-u79uwXL29TY76Z2rM5mHXA, Stephen Warren
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
Sebastian Reichel
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.
Signed-off-by: Sebastian Reichel <sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
---
Documentation/devicetree/bindings/misc/lis302.txt | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/misc/lis302.txt b/Documentation/devicetree/bindings/misc/lis302.txt
index 6def86f..2a19bff 100644
--- a/Documentation/devicetree/bindings/misc/lis302.txt
+++ b/Documentation/devicetree/bindings/misc/lis302.txt
@@ -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)
--
1.8.5.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH 0/4] lis3lv02d: update DT binding for use with Nokia N900
[not found] ` <1386968094-24554-1-git-send-email-sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
` (3 preceding siblings ...)
2013-12-13 20:54 ` [PATCH 4/4] Documentation: DT: lis302: update wakeup binding Sebastian Reichel
@ 2013-12-13 22:31 ` Éric Piel
[not found] ` <52AB8ACB.6000101-VkQ1JFuSMpfAbQlEx87xDw@public.gmane.org>
4 siblings, 1 reply; 8+ messages in thread
From: Éric Piel @ 2013-12-13 22:31 UTC (permalink / raw)
To: Sebastian Reichel, Sebastian Reichel, Daniel Mack,
devicetree-u79uwXL29TY76Z2rM5mHXA, Stephen Warren
Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell,
arnd-r2nGTMty4D4, Greg Kroah-Hartman
On 13-12-13 21:54, Sebastian Reichel wrote:
> 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.
>
> This patchset introduces support for describing inverted
> axis, configuration of second wakeup unit and wakeup
> threshold support.
Hi,
All the three patches related to the lis3lv02d driver look fine to me.
Here is my signed-off for patches 2, 3, and 4:
Signed-off-by: Éric Piel <eric.piel-VkQ1JFuSMpfAbQlEx87xDw@public.gmane.org>
I've got 2 side questions:
* How do you write a negative value in a DTS file? Is this just the
very standard way (i.e., -), or do you need to use a specific technique
(such as 2-completemnt on 32 bits)? If it's not the standard way, it
should probably be documented somewhere.
* Who wants to carry these patches? Can they all go via the devicetree
branch? Or maybe Arnd or Greg would prefer to pick them via the misc
driver branch? Both ways are fine for me...
Cheers,
Éric
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread