[PATCH v2 3/5] thermal/drivers/mediatek/lvts_thermal: Add mt8192 support

Nícolas F. R. A. Prado nfraprado at collabora.com
Fri Apr 28 13:10:38 PDT 2023


On Tue, Apr 25, 2023 at 03:30:50PM +0200, bchihi at baylibre.com wrote:
> From: Balsam CHIHI <bchihi at baylibre.com>
> 
> Add LVTS Driver support for MT8192.
> 
> Signed-off-by: Balsam CHIHI <bchihi at baylibre.com>
> Co-developed-by : Nícolas F. R. A. Prado <nfraprado at collabora.com>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado at collabora.com>
> ---
>  drivers/thermal/mediatek/lvts_thermal.c | 92 +++++++++++++++++++++++++
>  1 file changed, 92 insertions(+)
> 
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index 5ea8a9d569ea6..8df7b4c72a658 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
[..]
> +static const struct lvts_ctrl_data mt8192_lvts_mcu_data_ctrl[] = {
> +	{
> +		.cal_offset = { 0x04, 0x08 },
> +		.lvts_sensor = {
> +			{ .dt_id = MT8192_MCU_BIG_CPU0 },
> +			{ .dt_id = MT8192_MCU_BIG_CPU1 }
> +		},
> +		.num_lvts_sensor = 2,
> +		.offset = 0x0,
> +		.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT8192,

Hi Balsam,

during the investigation I did to fix the interrupt issues I mentioned in v1, I
noticed that the threshold interrupts (hot, hot to normal, cold), only trigger
when the controller is configured to filtered mode. In immediate mode the
threshold interrupts are not triggered.

So I say we add

               .mode = LVTS_MSR_FILTERED_MODE,

for all the controllers here. Same for MT8195, although I guess that'd be better
done in a separate series. And I haven't had time to test more on MT8195 to see
if I can get any interrupts there.

One issue with filtered mode is that the data read is often not ready (valid bit
unset), so most of the time it returns -EAGAIN. But I think that should be easy
to address by reading with a timeout (equal to the measurement interval we
already know), instead of a single time, if on filtered mode.

I'll also try to review the other commits in this series, though that'll have to
wait for next week.

Thanks,
Nícolas



More information about the Linux-mediatek mailing list