All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drivers: i2c: i2c-st: Update i2c timings
@ 2014-07-23 15:44 ` Maxime COQUELIN
  0 siblings, 0 replies; 4+ messages in thread
From: Maxime COQUELIN @ 2014-07-23 15:44 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, such as the HDMI link of the Toshiba 19AV600
TV, and might not work properly with minimum values.

This patch adds a 10% margin on all the timings in both Normal and Fast modes.

Trial and error method have been used to find the minimum margin necessary to
have the out-of-spec device working, and a security margin has been added.

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

diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
index 95b94767..4ab14ad 100644
--- a/drivers/i2c/busses/i2c-st.c
+++ b/drivers/i2c/busses/i2c-st.c
@@ -206,25 +206,31 @@ static inline void st_i2c_clr_bits(void __iomem *reg, u32 mask)
 	writel_relaxed(readl_relaxed(reg) & ~mask, reg);
 }
 
-/* From I2C Specifications v0.5 */
+/*
+ * From I2C Specifications v0.5.
+ *
+ * All the values below have +10% margin added to be
+ * compatible with some out-of-spec devices,
+ * like HDMI link of the Toshiba 19AV600 TV.
+ */
 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] 4+ messages in thread

* [PATCH v2] drivers: i2c: i2c-st: Update i2c timings
@ 2014-07-23 15:44 ` Maxime COQUELIN
  0 siblings, 0 replies; 4+ messages in thread
From: Maxime COQUELIN @ 2014-07-23 15:44 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Srinivas Kandagatla,
	Patrice Chotard
  Cc: kernel-F5mvAk5X5gdBDgjK7y7TUQ, maxime.coquelin-qxv4g6HH51o

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, such as the HDMI link of the Toshiba 19AV600
TV, and might not work properly with minimum values.

This patch adds a 10% margin on all the timings in both Normal and Fast modes.

Trial and error method have been used to find the minimum margin necessary to
have the out-of-spec device working, and a security margin has been added.

Signed-off-by: Maxime Coquelin <maxime.coquelin-qxv4g6HH51o@public.gmane.org>
---
 drivers/i2c/busses/i2c-st.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/i2c/busses/i2c-st.c b/drivers/i2c/busses/i2c-st.c
index 95b94767..4ab14ad 100644
--- a/drivers/i2c/busses/i2c-st.c
+++ b/drivers/i2c/busses/i2c-st.c
@@ -206,25 +206,31 @@ static inline void st_i2c_clr_bits(void __iomem *reg, u32 mask)
 	writel_relaxed(readl_relaxed(reg) & ~mask, reg);
 }
 
-/* From I2C Specifications v0.5 */
+/*
+ * From I2C Specifications v0.5.
+ *
+ * All the values below have +10% margin added to be
+ * compatible with some out-of-spec devices,
+ * like HDMI link of the Toshiba 19AV600 TV.
+ */
 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] 4+ messages in thread

* Re: [PATCH v2] drivers: i2c: i2c-st: Update i2c timings
@ 2014-08-01 17:48   ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2014-08-01 17:48 UTC (permalink / raw)
  To: Maxime COQUELIN
  Cc: linux-i2c, linux-kernel, Srinivas Kandagatla, Patrice Chotard, kernel

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

On Wed, Jul 23, 2014 at 05:44:07PM +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, such as the HDMI link of the Toshiba 19AV600
> TV, and might not work properly with minimum values.
> 
> This patch adds a 10% margin on all the timings in both Normal and Fast modes.
> 
> Trial and error method have been used to find the minimum margin necessary to
> have the out-of-spec device working, and a security margin has been added.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin@st.com>

Applied to for-next, thanks!


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

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

* Re: [PATCH v2] drivers: i2c: i2c-st: Update i2c timings
@ 2014-08-01 17:48   ` Wolfram Sang
  0 siblings, 0 replies; 4+ messages in thread
From: Wolfram Sang @ 2014-08-01 17:48 UTC (permalink / raw)
  To: Maxime COQUELIN
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, Srinivas Kandagatla,
	Patrice Chotard, kernel-F5mvAk5X5gdBDgjK7y7TUQ

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

On Wed, Jul 23, 2014 at 05:44:07PM +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, such as the HDMI link of the Toshiba 19AV600
> TV, and might not work properly with minimum values.
> 
> This patch adds a 10% margin on all the timings in both Normal and Fast modes.
> 
> Trial and error method have been used to find the minimum margin necessary to
> have the out-of-spec device working, and a security margin has been added.
> 
> Signed-off-by: Maxime Coquelin <maxime.coquelin-qxv4g6HH51o@public.gmane.org>

Applied to for-next, thanks!


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

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

end of thread, other threads:[~2014-08-01 17:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-23 15:44 [PATCH v2] drivers: i2c: i2c-st: Update i2c timings Maxime COQUELIN
2014-07-23 15:44 ` Maxime COQUELIN
2014-08-01 17:48 ` Wolfram Sang
2014-08-01 17:48   ` Wolfram Sang

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.