Re: [PATCH 3/6] hwmon: (max1619) Convert to use regmap

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 7/27/24 21:26, Tzung-Bi Shih wrote:
On Sat, Jul 27, 2024 at 07:38:17AM -0700, Guenter Roeck wrote:
+static int get_alarms(struct regmap *regmap)
+{
+	static u32 regs[2] = { MAX1619_REG_STATUS, MAX1619_REG_CONFIG };
+	u8 regdata[2];
+	int ret;
+
+	ret = regmap_multi_reg_read(regmap, regs, regdata, 2);
+	if (ret)
+		return ret;
+
+	/* OVERT status bit may be reversed */
+	if (!(regdata[1] & 0x20))
+		regdata[0] ^= 0x02;
+
+	return regdata[0] & 0x1e;

Why `& 0x1e`?  Original max1619_update_device() doesn't do that.


Bit 7 is the busy bit, and the other three masked bits are reserved.
Maybe I should make that change in a separate patch. What do you think ?

-static void max1619_init_client(struct i2c_client *client)
-{
-	u8 config;
+/* regmap */
- /*
-	 * Start the conversions.
-	 */
-	i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONVRATE,
-				  5); /* 2 Hz */
-	config = i2c_smbus_read_byte_data(client, MAX1619_REG_R_CONFIG);
-	if (config & 0x40)
-		i2c_smbus_write_byte_data(client, MAX1619_REG_W_CONFIG,
-					  config & 0xBF); /* run */

Doesn't it need the initialization anymore?


Odd, that got lost. Thanks for noticing!

Guenter





[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux