linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: i2c: i2c-st: Update i2c timings
@ 2014-05-16 15:32 Maxime COQUELIN
  2014-06-02 16:31 ` Wolfram Sang
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime COQUELIN @ 2014-05-16 15:32 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c, linux-kernel, Srinivas Kandagatla,
	Patrice Chotard
  Cc: kernel, maxime.coquelin

The i2c timing values specified in the driver are the minimun
values defined in the I2C specifications.
The I2C specification does not specify any default or maximum values.

Some I2C devices are out of spec, and might not work properly with minimum
values.

This patch adds a 10% margin on all the timings.

Signed-off-by: Maxime Coquelin <maxime.coquelin@st.com>
---
 drivers/i2c/busses/i2c-st.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
index 8720161..09142f1 100644
--- a/drivers/i2c/busses/i2c-st.c
+++ b/drivers/i2c/busses/i2c-st.c
@@ -210,21 +210,21 @@ static inline void st_i2c_clr_bits(void __iomem *reg, u32 mask)
 static struct st_i2c_timings i2c_timings[] = {
 	[I2C_MODE_STANDARD] = {
 		.rate			= 100000,
-		.rep_start_hold		= 4000,
-		.rep_start_setup	= 4700,
-		.start_hold		= 4000,
-		.data_setup_time	= 250,
-		.stop_setup_time	= 4000,
-		.bus_free_time		= 4700,
+		.rep_start_hold		= 4400,
+		.rep_start_setup	= 5170,
+		.start_hold		= 4400,
+		.data_setup_time	= 275,
+		.stop_setup_time	= 4400,
+		.bus_free_time		= 5170,
 	},
 	[I2C_MODE_FAST] = {
 		.rate			= 400000,
-		.rep_start_hold		= 600,
-		.rep_start_setup	= 600,
-		.start_hold		= 600,
-		.data_setup_time	= 100,
-		.stop_setup_time	= 600,
-		.bus_free_time		= 1300,
+		.rep_start_hold		= 660,
+		.rep_start_setup	= 660,
+		.start_hold		= 660,
+		.data_setup_time	= 110,
+		.stop_setup_time	= 660,
+		.bus_free_time		= 1430,
 	},
 };
 
-- 
1.9.1


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

* Re: [PATCH] drivers: i2c: i2c-st: Update i2c timings
  2014-05-16 15:32 [PATCH] drivers: i2c: i2c-st: Update i2c timings Maxime COQUELIN
@ 2014-06-02 16:31 ` Wolfram Sang
  2014-06-03  7:32   ` Maxime Coquelin
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfram Sang @ 2014-06-02 16:31 UTC (permalink / raw)
  To: Maxime COQUELIN
  Cc: linux-i2c, linux-kernel, Srinivas Kandagatla, Patrice Chotard, kernel

[-- Attachment #1: Type: text/plain, Size: 2060 bytes --]

On Fri, May 16, 2014 at 05:32:10PM +0200, Maxime COQUELIN wrote:
> The i2c timing values specified in the driver are the minimun
> values defined in the I2C specifications.
> The I2C specification does not specify any default or maximum values.
> 
> Some I2C devices are out of spec, and might not work properly with minimum
> values.

Can you give names here? Would be interesting to know since a few
drivers implement the minimum timings.

> This patch adds a 10% margin on all the timings.

Is there a safety margin or do the devices start to work exactly at 10%?

> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@st.com>
> ---
>  drivers/i2c/busses/i2c-st.c | 24 ++++++++++++------------
>  1 file changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
> index 8720161..09142f1 100644
> --- a/drivers/i2c/busses/i2c-st.c
> +++ b/drivers/i2c/busses/i2c-st.c
> @@ -210,21 +210,21 @@ static inline void st_i2c_clr_bits(void __iomem *reg, u32 mask)
>  static struct st_i2c_timings i2c_timings[] = {

That needs a comment about the margin, otherwise people will wonder
where these values come from.

>  	[I2C_MODE_STANDARD] = {
>  		.rate			= 100000,
> -		.rep_start_hold		= 4000,
> -		.rep_start_setup	= 4700,
> -		.start_hold		= 4000,
> -		.data_setup_time	= 250,
> -		.stop_setup_time	= 4000,
> -		.bus_free_time		= 4700,
> +		.rep_start_hold		= 4400,
> +		.rep_start_setup	= 5170,
> +		.start_hold		= 4400,
> +		.data_setup_time	= 275,
> +		.stop_setup_time	= 4400,
> +		.bus_free_time		= 5170,
>  	},
>  	[I2C_MODE_FAST] = {
>  		.rate			= 400000,
> -		.rep_start_hold		= 600,
> -		.rep_start_setup	= 600,
> -		.start_hold		= 600,
> -		.data_setup_time	= 100,
> -		.stop_setup_time	= 600,
> -		.bus_free_time		= 1300,
> +		.rep_start_hold		= 660,
> +		.rep_start_setup	= 660,
> +		.start_hold		= 660,
> +		.data_setup_time	= 110,
> +		.stop_setup_time	= 660,
> +		.bus_free_time		= 1430,
>  	},
>  };
>  
> -- 
> 1.9.1
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] drivers: i2c: i2c-st: Update i2c timings
  2014-06-02 16:31 ` Wolfram Sang
