[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250218165633.106867-3-francesco@dolcini.it>
Date: Tue, 18 Feb 2025 17:56:33 +0100
From: Francesco Dolcini <francesco@...cini.it>
To: Jean Delvare <jdelvare@...e.com>,
Guenter Roeck <linux@...ck-us.net>,
Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Farouk Bouabid <farouk.bouabid@...rry.de>,
Quentin Schulz <quentin.schulz@...rry.de>
Cc: Francesco Dolcini <francesco.dolcini@...adex.com>,
linux-hwmon@...r.kernel.org,
devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v1 2/2] hwmon: (amc6821) Add PWM polarity configuration with OF
From: Francesco Dolcini <francesco.dolcini@...adex.com>
Add support to configure the PWM-Out pin polarity based on a device
tree property.
Signed-off-by: Francesco Dolcini <francesco.dolcini@...adex.com>
---
drivers/hwmon/amc6821.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/amc6821.c b/drivers/hwmon/amc6821.c
index 1e3c6acd8974..1ea2d97eebca 100644
--- a/drivers/hwmon/amc6821.c
+++ b/drivers/hwmon/amc6821.c
@@ -845,7 +845,7 @@ static int amc6821_detect(struct i2c_client *client, struct i2c_board_info *info
return 0;
}
-static int amc6821_init_client(struct amc6821_data *data)
+static int amc6821_init_client(struct i2c_client *client, struct amc6821_data *data)
{
struct regmap *regmap = data->regmap;
int err;
@@ -864,6 +864,9 @@ static int amc6821_init_client(struct amc6821_data *data)
if (err)
return err;
+ if (of_property_read_bool(client->dev.of_node, "ti,pwm-inverted"))
+ pwminv = 1;
+
err = regmap_update_bits(regmap, AMC6821_REG_CONF1,
AMC6821_CONF1_THERMOVIE | AMC6821_CONF1_FANIE |
AMC6821_CONF1_START | AMC6821_CONF1_PWMINV,
@@ -916,7 +919,7 @@ static int amc6821_probe(struct i2c_client *client)
"Failed to initialize regmap\n");
data->regmap = regmap;
- err = amc6821_init_client(data);
+ err = amc6821_init_client(client, data);
if (err)
return err;
--
2.39.5
Powered by blists - more mailing lists