Re: [PATCH 11/12] iio: ad7291: reset device and setup irq before it is enabled

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

 



On 08/31/11 11:57, michael.hennerich@xxxxxxxxxx wrote:
> From: Michael Hennerich <michael.hennerich@xxxxxxxxxx>
> 
Looks right.
> 
> Signed-off-by: Michael Hennerich <michael.hennerich@xxxxxxxxxx>
merged
> ---
>  drivers/staging/iio/adc/ad7291.c |   27 ++++++++++++++++-----------
>  1 files changed, 16 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/iio/adc/ad7291.c b/drivers/staging/iio/adc/ad7291.c
> index 334951c..0811c5e 100644
> --- a/drivers/staging/iio/adc/ad7291.c
> +++ b/drivers/staging/iio/adc/ad7291.c
> @@ -589,8 +589,10 @@ static int __devinit ad7291_probe(struct i2c_client *client,
>  	i2c_set_clientdata(client, indio_dev);
>  
>  	chip->client = client;
> -	/* Tsense always enabled */
> -	chip->command = AD7291_NOISE_DELAY | AD7291_T_SENSE_MASK;
> +
> +	chip->command = AD7291_NOISE_DELAY |
> +			AD7291_T_SENSE_MASK | /* Tsense always enabled */
> +			AD7291_ALERT_POLARITY; /* set irq polarity low level */
>  
>  	if (voltage_uv) {
>  		chip->int_vref_mv = voltage_uv / 1000;
> @@ -607,6 +609,18 @@ static int __devinit ad7291_probe(struct i2c_client *client,
>  	indio_dev->info = &ad7291_info;
>  	indio_dev->modes = INDIO_DIRECT_MODE;
>  
> +	ret = ad7291_i2c_write(chip, AD7291_COMMAND, AD7291_RESET);
> +	if (ret) {
> +		ret = -EIO;
> +		goto error_disable_reg;
> +	}
> +
> +	ret = ad7291_i2c_write(chip, AD7291_COMMAND, chip->command);
> +	if (ret) {
> +		ret = -EIO;
> +		goto error_disable_reg;
> +	}
> +
>  	if (client->irq > 0) {
>  		ret = request_threaded_irq(client->irq,
>  					   NULL,
> @@ -616,15 +630,6 @@ static int __devinit ad7291_probe(struct i2c_client *client,
>  					   indio_dev);
>  		if (ret)
>  			goto error_disable_reg;
> -
> -		/* set irq polarity low level */
> -		chip->command |= AD7291_ALERT_POLARITY;
> -	}
> -
> -	ret = ad7291_i2c_write(chip, AD7291_COMMAND, chip->command);
> -	if (ret) {
> -		ret = -EIO;
> -		goto error_unreg_irq;
>  	}
>  
>  	ret = iio_device_register(indio_dev);

--
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