Commit 8a5c5cc61748642a1276ef94611e21a60f0796ab

Authored by Jean Delvare
Committed by Jean Delvare
1 parent 1db772216f

hwmon: (lm75) Per-chip configuration register initialization

There is no standard for the configuration register bits of LM75-like
chips. We shouldn't blindly clear bits setting the resolution as they
are either unused or used for something else on some of the supported
chips.

So, switch to per-chip configuration initialization. This will allow
for better tuning later, for example using more resolution bits when
available.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Guenter Roeck <linux@roeck-us.net>

Showing 1 changed file with 22 additions and 2 deletions Side-by-side Diff

drivers/hwmon/lm75.c
... ... @@ -167,8 +167,28 @@
167 167 * Then tweak to be more precise when appropriate.
168 168 */
169 169 set_mask = 0;
170   - clr_mask = (1 << 0) /* continuous conversions */
171   - | (1 << 6) | (1 << 5); /* 9-bit mode */
  170 + clr_mask = LM75_SHUTDOWN; /* continuous conversions */
  171 +
  172 + switch (id->driver_data) {
  173 + case adt75:
  174 + clr_mask |= 1 << 5; /* not one-shot mode */
  175 + break;
  176 + case ds1775:
  177 + case ds75:
  178 + case stds75:
  179 + clr_mask |= 3 << 5; /* 9-bit mode */
  180 + break;
  181 + case mcp980x:
  182 + case tmp100:
  183 + case tmp101:
  184 + case tmp105:
  185 + case tmp175:
  186 + case tmp275:
  187 + case tmp75:
  188 + clr_mask |= 3 << 5; /* 9-bit mode */
  189 + clr_mask |= 1 << 7; /* not one-shot mode */
  190 + break;
  191 + }
172 192  
173 193 /* configure as specified */
174 194 status = lm75_read_value(client, LM75_REG_CONF);