Re: [PATCH V4 4/4] thermal: qcom: add support for PMIC5 Gen3 ADC thermal monitoring

From: Jishnu Prakash
Date: Wed Nov 13 2024 - 09:09:28 EST


Hi Krzysztof,

On 10/31/2024 4:30 PM, Krzysztof Kozlowski wrote:
> On 30/10/2024 19:58, Jishnu Prakash wrote:
>> Add support for ADC_TM part of PMIC5 Gen3.
>>
>> This is an auxiliary driver under the Gen3 ADC driver, which
>> implements the threshold setting and interrupt generating
>> functionalities of QCOM ADC_TM drivers, used to support thermal
>> trip points.
>>
>> Signed-off-by: Jishnu Prakash <quic_jprakash@xxxxxxxxxxx>
>> ---
>> drivers/thermal/qcom/Kconfig | 11 +
>> drivers/thermal/qcom/Makefile | 1 +
>> drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c | 489 ++++++++++++++++++
>> 3 files changed, 501 insertions(+)
>> create mode 100644 drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c
>>
>> diff --git a/drivers/thermal/qcom/Kconfig b/drivers/thermal/qcom/Kconfig
>> index 2c7f3f9a26eb..f9876fb8606d 100644
>> --- a/drivers/thermal/qcom/Kconfig
>> +++ b/drivers/thermal/qcom/Kconfig
>> @@ -21,6 +21,17 @@ config QCOM_SPMI_ADC_TM5
>> Thermal client sets threshold temperature for both warm and cool and
>> gets updated when a threshold is reached.
>>
>> +config QCOM_SPMI_ADC_TM5_GEN3
>> + tristate "Qualcomm SPMI PMIC Thermal Monitor ADC5 Gen3"
>> + depends on OF && SPMI && IIO && QCOM_SPMI_ADC5_GEN3
>
> || COMPILE_TEST won't work?

Checking again, it looks like most of these dependencies are not needed and making it dependent on QCOM_SPMI_ADC5_GEN3 alone should be sufficient.
Will update this in the next patch version.

>
>> + select REGMAP_SPMI
>> + select QCOM_VADC_COMMON
>> + help
>> + This enables the auxiliary thermal driver for the ADC5 Gen3 thermal
>> + monitoring device. It shows up as a thermal zone with multiple trip points.
>> + Thermal client sets threshold temperature for both warm and cool and
>> + gets updated when a threshold is reached.
>> +
>
>
> ...
>
>> +
>> +static const struct auxiliary_device_id adctm5_auxiliary_id_table[] = {
>> + { .name = "qcom_spmi_adc5_gen3.adc5_tm_gen3", },
>> + {},
>> +};
>> +
>> +MODULE_DEVICE_TABLE(auxiliary, adctm5_auxiliary_id_table);
>> +
>> +static struct adc_tm5_auxiliary_drv adctm5gen3_auxiliary_drv = {
>> + .adrv = {
>> + .id_table = adctm5_auxiliary_id_table,
>> + .probe = adc_tm5_probe,
>> + },
>> + .tm_event_notify = adctm_event_handler,
>> +};
>> +
>> +static int __init adctm5_init_module(void)
>> +{
>> + return auxiliary_driver_register(&adctm5gen3_auxiliary_drv.adrv);
>> +}
>> +
>> +static void __exit adctm5_exit_module(void)
>> +{
>> + auxiliary_driver_unregister(&adctm5gen3_auxiliary_drv.adrv);
>> +}
>> +
>> +module_init(adctm5_init_module);
>> +module_exit(adctm5_exit_module);
>
> Why not module_auxiliary_driver?

module_auxiliary_driver should work, will update it in next patch version.

Thanks,
Jishnu


>
>
> Best regards,
> Krzysztof
>