@ 2014-06-03  7:32   ` Maxime Coquelin
  2014-06-03  7:59     ` Wolfram Sang
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Coquelin @ 2014-06-03  7:32 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Srinivas Kandagatla, Patrice Chotard, kernel

Hi Wolfram,

On 06/02/2014 06:31 PM, Wolfram Sang wrote:
> On Fri, May 16, 2014 at 05:32:10PM +0200, Maxime COQUELIN wrote:
>> The i2c timing values specified in the driver are the minimun
>> values defined in the I2C specifications.
>> The I2C specification does not specify any default or maximum values.
>>
>> Some I2C devices are out of spec, and might not work properly with minimum
>> values.
>
> Can you give names here? Would be interesting to know since a few
> drivers implement the minimum timings.

I don't have the name actually.
The request to implement this change came from hw guys.

>
>> This patch adds a 10% margin on all the timings.
>
> Is there a safety margin or do the devices start to work exactly at 10%?

10% is a safety margin, I don't know what is the limit.

>
>>
>> Signed-off-by: Maxime Coquelin <maxime.coquelin@st.com>
>> ---
>>   drivers/i2c/busses/i2c-st.c | 24 ++++++++++++------------
>>   1 file changed, 12 insertions(+), 12 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
>> index 8720161..09142f1 100644
>> --- a/drivers/i2c/busses/i2c-st.c
>> +++ b/drivers/i2c/busses/i2c-st.c
>> @@ -210,21 +210,21 @@ static inline void st_i2c_clr_bits(void __iomem *reg, u32 mask)
>>   static struct st_i2c_timings i2c_timings[] = {
>
> That needs a comment about the margin, otherwise people will wonder
> where these values come from.

Ok, I will add a comment in the v2.

>
>>   	[I2C_MODE_STANDARD] = {
>>   		.rate			= 100000,
>> -		.rep_start_hold		= 4000,
>> -		.rep_start_setup	= 4700,
>> -		.start_hold		= 4000,
>> -		.data_setup_time	= 250,
>> -		.stop_setup_time	= 4000,
>> -		.bus_free_time		= 4700,
>> +		.rep_start_hold		= 4400,
>> +		.rep_start_setup	= 5170,
>> +		.start_hold		= 4400,
>> +		.data_setup_time	= 275,
>> +		.stop_setup_time	= 4400,
>> +		.bus_free_time		= 5170,
>>   	},
>>   	[I2C_MODE_FAST] = {
>>   		.rate			= 400000,
>> -		.rep_start_hold		= 600,
>> -		.rep_start_setup	= 600,
>> -		.start_hold		= 600,
>> -		.data_setup_time	= 100,
>> -		.stop_setup_time	= 600,
>> -		.bus_free_time		= 1300,
>> +		.rep_start_hold		= 660,
>> +		.rep_start_setup	= 660,
>> +		.start_hold		= 660,
>> +		.data_setup_time	= 110,
>> +		.stop_setup_time	= 660,
>> +		.bus_free_time		= 1430,
>>   	},
>>   };
>>
>> --
>> 1.9.1
>>

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

