mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-07-30 02:16:59 +08:00

These patches were generated from: https://github.com/raspberrypi/linux/commits/rpi-6.12.y With the following command: git format-patch -N v6.12.27..HEAD (HEAD -> 8d3206ee456a5ecdf9ddbfd8e5e231e4f0cd716e) Exceptions: - (def)configs patches - github workflows patches - applied & reverted patches - readme patches - wireless patches Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
53 lines
1.6 KiB
Diff
53 lines
1.6 KiB
Diff
From 1d238cba561b2cb180387b31d18850e9bdfdad8e Mon Sep 17 00:00:00 2001
|
|
From: Josh Martinez <8892161+joshermar@users.noreply.github.com>
|
|
Date: Sun, 20 Apr 2025 17:29:36 -0500
|
|
Subject: [PATCH] hwmon: aht10: Fix AHT20 initialization
|
|
|
|
The existing driver claims AHT20 support in i2c_device_id, but fails to:
|
|
1. Use the correct init command (0xBE for AHT20 vs 0xE1 for AHT10)
|
|
2. Omit AHT10_MODE_CYC which AHT20 doesn't support/require
|
|
|
|
Add proper initialization sequence and include "aosong,aht20" in the
|
|
device tree match table to fully support the AHT20.
|
|
|
|
Signed-off-by: Josh Martinez <8892161+joshermar@users.noreply.github.com>
|
|
---
|
|
drivers/hwmon/aht10.c | 12 ++++++++++--
|
|
1 file changed, 10 insertions(+), 2 deletions(-)
|
|
|
|
--- a/drivers/hwmon/aht10.c
|
|
+++ b/drivers/hwmon/aht10.c
|
|
@@ -37,6 +37,8 @@
|
|
#define AHT10_CMD_MEAS 0b10101100
|
|
#define AHT10_CMD_RST 0b10111010
|
|
|
|
+#define AHT20_CMD_INIT 0b10111110
|
|
+
|
|
/*
|
|
* Flags in the answer byte/command
|
|
*/
|
|
@@ -59,6 +61,7 @@ MODULE_DEVICE_TABLE(i2c, aht10_id);
|
|
|
|
static const struct of_device_id aht10_of_id[] = {
|
|
{ .compatible = "aosong,aht10", },
|
|
+ { .compatible = "aosong,aht20", },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(of, aht10_of_id);
|
|
@@ -107,8 +110,13 @@ struct aht10_data {
|
|
*/
|
|
static int aht10_init(struct aht10_data *data)
|
|
{
|
|
- const u8 cmd_init[] = {AHT10_CMD_INIT, AHT10_CAL_ENABLED | AHT10_MODE_CYC,
|
|
- 0x00};
|
|
+ u8 cmd_init[] = {AHT10_CMD_INIT, AHT10_CAL_ENABLED | AHT10_MODE_CYC, 0x00};
|
|
+
|
|
+ if (data->crc8) { /* AHT20 */
|
|
+ cmd_init[0] = AHT20_CMD_INIT;
|
|
+ cmd_init[1] = AHT10_CAL_ENABLED;
|
|
+ }
|
|
+
|
|
int res;
|
|
u8 status;
|
|
struct i2c_client *client = data->client;
|