I'm using Linux 4.8.17 from this commit: GitHub - Freescale/linux-fslc at 35ef7950aaf7caa28afae35160bda0734ecfeba7
My device tree has this:
#include "imx28.dtsi"
&lradc {
status = "okay";
fsl,ave-ctrl = <4>;
fsl,ave-delay = <2>;
fsl,settling = <10>;
};
Using sysfs to access the LRADC's temperature channel:
# cat /sys/devices/soc0/80000000.apb/80040000.apbx/80050000.lradc/iio\:device0/in_temp8_raw
2
It gives values only -2 to 2 (with multiple runs).
The manual has relevant section 38.2.2 Internal Die Temperature Sensing.
https://www.nxp.com/docs/en/reference-manual/MCIMX28RM.pdf
The mxs-lradc driver has code that looks like it matches the manual description quite well.
linux-fslc/mxs-lradc.c at 35ef7950aaf7caa28afae35160bda0734ecfeba7 · Freescale/linux-fslc · GitHub
The sysfs scale is: 0.253000
The sysfs offset is: -1079.644268 (to convert Kelvin to C)
The sysfs raw output multiplied by the scale should be in Kelvin, so it is reading around 0 Kelvin.
It seems like the raw should be reading around 1200 or more: (1200 - 1079.6) * 0.253 = 30.46C, which is low but in the right region.
The mxs-lradc driver looks like it is setting the TEMPSENSE flag correctly at the beginning.
Is this a known problem? What might be the cause?
Hi Sam
Linux 4.8.17 is not supported by nxp and its issues can be posted on kernel mail list.
There were no known issues with i.MX28 lradc driver and one can test it with older offical nxp releases
linux-2.6-imx.git - Freescale i.MX Linux Tree
baremetal OBDS
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Thanks Igor, I will check out the older code.
Linux 3.0 was released 7 years ago, so it seems quite a backwards step to have to go back to the 2.6 kernel.
However, I see here that linux-imx repo is "Linux Kernel provided and supported by NXP with focus on i.MX Family Reference Boards. It includes support for many IPs such as GPU, VPU and IPU."
That would seem to have an officially supported lradc driver, right? Is this a better choice to use?
And linux-fslc is described as: "Linux kernel based on mainline kernel used by FSL Community BSP in order to provide support for some backported features and fixes, or because it was applied in linux-next and takes some time to become part of a stable version, or because it is not applicable for upstreaming."
And for completeness, there is also linux-fslc-imx: "Linux kernel based on NXP 4.9.11-1.0.0 GA release, used by FSL Community BSP in order to provide support for i.MX based platforms and include official Linux kernel stable updates, backported features and fixes coming from the vendors, kernel community or FSL Community itself."
Also, I can't find any mention of LRADC channel 8 or 9, or TEMPSENSE flag in the On Board Diagnostic Suite code, so I don't think that will help solve it.
Hi Sam
please check description of differencies between community "linux-fslc" bsps and official nxp bsps "linux-imx":
difference between Yocto Community BSP and Freescale BSP Release
[meta-freescale] Issue with freescale git server at git.freescale.com
official nxp bsps are described on below link (there is no i.MX28 support)
Best regards
igor
Or to put this another way, can you point me to a version of the mxs-lradc driver which is supported and is known to work well?
Hi Sam
please refer to Chapter 18 Touch Screen and ADC Drivers attached L2.6.35 Linux Manual.
Old NXP linux bsps can be supported using NXP Professional Services
Questions for community "linux-fslc" releases also can be posted on meta-fsl-arm mailing list
https://lists.yoctoproject.org/listinfo/meta-freescale
Best regards
igor
Ah, right, cheers.
Oops, I found I was searching on master branch instead of imx_2.6.35_11.09.01 on linux-2.6-imx...
I found the lradc driver here, which is written differently, but seems to follow about the same.
linux-2.6-imx.git - Freescale i.MX Linux Tree
Thanks for your help.
Okay, thanks. I am not using an evaluation board, so it is clear from the table that I am interested in the FSL Community BSP.
But with the linux-imx, is there one release version (effectively) for the evaluation board, then that just stays stagnant, and the newer evaluation board comes along and gets a newer kernel version and gets released and stays stagnant, then another board comes along.... is that how it works? So pulling the latest linux-imx and using it for an older evaluation board/system won't necessarily be supported? Is that how it works? Otherwise, why not use linux-imx, since it's kernel 4.9?
Anyway, with your link:
linux-2.6-imx.git - Freescale i.MX Linux Tree
I can't find the lradc driver....
> find . -name "*lradc*"
>
Did the driver have another name other than mxs-lradc? There are other mxs drivers:
> find . -name "*mxs*"
./sound/soc/mxs
./sound/soc/mxs/mxs-sgtl5000.c
./sound/soc/mxs/mxs-pcm.c
./sound/soc/mxs/mxs-saif.c
./sound/soc/mxs/mxs-saif.h
./sound/soc/mxs/mxs-pcm.h
./arch/arm/mach-imx/eukrea_mbimxsd35-baseboard.c
./arch/arm/mach-imx/eukrea_mbimxsd25-baseboard.c
./arch/arm/configs/mxs_defconfig
./arch/arm/mach-mxs
./arch/arm/mach-mxs/include/mach/mxs.h
./arch/arm/mach-mxs/include/mach/mxsfb.h
./arch/arm/mach-mxs/devices/platform-mxs-mmc.c
./arch/arm/mach-mxs/devices/platform-mxs-i2c.c
./arch/arm/mach-mxs/devices/platform-gpio-mxs.c
./arch/arm/mach-mxs/devices/platform-mxs-saif.c
./arch/arm/mach-mxs/devices/platform-mxs-pwm.c
./arch/arm/mach-mxs/devices/platform-mxsfb.c
./arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c
./drivers/dma/mxs-dma.c
./drivers/video/mxsfb.c
./drivers/mmc/host/mxs-mmc.c
./drivers/tty/serial/mxs-auart.c
./drivers/tty/mxser.h
./drivers/tty/mxser.c
./drivers/gpio/gpio-mxs.c
./drivers/i2c/busses/i2c-mxs.c