aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/k3_j72xx_bandgap.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-08-17thermal/drivers/banggap: Switch to new of APIDaniel Lezcano1-7/+5
The thermal OF code has a new API allowing to migrate the OF initialization to a simpler approach. The ops are no longer device tree specific and are the generic ones provided by the core code. Convert the ops to the thermal_zone_device_ops format and use the new API to register the thermal zone with these generic ops. Signed-off-by: Daniel Lezcano <daniel.lezcano@linexp.org> Link: https://lore.kernel.org/r/20220804224349.1926752-22-daniel.lezcano@linexp.org Reviewed-by: Bryan Brattlof <bb@ti.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2022-07-28thermal/drivers/k3_j72xx_bandgap: Make k3_j72xx_bandgap_j721e_data and k3_j72xx_bandgap_j7200_data staticJin Xiaoyun1-2/+2
Fix sparse warnings: drivers/thermal/k3_j72xx_bandgap.c:532:36: sparse: sparse: symbol 'k3_j72xx_bandgap_j721e_data' was not declared. Should it be static? drivers/thermal/k3_j72xx_bandgap.c:536:36: sparse: sparse: symbol 'k3_j72xx_bandgap_j7200_data' was not declared. Should it be static? Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Jin Xiaoyun <jinxiaoyun2@huawei.com> Link: https://lore.kernel.org/r/20220613063111.654893-1-jinxiaoyun2@huawei.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2022-07-28thermal/drivers/k3_j72xx_bandgap: Fix array underflow in prep_lookup_table()Dan Carpenter1-2/+0
This while loop exits with "i" set to -1 and so then it sets: derived_table[-1] = derived_table[0] - 300; There is no need for this assignment at all. Just delete it. Fixes: 72b3fc61c752 ("thermal: k3_j72xx_bandgap: Add the bandgap driver support") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/YoetjwcOEzYEFp9b@kili Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2022-07-28thermal/drivers/k3_j72xx_bandgap: Fix ref_table memory leak during probeBryan Brattlof1-2/+5
If an error occurs in the k3_j72xx_bandgap_probe() function the memory allocated to the 'ref_table' will not be released. Add a err_free_ref_table step to the error path to free 'ref_table' Fixes: 72b3fc61c752 ("thermal: k3_j72xx_bandgap: Add the bandgap driver support") Reported-by: kernel test robot <lkp@intel.com> Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Bryan Brattlof <bb@ti.com> Reviewed-by: Keerthy <j-keerthy@ti.com> Link: https://lore.kernel.org/r/20220525213617.30002-1-bb@ti.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
2022-05-19thermal: k3_j72xx_bandgap: Add the bandgap driver supportKeerthy1-0/+566
Add VTM thermal support. In the Voltage Thermal Management Module(VTM), K3 J72XX supplies a voltage reference and a temperature sensor feature that are gathered in the band gap voltage and temperature sensor (VBGAPTS) module. The band gap provides current and voltage reference for its internal circuits and other analog IP blocks. The analog-to-digital converter (ADC) produces an output value that is proportional to the silicon temperature. Currently reading temperatures only is supported. There are no active/passive cooling agent supported. J721e SoCs have errata i2128: https://www.ti.com/lit/pdf/sprz455 The VTM Temperature Monitors (TEMPSENSORs) are trimmed during production, with the resulting values stored in software-readable registers. Software should use these register values when translating the Temperature Monitor output codes to temperature values. It has an involved workaround. Software needs to read the error codes for -40C, 30C, 125C from the efuse for each device & derive a new look up table for adc to temperature conversion. Involved calculating slopes & constants using 3 different straight line equations with adc refernce codes as the y-axis & error codes in the x-axis. -40C to 30C 30C to 125C 125C to 150C With the above 2 line equations we derive the full look-up table to workaround the errata i2128 for j721e SoC. Tested temperature reading on J721e SoC & J7200 SoC. [daniel.lezcano@linaro.org: Generate look-up tables run-time] Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Keerthy <j-keerthy@ti.com> Link: https://lore.kernel.org/r/20220517172920.10857-3-j-keerthy@ti.com Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>