diff options
Diffstat (limited to 'drivers/iio/dac/mcp4725.c')
| -rw-r--r-- | drivers/iio/dac/mcp4725.c | 21 | 
1 files changed, 6 insertions, 15 deletions
diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c index 1397b6e0e41..43d14588448 100644 --- a/drivers/iio/dac/mcp4725.c +++ b/drivers/iio/dac/mcp4725.c @@ -15,7 +15,6 @@   */  #include <linux/module.h> -#include <linux/init.h>  #include <linux/i2c.h>  #include <linux/err.h>  #include <linux/delay.h> @@ -195,8 +194,9 @@ static const struct iio_chan_spec_ext_info mcp4725_ext_info[] = {  		.name = "powerdown",  		.read = mcp4725_read_powerdown,  		.write = mcp4725_write_powerdown, +		.shared = IIO_SEPARATE,  	}, -	IIO_ENUM("powerdown_mode", false, &mcp4725_powerdown_mode_enum), +	IIO_ENUM("powerdown_mode", IIO_SEPARATE, &mcp4725_powerdown_mode_enum),  	IIO_ENUM_AVAILABLE("powerdown_mode", &mcp4725_powerdown_mode_enum),  	{ },  }; @@ -208,7 +208,6 @@ static const struct iio_chan_spec mcp4725_channel = {  	.channel	= 0,  	.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),  	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), -	.scan_type	= IIO_ST('u', 12, 16, 0),  	.ext_info	= mcp4725_ext_info,  }; @@ -238,17 +237,15 @@ static int mcp4725_read_raw(struct iio_dev *indio_dev,  			   int *val, int *val2, long mask)  {  	struct mcp4725_data *data = iio_priv(indio_dev); -	unsigned long scale_uv;  	switch (mask) {  	case IIO_CHAN_INFO_RAW:  		*val = data->dac_value;  		return IIO_VAL_INT;  	case IIO_CHAN_INFO_SCALE: -		scale_uv = (data->vref_mv * 1000) >> 12; -		*val =  scale_uv / 1000000; -		*val2 = scale_uv % 1000000; -		return IIO_VAL_INT_PLUS_MICRO; +		*val = data->vref_mv; +		*val2 = 12; +		return IIO_VAL_FRACTIONAL_LOG2;  	}  	return -EINVAL;  } @@ -321,13 +318,7 @@ static int mcp4725_probe(struct i2c_client *client,  	data->powerdown_mode = pd ? pd-1 : 2; /* 500kohm_to_gnd */  	data->dac_value = (inbuf[1] << 4) | (inbuf[2] >> 4); -	err = iio_device_register(indio_dev); -	if (err) -		return err; - -	dev_info(&client->dev, "MCP4725 DAC registered\n"); - -	return 0; +	return iio_device_register(indio_dev);  }  static int mcp4725_remove(struct i2c_client *client)  | 
