All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: ad799x: Fix ad7991/ad7995/ad7999 config setup
@ 2014-11-26 10:35 Lars-Peter Clausen
  2014-11-26 11:51 ` Mike Looijmans
  0 siblings, 1 reply; 3+ messages in thread
From: Lars-Peter Clausen @ 2014-11-26 10:35 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Peter Meerwald, Mike Looijmans, linux-iio,
	Lars-Peter Clausen

The ad7991/ad7995/ad7999 does not have a configuration register like the
other devices that can be written and read. The configuration is written as
part of the conversion sequence.

Fixes: 0f7ddcc1bff1 ("iio:adc:ad799x: Write default config on probe and reset alert status on probe")
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
---
 drivers/iio/adc/ad799x.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
index e37412d..b99de00 100644
--- a/drivers/iio/adc/ad799x.c
+++ b/drivers/iio/adc/ad799x.c
@@ -143,9 +143,15 @@ static int ad799x_write_config(struct ad799x_state *st, u16 val)
 	case ad7998:
 		return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG,
 			val);
-	default:
+	case ad7992:
+	case ad7993:
+	case ad7994:
 		return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG,
 			val);
+	default:
+		/* Will be written when doing a conversion */
+		st->config = val;
+		return 0;
 	}
 }
 
@@ -155,8 +161,13 @@ static int ad799x_read_config(struct ad799x_state *st)
 	case ad7997:
 	case ad7998:
 		return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG);
-	default:
+	case ad7992:
+	case ad7993:
+	case ad7994:
 		return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG);
+	default:
+		/* No readback support */
+		return st->config;
 	}
 }
 
-- 
1.8.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: ad799x: Fix ad7991/ad7995/ad7999 config setup
  2014-11-26 10:35 [PATCH] iio: ad799x: Fix ad7991/ad7995/ad7999 config setup Lars-Peter Clausen
@ 2014-11-26 11:51 ` Mike Looijmans
  2014-12-12 12:34   ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Mike Looijmans @ 2014-11-26 11:51 UTC (permalink / raw)
  To: Lars-Peter Clausen, Jonathan Cameron
  Cc: Hartmut Knaack, Peter Meerwald, linux-iio

Tested it on the Miami board, and this patch indeed fixes the issue. You can 
add my tested-by if you like:

Tested-by: Mike Looijmans <mike.looijmans@topic.nl>


On 11/26/2014 11:35 AM, Lars-Peter Clausen wrote:
> The ad7991/ad7995/ad7999 does not have a configuration register like the
> other devices that can be written and read. The configuration is written as
> part of the conversion sequence.
>
> Fixes: 0f7ddcc1bff1 ("iio:adc:ad799x: Write default config on probe and reset alert status on probe")
> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
> ---
>   drivers/iio/adc/ad799x.c | 15 +++++++++++++--
>   1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
> index e37412d..b99de00 100644
> --- a/drivers/iio/adc/ad799x.c
> +++ b/drivers/iio/adc/ad799x.c
> @@ -143,9 +143,15 @@ static int ad799x_write_config(struct ad799x_state *st, u16 val)
>   	case ad7998:
>   		return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG,
>   			val);
> -	default:
> +	case ad7992:
> +	case ad7993:
> +	case ad7994:
>   		return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG,
>   			val);
> +	default:
> +		/* Will be written when doing a conversion */
> +		st->config = val;
> +		return 0;
>   	}
>   }
>
> @@ -155,8 +161,13 @@ static int ad799x_read_config(struct ad799x_state *st)
>   	case ad7997:
>   	case ad7998:
>   		return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG);
> -	default:
> +	case ad7992:
> +	case ad7993:
> +	case ad7994:
>   		return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG);
> +	default:
> +		/* No readback support */
> +		return st->config;
>   	}
>   }
>
>



Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert


