Re: [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver.

2012-08-06 Thread Linus Walleij
On Mon, Aug 6, 2012 at 2:25 PM, Lee Jones lee.jo...@linaro.org wrote:

 At this moment in time there is only one known configuration for the
 Nomadik I2C driver. By not holding that configuration in the driver
 adds some unnecessary overhead in platform code. The configuration
 as already been removed from platform code, this patch checks for any
 over-riding configurations. If there aren't any, the default is used.

 Cc: linux-i2c@vger.kernel.org
 Acked-by: srinidhi kasagar srinidhi.kasa...@stericsson.com
 Acked-by: Linus Walleij linus.wall...@linaro.org
 Signed-off-by: Lee Jones lee.jo...@linaro.org

This still does not apply for me on v3.6-rc1 what did you base
this patch on?

Applying: i2c: Add default configuration into the Nomadik I2C driver.
error: patch failed: drivers/i2c/busses/i2c-nomadik.c:899
error: drivers/i2c/busses/i2c-nomadik.c: patch does not apply
Patch failed at 0001 i2c: Add default configuration into the Nomadik I2C driver.
When you have resolved this problem run git am --resolved.
If you would prefer to skip this patch, instead run git am --skip.
To restore the original branch and stop patching run git am --abort.

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line unsubscribe linux-i2c in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver.

2012-08-06 Thread Lee Jones
On Mon, Aug 06, 2012 at 04:00:04PM +0200, Linus Walleij wrote:
 On Mon, Aug 6, 2012 at 2:25 PM, Lee Jones lee.jo...@linaro.org wrote:
 
  At this moment in time there is only one known configuration for the
  Nomadik I2C driver. By not holding that configuration in the driver
  adds some unnecessary overhead in platform code. The configuration
  as already been removed from platform code, this patch checks for any
  over-riding configurations. If there aren't any, the default is used.
 
  Cc: linux-i2c@vger.kernel.org
  Acked-by: srinidhi kasagar srinidhi.kasa...@stericsson.com
  Acked-by: Linus Walleij linus.wall...@linaro.org
  Signed-off-by: Lee Jones lee.jo...@linaro.org
 
 This still does not apply for me on v3.6-rc1 what did you base
 this patch on?
 
 Applying: i2c: Add default configuration into the Nomadik I2C driver.
 error: patch failed: drivers/i2c/busses/i2c-nomadik.c:899
 error: drivers/i2c/busses/i2c-nomadik.c: patch does not apply
 Patch failed at 0001 i2c: Add default configuration into the Nomadik I2C 
 driver.
 When you have resolved this problem run git am --resolved.
 If you would prefer to skip this patch, instead run git am --skip.
 To restore the original branch and stop patching run git am --abort.

Ah, my mistake.

I'll rebase to latest and re-submit.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-i2c in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] i2c: convert struct i2c_msg initialization to C99 format

2012-08-06 Thread Jean Delvare
On Mon, 6 Aug 2012 14:27:47 +0530, Shubhrajyoti D wrote:
 Convert the struct i2c_msg initialization to C99 format. This makes
 maintaining and editing the code simpler. Also helps once other fields
 like transferred are added in future.
 
 Signed-off-by: Shubhrajyoti D shubhrajy...@ti.com
 ---
  drivers/i2c/i2c-core.c |   17 ++---
  1 files changed, 14 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
 index 2efa56c..c77a1ac 100644
 --- a/drivers/i2c/i2c-core.c
 +++ b/drivers/i2c/i2c-core.c
 @@ -1971,12 +1971,23 @@ static s32 i2c_smbus_xfer_emulated(struct i2c_adapter 
 *adapter, u16 addr,
   unsigned char msgbuf0[I2C_SMBUS_BLOCK_MAX+3];
   unsigned char msgbuf1[I2C_SMBUS_BLOCK_MAX+2];
   int num = read_write == I2C_SMBUS_READ ? 2 : 1;
 - struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 },
 -   { addr, flags | I2C_M_RD, 0, msgbuf1 }
 - };
   int i;
   u8 partial_pec = 0;
   int status;
 + struct i2c_msg msg[2] = {
 + {
 + .addr = addr,
 + .flags = flags,
 + .len = 1,
 + .buf = msgbuf0,
 +  },
 + {
 + .addr = addr,
 + .flags = flags | I2C_M_RD,
 + .len = 0,
 + .buf = msgbuf1,
 + },
 + };
  
   msgbuf0[0] = command;
   switch (size) {

Applied, thanks.

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


[PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver.

2012-08-06 Thread Lee Jones
At this moment in time there is only one known configuration for the
Nomadik I2C driver. By not holding that configuration in the driver
adds some unnecessary overhead in platform code. The configuration
as already been removed from platform code, this patch checks for any
over-riding configurations. If there aren't any, the default is used.

Cc: linux-i2c@vger.kernel.org
Acked-by: srinidhi kasagar srinidhi.kasa...@stericsson.com
Acked-by: Linus Walleij linus.wall...@linaro.org
Signed-off-by: Lee Jones lee.jo...@linaro.org
---
 drivers/i2c/busses/i2c-nomadik.c |   28 ++--
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 5e6f1ee..e42e526 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -350,10 +350,6 @@ static void setup_i2c_controller(struct nmk_i2c_dev *dev)
 
i2c_clk = clk_get_rate(dev-clk);
 
-   /* fallback to std. mode if machine has not provided it */
-   if (dev-cfg.clk_freq == 0)
-   dev-cfg.clk_freq = 10;
-
/*
 * The spec says, in case of std. mode the divider is
 * 2 whereas it is 3 for fast and fastplus mode of
@@ -911,20 +907,32 @@ static const struct i2c_algorithm nmk_i2c_algo = {
.functionality  = nmk_i2c_functionality
 };
 
+static struct nmk_i2c_controller u8500_i2c = {
+   /*
+* Slave data setup time; 250ns, 100ns, and 10ns, which
+* is 14, 6 and 2 respectively for a 48Mhz i2c clock.
+*/
+   .slsu   = 0xe,
+   .tft= 1,  /* Tx FIFO threshold */
+   .rft= 8,  /* Rx FIFO threshold */
+   .clk_freq   = 40, /* fast mode operation */
+   .timeout= 200,/* Slave response timeout(ms) */
+   .sm = I2C_FREQ_MODE_FAST,
+};
+
 static atomic_t adapter_id = ATOMIC_INIT(0);
 
 static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
 {
int ret = 0;
-   struct nmk_i2c_controller *pdata =
-   adev-dev.platform_data;
+   struct nmk_i2c_controller *pdata = pdev-dev.platform_data;
struct nmk_i2c_dev  *dev;
struct i2c_adapter *adap;
 
-   if (!pdata) {
-   dev_warn(adev-dev, no platform data\n);
-   return -ENODEV;
-   }
+   if (!pdata)
+   /* No i2c configuration found, using the default. */
+   pdata = u8500_i2c;
+
dev = kzalloc(sizeof(struct nmk_i2c_dev), GFP_KERNEL);
if (!dev) {
dev_err(adev-dev, cannot allocate memory\n);
-- 
1.7.9.5

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


Re: [PATCH 1/1] i2c: Add default configuration into the Nomadik I2C driver.

2012-08-06 Thread Lee Jones
 This still does not apply for me on v3.6-rc1 what did you base
 this patch on?

Resent based on v3.6-rc1, sorry for the mixup.

-- 
Lee Jones
Linaro ST-Ericsson Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line unsubscribe linux-i2c in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/1 v2] i2c: Add default configuration into the Nomadik I2C driver.

2012-08-06 Thread Lee Jones
Looks like I introduced a merge error on the last patch. Trying again:

From: Lee Jones lee.jo...@linaro.org
Date: Mon, 6 Aug 2012 11:04:14 +0100
Subject: [PATCH 1/1 v2] i2c: Add default configuration into the Nomadik I2C
 driver.

At this moment in time there is only one known configuration for the
Nomadik I2C driver. By not holding that configuration in the driver
adds some unnecessary overhead in platform code. The configuration
as already been removed from platform code, this patch checks for any
over-riding configurations. If there aren't any, the default is used.

Cc: linux-i2c@vger.kernel.org
Acked-by: srinidhi kasagar srinidhi.kasa...@stericsson.com
Acked-by: Linus Walleij linus.wall...@linaro.org
Signed-off-by: Lee Jones lee.jo...@linaro.org
---
 .../mali/mali400ko/driver/src/devicedrv/mali/arch  |1 +
 drivers/i2c/busses/i2c-nomadik.c   |   28 +---
 2 files changed, 19 insertions(+), 10 deletions(-)
 create mode 12 drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/arch

diff --git a/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/arch 
b/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/arch
new file mode 12
index 000..427334b
--- /dev/null
+++ b/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/arch
@@ -0,0 +1 @@
+/home/ljkenny/projects/linaro/snowball/snowball/drivers/gpu/mali/mali400ko/driver/src/devicedrv/mali/arch-ux500
\ No newline at end of file
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 5e6f1ee..61b00ed 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -350,10 +350,6 @@ static void setup_i2c_controller(struct nmk_i2c_dev *dev)
 
i2c_clk = clk_get_rate(dev-clk);
 
-   /* fallback to std. mode if machine has not provided it */
-   if (dev-cfg.clk_freq == 0)
-   dev-cfg.clk_freq = 10;
-
/*
 * The spec says, in case of std. mode the divider is
 * 2 whereas it is 3 for fast and fastplus mode of
@@ -911,20 +907,32 @@ static const struct i2c_algorithm nmk_i2c_algo = {
.functionality  = nmk_i2c_functionality
 };
 
+static struct nmk_i2c_controller u8500_i2c = {
+   /*
+* Slave data setup time; 250ns, 100ns, and 10ns, which
+* is 14, 6 and 2 respectively for a 48Mhz i2c clock.
+*/
+   .slsu   = 0xe,
+   .tft= 1,  /* Tx FIFO threshold */
+   .rft= 8,  /* Rx FIFO threshold */
+   .clk_freq   = 40, /* fast mode operation */
+   .timeout= 200,/* Slave response timeout(ms) */
+   .sm = I2C_FREQ_MODE_FAST,
+};
+
 static atomic_t adapter_id = ATOMIC_INIT(0);
 
 static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
 {
int ret = 0;
-   struct nmk_i2c_controller *pdata =
-   adev-dev.platform_data;
+   struct nmk_i2c_controller *pdata = adev-dev.platform_data;
struct nmk_i2c_dev  *dev;
struct i2c_adapter *adap;
 
-   if (!pdata) {
-   dev_warn(adev-dev, no platform data\n);
-   return -ENODEV;
-   }
+   if (!pdata)
+   /* No i2c configuration found, using the default. */
+   pdata = u8500_i2c;
+
dev = kzalloc(sizeof(struct nmk_i2c_dev), GFP_KERNEL);
if (!dev) {
dev_err(adev-dev, cannot allocate memory\n);
-- 
1.7.9.5
--
To unsubscribe from this list: send the line unsubscribe linux-i2c in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] i2c: fix i2c-i801.c printk format warning

2012-08-06 Thread Jean Delvare
Hi Randy,

On Mon, 06 Aug 2012 09:10:47 -0700, Randy Dunlap wrote:
 From: Randy Dunlap rdun...@xenotime.net
 
 Fix printk format warning.  ARRAY_SIZE() uses sizeof(),
 which is size_t, so use %zu to print it.
 
 drivers/i2c/busses/i2c-i801.c: In function 'i801_add_mux':
 drivers/i2c/busses/i2c-i801.c:1043:4: warning: format '%lu' expects type 
 'long unsigned int', but argument 3 has type 'unsigned int'
 
 Signed-off-by: Randy Dunlap rdun...@xenotime.net
 Cc: Mark D. Studebaker mdsxyz...@yahoo.com
 Cc: Jean Delvare kh...@linux-fr.org
 ---
  drivers/i2c/busses/i2c-i801.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 --- linux-next-20120806.orig/drivers/i2c/busses/i2c-i801.c
 +++ linux-next-20120806/drivers/i2c/busses/i2c-i801.c
 @@ -1039,7 +1039,7 @@ static int __devinit i801_add_mux(struct
  
   /* Find absolute GPIO pin numbers */
   if (ARRAY_SIZE(priv-mux_priv)  mux_config-n_gpios) {
 - dev_err(dev, i801_priv.mux_priv too small (%lu, need %d)\n,
 + dev_err(dev, i801_priv.mux_priv too small (%zu, need %d)\n,
   ARRAY_SIZE(priv-mux_priv), mux_config-n_gpios);
   return -ENODEV;
   }

Good catch once again, thanks a lot. As the offending patch is still
not upstream, I've folded your fix into it.

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


Re: [PATCH] I2C: OMAP: xfer: fix runtime PM get/put balance on error

2012-08-06 Thread Kevin Hilman
Hi Wolfram,

Kevin Hilman khil...@ti.com writes:

 In omap_i2c_xfer(), ensure pm_runtime_put() is called, even on
 failure.

 Without this, after a failed xfer, the runtime PM usecount will have
 been incremented, but not decremented causing the usecount to never
 reach zero after a failure.  This keeps the device always runtime PM
 enabled which keeps the enclosing power domain active, and prevents
 full-chip retention/off from happening during idle.

 Cc: Shubhrajyoti D shubhrajy...@ti.com
 Signed-off-by: Kevin Hilman khil...@ti.com
 ---
 This patch applies to current i2c-embedded/for-next branch

This one is needed for v3.6.  Can you queue this up as a fix for
v3.6-rc?

Thanks,

Kevin

  drivers/i2c/busses/i2c-omap.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
 index 9895fa7..b105733 100644
 --- a/drivers/i2c/busses/i2c-omap.c
 +++ b/drivers/i2c/busses/i2c-omap.c
 @@ -582,7 +582,7 @@ omap_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg 
 msgs[], int num)
  
   r = pm_runtime_get_sync(dev-dev);
   if (IS_ERR_VALUE(r))
 - return r;
 + goto out;
  
   r = omap_i2c_wait_for_bb(dev);
   if (r  0)
--
To unsubscribe from this list: send the line unsubscribe linux-i2c in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html