[PATCH 3/3] thermal: mediatek: add MT8365 thermal driver support

Daniel Lezcano daniel.lezcano at linaro.org
Mon Oct 18 09:03:44 PDT 2021


Hi Markus,

On 18/10/2021 17:40, Markus Schneider-Pargmann wrote:

[ ... ]

>>
>>>  	}, {
>>>  	},
>>>  };
>>>  MODULE_DEVICE_TABLE(of, mtk_thermal_of_match);
>>>  
>>> -static void mtk_thermal_turn_on_buffer(void __iomem *apmixed_base)
>>> +static void mtk_thermal_turn_on_buffer(struct mtk_thermal *mt,
>>> +				       void __iomem *apmixed_base)
>>>  {
>>>  	int tmp;
>>>  
>>> -	tmp = readl(apmixed_base + APMIXED_SYS_TS_CON1);
>>> -	tmp &= ~(0x37);
>>> -	tmp |= 0x1;
>>> -	writel(tmp, apmixed_base + APMIXED_SYS_TS_CON1);
>>> +	if (!mt->conf->apmixed_buffer_ctl_reg)
>>> +		return;
>>> +
>>> +	tmp = readl(apmixed_base + mt->conf->apmixed_buffer_ctl_reg);
>>> +	tmp &= mt->conf->apmixed_buffer_ctl_mask;
>>> +	tmp |= mt->conf->apmixed_buffer_ctl_set;
>>
>> What is the goal of these two bits operations ?
> 
> mt7622 needs to unset a few bits and set one bit in this register.
> mt8365 only unsets bits. For this purpose I created a _mask field to
> unset bits and a _set field to set bits.
> 
> Would you suggest a different way?

No, I understand what you wanted to do. I was just unsure if there was a
trick because of the tmp |= 0;




-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog



More information about the Linux-mediatek mailing list