All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] Parallella board temperature sensing
@ 2015-06-06 14:51 Gergely Imreh
  2015-06-06 15:01 ` Guenter Roeck
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Gergely Imreh @ 2015-06-06 14:51 UTC (permalink / raw)
  To: lm-sensors

Hi,

I was checking out what would it take to support lm-sensors on the
Parallella board[1]. It's an interesting little board with a dual core
Xilinx ARM Cortex-A9, an FPGA, and a 16-core Epiphany co-processor.
It's Xilinx XADC sensor used for temperature/voltage sensing does not
seem to be anywhere on the lm-sensors supported device list. Currently
users seem to monitor it through reading the device data directly from
the /sys entries and doing the necessary scaling and conversion (as it
was discussed on the Parallella forums, bash script included[2])

In a nutshell, the data is accessible through
/sys/bus/iio/devices/iio:device0/in_temp0_{raw,offset,scale} files.
There are also 8 voltage readings there that could be extracted.

I'm really happy to do any testing for sure, as well as some
development if there are any pointers how to get started.

Cheers,
   Greg


[1]: https://www.parallella.org/
[2]: https://parallella.org/forums/viewtopic.php?f#&t“0

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [lm-sensors] Parallella board temperature sensing
  2015-06-06 14:51 [lm-sensors] Parallella board temperature sensing Gergely Imreh
@ 2015-06-06 15:01 ` Guenter Roeck
  2015-06-06 15:05 ` Guenter Roeck
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-06-06 15:01 UTC (permalink / raw)
  To: lm-sensors

On 06/06/2015 07:51 AM, Gergely Imreh wrote:
> Hi,
>
> I was checking out what would it take to support lm-sensors on the
> Parallella board[1]. It's an interesting little board with a dual core
> Xilinx ARM Cortex-A9, an FPGA, and a 16-core Epiphany co-processor.
> It's Xilinx XADC sensor used for temperature/voltage sensing does not
> seem to be anywhere on the lm-sensors supported device list. Currently
> users seem to monitor it through reading the device data directly from
> the /sys entries and doing the necessary scaling and conversion (as it
> was discussed on the Parallella forums, bash script included[2])
>
> In a nutshell, the data is accessible through
> /sys/bus/iio/devices/iio:device0/in_temp0_{raw,offset,scale} files.
> There are also 8 voltage readings there that could be extracted.
>

If it is supported through iio, it should be possible use the iio->hwmon
bridge.

Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [lm-sensors] Parallella board temperature sensing
  2015-06-06 14:51 [lm-sensors] Parallella board temperature sensing Gergely Imreh
  2015-06-06 15:01 ` Guenter Roeck
@ 2015-06-06 15:05 ` Guenter Roeck
  2015-06-06 15:28 ` Gergely Imreh
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-06-06 15:05 UTC (permalink / raw)
  To: lm-sensors

On 06/06/2015 08:01 AM, Guenter Roeck wrote:
> On 06/06/2015 07:51 AM, Gergely Imreh wrote:
>> Hi,
>>
>> I was checking out what would it take to support lm-sensors on the
>> Parallella board[1]. It's an interesting little board with a dual core
>> Xilinx ARM Cortex-A9, an FPGA, and a 16-core Epiphany co-processor.
>> It's Xilinx XADC sensor used for temperature/voltage sensing does not
>> seem to be anywhere on the lm-sensors supported device list. Currently
>> users seem to monitor it through reading the device data directly from
>> the /sys entries and doing the necessary scaling and conversion (as it
>> was discussed on the Parallella forums, bash script included[2])
>>
>> In a nutshell, the data is accessible through
>> /sys/bus/iio/devices/iio:device0/in_temp0_{raw,offset,scale} files.
>> There are also 8 voltage readings there that could be extracted.
>>
>
> If it is supported through iio, it should be possible use the iio->hwmon
> bridge.
>

