Re: [PATCH v2 5/5] iio: chemical: sgp40: Implement turn_heater_off-command

From: Jaakko Koivisto

Date: Mon Nov 16 2026 - 04:24:20 EST


On Sun Nov 8, 2026 at 3:05 AM EET, Jonathan Cameron wrote:
> On Mon, 2 Nov 2026 11:56:02 +0200
> Jaakko Koivisto <jmatko@xxxxxx> wrote:
>
>> Add functionality for turning the SGP40 sensor heating element
>> on or off manually. After turning the heater off, the sensor enters
>> idle mode. Track the state of the heater in the driver, as the device
>> does not expose current heater state via any register.
>>
>> Turning the heater off saves approx. 2.5 mA compared to regular
>> operation. The heating element is automatically turned back on
>> when measurement is performed.
> Hi Jaakko,
>
> Add something here on how long it takes to power up. It
> isn't obvious so far that this should be just done via runtime
> pm and autosuspend.
>
> Normally the argument to have a manual turn off is that time
> is huge. Otherwise, why not runtime pm?
>

I'm currently unsure which would be the better way, runtime pm or
manual. There is another source in addition to the datasheet which says
that turning the sensor on 170 ms before measurement is acceptable
(https://github.com/Sensirion/gas-index-algorithm, Algorithm usage with
SGP40 in low power mode).
The datasheet values 60 seconds and 60 minutes warrant manual control,
but 170 ms would be workable with automatic pm.

>From chemistry perspective the datasheet values refer to power-on from
completely cold sensor, lot's of adsorped water and need to heat for a
long time to reach steady state, while the 170 ms case is for periodic
measurement and the sensor does not have enough time to cool down and
adsorp more water between the measurements.

I'm gravitating towards manual control, since that does not alter current
behaviour, the proper heating times are based on how the sensor is used,
and the sensor power consumption is quite small so it's not horrible
having it on all the time.

>
> thanks,
>
> Jonathan