TOPIC Embedded Systems
Eindhovenseweg 32-C, NL-5683 KH Best
Postbus 440, NL-5680 AK Best
Telefoon: (+31) (0) 499 33 69 79
Telefax:  (+31) (0) 499 33 69 70
E-mail: mike.looijmans@topic.nl
Website: www.topic.nl

Please consider the environment before printing this e-mail

Topic zoekt gedreven (embedded) software specialisten!
http://topic.nl/vacatures/topic-zoekt-software-engineers/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iio: ad799x: Fix ad7991/ad7995/ad7999 config setup
  2014-11-26 11:51 ` Mike Looijmans
@ 2014-12-12 12:34   ` Jonathan Cameron
  0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Cameron @ 2014-12-12 12:34 UTC (permalink / raw)
  To: Mike Looijmans, Lars-Peter Clausen
  Cc: Hartmut Knaack, Peter Meerwald, linux-iio

On 26/11/14 11:51, Mike Looijmans wrote:
> Tested it on the Miami board, and this patch indeed fixes the issue. You can add my tested-by if you like:
> 
> Tested-by: Mike Looijmans <mike.looijmans@topic.nl>
Applied to the fixes-togreg branch of iio.git

Thanks,

Jonathan
> 
> 
> On 11/26/2014 11:35 AM, Lars-Peter Clausen wrote:
>> The ad7991/ad7995/ad7999 does not have a configuration register like the
>> other devices that can be written and read. The configuration is written as
>> part of the conversion sequence.
>>
>> Fixes: 0f7ddcc1bff1 ("iio:adc:ad799x: Write default config on probe and reset alert status on probe")
>> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
>> ---
>>   drivers/iio/adc/ad799x.c | 15 +++++++++++++--
>>   1 file changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c
>> index e37412d..b99de00 100644
>> --- a/drivers/iio/adc/ad799x.c
>> +++ b/drivers/iio/adc/ad799x.c
>> @@ -143,9 +143,15 @@ static int ad799x_write_config(struct ad799x_state *st, u16 val)
>>       case ad7998:
>>           return i2c_smbus_write_word_swapped(st->client, AD7998_CONF_REG,
>>               val);
>> -    default:
>> +    case ad7992:
>> +    case ad7993:
>> +    case ad7994:
>>           return i2c_smbus_write_byte_data(st->client, AD7998_CONF_REG,
>>               val);
>> +    default:
>> +        /* Will be written when doing a conversion */
>> +        st->config = val;
>> +        return 0;
>>       }
>>   }
>>
>> @@ -155,8 +161,13 @@ static int ad799x_read_config(struct ad799x_state *st)
>>       case ad7997:
>>       case ad7998:
>>           return i2c_smbus_read_word_swapped(st->client, AD7998_CONF_REG);
>> -    default:
>> +    case ad7992:
>> +    case ad7993:
>> +    case ad7994:
>>           return i2c_smbus_read_byte_data(st->client, AD7998_CONF_REG);
>> +    default:
>> +        /* No readback support */
>> +        return st->config;
>>       }
>>   }
>>
>>
> 
> 
> 
> Met vriendelijke groet / kind regards,
> 
> Mike Looijmans
> System Expert
> 
> 
> TOPIC Embedded Systems
> Eindhovenseweg 32-C, NL-5683 KH Best
> Postbus 440, NL-5680 AK Best
> Telefoon: (+31) (0) 499 33 69 79
> Telefax:  (+31) (0) 499 33 69 70
> E-mail: mike.looijmans@topic.nl
> Website: www.topic.nl
> 
> Please consider the environment before printing this e-mail
> 
> Topic zoekt gedreven (embedded) software specialisten!
> http://topic.nl/vacatures/topic-zoekt-software-engineers/
> 
> -- 
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-12 12:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-26 10:35 [PATCH] iio: ad799x: Fix ad7991/ad7995/ad7999 config setup Lars-Peter Clausen
2014-11-26 11:51 ` Mike Looijmans
2014-12-12 12:34   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.