Here is an example devicetree entry, used to configure a max1139 as
hwmon device.

		max1139: voltage-sensor@35 {
	                compatible = "maxim,max1139";
                         reg = <0x35>;
                         vcc-supply = <&reg_3p3v>;
                         vref-supply = <&reg_3p3v>;
                         #io-channel-cells = <1>;
                 };

...

	max1139@35 {
                 compatible = "iio-hwmon";

                 io-channels = <&max1139 0>, <&max1139 1>, <&max1139 2>,
                         <&max1139 3>, <&max1139 4>, <&max1139 5>,
                         <&max1139 6>, <&max1139 7>, <&max1139 8>,
                         <&max1139 9>, <&max1139 10>, <&max1139 11>;
         };

Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [lm-sensors] Parallella board temperature sensing
  2015-06-06 14:51 [lm-sensors] Parallella board temperature sensing Gergely Imreh
  2015-06-06 15:01 ` Guenter Roeck
  2015-06-06 15:05 ` Guenter Roeck
@ 2015-06-06 15:28 ` Gergely Imreh
  2015-06-06 16:55 ` Guenter Roeck
  2015-06-07  5:44 ` Gergely Imreh
  4 siblings, 0 replies; 6+ messages in thread
From: Gergely Imreh @ 2015-06-06 15:28 UTC (permalink / raw)
  To: lm-sensors

On 6 June 2015 at 23:05, Guenter Roeck <linux@roeck-us.net> wrote:
> On 06/06/2015 08:01 AM, Guenter Roeck wrote:
>>
>> On 06/06/2015 07:51 AM, Gergely Imreh wrote:
>>>
>>> Hi,
>>>
>>> I was checking out what would it take to support lm-sensors on the
>>> Parallella board[1]. It's an interesting little board with a dual core
>>> Xilinx ARM Cortex-A9, an FPGA, and a 16-core Epiphany co-processor.
>>> It's Xilinx XADC sensor used for temperature/voltage sensing does not
>>> seem to be anywhere on the lm-sensors supported device list. Currently
>>> users seem to monitor it through reading the device data directly from
>>> the /sys entries and doing the necessary scaling and conversion (as it
>>> was discussed on the Parallella forums, bash script included[2])
>>>
>>> In a nutshell, the data is accessible through
>>> /sys/bus/iio/devices/iio:device0/in_temp0_{raw,offset,scale} files.
>>> There are also 8 voltage readings there that could be extracted.
>>>
>>
>> If it is supported through iio, it should be possible use the iio->hwmon
>> bridge.
>>
>
> Here is an example devicetree entry, used to configure a max1139 as
> hwmon device.
>
>                 max1139: voltage-sensor@35 {
>                         compatible = "maxim,max1139";
>                         reg = <0x35>;
>                         vcc-supply = <&reg_3p3v>;
>                         vref-supply = <&reg_3p3v>;
>                         #io-channel-cells = <1>;
>                 };
>
> ...
>
>         max1139@35 {
>                 compatible = "iio-hwmon";
>
>                 io-channels = <&max1139 0>, <&max1139 1>, <&max1139 2>,
>                         <&max1139 3>, <&max1139 4>, <&max1139 5>,
>                         <&max1139 6>, <&max1139 7>, <&max1139 8>,
>                         <&max1139 9>, <&max1139 10>, <&max1139 11>;
>         };
>
> Guenter
>

So if I get it right, all the support can be enabled through iio-hwmon
by modifying the Parallella device tree?

If so, the relevant entry is I think this (from the repo[1])

xadc@f8007100 {
    compatible = "xlnx,zynq-xadc-1.00.a", "xlnx,ps7-xadc-1.00.a";
    reg = <0xf8007100 0x20>;
    interrupts = <0 7 4>;
    interrupt-parent = <&gic>;
    clocks = <&clkc 12>;
};

I guess in the above example "voltage-sensor" is just a descriptive
label, can be anything else too, right?

Looking at the iio-hwmon binding docs[2], would a version like this be usable?

adc: xadc@f8007100 {
    compatible = "xlnx,zynq-xadc-1.00.a", "xlnx,ps7-xadc-1.00.a";
    reg = <0xf8007100 0x20>;
    interrupts = <0 7 4>;
    interrupt-parent = <&gic>;
    clocks = <&clkc 12>;
    #io-channel-cells = <1>;
};

iio_hwmon {
    compatible = "iio-hwmon";
    io-channels = <&adc 0>, <&adc 1>, <&adc 2>,
                         <&adc 3>, <&adc 4>, <&adc 5>,
                         <&adc 6>, <&adc 7>, <&adc 8>,
                         <&adc 9>; <&adc 10>; <&adc 11>;
                         <&adc 12>; <&adc 13>; <&adc 14>;
                         <&adc 15>; <&adc 16>; <&adc 17>;
                         <&adc 18>;
};

How would this be able to tell which adc channels belong to what? (eg.
0-1-2 are needed for the temperature sensing, the rest are voltage
sensors in pairs, raw and scale values)

Cheers,
Greg

[1]: https://github.com/parallella/parallella-linux/blob/7a0dc647b9b1c0010ff83fc117e29b408d5693bb/arch/arm/boot/dts/zynq-parallella1.dtsi#L236-L242
[2]: http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/iio/iio-bindings.txt

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [lm-sensors] Parallella board temperature sensing
  2015-06-06 14:51 [lm-sensors] Parallella board temperature sensing Gergely Imreh
                   ` (2 preceding siblings ...)
  2015-06-06 15:28 ` Gergely Imreh
@ 2015-06-06 16:55 ` Guenter Roeck
  2015-06-07  5:44 ` Gergely Imreh
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2015-06-06 16:55 UTC (permalink / raw)
  To: lm-sensors

On 06/06/2015 08:28 AM, Gergely Imreh wrote:
> On 6 June 2015 at 23:05, Guenter Roeck <linux@roeck-us.net> wrote:
>> On 06/06/2015 08:01 AM, Guenter Roeck wrote:
>>>
>>> On 06/06/2015 07:51 AM, Gergely Imreh wrote:
>>>>
>>>> Hi,
>>>>
>>>> I was checking out what would it take to support lm-sensors on the
>>>> Parallella board[1]. It's an interesting little board with a dual core
>>>> Xilinx ARM Cortex-A9, an FPGA, and a 16-core Epiphany co-processor.
>>>> It's Xilinx XADC sensor used for temperature/voltage sensing does not
>>>> seem to be anywhere on the lm-sensors supported device list. Currently
>>>> users seem to monitor it through reading the device data directly from
>>>> the /sys entries and doing the necessary scaling and conversion (as it
>>>> was discussed on the Parallella forums, bash script included[2])
>>>>
>>>> In a nutshell, the data is accessible through
>>>> /sys/bus/iio/devices/iio:device0/in_temp0_{raw,offset,scale} files.
>>>> There are also 8 voltage readings there that could be extracted.
>>>>
>>>
>>> If it is supported through iio, it should be possible use the iio->hwmon
>>> bridge.
>>>
>>
>> Here is an example devicetree entry, used to configure a max1139 as
>> hwmon device.
>>
>>                  max1139: voltage-sensor@35 {
>>                          compatible = "maxim,max1139";
>>                          reg = <0x35>;
>>                          vcc-supply = <&reg_3p3v>;
>>                          vref-supply = <&reg_3p3v>;
>>                          #io-channel-cells = <1>;
>>                  };
>>
>> ...
>>
>>          max1139@35 {
>>                  compatible = "iio-hwmon";
>>
>>                  io-channels = <&max1139 0>, <&max1139 1>, <&max1139 2>,
>>                          <&max1139 3>, <&max1139 4>, <&max1139 5>,
>>                          <&max1139 6>, <&max1139 7>, <&max1139 8>,
>>                          <&max1139 9>, <&max1139 10>, <&max1139 11>;
>>          };
>>
>> Guenter
>>
>
> So if I get it right, all the support can be enabled through iio-hwmon
> by modifying the Parallella device tree?
>
> If so, the relevant entry is I think this (from the repo[1])
>
> xadc@f8007100 {
>      compatible = "xlnx,zynq-xadc-1.00.a", "xlnx,ps7-xadc-1.00.a";
>      reg = <0xf8007100 0x20>;
>      interrupts = <0 7 4>;
>      interrupt-parent = <&gic>;
>      clocks = <&clkc 12>;
> };
>
> I guess in the above example "voltage-sensor" is just a descriptive
> label, can be anything else too, right?
>
Yes.

> Looking at the iio-hwmon binding docs[2], would a version like this be usable?
>
> adc: xadc@f8007100 {
>      compatible = "xlnx,zynq-xadc-1.00.a", "xlnx,ps7-xadc-1.00.a";
>      reg = <0xf8007100 0x20>;
>      interrupts = <0 7 4>;
>      interrupt-parent = <&gic>;
>      clocks = <&clkc 12>;
>      #io-channel-cells = <1>;
> };
>
> iio_hwmon {
>      compatible = "iio-hwmon";
>      io-channels = <&adc 0>, <&adc 1>, <&adc 2>,
>                           <&adc 3>, <&adc 4>, <&adc 5>,
>                           <&adc 6>, <&adc 7>, <&adc 8>,
>                           <&adc 9>; <&adc 10>; <&adc 11>;
>                           <&adc 12>; <&adc 13>; <&adc 14>;
>                           <&adc 15>; <&adc 16>; <&adc 17>;
>                           <&adc 18>;
> };

Something like that, correct.

>
> How would this be able to tell which adc channels belong to what? (eg.
> 0-1-2 are needed for the temperature sensing, the rest are voltage
> sensors in pairs, raw and scale values)
>

iio-hwmon checks the sensor type and instantiates it accordingly.

Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [lm-sensors] Parallella board temperature sensing
  2015-06-06 14:51 [lm-sensors] Parallella board temperature sensing Gergely Imreh
                   ` (3 preceding siblings ...)
  2015-06-06 16:55 ` Guenter Roeck
@ 2015-06-07  5:44 ` Gergely Imreh
  4 siblings, 0 replies; 6+ messages in thread
