Commit ee35f721 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov Committed by Daniel Lezcano
Browse files

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: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarBhupesh Sharma <bhupesh.sharma@linaro.org>
Link: https://lore.kernel.org/r/20220719054940.755907-2-dmitry.baryshkov@linaro.org


Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
parent fb55b012
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@
#include <linux/thermal.h>
#include <asm-generic/unaligned.h>

#include "../thermal_hwmon.h"

/*
 * Thermal monitoring block consists of 8 (ADC_TM5_NUM_CHANNELS) channels. Each
 * channel is programmed to use one of ADC channels for voltage comparison.
@@ -687,6 +689,9 @@ static int adc_tm5_register_tzd(struct adc_tm5_chip *adc_tm)
			return PTR_ERR(tzd);
		}
		adc_tm->channels[i].tzd = tzd;
		if (devm_thermal_add_hwmon_sysfs(tzd))
			dev_warn(adc_tm->dev,
				 "Failed to add hwmon sysfs attributes\n");
	}

	return 0;