Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal/drivers/qcom/spmi-adc-tm5: Register thermal zones as hwmon sensors

Register thermal zones as hwmon sensors to let userspace read
temperatures using standard hwmon interface.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Bhupesh Sharma <bhupesh.sharma@linaro.org>
Link: https://lore.kernel.org/r/20220719054940.755907-2-dmitry.baryshkov@linaro.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>

authored by

Dmitry Baryshkov and committed by
Daniel Lezcano
ee35f721 fb55b012

+5
+5
drivers/thermal/qcom/qcom-spmi-adc-tm5.c
··· 20 20 #include <linux/thermal.h> 21 21 #include <asm-generic/unaligned.h> 22 22 23 + #include "../thermal_hwmon.h" 24 + 23 25 /* 24 26 * Thermal monitoring block consists of 8 (ADC_TM5_NUM_CHANNELS) channels. Each 25 27 * channel is programmed to use one of ADC channels for voltage comparison. ··· 689 687 return PTR_ERR(tzd); 690 688 } 691 689 adc_tm->channels[i].tzd = tzd; 690 + if (devm_thermal_add_hwmon_sysfs(tzd)) 691 + dev_warn(adc_tm->dev, 692 + "Failed to add hwmon sysfs attributes\n"); 692 693 } 693 694 694 695 return 0;