From: Gergely Imreh @ 2015-06-07  5:44 UTC (permalink / raw)
  To: lm-sensors

On 7 June 2015 at 00:55, Guenter Roeck <linux@roeck-us.net> wrote:
> On 06/06/2015 08:28 AM, Gergely Imreh wrote:
>>
>> On 6 June 2015 at 23:05, Guenter Roeck <linux@roeck-us.net> wrote:
>>>
>>> On 06/06/2015 08:01 AM, Guenter Roeck wrote:
>>>>
>>>>
>>>> On 06/06/2015 07:51 AM, Gergely Imreh wrote:
>>>>>
>>>>>
>>>>> Hi,
>>>>>
>>>>> I was checking out what would it take to support lm-sensors on the
>>>>> Parallella board[1]. It's an interesting little board with a dual core
>>>>> Xilinx ARM Cortex-A9, an FPGA, and a 16-core Epiphany co-processor.
>>>>> It's Xilinx XADC sensor used for temperature/voltage sensing does not
>>>>> seem to be anywhere on the lm-sensors supported device list. Currently
>>>>> users seem to monitor it through reading the device data directly from
>>>>> the /sys entries and doing the necessary scaling and conversion (as it
>>>>> was discussed on the Parallella forums, bash script included[2])
>>>>>
>>>>> In a nutshell, the data is accessible through
>>>>> /sys/bus/iio/devices/iio:device0/in_temp0_{raw,offset,scale} files.
>>>>> There are also 8 voltage readings there that could be extracted.
>>>>>
>>>>
>>>> If it is supported through iio, it should be possible use the iio->hwmon
>>>> bridge.
>>>>
>>>
>>> Here is an example devicetree entry, used to configure a max1139 as
>>> hwmon device.
>>>
>>>                  max1139: voltage-sensor@35 {
>>>                          compatible = "maxim,max1139";
>>>                          reg = <0x35>;
>>>                          vcc-supply = <&reg_3p3v>;
>>>                          vref-supply = <&reg_3p3v>;
>>>                          #io-channel-cells = <1>;
>>>                  };
>>>
>>> ...
>>>
>>>          max1139@35 {
>>>                  compatible = "iio-hwmon";
>>>
>>>                  io-channels = <&max1139 0>, <&max1139 1>, <&max1139 2>,
>>>                          <&max1139 3>, <&max1139 4>, <&max1139 5>,
>>>                          <&max1139 6>, <&max1139 7>, <&max1139 8>,
>>>                          <&max1139 9>, <&max1139 10>, <&max1139 11>;
>>>          };
>>>
>>> Guenter
>>>
>>
>> So if I get it right, all the support can be enabled through iio-hwmon
>> by modifying the Parallella device tree?
>>
>> If so, the relevant entry is I think this (from the repo[1])
>>
>> xadc@f8007100 {
>>      compatible = "xlnx,zynq-xadc-1.00.a", "xlnx,ps7-xadc-1.00.a";
>>      reg = <0xf8007100 0x20>;
>>      interrupts = <0 7 4>;
>>      interrupt-parent = <&gic>;
>>      clocks = <&clkc 12>;
>> };
>>
>> I guess in the above example "voltage-sensor" is just a descriptive
>> label, can be anything else too, right?
>>
> Yes.
>
>> Looking at the iio-hwmon binding docs[2], would a version like this be
>> usable?
>>
>> adc: xadc@f8007100 {
>>      compatible = "xlnx,zynq-xadc-1.00.a", "xlnx,ps7-xadc-1.00.a";
>>      reg = <0xf8007100 0x20>;
>>      interrupts = <0 7 4>;
>>      interrupt-parent = <&gic>;
>>      clocks = <&clkc 12>;
>>      #io-channel-cells = <1>;
>> };
>>
>> iio_hwmon {
>>      compatible = "iio-hwmon";
>>      io-channels = <&adc 0>, <&adc 1>, <&adc 2>,
>>                           <&adc 3>, <&adc 4>, <&adc 5>,
>>                           <&adc 6>, <&adc 7>, <&adc 8>,
>>                           <&adc 9>; <&adc 10>; <&adc 11>;
>>                           <&adc 12>; <&adc 13>; <&adc 14>;
>>                           <&adc 15>; <&adc 16>; <&adc 17>;
>>                           <&adc 18>;
>> };
>
>
> Something like that, correct.
>
>>
>> How would this be able to tell which adc channels belong to what? (eg.
>> 0-1-2 are needed for the temperature sensing, the rest are voltage
>> sensors in pairs, raw and scale values)
>>
>
> iio-hwmon checks the sensor type and instantiates it accordingly.
>

I've added a modified version and works like a charm! Took a bit of
trial and error, and had to update the iio driver for the relevant
Xilinx ADC (voltage channels returned offset even when there was
none), but now sensors can read both the temperature and the 8 voltage
channels!

Thanks a lor for the help!

If interested, here's the pull request I've sent to Parallella:
https://github.com/parallella/parallella-linux/pull/6 and the forum
post discussing this:
https://parallella.org/forums/viewtopic.php?fH&t%12&sid–e7173edac3777fbea4906d8c640c08
Any other feedback is appreciated.

Cheers,
   Greg

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-07  5:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-06 14:51 [lm-sensors] Parallella board temperature sensing Gergely Imreh
2015-06-06 15:01 ` Guenter Roeck
2015-06-06 15:05 ` Guenter Roeck
2015-06-06 15:28 ` Gergely Imreh
2015-06-06 16:55 ` Guenter Roeck
2015-06-07  5:44 ` Gergely Imreh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.