From: Sebastian Reichel <sre-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
To: "Éric Piel" <eric.piel-VkQ1JFuSMpfAbQlEx87xDw@public.gmane.org>
Cc: Daniel Mack <zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Rob Herring <rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org>,
Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>,
Ian Campbell
<ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: lis302 DT binding for Nokia N900
Date: Sun, 8 Dec 2013 15:48:20 +0100 [thread overview]
Message-ID: <20131208144818.GA26502@earth.universe> (raw)
In-Reply-To: <52A47B84.8050009-VkQ1JFuSMpfAbQlEx87xDw@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 1835 bytes --]
On Sun, Dec 08, 2013 at 03:00:36PM +0100, Éric Piel wrote:
> On 08-12-13 14:46, Sebastian Reichel wrote:
> :
> >No, it's connected via I2C. Please note, that the N900's accelerometer
> >is already supported, but only when initialized via legacy boardcode.
> >
> >The problem is, that I can't specify negative values in the device
> >tree file (the device tree compiler complains). I couldn't find any
> >example of negative numbers in any dts file, so I guess, that
> >negative numbers are not supported.
> >
> :
> >I just want to port the existing boardcode to device tree.
> >The existing platform data is defined as rx51_lis3lv02d_data in
> >arch/arm/mach-omap2/board-rx51-peripherals.c.
> Oh! Yes, then the values themselves should be fine.
> Indeed, the problem is in the parsing of the DT values.
> Currently, lis3lv02d_init_dt() reads values as unsigned int:
>
> u32 val;
> if (of_get_property(np, "st,axis-x", &val))
> pdata->axis_x = val;
>
> So it's quite unlikely to get negative ;-) Is there a way to read
> signed ints in DT? If so, I can update the driver.
I just found a link, which describes how to put negative values into
the DTS, so that the device tree compiler understands them and
translates them into 2's-compliment [0].
The kernel code currently does not provide of_property_read_s32(),
but it seems that there was just no use case so far. At least one
of the DT binding maintainers seems to be finde with introducing it
[1].
I will prepare a patch, which adds of_property_read_s32 and another
one, which updates lis3lv02d to use the new function.
[0] http://www.mail-archive.com/linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org/msg05121.html
[1] http://www.mail-archive.com/linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org/msg05125.html
-- Sebastian
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2013-12-08 14:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 12:21 lis302 DT binding for Nokia N900 Sebastian Reichel
[not found] ` <20131203122059.GB4653-SfvFxonMDyemK9LvCR3Hrw@public.gmane.org>
2013-12-08 13:27 ` Éric Piel
[not found] ` <52A473D8.7020706-VkQ1JFuSMpfAbQlEx87xDw@public.gmane.org>
2013-12-08 13:46 ` Sebastian Reichel
[not found] ` <20131208134651.GA25587-SfvFxonMDyemK9LvCR3Hrw@public.gmane.org>
2013-12-08 14:00 ` Éric Piel
[not found] ` <52A47B84.8050009-VkQ1JFuSMpfAbQlEx87xDw@public.gmane.org>
2013-12-08 14:48 ` Sebastian Reichel [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131208144818.GA26502@earth.universe \
--to=sre-8fiuurrzop0dnm+yrofe0a@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=eric.piel-VkQ1JFuSMpfAbQlEx87xDw@public.gmane.org \
--cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=pawel.moll-5wv7dgnIgG8@public.gmane.org \
--cc=rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org \
--cc=swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org \
--cc=zonque-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).