Re: [PATCH 4/8] platform: arm64: qcom-hamoa-ec: Add fan RPM query and LUT calibration

From: Anvesh Jain P

Date: Thu Jul 30 2026 - 02:40:44 EST




On 7/29/2026 4:37 PM, Konrad Dybcio wrote:
> On 7/28/26 7:44 PM, Anvesh Jain P wrote:
>> Add the EC command definitions and handler functions for querying fan
>> RPM and programming per-fan LUTs (lookup tables mapping SoC
>> temperature to target RPM), and introduce a raw i2c_transfer()-based
>> transport for the two commands, since their variable-length,
>> sub-command-addressed payloads don't fit the smbus block-data model
>> used by the existing commands.
>>
>> Fan LUT geometry and temperature breakpoints vary by board, so encode
>> them in per-compatible qcom_ec_lut_config data selected via
>> device_get_match_data(). Add configs for the Hamoa CRD, Hamoa/Purwa
>> IOT EVK, and Glymur CRD ECs; IOT EVK boards share the Hamoa LUT
>> geometry but are bring-up platforms without a calibrated fan curve,
>> so skip_lut_set suppresses the LUT-set command on those boards.
>
> So are we expecting every single laptop/device that utilizes a
> compatible EC to require modifications to the driver here?
>

Yes, currently a new board does need a driver-side compatible + LUT
config entry. Will check on the feasibility of moving the LUT
geometry/curve data into devicetree instead so new boards don't require
driver changes.

>> Since the LUT values depend on each fan's maximum RPM, which varies
>> per board assembly, calibrate it at runtime: drive the fan to full
>> PWM, wait for it to spin up, and read back the achieved RPM via the
>> new query command. Run calibration in a work item at probe time and
>> after EC reset recovery, and make it abortable via a completion so
>> suspend can cut it short. Track calibration completion state so the
>> LUT is programmed once calibration finishes and again on every
>> subsequent power-supply-driven profile switch.
>
> I don't want my laptop to become a jetplane on every bootup. I
> doubt anyone does.
>
> Konrad

There's no EC command that reports a fan's max/rated RPM directly — the
only way to learn it is to drive the fan to full PWM and read back what
it actually spins up to, which is what calibration does. It's bounded to
a 10s timeout per fan and only runs once at probe (and again after EC
reset recovery).

--
Best Regards,
Anvesh