Re: [PATCH v2 4/7] hwmon: (max1619) Convert to use regmap

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

 



On 7/28/24 20:24, Tzung-Bi Shih wrote:
On Sun, Jul 28, 2024 at 08:16:35PM -0700, Guenter Roeck wrote:
On 7/28/24 19:18, Tzung-Bi Shih wrote:
On Sun, Jul 28, 2024 at 07:37:12AM -0700, Guenter Roeck wrote:
-static void max1619_init_client(struct i2c_client *client)
+static int max1619_init_chip(struct regmap *regmap)
   {
-	u8 config;
+	int ret;
-	/*
-	 * 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 */
+	ret = regmap_write(regmap, MAX1619_REG_CONVRATE, 5);	/* 2 Hz */
+	if (ret)
+		return ret;
+
+	/* Start conversions */
+	return regmap_set_bits(regmap, MAX1619_REG_CONFIG, 0x40);

Should be regmap_clear_bits()?


Sigh. yes, of course.

With that,
Reviewed-by: Tzung-Bi Shih <tzungbi@xxxxxxxxxx>


Thanks!

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