* Re: [PATCH] drivers: i2c: i2c-st: Update i2c timings
  2014-06-03  7:32   ` Maxime Coquelin
@ 2014-06-03  7:59     ` Wolfram Sang
  2014-07-21 11:05       ` Maxime Coquelin
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfram Sang @ 2014-06-03  7:59 UTC (permalink / raw)
  To: Maxime Coquelin
  Cc: linux-i2c, linux-kernel, Srinivas Kandagatla, Patrice Chotard, kernel

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]


> >Can you give names here? Would be interesting to know since a few
> >drivers implement the minimum timings.
> 
> I don't have the name actually.
> The request to implement this change came from hw guys.

Can you ask? It feels better to have changes based on facts.

> >>This patch adds a 10% margin on all the timings.
> >
> >Is there a safety margin or do the devices start to work exactly at 10%?
> 
> 10% is a safety margin, I don't know what is the limit.

Which also came from the HW guys? Please ask for details why 10%, too.

Thanks,

   Wolfram


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] drivers: i2c: i2c-st: Update i2c timings
  2014-06-03  7:59     ` Wolfram Sang
@ 2014-07-21 11:05       ` Maxime Coquelin
  2014-07-21 14:03         ` Wolfram Sang
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Coquelin @ 2014-07-21 11:05 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-kernel, Srinivas Kandagatla, Patrice Chotard, kernel

Hi Wolfram,

On 06/03/2014 09:59 AM, Wolfram Sang wrote:
> 
>>> Can you give names here? Would be interesting to know since a few
>>> drivers implement the minimum timings.
>>
>> I don't have the name actually.
>> The request to implement this change came from hw guys.
> 
> Can you ask? It feels better to have changes based on facts.

Sorry for the late reply, but it took time to get the answer.

Apparently the HDMI link of the Toshiba 19AV600U TV is affected by this.
I have no references of other devices (if any).

> 
>>>> This patch adds a 10% margin on all the timings.
>>>
>>> Is there a safety margin or do the devices start to work exactly at 10%?
>>
>> 10% is a safety margin, I don't know what is the limit.
> 
> Which also came from the HW guys? Please ask for details why 10%, too.

This is a safety margin.
Note that the I2C specification only defines minimal timings.

Is it fine for you?
Can I re-send a v2, which:
 - Indicate the Toshiba TV is one of the affected devices in the commit message
 - Indicate the 10% margin is a safety one in the commit message
 - Add a comment above the table indicating these are standard timings + 10% margin.

Regards,
Maxime

> 
> Thanks,
> 
>     Wolfram
> 

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

* Re: [PATCH] drivers: i2c: i2c-st: Update i2c timings
  2014-07-21 11:05       ` Maxime Coquelin
@ 2014-07-21 14:03         ` Wolfram Sang
  0 siblings, 0 replies; 6+ messages in thread
From: Wolfram Sang @ 2014-07-21 14:03 UTC (permalink / raw)
  To: Maxime Coquelin
  Cc: linux-i2c, linux-kernel, Srinivas Kandagatla, Patrice Chotard, kernel

[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]


> Sorry for the late reply, but it took time to get the answer.

No problem, thanks for keeping at it.

> > Which also came from the HW guys? Please ask for details why 10%, too.
> 
> This is a safety margin.

I understood that. Still why 10%? Is it randomly guessed? Was 5% the
first working value, so we took this * 2? Is it a secret value from a
well-experienced engineer? While not perfect, I'd accept those reasons
as long as they are clearly stated. I just want to avoid trial and error
trying to find a good value.

> Note that the I2C specification only defines minimal timings.
> 
> Is it fine for you?
> Can I re-send a v2, which:
>  - Indicate the Toshiba TV is one of the affected devices in the commit message
>  - Indicate the 10% margin is a safety one in the commit message
>  - Add a comment above the table indicating these are standard timings + 10% margin.

Basically yes. The same information should be in the commit message and
the comment above the table. I'd really like a short reason why 10%.

Regards,

    Wolfram


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

end of thread, other threads:[~2014-07-21 14:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-16 15:32 [PATCH] drivers: i2c: i2c-st: Update i2c timings Maxime COQUELIN
2014-06-02 16:31 ` Wolfram Sang
2014-06-03  7:32   ` Maxime Coquelin
2014-06-03  7:59     ` Wolfram Sang
2014-07-21 11:05       ` Maxime Coquelin
2014-07-21 14:03         ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).