[PATCH v2 5/6] aiodev: Add TEMPMON driver

Andrey Smirnov andrew.smirnov at gmail.com
Fri May 13 08:44:45 PDT 2016


On Mon, May 9, 2016 at 11:02 PM, Sascha Hauer <s.hauer at pengutronix.de> wrote:
> On Fri, May 06, 2016 at 07:09:29AM -0700, Andrey Smirnov wrote:
>> Port TEMPMON driver from U-Boot
>>
>> Signed-off-by: Andrey Smirnov <andrew.smirnov at gmail.com>
>> ---
>>  arch/arm/dts/imx6qdl.dtsi    |  14 +++
>>  arch/arm/dts/imx6sx.dtsi     |  14 +++
>>  drivers/aiodev/Kconfig       |   8 ++
>>  drivers/aiodev/Makefile      |   1 +
>>  drivers/aiodev/imx_thermal.c | 239 +++++++++++++++++++++++++++++++++++++++++++
>>  5 files changed, 276 insertions(+)
>>  create mode 100644 drivers/aiodev/imx_thermal.c
>>
>> diff --git a/arch/arm/dts/imx6qdl.dtsi b/arch/arm/dts/imx6qdl.dtsi
>> index 828be9c..0deafbc 100644
>> --- a/arch/arm/dts/imx6qdl.dtsi
>> +++ b/arch/arm/dts/imx6qdl.dtsi
>> @@ -8,3 +8,17 @@
>>               ipu0 = &ipu1;
>>       };
>>  };
>> +
>> +&ocotp {
>> +     #address-cells = <1>;
>> +     #size-cells = <1>;
>> +
>> +     analog1: ocotp_ana1 at 34 {
>
> @38?
>
>> +             reg = <0x38 0x4>;
>> +     };
>> +};
>> +
>> +&tempmon {
>> +     nvmem-cells = <&analog1>;
>> +     nvmem-cell-names = "ocotp-ana1";
>> +};
>
> Why not use the existing binding? The nvmem binding may be better, but I
> think we should not introduce new bindings without need.

I was using it originally (back when this was a part of HWMON RFC),
but then "cdev_do_open" was removed, so I switched to using "nvmem".
Granted there is not meaningful "open" or "close" operation for ocotp
cdev, but I just liked that approach less. I'll revert to original
code in v3

>
>> +     node = of_parse_phandle(dev->device_node, "fsl,tempmon", 0);
>> +     if (!node) {
>> +             ret = -EINVAL;
>> +             dev_err(dev, "Failed to parse fsl,tempmon\n");
>> +             goto free_calibration_data;
>> +     }
>> +
>> +     anatop = of_find_device_by_node(node);
>> +     if (!anatop) {
>> +             ret = -EINVAL;
>> +             dev_err(dev, "No device corresponds to fsl,tempmon\n");
>> +             goto free_calibration_data;
>> +     }
>
> syscon_base_lookup_by_phandle() instead of
> of_parse_phandle()/of_find_device_by_node()?

Will fix in v3

>
> Sascha
>
> --
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list