Re: [PATCH v2] iio/axp288_adc: add missing channel info mask

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

 



On 06/04/15 19:38, Jacob Pan wrote:
> Commit 65de7654d39c70c2b ("iio: iio: Fix iio_channel_read return if
> channel havn't info") added a check for valid info masks.
> 
> This patch adds missing channel info masks for all ADC channels.
> Otherwise, iio_read_channel_raw() would return -EINVAL when called
> by consumer drivers.
> 
> Signed-off-by: Jacob Pan <jacob.jun.pan@xxxxxxxxxxxxxxx>

This makes me a little nervous. Why did we have the separate raw and
processed paths in the read_raw function in the first place?

Also this changes the exposed userspace ABI by dropping those processed
attributes that already exist..

Jonathan
> ---
>  drivers/iio/adc/axp288_adc.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/adc/axp288_adc.c b/drivers/iio/adc/axp288_adc.c
> index 08bcfb0..56008a8 100644
> --- a/drivers/iio/adc/axp288_adc.c
> +++ b/drivers/iio/adc/axp288_adc.c
> @@ -53,39 +53,42 @@ static const struct iio_chan_spec const axp288_adc_channels[] = {
>  		.channel = 0,
>  		.address = AXP288_TS_ADC_H,
>  		.datasheet_name = "TS_PIN",
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
>  	}, {
>  		.indexed = 1,
>  		.type = IIO_TEMP,
>  		.channel = 1,
>  		.address = AXP288_PMIC_ADC_H,
>  		.datasheet_name = "PMIC_TEMP",
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
>  	}, {
>  		.indexed = 1,
>  		.type = IIO_TEMP,
>  		.channel = 2,
>  		.address = AXP288_GP_ADC_H,
>  		.datasheet_name = "GPADC",
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
>  	}, {
>  		.indexed = 1,
>  		.type = IIO_CURRENT,
>  		.channel = 3,
>  		.address = AXP20X_BATT_CHRG_I_H,
>  		.datasheet_name = "BATT_CHG_I",
> -		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
>  	}, {
>  		.indexed = 1,
>  		.type = IIO_CURRENT,
>  		.channel = 4,
>  		.address = AXP20X_BATT_DISCHRG_I_H,
>  		.datasheet_name = "BATT_DISCHRG_I",
> -		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
>  	}, {
>  		.indexed = 1,
>  		.type = IIO_VOLTAGE,
>  		.channel = 5,
>  		.address = AXP20X_BATT_V_H,
>  		.datasheet_name = "BATT_V",
> -		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
> +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
>  	},
>  };
>  
> @@ -151,9 +154,6 @@ static int axp288_adc_read_raw(struct iio_dev *indio_dev,
>  						chan->address))
>  			dev_err(&indio_dev->dev, "TS pin restore\n");
>  		break;
> -	case IIO_CHAN_INFO_PROCESSED:
> -		ret = axp288_adc_read_channel(val, chan->address, info->regmap);
> -		break;
>  	default:
>  		ret = -EINVAL;
>  	}
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux