Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (aht10) Fix initialization commands for AHT20

According to the AHT20 datasheet (updated to V1.0 after the 2023.09
version), the initialization command for AHT20 is 0b10111110 (0xBE).
The previous sequence (0xE1) used in earlier versions is no longer
compatible with newer AHT20 sensors. Update the initialization
command to ensure the sensor is properly initialized.

While at it, use binary notation for DHT20_CMD_INIT to match the notation
used in the datasheet.

Fixes: d2abcb5cc885 ("hwmon: (aht10) Add support for compatible aht20")
Signed-off-by: Hao Yu <haoyufine@gmail.com>
Link: https://lore.kernel.org/r/20260222170332.1616-3-haoyufine@gmail.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

authored by

Hao Yu and committed by
Guenter Roeck
b7497b5a ac209a7d

+4 -2
+4 -2
drivers/hwmon/aht10.c
··· 37 37 #define AHT10_CMD_MEAS 0b10101100 38 38 #define AHT10_CMD_RST 0b10111010 39 39 40 - #define DHT20_CMD_INIT 0x71 40 + #define AHT20_CMD_INIT 0b10111110 41 + 42 + #define DHT20_CMD_INIT 0b01110001 41 43 42 44 /* 43 45 * Flags in the answer byte/command ··· 343 341 data->meas_size = AHT20_MEAS_SIZE; 344 342 data->crc8 = true; 345 343 crc8_populate_msb(crc8_table, AHT20_CRC8_POLY); 346 - data->init_cmd = AHT10_CMD_INIT; 344 + data->init_cmd = AHT20_CMD_INIT; 347 345 break; 348 346 case dht20: 349 347 data->meas_size = AHT20_MEAS_SIZE;