lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250603113125.3175103-4-florin.leotescu@oss.nxp.com>
Date: Tue,  3 Jun 2025 14:31:24 +0300
From: florin.leotescu@....nxp.com
To: Jean Delvare <jdelvare@...e.com>,
	Guenter Roeck <linux@...ck-us.net>,
	Florin Leotescu <florin.leotescu@....com>,
	linux-hwmon@...r.kernel.org,
	linux-kernel@...r.kernel.org
Cc: viorel.suman@....com,
	carlos.song@....com,
	daniel.baluta@....com,
	linux-arm-kernel@...ts.infradead.org,
	imx@...ts.linux.dev,
	festevam@...il.com
Subject: [PATCH 3/4] hwmon: emc2305: Enable PWM polarity and output configuration

From: Florin Leotescu <florin.leotescu@....com>

Enable configuration of PWM polarity and PWM output config
based Device Tree properties.

Signed-off-by: Florin Leotescu <florin.leotescu@....com>
---
 drivers/hwmon/emc2305.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/hwmon/emc2305.c b/drivers/hwmon/emc2305.c
index 0228511f4753..db65c3177f29 100644
--- a/drivers/hwmon/emc2305.c
+++ b/drivers/hwmon/emc2305.c
@@ -28,6 +28,10 @@
 #define EMC2305_TACH_RANGE_MIN		480
 #define EMC2305_DEFAULT_OUTPUT		0x0
 #define EMC2305_DEFAULT_POLARITY	0x0
+#define EMC2305_REG_POLARITY		0x2a
+#define EMC2305_REG_DRIVE_PWM_OUT	0x2b
+#define EMC2305_OPEN_DRAIN		0x0
+#define EMC2305_PUSH_PULL		0x1
 
 #define EMC2305_PWM_DUTY2STATE(duty, max_state, pwm_max) \
 	DIV_ROUND_CLOSEST((duty) * (max_state), (pwm_max))
@@ -686,6 +690,16 @@ static int emc2305_probe(struct i2c_client *client)
 		}
 	}
 
+	ret = i2c_smbus_write_byte_data(client, EMC2305_REG_DRIVE_PWM_OUT,
+					data->pwm_output_mask);
+	if (ret < 0)
+		dev_err(dev, "Failed to configure pwm output, using default\n");
+
+	ret = i2c_smbus_write_byte_data(client, EMC2305_REG_POLARITY,
+					data->pwm_polarity_mask);
+	if (ret < 0)
+		dev_err(dev, "Failed to configure pwm polarity, using default\n");
+
 	for (i = 0; i < data->pwm_num; i++) {
 		ret = i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_MIN_DRIVE(i),
 						data->pwm_min[i]);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