Re: lis302 DT binding for Nokia N900

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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@xxxxxxxxxxxxxxx/msg05121.html
[1] http://www.mail-archive.com/linux-arm-msm@xxxxxxxxxxxxxxx/msg05125.html

-- Sebastian

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux