Lines Matching full:max9611

3  * iio/adc/max9611.c
5 * Maxim max9611/max9612 high side current sense amplifier with
14 * Maxim max9611/max9612.
28 #define DRIVER_NAME "max9611"
30 /* max9611 register addresses */
37 /* max9611 REG1 mux configuration options */
45 /* max9611 voltage (both csa and input) helper macros */
50 * max9611 current sense amplifier voltage output:
70 * max9611 common input mode (CIM): LSB is 14mV, with 14mV offset at 25 C
79 * max9611 temperature reading: LSB is 480 milli degrees Celsius
205 * @max9611: max9611 device
209 static int max9611_read_single(struct max9611_dev *max9611, in max9611_read_single() argument
222 mutex_lock(&max9611->lock); in max9611_read_single()
223 ret = i2c_smbus_write_byte_data(max9611->i2c_client, in max9611_read_single()
226 dev_err(max9611->dev, "i2c write byte failed: 0x%2x - 0x%2x\n", in max9611_read_single()
228 mutex_unlock(&max9611->lock); in max9611_read_single()
236 ret = i2c_smbus_read_word_swapped(max9611->i2c_client, reg_addr); in max9611_read_single()
238 dev_err(max9611->dev, "i2c read word from 0x%2x failed\n", in max9611_read_single()
240 mutex_unlock(&max9611->lock); in max9611_read_single()
245 mutex_unlock(&max9611->lock); in max9611_read_single()
258 * @max9611: max9611 device
262 static int max9611_read_csa_voltage(struct max9611_dev *max9611, in max9611_read_csa_voltage() argument
275 ret = max9611_read_single(max9611, gain_selectors[i], adc_raw); in max9611_read_csa_voltage()
353 * Even if max9611 can output raw csa voltage readings, in max9611_read_raw()
426 struct max9611_dev *max9611 = iio_priv(dev_to_iio_dev(dev)); in max9611_shunt_resistor_show() local
429 i = max9611->shunt_resistor_uohm / 1000000; in max9611_shunt_resistor_show()
430 r = max9611->shunt_resistor_uohm % 1000000; in max9611_shunt_resistor_show()
455 static int max9611_init(struct max9611_dev *max9611) in max9611_init() argument
457 struct i2c_client *client = max9611->i2c_client; in max9611_init()
464 dev_err(max9611->dev, in max9611_init()
470 ret = max9611_read_single(max9611, CONF_TEMP, &regval); in max9611_init()
479 dev_err(max9611->dev, in max9611_init()
486 ret = i2c_smbus_write_byte_data(max9611->i2c_client, in max9611_init()
489 dev_err(max9611->dev, "i2c write byte failed: 0x%2x - 0x%2x\n", in max9611_init()
494 ret = i2c_smbus_write_byte_data(max9611->i2c_client, in max9611_init()
497 dev_err(max9611->dev, "i2c write byte failed: 0x%2x - 0x%2x\n", in max9611_init()
507 { .compatible = "maxim,max9611", .data = "max9611" },
516 struct max9611_dev *max9611; in max9611_probe() local
522 indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*max9611)); in max9611_probe()
528 max9611 = iio_priv(indio_dev); in max9611_probe()
529 max9611->dev = dev; in max9611_probe()
530 max9611->i2c_client = client; in max9611_probe()
531 mutex_init(&max9611->lock); in max9611_probe()
539 max9611->shunt_resistor_uohm = of_shunt; in max9611_probe()
541 ret = max9611_init(max9611); in max9611_probe()
564 MODULE_DESCRIPTION("Maxim max9611/12 current sense amplifier with 12bit ADC");