[PATCH V2] mmc: core: eMMC4.5 Add the timeout for switch

2011-09-01 Thread Girish K S
V2- The datatype of the cmd6_timeout is changed from u8 to unsigned int,
as it can hold a value upto 255*10=2550 and the data assignment in
mmc_switch function.
This patch adds the code to handle the default timeout
for switch command.
For eMMC 4.5 devices if timeout is not specified for the switch
command while accessing a specific field,then the default timeout
shall be used to timeout. Specification says there is no timeout
defined while accessing BKOPS_START, SANITIZE_START, FLUSH_CACHE
field(so these fields are excluded).

Signed-off-by: Girish K S girish.shivananja...@linaro.org
---
 drivers/mmc/core/mmc.c |5 +
 drivers/mmc/core/mmc_ops.c |8 
 include/linux/mmc/card.h   |1 +
 include/linux/mmc/mmc.h|4 
 4 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 5700b1c..5b9fb6a 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -405,6 +405,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8 
*ext_csd)
if (card-ext_csd.rev = 5)
card-ext_csd.rel_param = ext_csd[EXT_CSD_WR_REL_PARAM];
 
+   if (card-ext_csd.rev  5) {
+   /* (eMMC 4.5)timeout is expressed in units of 10 ms*/
+   card-ext_csd.cmd6_timeout = ext_csd[EXT_CSD_CMD6_TIME]*10;
+   }
+
if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
card-erased_byte = 0xFF;
else
diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
index 770c3d0..c4d82f4 100644
--- a/drivers/mmc/core/mmc_ops.c
+++ b/drivers/mmc/core/mmc_ops.c
@@ -394,6 +394,14 @@ int mmc_switch(struct mmc_card *card, u8 set, u8 index, u8 
value,
cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
cmd.cmd_timeout_ms = timeout_ms;
 
+   /* timeout is not defined for below command indexes (eMMC 4.5) */
+   if ((timeout_ms == 0)   
+   (card-ext_csd.rev  5) 
+   (index != EXT_CSD_BKOPS_START)  
+   (index != EXT_CSD_SANITIZE_START)   
+   (index != EXT_CSD_FLUSH_CACHE))
+   cmd.cmd_timeout_ms = card-ext_csd.cmd6_timeout;
+
err = mmc_wait_for_cmd(card-host, cmd, MMC_CMD_RETRIES);
if (err)
return err;
diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
index b460fc2..ef88412 100644
--- a/include/linux/mmc/card.h
+++ b/include/linux/mmc/card.h
@@ -50,6 +50,7 @@ struct mmc_ext_csd {
u8  rel_sectors;
u8  rel_param;
u8  part_config;
+   unsigned intcmd6_timeout;   /* timeout in ms */
unsigned intpart_time;  /* Units: ms */
unsigned intsa_timeout; /* Units: 100ns */
unsigned inths_max_dtr;
diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
index 5a794cb..a23f836 100644
--- a/include/linux/mmc/mmc.h
+++ b/include/linux/mmc/mmc.h
@@ -270,8 +270,11 @@ struct _mmc_csd {
  * EXT_CSD fields
  */
 
+#define EXT_CSD_FLUSH_CACHE32  /* R/W */
 #define EXT_CSD_PARTITION_ATTRIBUTE156 /* R/W */
 #define EXT_CSD_PARTITION_SUPPORT  160 /* RO */
+#define EXT_CSD_BKOPS_START164 /* R/W */
+#define EXT_CSD_SANITIZE_START 165 /* R/W */
 #define EXT_CSD_WR_REL_PARAM   166 /* RO */
 #define EXT_CSD_ERASE_GROUP_DEF175 /* R/W */
 #define EXT_CSD_PART_CONFIG179 /* R/W */
@@ -293,6 +296,7 @@ struct _mmc_csd {
 #define EXT_CSD_SEC_ERASE_MULT 230 /* RO */
 #define EXT_CSD_SEC_FEATURE_SUPPORT231 /* RO */
 #define EXT_CSD_TRIM_MULT  232 /* RO */
+#define EXT_CSD_CMD6_TIME  248 /* RO */
 
 /*
  * EXT_CSD field definitions
-- 
1.7.1

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 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] mmc: core: eMMC4.5 Add the timeout for switch

2011-09-01 Thread Seungwon Jeon
Hi Girish,

Girish K S wrote:
 
 V2- The datatype of the cmd6_timeout is changed from u8 to unsigned int,
 as it can hold a value upto 255*10=2550.
   This patch adds the code to handle the default timeout
 for switch command.
 For eMMC 4.5 devices if timeout is not specified for the switch
 command while accessing a specific field,then the default timeout
 shall be used to timeout. Specification says there is no timeout
 defined while accessing BKOPS_START, SANITIZE_START, FLUSH_CACHE
 field(so these fields are excluded).
 
 Signed-off-by: Girish K S girish.shivananja...@linaro.org
 ---
  drivers/mmc/core/mmc.c |5 +
  drivers/mmc/core/mmc_ops.c |8 
  include/linux/mmc/card.h   |1 +
  include/linux/mmc/mmc.h|4 
  4 files changed, 18 insertions(+), 0 deletions(-)
 
 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
 index 5700b1c..5b9fb6a 100644
 --- a/drivers/mmc/core/mmc.c
 +++ b/drivers/mmc/core/mmc.c
 @@ -405,6 +405,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8
 *ext_csd)
   if (card-ext_csd.rev = 5)
   card-ext_csd.rel_param = ext_csd[EXT_CSD_WR_REL_PARAM];
 
 + if (card-ext_csd.rev  5) {
 + /* (eMMC 4.5)timeout is expressed in units of 10 ms*/
 + card-ext_csd.cmd6_timeout = ext_csd[EXT_CSD_CMD6_TIME]*10;
 + }
 +
   if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
   card-erased_byte = 0xFF;
   else
 diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
 index 770c3d0..c4d82f4 100644
 --- a/drivers/mmc/core/mmc_ops.c
 +++ b/drivers/mmc/core/mmc_ops.c
 @@ -394,6 +394,14 @@ int mmc_switch(struct mmc_card *card, u8 set, u8
 index, u8 value,
   cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
   cmd.cmd_timeout_ms = timeout_ms;
 
 + /* timeout is not defined for below command indexes (eMMC 4.5) */
 + if ((timeout_ms == 0)   
 + (card-ext_csd-rev  5)
 + (index != EXT_CSD_BKOPS_START)  
 + (index != EXT_CSD_SANITIZE_START)   
 + (index != EXT_CSD_FLUSH_CACHE))
 + cmd.cmd_timeout_ms = card-ext_csd-cmd6_timeout;
 +
mmc_switch doesn't need to take over '0' value for timeout_ms except for 
undefined timeout(Background operation, sanitize, etc)
It is possible and good to pass the argument of specific timeout_ms(including 
default cmd6 timeout) explicitly rather than '0',
if timeout value for cmd6 is defined.
Then, mmc_switch maybe doesn't need to handle timeout for some exception case.

   err = mmc_wait_for_cmd(card-host, cmd, MMC_CMD_RETRIES);
   if (err)
   return err;
 diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
 index b460fc2..ef88412 100644
 --- a/include/linux/mmc/card.h
 +++ b/include/linux/mmc/card.h
 @@ -50,6 +50,7 @@ struct mmc_ext_csd {
   u8  rel_sectors;
   u8  rel_param;
   u8  part_config;
 + unsigned intcmd6_timeout;   /* timeout in ms */
   unsigned intpart_time;  /* Units: ms */
   unsigned intsa_timeout; /* Units: 100ns */
   unsigned inths_max_dtr;
 diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
 index 5a794cb..a23f836 100644
 --- a/include/linux/mmc/mmc.h
 +++ b/include/linux/mmc/mmc.h
 @@ -270,8 +270,11 @@ struct _mmc_csd {
   * EXT_CSD fields
   */
 
 +#define EXT_CSD_FLUSH_CACHE  32  /* R/W */
  #define EXT_CSD_PARTITION_ATTRIBUTE  156 /* R/W */
  #define EXT_CSD_PARTITION_SUPPORT160 /* RO */
 +#define EXT_CSD_BKOPS_START  164 /* R/W */
 +#define EXT_CSD_SANITIZE_START   165 /* R/W */
  #define EXT_CSD_WR_REL_PARAM 166 /* RO */
  #define EXT_CSD_ERASE_GROUP_DEF  175 /* R/W */
  #define EXT_CSD_PART_CONFIG  179 /* R/W */
 @@ -293,6 +296,7 @@ struct _mmc_csd {
  #define EXT_CSD_SEC_ERASE_MULT   230 /* RO */
  #define EXT_CSD_SEC_FEATURE_SUPPORT  231 /* RO */
  #define EXT_CSD_TRIM_MULT232 /* RO */
 +#define EXT_CSD_CMD6_TIME248 /* RO */
 
  /*
   * EXT_CSD field definitions
 --
 1.7.1
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-mmc in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc 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] mmc: core: eMMC4.5 Add the timeout for switch

2011-09-01 Thread Girish K S
Hello Mr Jeon,
  In case if the timeout is specified by the
calling function, the code in this patch will not be executed. But if
some command other than the three are called with 0, then this code
will make sure that atleast the default value is used to timeout.

regards
Girish K S

On 1 September 2011 11:50, Seungwon Jeon tgih@samsung.com wrote:
 Hi Girish,

 Girish K S wrote:

 V2- The datatype of the cmd6_timeout is changed from u8 to unsigned int,
 as it can hold a value upto 255*10=2550.
       This patch adds the code to handle the default timeout
 for switch command.
 For eMMC 4.5 devices if timeout is not specified for the switch
 command while accessing a specific field,then the default timeout
 shall be used to timeout. Specification says there is no timeout
 defined while accessing BKOPS_START, SANITIZE_START, FLUSH_CACHE
 field(so these fields are excluded).

 Signed-off-by: Girish K S girish.shivananja...@linaro.org
 ---
  drivers/mmc/core/mmc.c     |    5 +
  drivers/mmc/core/mmc_ops.c |    8 
  include/linux/mmc/card.h   |    1 +
  include/linux/mmc/mmc.h    |    4 
  4 files changed, 18 insertions(+), 0 deletions(-)

 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
 index 5700b1c..5b9fb6a 100644
 --- a/drivers/mmc/core/mmc.c
 +++ b/drivers/mmc/core/mmc.c
 @@ -405,6 +405,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8
 *ext_csd)
       if (card-ext_csd.rev = 5)
               card-ext_csd.rel_param = ext_csd[EXT_CSD_WR_REL_PARAM];

 +     if (card-ext_csd.rev  5) {
 +             /* (eMMC 4.5)timeout is expressed in units of 10 ms*/
 +             card-ext_csd.cmd6_timeout = ext_csd[EXT_CSD_CMD6_TIME]*10;
 +     }
 +
       if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
               card-erased_byte = 0xFF;
       else
 diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
 index 770c3d0..c4d82f4 100644
 --- a/drivers/mmc/core/mmc_ops.c
 +++ b/drivers/mmc/core/mmc_ops.c
 @@ -394,6 +394,14 @@ int mmc_switch(struct mmc_card *card, u8 set, u8
 index, u8 value,
       cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
       cmd.cmd_timeout_ms = timeout_ms;

 +     /* timeout is not defined for below command indexes (eMMC 4.5) */
 +     if ((timeout_ms == 0)                                   
 +             (card-ext_csd-rev  5)                        
 +             (index != EXT_CSD_BKOPS_START)          
 +             (index != EXT_CSD_SANITIZE_START)       
 +             (index != EXT_CSD_FLUSH_CACHE))
 +                     cmd.cmd_timeout_ms = card-ext_csd-cmd6_timeout;
 +
 mmc_switch doesn't need to take over '0' value for timeout_ms except for 
 undefined timeout(Background operation, sanitize, etc)
 It is possible and good to pass the argument of specific timeout_ms(including 
 default cmd6 timeout) explicitly rather than '0',
 if timeout value for cmd6 is defined.
 Then, mmc_switch maybe doesn't need to handle timeout for some exception case.

       err = mmc_wait_for_cmd(card-host, cmd, MMC_CMD_RETRIES);
       if (err)
               return err;
 diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
 index b460fc2..ef88412 100644
 --- a/include/linux/mmc/card.h
 +++ b/include/linux/mmc/card.h
 @@ -50,6 +50,7 @@ struct mmc_ext_csd {
       u8                      rel_sectors;
       u8                      rel_param;
       u8                      part_config;
 +     unsigned int            cmd6_timeout;   /* timeout in ms */
       unsigned int            part_time;              /* Units: ms */
       unsigned int            sa_timeout;             /* Units: 100ns */
       unsigned int            hs_max_dtr;
 diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
 index 5a794cb..a23f836 100644
 --- a/include/linux/mmc/mmc.h
 +++ b/include/linux/mmc/mmc.h
 @@ -270,8 +270,11 @@ struct _mmc_csd {
   * EXT_CSD fields
   */

 +#define EXT_CSD_FLUSH_CACHE          32      /* R/W */
  #define EXT_CSD_PARTITION_ATTRIBUTE  156     /* R/W */
  #define EXT_CSD_PARTITION_SUPPORT    160     /* RO */
 +#define EXT_CSD_BKOPS_START          164     /* R/W */
 +#define EXT_CSD_SANITIZE_START               165     /* R/W */
  #define EXT_CSD_WR_REL_PARAM         166     /* RO */
  #define EXT_CSD_ERASE_GROUP_DEF              175     /* R/W */
  #define EXT_CSD_PART_CONFIG          179     /* R/W */
 @@ -293,6 +296,7 @@ struct _mmc_csd {
  #define EXT_CSD_SEC_ERASE_MULT               230     /* RO */
  #define EXT_CSD_SEC_FEATURE_SUPPORT  231     /* RO */
  #define EXT_CSD_TRIM_MULT            232     /* RO */
 +#define EXT_CSD_CMD6_TIME            248     /* RO */

  /*
   * EXT_CSD field definitions
 --
 1.7.1

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


--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in
the body of a 

Re: [PATCH V2] mmc: core: eMMC4.5 Add the timeout for switch

2011-09-01 Thread Jaehoon Chung
Hi Girish.

I agreed for Mr.Jeon's opinion.
I think that need not to check for any exception case.
(Mr.Jeon mentioned the below comment, just using default cmd6_timeout)

Thanks,
Jaehoon Chung

Girish K S wrote:

 Hello Mr Jeon,
   In case if the timeout is specified by the
 calling function, the code in this patch will not be executed. But if
 some command other than the three are called with 0, then this code
 will make sure that atleast the default value is used to timeout.
 
 regards
 Girish K S
 
 On 1 September 2011 11:50, Seungwon Jeon tgih@samsung.com wrote:
 Hi Girish,

 Girish K S wrote:
 V2- The datatype of the cmd6_timeout is changed from u8 to unsigned int,
 as it can hold a value upto 255*10=2550.
   This patch adds the code to handle the default timeout
 for switch command.
 For eMMC 4.5 devices if timeout is not specified for the switch
 command while accessing a specific field,then the default timeout
 shall be used to timeout. Specification says there is no timeout
 defined while accessing BKOPS_START, SANITIZE_START, FLUSH_CACHE
 field(so these fields are excluded).

 Signed-off-by: Girish K S girish.shivananja...@linaro.org
 ---
  drivers/mmc/core/mmc.c |5 +
  drivers/mmc/core/mmc_ops.c |8 
  include/linux/mmc/card.h   |1 +
  include/linux/mmc/mmc.h|4 
  4 files changed, 18 insertions(+), 0 deletions(-)

 diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
 index 5700b1c..5b9fb6a 100644
 --- a/drivers/mmc/core/mmc.c
 +++ b/drivers/mmc/core/mmc.c
 @@ -405,6 +405,11 @@ static int mmc_read_ext_csd(struct mmc_card *card, u8
 *ext_csd)
   if (card-ext_csd.rev = 5)
   card-ext_csd.rel_param = ext_csd[EXT_CSD_WR_REL_PARAM];

 + if (card-ext_csd.rev  5) {
 + /* (eMMC 4.5)timeout is expressed in units of 10 ms*/
 + card-ext_csd.cmd6_timeout = ext_csd[EXT_CSD_CMD6_TIME]*10;
 + }
 +
   if (ext_csd[EXT_CSD_ERASED_MEM_CONT])
   card-erased_byte = 0xFF;
   else
 diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c
 index 770c3d0..c4d82f4 100644
 --- a/drivers/mmc/core/mmc_ops.c
 +++ b/drivers/mmc/core/mmc_ops.c
 @@ -394,6 +394,14 @@ int mmc_switch(struct mmc_card *card, u8 set, u8
 index, u8 value,
   cmd.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC;
   cmd.cmd_timeout_ms = timeout_ms;

 + /* timeout is not defined for below command indexes (eMMC 4.5) */
 + if ((timeout_ms == 0)   
 + (card-ext_csd-rev  5)
 + (index != EXT_CSD_BKOPS_START)  
 + (index != EXT_CSD_SANITIZE_START)   
 + (index != EXT_CSD_FLUSH_CACHE))
 + cmd.cmd_timeout_ms = card-ext_csd-cmd6_timeout;
 +
 mmc_switch doesn't need to take over '0' value for timeout_ms except for 
 undefined timeout(Background operation, sanitize, etc)
 It is possible and good to pass the argument of specific 
 timeout_ms(including default cmd6 timeout) explicitly rather than '0',
 if timeout value for cmd6 is defined.
 Then, mmc_switch maybe doesn't need to handle timeout for some exception 
 case.

   err = mmc_wait_for_cmd(card-host, cmd, MMC_CMD_RETRIES);
   if (err)
   return err;
 diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h
 index b460fc2..ef88412 100644
 --- a/include/linux/mmc/card.h
 +++ b/include/linux/mmc/card.h
 @@ -50,6 +50,7 @@ struct mmc_ext_csd {
   u8  rel_sectors;
   u8  rel_param;
   u8  part_config;
 + unsigned intcmd6_timeout;   /* timeout in ms */
   unsigned intpart_time;  /* Units: ms */
   unsigned intsa_timeout; /* Units: 100ns */
   unsigned inths_max_dtr;
 diff --git a/include/linux/mmc/mmc.h b/include/linux/mmc/mmc.h
 index 5a794cb..a23f836 100644
 --- a/include/linux/mmc/mmc.h
 +++ b/include/linux/mmc/mmc.h
 @@ -270,8 +270,11 @@ struct _mmc_csd {
   * EXT_CSD fields
   */

 +#define EXT_CSD_FLUSH_CACHE  32  /* R/W */
  #define EXT_CSD_PARTITION_ATTRIBUTE  156 /* R/W */
  #define EXT_CSD_PARTITION_SUPPORT160 /* RO */
 +#define EXT_CSD_BKOPS_START  164 /* R/W */
 +#define EXT_CSD_SANITIZE_START   165 /* R/W */
  #define EXT_CSD_WR_REL_PARAM 166 /* RO */
  #define EXT_CSD_ERASE_GROUP_DEF  175 /* R/W */
  #define EXT_CSD_PART_CONFIG  179 /* R/W */
 @@ -293,6 +296,7 @@ struct _mmc_csd {
  #define EXT_CSD_SEC_ERASE_MULT   230 /* RO */
  #define EXT_CSD_SEC_FEATURE_SUPPORT  231 /* RO */
  #define EXT_CSD_TRIM_MULT232 /* RO */
 +#define EXT_CSD_CMD6_TIME248 /* RO */

  /*
   * EXT_CSD field definitions
 --
 1.7.1

 --
 To unsubscribe from this list: send the line unsubscribe 

Re: [PATCH 4/6] DMA: PL330: Add device tree support

2011-09-01 Thread Thomas Abraham
Hi Rob,

On 31 August 2011 21:34, Rob Herring robherri...@gmail.com wrote:
 Thomas,

[...]


 As it says in Documentation/devicetree/bindings/arm/primecell.txt, you
 should have arm,primecell and a value for the specific peripheral. It
 should be in order of most specific to least specific.

 What Linux uses currently from the binding is a bit irrelevant. The
 binding is supposed to be future proof. An OS could choose to not use
 the primecell ID at all and only match with compatible string.

Thanks for pointing this out. arm,pl330 has been added as another
mandatory compatible string for the pl330 device node.

Regards,
Thomas.


 Rob


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


[PATCH v2 0/6] Add device tree support for PL330 dma controller driver

2011-09-01 Thread Thomas Abraham
This patchset adds device tree support for PL330 driver and uses it
to add device tree support for Samsung platforms, specifically Exynos4.

First patch moves the pl330_filter function from Samsung specific wrappers
to pl330 dma driver and also adds a check to ensure that the filter function
proceeds only if it the dma channel being investigated belongs to pl330
dma controller instance.

Second patch adds support to infer the direction of the dma transfer
using the direction specified with the transfer request instead of
including this information in the platform data. This simlifies the
addition of device tree support. Third patch simplifies the platform
data for Exynos4 pl330 dma controllers. Similar patches simplifying
the platform data for other Samsung platforms is under development.

Fourth patch adds device tree support for pl330 dma controller driver.
A dma channel is represented using a phandle of the dma controller
node and the channel id within that controller. Client driver request
a dma channel using the phandle and channel id pair. Correspondingly,
the pl330 filter function has been modified to lookup a channel based
on this value.

Fifth patch adds device tree support for Samsung's DMA engine wrappers.
Client drivers retrive the channel property from their device node and
pass it to the wrappers. The wrapper functions use the property value
as the filter function parameter. Sixth patch restricts the usage of
pl330 device and platform data instances to non-dt platforms.

This patchset is based on Linux 3.1-rc3 with the following patch sets.

* To use DMA generic APIs for Samsung DMA - v7 - (15 patches)
* ARM: Samsung: use dma-pl330 device name for clock (3 patches)
* ARM: S5P64X0: Add the devname for DMA clock.
* ARM: SAMSUNG: register the second instance of PL330 DMAC (3 patches)

Changes since v1:
- Removed arm,pl330-pdma and arm,pl330-mdma compatible values.
- Removed arm,primecell-periphid and arm,pl330-peri-reqs
  property requirements.

Thomas Abraham (6):
  DMA: PL330: move filter function into driver
  DMA: PL330: Infer transfer direction from transfer request instead of 
platform data
  ARM: EXYNOS4: Modify platform data for pl330 driver
  DMA: PL330: Add device tree support
  ARM: SAMSUNG: Add device tree support for pl330 dma engine wrappers
  ARM: EXYNOS4: Limit usage of pl330 device instance to non-dt build

 .../devicetree/bindings/dma/arm-pl330.txt  |   29 +++
 arch/arm/mach-exynos4/Kconfig  |7 +
 arch/arm/mach-exynos4/Makefile |3 +-
 arch/arm/mach-exynos4/dma.c|  223 ++--
 arch/arm/plat-samsung/dma-ops.c|   15 +-
 arch/arm/plat-samsung/include/plat/dma-ops.h   |1 +
 arch/arm/plat-samsung/include/plat/dma-pl330.h |3 +-
 drivers/dma/pl330.c|  101 +
 include/linux/amba/pl330.h |   15 +-
 9 files changed, 170 insertions(+), 227 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/arm-pl330.txt

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


[PATCH v2 1/6] DMA: PL330: move filter function into driver

2011-09-01 Thread Thomas Abraham
The dma channel selection filter function is moved from plat-samsung
into the pl330 driver. In additon to that, a check is added in the
filter function to ensure that the channel on which the filter has
been invoked is pl330 channel instance (and avoid any incorrect
access of chan-private in a system with multiple types of DMA
drivers).

Suggested-by: Russell King rmk+ker...@arm.linux.org.uk
Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
---
 arch/arm/plat-samsung/dma-ops.c |6 --
 drivers/dma/pl330.c |   15 +++
 include/linux/amba/pl330.h  |2 ++
 3 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/arch/arm/plat-samsung/dma-ops.c b/arch/arm/plat-samsung/dma-ops.c
index 6e3d9ab..8d18425 100644
--- a/arch/arm/plat-samsung/dma-ops.c
+++ b/arch/arm/plat-samsung/dma-ops.c
@@ -17,12 +17,6 @@
 
 #include mach/dma.h
 
-static inline bool pl330_filter(struct dma_chan *chan, void *param)
-{
-   struct dma_pl330_peri *peri = chan-private;
-   return peri-peri_id == (unsigned)param;
-}
-
 static unsigned samsung_dmadev_request(enum dma_ch dma_ch,
struct samsung_dma_info *info)
 {
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 95976cf..7df2516 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -116,6 +116,9 @@ struct dma_pl330_desc {
struct dma_pl330_chan *pchan;
 };
 
+/* forward declaration */
+static struct amba_driver pl330_driver;
+
 static inline struct dma_pl330_chan *
 to_pchan(struct dma_chan *ch)
 {
@@ -267,6 +270,18 @@ static void dma_pl330_rqcb(void *token, enum pl330_op_err 
err)
tasklet_schedule(pch-task);
 }
 
+bool pl330_filter(struct dma_chan *chan, void *param)
+{
+   struct dma_pl330_peri *peri;
+
+   if (chan-device-dev-driver != pl330_driver.drv)
+   return false;
+
+   peri = chan-private;
+   return peri-peri_id == (unsigned)param;
+}
+EXPORT_SYMBOL(pl330_filter);
+
 static int pl330_alloc_chan_resources(struct dma_chan *chan)
 {
struct dma_pl330_chan *pch = to_pchan(chan);
diff --git a/include/linux/amba/pl330.h b/include/linux/amba/pl330.h
index d12f077..6db72da 100644
--- a/include/linux/amba/pl330.h
+++ b/include/linux/amba/pl330.h
@@ -12,6 +12,7 @@
 #ifndef__AMBA_PL330_H_
 #define__AMBA_PL330_H_
 
+#include linux/dmaengine.h
 #include asm/hardware/pl330.h
 
 struct dma_pl330_peri {
@@ -38,4 +39,5 @@ struct dma_pl330_platdata {
unsigned mcbuf_sz;
 };
 
+extern bool pl330_filter(struct dma_chan *chan, void *param);
 #endif /* __AMBA_PL330_H_ */
-- 
1.6.6.rc2

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


[PATCH v2 3/6] ARM: EXYNOS4: Modify platform data for pl330 driver

2011-09-01 Thread Thomas Abraham
With the 'struct dma_pl330_peri' removed, the platfrom data for dma
driver can be simplified to a simple list of peripheral request ids.

Cc: Jassi Brar jassisinghb...@gmail.com
Cc: Boojin Kim boojin@samsung.com
Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
---
 arch/arm/mach-exynos4/dma.c |  223 ---
 1 files changed, 62 insertions(+), 161 deletions(-)

diff --git a/arch/arm/mach-exynos4/dma.c b/arch/arm/mach-exynos4/dma.c
index 9667c61..c3c0d17 100644
--- a/arch/arm/mach-exynos4/dma.c
+++ b/arch/arm/mach-exynos4/dma.c
@@ -35,95 +35,40 @@
 
 static u64 dma_dmamask = DMA_BIT_MASK(32);
 
-struct dma_pl330_peri pdma0_peri[28] = {
-   {
-   .peri_id = (u8)DMACH_PCM0_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_PCM0_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_PCM2_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_PCM2_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_MSM_REQ0,
-   }, {
-   .peri_id = (u8)DMACH_MSM_REQ2,
-   }, {
-   .peri_id = (u8)DMACH_SPI0_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_SPI0_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_SPI2_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_SPI2_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_I2S0S_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_I2S0_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_I2S0_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_UART0_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_UART0_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_UART2_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_UART2_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_UART4_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_UART4_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_SLIMBUS0_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_SLIMBUS0_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_SLIMBUS2_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_SLIMBUS2_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_SLIMBUS4_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_SLIMBUS4_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_AC97_MICIN,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_AC97_PCMIN,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_AC97_PCMOUT,
-   .rqtype = MEMTODEV,
-   },
+u8 pdma0_peri[] = {
+   DMACH_PCM0_RX,
+   DMACH_PCM0_TX,
+   DMACH_PCM2_RX,
+   DMACH_PCM2_TX,
+   DMACH_MSM_REQ0,
+   DMACH_MSM_REQ2,
+   DMACH_SPI0_RX,
+   DMACH_SPI0_TX,
+   DMACH_SPI2_RX,
+   DMACH_SPI2_TX,
+   DMACH_I2S0S_TX,
+   DMACH_I2S0_RX,
+   DMACH_I2S0_TX,
+   DMACH_UART0_RX,
+   DMACH_UART0_TX,
+   DMACH_UART2_RX,
+   DMACH_UART2_TX,
+   DMACH_UART4_RX,
+   DMACH_UART4_TX,
+   DMACH_SLIMBUS0_RX,
+   DMACH_SLIMBUS0_TX,
+   DMACH_SLIMBUS2_RX,
+   DMACH_SLIMBUS2_TX,
+   DMACH_SLIMBUS4_RX,
+   DMACH_SLIMBUS4_TX,
+   DMACH_AC97_MICIN,
+   DMACH_AC97_PCMIN,
+   DMACH_AC97_PCMOUT,
 };
 
 struct dma_pl330_platdata exynos4_pdma0_pdata = {
.nr_valid_peri = ARRAY_SIZE(pdma0_peri),
-   .peri = pdma0_peri,
+   .peri_id = pdma0_peri,
 };
 
 struct amba_device exynos4_device_pdma0 = {
@@ -142,86 +87,37 @@ struct amba_device exynos4_device_pdma0 = {
.periphid = 0x00041330,
 };
 
-struct dma_pl330_peri pdma1_peri[25] = {
-   {
-   .peri_id = (u8)DMACH_PCM0_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_PCM0_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_PCM1_RX,
-   .rqtype = DEVTOMEM,
-   }, {
-   .peri_id = (u8)DMACH_PCM1_TX,
-   .rqtype = MEMTODEV,
-   }, {
-   .peri_id = (u8)DMACH_MSM_REQ1,
-   }, {
-   .peri_id = (u8)DMACH_MSM_REQ3,
-   }, {
-   .peri_id = (u8)DMACH_SPI1_RX,
-   .rqtype = DEVTOMEM,
-   

[PATCH v2 4/6] DMA: PL330: Add device tree support

2011-09-01 Thread Thomas Abraham
For PL330 dma controllers instantiated from device tree, the channel
lookup is based on phandle of the dma controller and dma request id
specified by the client node. During probe, the private data of each
channel of the controller is set to point to the device node of the
dma controller. The 'chan_id' of the each channel is used as the
dma request id.

Client driver requesting dma channels specify the phandle of the
dma controller and the request id. The pl330 filter function
converts the phandle to the device node pointer and matches that
with channel's private data. If a match is found, the request id
from the client node and the 'chan_id' of the channel is matched.
A channel is found if both the values match.

Cc: Jassi Brar jassisinghb...@gmail.com
Cc: Boojin Kim boojin@samsung.com
Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
---
 .../devicetree/bindings/dma/arm-pl330.txt  |   29 
 drivers/dma/pl330.c|   35 +---
 2 files changed, 59 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/dma/arm-pl330.txt

diff --git a/Documentation/devicetree/bindings/dma/arm-pl330.txt 
b/Documentation/devicetree/bindings/dma/arm-pl330.txt
new file mode 100644
index 000..69e6c02
--- /dev/null
+++ b/Documentation/devicetree/bindings/dma/arm-pl330.txt
@@ -0,0 +1,29 @@
+* ARM PrimeCell PL330 DMA Controller
+
+The ARM PrimeCell PL330 DMA controller can move blocks of memory contents
+between memory and peripherals or memory to memory.
+
+Required properties:
+  - compatible: should include both arm,pl330 and arm,primecell.
+  - reg: physical base address of the controller and length of memory mapped
+region.
+  - interrupts: interrupt number to the cpu.
+
+Example: (from Samsung's Exynos4 processor dtsi file)
+
+   pdma0: pdma@1268 {
+   compatible = arm,pl330, arm,primecell;
+   reg = 0x1268 0x1000;
+   interrupts = 99;
+   };
+
+Client drivers (device nodes requiring dma transfers from dev-to-mem or
+mem-to-dev) should specify the DMA channel numbers using a two-value pair
+as shown below.
+
+  [property name]  = [phandle of the dma controller] [dma request id];
+
+  where 'dma request id' is the dma request number which is connected
+  to the client controller.
+
+  Example:  tx-dma-channel = pdma0 12;
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 9732995..0c55de4 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -19,6 +19,7 @@
 #include linux/amba/pl330.h
 #include linux/pm_runtime.h
 #include linux/scatterlist.h
+#include linux/of.h
 
 #define NR_DEFAULT_DESC16
 
@@ -277,6 +278,20 @@ bool pl330_filter(struct dma_chan *chan, void *param)
if (chan-device-dev-driver != pl330_driver.drv)
return false;
 
+#ifdef CONFIG_OF
+   if (chan-device-dev-of_node) {
+   const __be32 *prop_value;
+   phandle phandle;
+   struct device_node *node;
+
+   prop_value = ((struct property *)param)-value;
+   phandle = be32_to_cpup(prop_value++);
+   node = of_find_node_by_phandle(phandle);
+   return ((chan-private == node) 
+   (chan-chan_id == be32_to_cpup(prop_value)));
+   }
+#endif
+
peri_id = chan-private;
return *peri_id == (unsigned)param;
 }
@@ -857,12 +872,17 @@ pl330_probe(struct amba_device *adev, const struct 
amba_id *id)
INIT_LIST_HEAD(pd-channels);
 
/* Initialize channel parameters */
-   num_chan = max(pdat ? pdat-nr_valid_peri : 0, (u8)pi-pcfg.num_chan);
+   num_chan = max(pdat ? pdat-nr_valid_peri : (u8)pi-pcfg.num_peri,
+   (u8)pi-pcfg.num_chan);
pdmac-peripherals = kzalloc(num_chan * sizeof(*pch), GFP_KERNEL);
 
for (i = 0; i  num_chan; i++) {
pch = pdmac-peripherals[i];
-   pch-chan.private = pdat ? pdat-peri_id[i] : NULL;
+   if (!adev-dev.of_node)
+   pch-chan.private = pdat ? pdat-peri_id[i] : NULL;
+   else
+   pch-chan.private = adev-dev.of_node;
+
INIT_LIST_HEAD(pch-work_list);
spin_lock_init(pch-lock);
pch-pl330_chid = NULL;
@@ -876,11 +896,16 @@ pl330_probe(struct amba_device *adev, const struct 
amba_id *id)
}
 
pd-dev = adev-dev;
-   if (pdat)
+   if (pdat) {
pd-cap_mask = pdat-cap_mask;
-   else
+   } else {
dma_cap_set(DMA_MEMCPY, pd-cap_mask);
-
+   if (pi-pcfg.num_peri) {
+   dma_cap_set(DMA_SLAVE, pd-cap_mask);
+   dma_cap_set(DMA_CYCLIC, pd-cap_mask);
+   }
+   }
+
pd-device_alloc_chan_resources = pl330_alloc_chan_resources;
pd-device_free_chan_resources = pl330_free_chan_resources;

[PATCH v2 6/6] ARM: EXYNOS4: Limit usage of pl330 device instance to non-dt build

2011-09-01 Thread Thomas Abraham
The pl330 device instances and associated platform data is required only
for non-device-tree builds. With device tree, all of this information is
obtained from the device tree.

Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
---
 arch/arm/mach-exynos4/Kconfig  |7 +++
 arch/arm/mach-exynos4/Makefile |3 ++-
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index d4d401c..3edbf37 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -21,6 +21,13 @@ config EXYNOS4_MCT
help
  Use MCT (Multi Core Timer) as kernel timers
 
+config EXYNOS4_DEV_DMA
+   bool
+   default y if !OF
+   help
+ Compile in amba device definitions for DMA controller if OF
+ is not enabled.
+
 config EXYNOS4_DEV_AHCI
bool
help
diff --git a/arch/arm/mach-exynos4/Makefile b/arch/arm/mach-exynos4/Makefile
index d2bf5bf..a2f33dc 100644
--- a/arch/arm/mach-exynos4/Makefile
+++ b/arch/arm/mach-exynos4/Makefile
@@ -13,7 +13,8 @@ obj-  :=
 # Core support for EXYNOS4 system
 
 obj-$(CONFIG_CPU_EXYNOS4210)   += cpu.o init.o clock.o irq-combiner.o
-obj-$(CONFIG_CPU_EXYNOS4210)   += setup-i2c0.o irq-eint.o dma.o pmu.o
+obj-$(CONFIG_CPU_EXYNOS4210)   += setup-i2c0.o irq-eint.o pmu.o
+obj-$(CONFIG_EXYNOS4_DEV_DMA)  += dma.o
 obj-$(CONFIG_PM)   += pm.o sleep.o
 obj-$(CONFIG_CPU_IDLE) += cpuidle.o
 
-- 
1.6.6.rc2

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


[PATCH 0/19 v4] s5p-fimc driver conversion to media controller and control framework

2011-09-01 Thread Sylwester Nawrocki
Hello,

following is a fourth version of the patchset converting s5p-fimc driver
to the media controller API and the new control framework.

Mauro, could you please have a look at the patches and let me know of any 
doubts?
I tried to provide possibly detailed description of what each patch does and 
why.

The changeset is available at:
  http://git.infradead.org/users/kmpark/linux-2.6-samsung
  branch: v4l_fimc_for_mauro

on top of patches from Marek's 'Videobuf2  FIMC fixes pull request
which this series depends on.

Changes since v3:
 - more detailed commit descriptions
 - add missing dependency on EXPERIMENTAL and mark the driver as experimental
   in the config menu
 - removed the first patch as of v3 series, it has been posted separately
 - added 2 new patches: 18/19, 19/19
 - moved the link_setup capture video node media entity operation to the capture
   subdev entity; the link_setup op prevented having 2 active source attached to
   single data sink, there is no need for this at the video node entity as it
   has only an immutable link; Instead we guard the number of sources being 
   connected to the FIMC capture subdev
 - rebased onto recent vb2 modifications changing the queue initialization order
 - s/fimc_start_capture/fimc_init_capture, 
   s/fimc_capture_apply_cfg/fimc_capture_config_update
 - slightly improved the comments and fixed typos 

Changes since v2:
- reworked (runtime) power management;
- added pm_runtime_get_sync/pm_runtime_put around sensor registration
  code so the clock for sensors is enabled during host driver's probe();
- reworked try_crop operation handler to support multiple of the prescaler
  ratio relationship constraint for format at the sink pad;
- corrected fimc_md_unregister_entities() function


Sylwester Nawrocki (19):
  s5p-fimc: Remove registration of video nodes from probe()
  s5p-fimc: Remove sclk_cam clock handling
  s5p-fimc: Limit number of available inputs to one
  s5p-fimc: Remove sensor management code from FIMC capture driver
  s5p-fimc: Remove v4l2_device from video capture and m2m driver
  s5p-fimc: Add the media device driver
  s5p-fimc: Conversion to use struct v4l2_fh
  s5p-fimc: Convert to the new control framework
  s5p-fimc: Add media operations in the capture entity driver
  s5p-fimc: Add PM helper function for streaming control
  s5p-fimc: Correct color format enumeration
  s5p-fimc: Convert to use media pipeline operations
  s5p-fimc: Add subdev for the FIMC processing block
  s5p-fimc: Add support for JPEG capture
  s5p-fimc: Add v4l2_device notification support for single frame
capture
  s5p-fimc: Use consistent names for the buffer list functions
  s5p-fimc: Add runtime PM support in the camera capture driver
  s5p-fimc: Correct crop offset alignment on exynos4
  s5p-fimc: Remove single-planar capability flags

 drivers/media/video/Kconfig |5 +-
 drivers/media/video/s5p-fimc/Makefile   |2 +-
 drivers/media/video/s5p-fimc/fimc-capture.c | 1416 ++
 drivers/media/video/s5p-fimc/fimc-core.c|  884 -
 drivers/media/video/s5p-fimc/fimc-core.h|  201 +++--
 drivers/media/video/s5p-fimc/fimc-mdevice.c |  857 
 drivers/media/video/s5p-fimc/fimc-mdevice.h |  118 +++
 drivers/media/video/s5p-fimc/fimc-reg.c |   74 +-
 drivers/media/video/s5p-fimc/regs-fimc.h|8 +-
 include/media/s5p_fimc.h|   11 +
 10 files changed, 2551 insertions(+), 1025 deletions(-)
 create mode 100644 drivers/media/video/s5p-fimc/fimc-mdevice.c
 create mode 100644 drivers/media/video/s5p-fimc/fimc-mdevice.h


Regards,
--
Sylwester Nawrocki
Samsung Poland RD Center

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


[PATCH 07/19 v4] s5p-fimc: Conversion to use struct v4l2_fh

2011-09-01 Thread Sylwester Nawrocki
This is a prerequisite for the patch converting the driver to use
the control framework. As the capture driver does not use per file
handle contexts, two separate ioctl handlers are created for it
(vidioc_try_fmt_mplane, and vidioc_g_fmt_mplane) so there is no
handlers shared between the memory-to-memory and capture video node.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |  114 ++
 drivers/media/video/s5p-fimc/fimc-core.c|  179 ++
 drivers/media/video/s5p-fimc/fimc-core.h|   10 +-
 3 files changed, 165 insertions(+), 138 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index a1ac986..562b23c 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -276,7 +276,10 @@ static struct vb2_ops fimc_capture_qops = {
 static int fimc_capture_open(struct file *file)
 {
struct fimc_dev *fimc = video_drvdata(file);
-   int ret = 0;
+   int ret = v4l2_fh_open(file);
+
+   if (ret)
+   return ret;
 
dbg(pid: %d, state: 0x%lx, task_pid_nr(current), fimc-state);
 
@@ -285,11 +288,12 @@ static int fimc_capture_open(struct file *file)
return -EBUSY;
 
ret = pm_runtime_get_sync(fimc-pdev-dev);
-   if (ret)
+   if (ret  0) {
+   v4l2_fh_release(file);
return ret;
+   }
 
++fimc-vid_cap.refcnt;
-   file-private_data = fimc-vid_cap.ctx;
 
return 0;
 }
@@ -307,22 +311,20 @@ static int fimc_capture_close(struct file *file)
 
pm_runtime_put(fimc-pdev-dev);
 
-   return 0;
+   return v4l2_fh_release(file);
 }
 
 static unsigned int fimc_capture_poll(struct file *file,
  struct poll_table_struct *wait)
 {
-   struct fimc_ctx *ctx = file-private_data;
-   struct fimc_dev *fimc = ctx-fimc_dev;
+   struct fimc_dev *fimc = video_drvdata(file);
 
return vb2_poll(fimc-vid_cap.vbq, file, wait);
 }
 
 static int fimc_capture_mmap(struct file *file, struct vm_area_struct *vma)
 {
-   struct fimc_ctx *ctx = file-private_data;
-   struct fimc_dev *fimc = ctx-fimc_dev;
+   struct fimc_dev *fimc = video_drvdata(file);
 
return vb2_mmap(fimc-vid_cap.vbq, vma);
 }
@@ -340,8 +342,7 @@ static const struct v4l2_file_operations fimc_capture_fops 
= {
 static int fimc_vidioc_querycap_capture(struct file *file, void *priv,
struct v4l2_capability *cap)
 {
-   struct fimc_ctx *ctx = file-private_data;
-   struct fimc_dev *fimc = ctx-fimc_dev;
+   struct fimc_dev *fimc = video_drvdata(file);
 
strncpy(cap-driver, fimc-pdev-name, sizeof(cap-driver) - 1);
strncpy(cap-card, fimc-pdev-name, sizeof(cap-card) - 1);
@@ -388,20 +389,41 @@ static int sync_capture_fmt(struct fimc_ctx *ctx)
return 0;
 }
 
+static int fimc_cap_g_fmt_mplane(struct file *file, void *fh,
+struct v4l2_format *f)
+{
+   struct fimc_dev *fimc = video_drvdata(file);
+   struct fimc_ctx *ctx = fimc-vid_cap.ctx;
+
+   if (f-type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
+   return -EINVAL;
+
+   return fimc_fill_format(ctx-d_frame, f);
+}
+
+static int fimc_cap_try_fmt_mplane(struct file *file, void *fh,
+  struct v4l2_format *f)
+{
+   struct fimc_dev *fimc = video_drvdata(file);
+   struct fimc_ctx *ctx = fimc-vid_cap.ctx;
+
+   return fimc_try_fmt_mplane(ctx, f);
+}
+
 static int fimc_cap_s_fmt_mplane(struct file *file, void *priv,
 struct v4l2_format *f)
 {
-   struct fimc_ctx *ctx = priv;
-   struct fimc_dev *fimc = ctx-fimc_dev;
-   struct fimc_frame *frame;
+   struct fimc_dev *fimc = video_drvdata(file);
+   struct fimc_ctx *ctx = fimc-vid_cap.ctx;
struct v4l2_pix_format_mplane *pix;
+   struct fimc_frame *frame;
int ret;
int i;
 
if (f-type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
return -EINVAL;
 
-   ret = fimc_vidioc_try_fmt_mplane(file, priv, f);
+   ret = fimc_try_fmt_mplane(ctx, f);
if (ret)
return ret;
 
@@ -443,7 +465,7 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void 
*priv,
 static int fimc_cap_enum_input(struct file *file, void *priv,
   struct v4l2_input *i)
 {
-   struct fimc_ctx *ctx = priv;
+   struct fimc_dev *fimc = video_drvdata(file);
 
if (i-index != 0)
return -EINVAL;
@@ -467,8 +489,8 @@ static int fimc_cap_g_input(struct file *file, void *priv, 
unsigned int *i)
 static int fimc_cap_streamon(struct file *file, void *priv,
 enum v4l2_buf_type type)
 {
-   struct 

[PATCH 05/19 v4] s5p-fimc: Remove v4l2_device from video capture and m2m driver

2011-09-01 Thread Sylwester Nawrocki
Currently there is a v4l2_device instance being registered per each
(capture and memory-to-memory) video node created per FIMC H/W instance.
This patch is a prerequisite for using the top level v4l2_device
instantiated by the media device driver.
To retain current debug trace semantic (so it's possible to distinguish
between the capture and m2m FIMC) the video_device is used in place
of v4l2_device where appropriate.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |   39 +++
 drivers/media/video/s5p-fimc/fimc-core.c|   54 ++-
 drivers/media/video/s5p-fimc/fimc-core.h|   15 ---
 drivers/media/video/s5p-fimc/fimc-reg.c |7 ++-
 4 files changed, 47 insertions(+), 68 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 40f3330..a1ac986 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -191,7 +191,6 @@ static int buffer_prepare(struct vb2_buffer *vb)
 {
struct vb2_queue *vq = vb-vb2_queue;
struct fimc_ctx *ctx = vq-drv_priv;
-   struct v4l2_device *v4l2_dev = ctx-fimc_dev-m2m.v4l2_dev;
int i;
 
if (!ctx-d_frame.fmt || vq-type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
@@ -201,7 +200,8 @@ static int buffer_prepare(struct vb2_buffer *vb)
unsigned long size = get_plane_size(ctx-d_frame, i);
 
if (vb2_plane_size(vb, i)  size) {
-   v4l2_err(v4l2_dev, User buffer too small (%ld  
%ld)\n,
+   v4l2_err(ctx-fimc_dev-vid_cap.vfd,
+User buffer too small (%ld  %ld)\n,
 vb2_plane_size(vb, i), size);
return -EINVAL;
}
@@ -413,7 +413,8 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void 
*priv,
pix = f-fmt.pix_mp;
frame-fmt = find_format(f, FMT_FLAGS_M2M | FMT_FLAGS_CAM);
if (!frame-fmt) {
-   err(fimc target format not found\n);
+   v4l2_err(fimc-vid_cap.vfd,
+Not supported capture (FIMC target) color format\n);
return -EINVAL;
}
 
@@ -473,7 +474,7 @@ static int fimc_cap_streamon(struct file *file, void *priv,
return -EBUSY;
 
if (!(ctx-state  FIMC_DST_FMT)) {
-   v4l2_err(fimc-vid_cap.v4l2_dev, Format is not set\n);
+   v4l2_err(fimc-vid_cap.vfd, Format is not set\n);
return -EINVAL;
}
 
@@ -603,9 +604,8 @@ static int fimc_cap_s_crop(struct file *file, void *fh,
return ret;
 
if (!(ctx-state  FIMC_DST_FMT)) {
-   v4l2_err(fimc-vid_cap.v4l2_dev,
-Capture color format not set\n);
-   return -EINVAL; /* TODO: make sure this is the right value */
+   v4l2_err(fimc-vid_cap.vfd, Capture format is not set\n);
+   return -EINVAL;
}
 
f = ctx-s_frame;
@@ -614,7 +614,7 @@ static int fimc_cap_s_crop(struct file *file, void *fh,
  ctx-d_frame.width, ctx-d_frame.height,
  ctx-rotation);
if (ret) {
-   v4l2_err(fimc-vid_cap.v4l2_dev, Out of the scaler range\n);
+   v4l2_err(fimc-vid_cap.vfd, Out of the scaler range\n);
return ret;
}
 
@@ -658,16 +658,16 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops 
= {
 };
 
 /* fimc-lock must be already initialized */
-int fimc_register_capture_device(struct fimc_dev *fimc)
+int fimc_register_capture_device(struct fimc_dev *fimc,
+struct v4l2_device *v4l2_dev)
 {
-   struct v4l2_device *v4l2_dev = fimc-vid_cap.v4l2_dev;
struct video_device *vfd;
struct fimc_vid_cap *vid_cap;
struct fimc_ctx *ctx;
struct v4l2_format f;
struct fimc_frame *fr;
struct vb2_queue *q;
-   int ret;
+   int ret = -ENOMEM;
 
ctx = kzalloc(sizeof *ctx, GFP_KERNEL);
if (!ctx)
@@ -685,20 +685,14 @@ int fimc_register_capture_device(struct fimc_dev *fimc)
fr-width = fr-f_width = fr-o_width = 640;
fr-height = fr-f_height = fr-o_height = 480;
 
-   snprintf(v4l2_dev-name, sizeof(v4l2_dev-name),
-%s.capture, dev_name(fimc-pdev-dev));
-
-   ret = v4l2_device_register(NULL, v4l2_dev);
-   if (ret)
-   goto err_info;
-
vfd = video_device_alloc();
if (!vfd) {
v4l2_err(v4l2_dev, Failed to allocate video device\n);
-   goto err_v4l2_reg;
+   goto err_vd_alloc;
}
 
-   strlcpy(vfd-name, v4l2_dev-name, sizeof(vfd-name));
+   snprintf(vfd-name, sizeof(vfd-name), %s.capture,
+ 

[PATCH 12/19 v4] s5p-fimc: Convert to use media pipeline operations

2011-09-01 Thread Sylwester Nawrocki
In the camera capture driver use fimc_pipeline_* calls provided by
the media device driver part, in place where v4l2_subdev_call() were
used. This way the capture driver don't need to differentiate between
various H/W pipeline setups, i.e. if the MIPI-CSI receiver subdev is
used or not.

Remove the sync_capture_fmt() function instead of which
fimc_pipeline_try_format() is introduced in the following patch adding
the FIMC capture subdev.

The TRY_FMT ioctl function is completed by a subsequent patch adding
the capture subdev, so the try_fmt routines can be reused in the subdev
and the video node ioctl handlers.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |  118 --
 drivers/media/video/s5p-fimc/fimc-core.c|  125 +++
 drivers/media/video/s5p-fimc/fimc-core.h|   11 ++-
 3 files changed, 130 insertions(+), 124 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 32c2854..f0fed61 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -68,7 +68,7 @@ static int fimc_init_capture(struct fimc_dev *fimc)
return ret;
 }
 
-static void fimc_capture_state_cleanup(struct fimc_dev *fimc)
+static int fimc_capture_state_cleanup(struct fimc_dev *fimc)
 {
struct fimc_vid_cap *cap = fimc-vid_cap;
struct fimc_vid_buffer *buf;
@@ -76,7 +76,8 @@ static void fimc_capture_state_cleanup(struct fimc_dev *fimc)
 
spin_lock_irqsave(fimc-slock, flags);
fimc-state = ~(1  ST_CAPT_RUN | 1  ST_CAPT_PEND |
-1  ST_CAPT_SHUT | 1  ST_CAPT_STREAM);
+1  ST_CAPT_SHUT | 1  ST_CAPT_STREAM |
+1  ST_CAPT_ISP_STREAM);
 
fimc-vid_cap.active_buf_cnt = 0;
 
@@ -92,6 +93,11 @@ static void fimc_capture_state_cleanup(struct fimc_dev *fimc)
}
 
spin_unlock_irqrestore(fimc-slock, flags);
+
+   if (test_bit(ST_CAPT_ISP_STREAM, fimc-state))
+   return fimc_pipeline_s_stream(fimc, 0);
+   else
+   return 0;
 }
 
 static int fimc_stop_capture(struct fimc_dev *fimc)
@@ -111,11 +117,7 @@ static int fimc_stop_capture(struct fimc_dev *fimc)
   !test_bit(ST_CAPT_SHUT, fimc-state),
   FIMC_SHUTDOWN_TIMEOUT);
 
-   v4l2_subdev_call(cap-sd, video, s_stream, 0);
-
-   fimc_capture_state_cleanup(fimc);
-   dbg(state: 0x%lx, fimc-state);
-   return 0;
+   return fimc_capture_state_cleanup(fimc);
 }
 
 
@@ -138,9 +140,14 @@ static int start_streaming(struct vb2_queue *q, unsigned 
int count)
 
min_bufs = fimc-vid_cap.reqbufs_count  1 ? 2 : 1;
 
-   if (fimc-vid_cap.active_buf_cnt = min_bufs)
+   if (vid_cap-active_buf_cnt = min_bufs 
+   !test_and_set_bit(ST_CAPT_STREAM, fimc-state)) {
fimc_activate_capture(ctx);
 
+   if (!test_and_set_bit(ST_CAPT_ISP_STREAM, fimc-state))
+   fimc_pipeline_s_stream(fimc, 1);
+   }
+
return 0;
 error:
fimc_capture_state_cleanup(fimc);
@@ -202,11 +209,11 @@ static int buffer_prepare(struct vb2_buffer *vb)
struct fimc_ctx *ctx = vq-drv_priv;
int i;
 
-   if (!ctx-d_frame.fmt || vq-type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)
+   if (ctx-d_frame.fmt == NULL)
return -EINVAL;
 
for (i = 0; i  ctx-d_frame.fmt-memplanes; i++) {
-   unsigned long size = get_plane_size(ctx-d_frame, i);
+   unsigned long size = ctx-d_frame.payload[i];
 
if (vb2_plane_size(vb, i)  size) {
v4l2_err(ctx-fimc_dev-vid_cap.vfd,
@@ -214,7 +221,6 @@ static int buffer_prepare(struct vb2_buffer *vb)
 vb2_plane_size(vb, i), size);
return -EINVAL;
}
-
vb2_set_plane_payload(vb, i, size);
}
 
@@ -223,10 +229,10 @@ static int buffer_prepare(struct vb2_buffer *vb)
 
 static void buffer_queue(struct vb2_buffer *vb)
 {
-   struct fimc_ctx *ctx = vb2_get_drv_priv(vb-vb2_queue);
-   struct fimc_dev *fimc = ctx-fimc_dev;
struct fimc_vid_buffer *buf
= container_of(vb, struct fimc_vid_buffer, vb);
+   struct fimc_ctx *ctx = vb2_get_drv_priv(vb-vb2_queue);
+   struct fimc_dev *fimc = ctx-fimc_dev;
struct fimc_vid_cap *vid_cap = fimc-vid_cap;
unsigned long flags;
int min_bufs;
@@ -252,11 +258,17 @@ static void buffer_queue(struct vb2_buffer *vb)
 
min_bufs = vid_cap-reqbufs_count  1 ? 2 : 1;
 
+
if (vb2_is_streaming(vid_cap-vbq) 
vid_cap-active_buf_cnt = min_bufs 
-   !test_and_set_bit(ST_CAPT_STREAM, fimc-state))
+   !test_and_set_bit(ST_CAPT_STREAM, fimc-state)) {
  

[PATCH 16/19 v4] s5p-fimc: Use consistent names for the buffer list functions

2011-09-01 Thread Sylwester Nawrocki
Also correct and improve *_queue_add/pop functions description.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |6 ++--
 drivers/media/video/s5p-fimc/fimc-core.c|6 ++--
 drivers/media/video/s5p-fimc/fimc-core.h|   38 +-
 3 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 7fafd12..4693846 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -84,12 +84,12 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc)
 
/* Release buffers that were enqueued in the driver by videobuf2. */
while (!list_empty(cap-pending_buf_q)) {
-   buf = pending_queue_pop(cap);
+   buf = fimc_pending_queue_pop(cap);
vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR);
}
 
while (!list_empty(cap-active_buf_q)) {
-   buf = active_queue_pop(cap);
+   buf = fimc_active_queue_pop(cap);
vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR);
}
 
@@ -279,7 +279,7 @@ static void buffer_queue(struct vb2_buffer *vb)
 
fimc_hw_set_output_addr(fimc, buf-paddr, buf_id);
buf-index = vid_cap-buf_index;
-   active_queue_add(vid_cap, buf);
+   fimc_active_queue_add(vid_cap, buf);
 
if (++vid_cap-buf_index = FIMC_MAX_OUT_BUFS)
vid_cap-buf_index = 0;
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c 
b/drivers/media/video/s5p-fimc/fimc-core.c
index 52f0862..4369c4f 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -338,7 +338,7 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, bool 
final)
test_bit(ST_CAPT_RUN, fimc-state)  final) {
ktime_get_real_ts(ts);
 
-   v_buf = active_queue_pop(cap);
+   v_buf = fimc_active_queue_pop(cap);
 
tv = v_buf-vb.v4l2_buf.timestamp;
tv-tv_sec = ts.tv_sec;
@@ -355,12 +355,12 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, bool 
final)
 
if (!list_empty(cap-pending_buf_q)) {
 
-   v_buf = pending_queue_pop(cap);
+   v_buf = fimc_pending_queue_pop(cap);
fimc_hw_set_output_addr(fimc, v_buf-paddr, cap-buf_index);
v_buf-index = cap-buf_index;
 
/* Move the buffer to the capture active queue */
-   active_queue_add(cap, v_buf);
+   fimc_active_queue_add(cap, v_buf);
 
dbg(next frame: %d, done frame: %d,
fimc_hw_get_frame_index(fimc), v_buf-index);
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h 
b/drivers/media/video/s5p-fimc/fimc-core.h
index 6ec8b37..82ac597 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.h
+++ b/drivers/media/video/s5p-fimc/fimc-core.h
@@ -745,22 +745,27 @@ static inline void fimc_deactivate_capture(struct 
fimc_dev *fimc)
 }
 
 /*
- * Add buf to the capture active buffers queue.
- * Locking: Need to be called with fimc_dev::slock held.
+ * Buffer list manipulation functions. Must be called with fimc.slock held.
  */
-static inline void active_queue_add(struct fimc_vid_cap *vid_cap,
-   struct fimc_vid_buffer *buf)
+
+/**
+ * fimc_active_queue_add - add buffer to the capture active buffers queue
+ * @buf: buffer to add to the active buffers list
+ */
+static inline void fimc_active_queue_add(struct fimc_vid_cap *vid_cap,
+struct fimc_vid_buffer *buf)
 {
list_add_tail(buf-list, vid_cap-active_buf_q);
vid_cap-active_buf_cnt++;
 }
 
-/*
- * Pop a video buffer from the capture active buffers queue
- * Locking: Need to be called with fimc_dev::slock held.
+/**
+ * fimc_active_queue_pop - pop buffer from the capture active buffers queue
+ *
+ * The caller must assure the active_buf_q list is not empty.
  */
-static inline struct fimc_vid_buffer *
-active_queue_pop(struct fimc_vid_cap *vid_cap)
+static inline struct fimc_vid_buffer *fimc_active_queue_pop(
+   struct fimc_vid_cap *vid_cap)
 {
struct fimc_vid_buffer *buf;
buf = list_entry(vid_cap-active_buf_q.next,
@@ -770,16 +775,23 @@ active_queue_pop(struct fimc_vid_cap *vid_cap)
return buf;
 }
 
-/* Add video buffer to the capture pending buffers queue */
+/**
+ * fimc_pending_queue_add - add buffer to the capture pending buffers queue
+ * @buf: buffer to add to the pending buffers list
+ */
 static inline void fimc_pending_queue_add(struct fimc_vid_cap *vid_cap,
  struct fimc_vid_buffer *buf)
 {
list_add_tail(buf-list, vid_cap-pending_buf_q);
 }
 
-/* 

[PATCH 18/19 v4] s5p-fimc: Correct crop offset alignment on exynos4

2011-09-01 Thread Sylwester Nawrocki
Horizontal crop offset must be multiple of 2 otherwise
color distortion occurs.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-core.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-core.c 
b/drivers/media/video/s5p-fimc/fimc-core.c
index a528a76..8978360 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -1898,7 +1898,7 @@ static struct samsung_fimc_variant fimc0_variant_exynos4 
= {
.has_mainscaler_ext = 1,
.min_inp_pixsize = 16,
.min_out_pixsize = 16,
-   .hor_offs_align  = 1,
+   .hor_offs_align  = 2,
.out_buf_count   = 32,
.pix_limit   = s5p_pix_limit[1],
 };
@@ -1910,7 +1910,7 @@ static struct samsung_fimc_variant fimc3_variant_exynos4 
= {
.has_mainscaler_ext = 1,
.min_inp_pixsize = 16,
.min_out_pixsize = 16,
-   .hor_offs_align  = 1,
+   .hor_offs_align  = 2,
.out_buf_count   = 32,
.pix_limit   = s5p_pix_limit[3],
 };
-- 
1.7.6

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


[PATCH 15/19 v4] s5p-fimc: Add v4l2_device notification support for single frame capture

2011-09-01 Thread Sylwester Nawrocki
Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |   47 +++
 drivers/media/video/s5p-fimc/fimc-core.h|2 +
 drivers/media/video/s5p-fimc/fimc-mdevice.c |1 +
 include/media/s5p_fimc.h|9 +
 4 files changed, 59 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index adbbb63..7fafd12 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -1076,6 +1076,53 @@ static const struct media_entity_operations 
fimc_sd_media_ops = {
.link_setup = fimc_link_setup,
 };
 
+/**
+ * fimc_sensor_notify - v4l2_device notification from a sensor subdev
+ * @sd: pointer to a subdev generating the notification
+ * @notification: the notification type, must be S5P_FIMC_TX_END_NOTIFY
+ * @arg: pointer to an u32 type integer that stores the frame payload value
+ *
+ * The End Of Frame notification sent by sensor subdev in its still capture
+ * mode. If there is only a single VSYNC generated by the sensor at the
+ * beginning of a frame transmission, FIMC does not issue the LastIrq
+ * (end of frame) interrupt. And this notification is used to complete the
+ * frame capture and returning a buffer to user-space. Subdev drivers should
+ * call this notification from their last 'End of frame capture' interrupt.
+ */
+void fimc_sensor_notify(struct v4l2_subdev *sd, unsigned int notification,
+   void *arg)
+{
+   struct fimc_sensor_info *sensor;
+   struct fimc_vid_buffer *buf;
+   struct fimc_md *fmd;
+   struct fimc_dev *fimc;
+   unsigned long flags;
+
+   if (sd == NULL)
+   return;
+
+   sensor = v4l2_get_subdev_hostdata(sd);
+   fmd = entity_to_fimc_mdev(sd-entity);
+
+   spin_lock_irqsave(fmd-slock, flags);
+   fimc = sensor ? sensor-host : NULL;
+
+   if (fimc  arg  notification == S5P_FIMC_TX_END_NOTIFY 
+   test_bit(ST_CAPT_PEND, fimc-state)) {
+   unsigned long irq_flags;
+   spin_lock_irqsave(fimc-slock, irq_flags);
+   if (!list_empty(fimc-vid_cap.active_buf_q)) {
+   buf = list_entry(fimc-vid_cap.active_buf_q.next,
+struct fimc_vid_buffer, list);
+   vb2_set_plane_payload(buf-vb, 0, *((u32 *)arg));
+   }
+   fimc_capture_irq_handler(fimc, true);
+   fimc_deactivate_capture(fimc);
+   spin_unlock_irqrestore(fimc-slock, irq_flags);
+   }
+   spin_unlock_irqrestore(fmd-slock, flags);
+}
+
 static int fimc_subdev_enum_mbus_code(struct v4l2_subdev *sd,
  struct v4l2_subdev_fh *fh,
  struct v4l2_subdev_mbus_code_enum *code)
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h 
b/drivers/media/video/s5p-fimc/fimc-core.h
index 9b44875..6ec8b37 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.h
+++ b/drivers/media/video/s5p-fimc/fimc-core.h
@@ -723,6 +723,8 @@ void fimc_unregister_capture_device(struct fimc_dev *fimc);
 int fimc_capture_ctrls_create(struct fimc_dev *fimc);
 int fimc_vid_cap_buf_queue(struct fimc_dev *fimc,
 struct fimc_vid_buffer *fimc_vb);
+void fimc_sensor_notify(struct v4l2_subdev *sd, unsigned int notification,
+   void *arg);
 int fimc_capture_suspend(struct fimc_dev *fimc);
 int fimc_capture_resume(struct fimc_dev *fimc);
 int fimc_capture_config_update(struct fimc_ctx *ctx);
diff --git a/drivers/media/video/s5p-fimc/fimc-mdevice.c 
b/drivers/media/video/s5p-fimc/fimc-mdevice.c
index 6fb19c0..199aa86 100644
--- a/drivers/media/video/s5p-fimc/fimc-mdevice.c
+++ b/drivers/media/video/s5p-fimc/fimc-mdevice.c
@@ -761,6 +761,7 @@ static int __devinit fimc_md_probe(struct platform_device 
*pdev)
 
v4l2_dev = fmd-v4l2_dev;
v4l2_dev-mdev = fmd-media_dev;
+   v4l2_dev-notify = fimc_sensor_notify;
snprintf(v4l2_dev-name, sizeof(v4l2_dev-name), %s,
 dev_name(pdev-dev));
 
diff --git a/include/media/s5p_fimc.h b/include/media/s5p_fimc.h
index 086a7aa..2b58904 100644
--- a/include/media/s5p_fimc.h
+++ b/include/media/s5p_fimc.h
@@ -60,4 +60,13 @@ struct s5p_platform_fimc {
struct s5p_fimc_isp_info *isp_info;
int num_clients;
 };
+
+/*
+ * v4l2_device notification id. This is only for internal use in the kernel.
+ * Sensor subdevs should issue S5P_FIMC_TX_END_NOTIFY notification in single
+ * frame capture mode when there is only one VSYNC pulse issued by the sensor
+ * at begining of the frame transmission.
+ */
+#define S5P_FIMC_TX_END_NOTIFY _IO('e', 0)
+
 #endif /* S5P_FIMC_H_ */
-- 
1.7.6

--
To unsubscribe from this list: send the line unsubscribe linux-samsung-soc in

[PATCH 17/19 v4] s5p-fimc: Add runtime PM support in the camera capture driver

2011-09-01 Thread Sylwester Nawrocki
Add support for whole pipeline suspend/resume. Sensors must support
suspend/resume through s_power subdev operation.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |   83 +++---
 drivers/media/video/s5p-fimc/fimc-core.c|   10 ++--
 drivers/media/video/s5p-fimc/fimc-core.h|1 +
 3 files changed, 66 insertions(+), 28 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 4693846..9ca9462 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -69,30 +69,32 @@ static int fimc_init_capture(struct fimc_dev *fimc)
return ret;
 }
 
-static int fimc_capture_state_cleanup(struct fimc_dev *fimc)
+static int fimc_capture_state_cleanup(struct fimc_dev *fimc, bool suspend)
 {
struct fimc_vid_cap *cap = fimc-vid_cap;
struct fimc_vid_buffer *buf;
unsigned long flags;
 
spin_lock_irqsave(fimc-slock, flags);
-   fimc-state = ~(1  ST_CAPT_RUN | 1  ST_CAPT_PEND |
-1  ST_CAPT_SHUT | 1  ST_CAPT_STREAM |
-1  ST_CAPT_ISP_STREAM);
+   fimc-state = ~(1  ST_CAPT_RUN | 1  ST_CAPT_SHUT |
+1  ST_CAPT_STREAM | 1  ST_CAPT_ISP_STREAM);
+   if (!suspend)
+   fimc-state = ~(1  ST_CAPT_PEND | 1  ST_CAPT_SUSPENDED);
 
-   fimc-vid_cap.active_buf_cnt = 0;
-
-   /* Release buffers that were enqueued in the driver by videobuf2. */
-   while (!list_empty(cap-pending_buf_q)) {
+   /* Release unused buffers */
+   while (!suspend  !list_empty(cap-pending_buf_q)) {
buf = fimc_pending_queue_pop(cap);
vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR);
}
-
+   /* If suspending put unused buffers onto pending queue */
while (!list_empty(cap-active_buf_q)) {
buf = fimc_active_queue_pop(cap);
-   vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR);
+   if (suspend)
+   fimc_pending_queue_add(cap, buf);
+   else
+   vb2_buffer_done(buf-vb, VB2_BUF_STATE_ERROR);
}
-
+   set_bit(ST_CAPT_SUSPENDED, fimc-state);
spin_unlock_irqrestore(fimc-slock, flags);
 
if (test_bit(ST_CAPT_ISP_STREAM, fimc-state))
@@ -101,9 +103,8 @@ static int fimc_capture_state_cleanup(struct fimc_dev *fimc)
return 0;
 }
 
-static int fimc_stop_capture(struct fimc_dev *fimc)
+static int fimc_stop_capture(struct fimc_dev *fimc, bool suspend)
 {
-   struct fimc_vid_cap *cap = fimc-vid_cap;
unsigned long flags;
 
if (!fimc_capture_active(fimc))
@@ -116,9 +117,9 @@ static int fimc_stop_capture(struct fimc_dev *fimc)
 
wait_event_timeout(fimc-irq_queue,
   !test_bit(ST_CAPT_SHUT, fimc-state),
-  FIMC_SHUTDOWN_TIMEOUT);
+  (2*HZ/10)); /* 200 ms */
 
-   return fimc_capture_state_cleanup(fimc);
+   return fimc_capture_state_cleanup(fimc, suspend);
 }
 
 /**
@@ -181,7 +182,7 @@ static int start_streaming(struct vb2_queue *q, unsigned 
int count)
 
return 0;
 error:
-   fimc_capture_state_cleanup(fimc);
+   fimc_capture_state_cleanup(fimc, false);
return ret;
 }
 
@@ -193,17 +194,46 @@ static int stop_streaming(struct vb2_queue *q)
if (!fimc_capture_active(fimc))
return -EINVAL;
 
-   return fimc_stop_capture(fimc);
+   return fimc_stop_capture(fimc, false);
 }
 
 int fimc_capture_suspend(struct fimc_dev *fimc)
 {
-   return -EBUSY;
+   bool suspend = fimc_capture_busy(fimc);
+
+   int ret = fimc_stop_capture(fimc, suspend);
+   if (ret)
+   return ret;
+   return fimc_pipeline_shutdown(fimc);
 }
 
+static void buffer_queue(struct vb2_buffer *vb);
+
 int fimc_capture_resume(struct fimc_dev *fimc)
 {
+   struct fimc_vid_cap *vid_cap = fimc-vid_cap;
+   struct fimc_vid_buffer *buf;
+   int i;
+
+   if (!test_and_clear_bit(ST_CAPT_SUSPENDED, fimc-state))
+   return 0;
+
+   INIT_LIST_HEAD(fimc-vid_cap.active_buf_q);
+   vid_cap-buf_index = 0;
+   fimc_pipeline_initialize(fimc, fimc-vid_cap.vfd-entity,
+false);
+   fimc_init_capture(fimc);
+
+   clear_bit(ST_CAPT_SUSPENDED, fimc-state);
+
+   for (i = 0; i  vid_cap-reqbufs_count; i++) {
+   if (list_empty(vid_cap-pending_buf_q))
+   break;
+   buf = fimc_pending_queue_pop(vid_cap);
+   buffer_queue(buf-vb);
+   }
return 0;
+
 }
 
 static unsigned int get_plane_size(struct fimc_frame *fr, unsigned int plane)
@@ -271,8 +301,9 @@ static void buffer_queue(struct vb2_buffer *vb)
spin_lock_irqsave(fimc-slock, 

[PATCH 08/19 v4] s5p-fimc: Convert to the new control framework

2011-09-01 Thread Sylwester Nawrocki
Convert the v4l controls code to use the new control framework.

fimc_ctrls_activate/deactivate functions are introduced for the
transparent DMA transfer mode (JPEG), where the rotation and flipping
controls are not supported.

The capture video node does not inherit sensors' controls when the
subdevs are configured by the user space (user_subdev_api == true).
However by default after the driver's initialization
the 'user-subdev_api' flag is false and any sensor controls will
also be available at the video node.

When the pipeline links are disconnected through the media device
the FIMC and any sensor inherited controls are destroyed and then
again created when the pipeline connection completes.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |   61 +++---
 drivers/media/video/s5p-fimc/fimc-core.c|  291 +++
 drivers/media/video/s5p-fimc/fimc-core.h|   34 ++--
 drivers/media/video/s5p-fimc/fimc-mdevice.c |   11 +-
 drivers/media/video/s5p-fimc/fimc-reg.c |   32 +---
 5 files changed, 188 insertions(+), 241 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 562b23c..0c237a7 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -27,6 +27,7 @@
 #include media/videobuf2-core.h
 #include media/videobuf2-dma-contig.h
 
+#include fimc-mdevice.h
 #include fimc-core.h
 
 static void fimc_capture_state_cleanup(struct fimc_dev *fimc)
@@ -273,6 +274,31 @@ static struct vb2_ops fimc_capture_qops = {
.stop_streaming = stop_streaming,
 };
 
+/**
+ * fimc_capture_ctrls_create - initialize the control handler
+ * Initialize the capture video node control handler and fill it
+ * with the FIMC controls. Inherit any sensor's controls if the
+ * 'user_subdev_api' flag is false (default behaviour).
+ * This function need to be called with the graph mutex held.
+ */
+int fimc_capture_ctrls_create(struct fimc_dev *fimc)
+{
+   struct fimc_vid_cap *vid_cap = fimc-vid_cap;
+   int ret;
+
+   if (WARN_ON(vid_cap-ctx == NULL))
+   return -ENXIO;
+   if (vid_cap-ctx-ctrls_rdy)
+   return 0;
+
+   ret = fimc_ctrls_create(vid_cap-ctx);
+   if (ret || vid_cap-user_subdev_api)
+   return ret;
+
+   return v4l2_ctrl_add_handler(vid_cap-ctx-ctrl_handler,
+   fimc-pipeline.sensor-ctrl_handler);
+}
+
 static int fimc_capture_open(struct file *file)
 {
struct fimc_dev *fimc = video_drvdata(file);
@@ -293,9 +319,10 @@ static int fimc_capture_open(struct file *file)
return ret;
}
 
-   ++fimc-vid_cap.refcnt;
+   if (++fimc-vid_cap.refcnt == 1)
+   ret = fimc_capture_ctrls_create(fimc);
 
-   return 0;
+   return ret;
 }
 
 static int fimc_capture_close(struct file *file)
@@ -306,6 +333,7 @@ static int fimc_capture_close(struct file *file)
 
if (--fimc-vid_cap.refcnt == 0) {
fimc_stop_capture(fimc);
+   fimc_ctrls_delete(fimc-vid_cap.ctx);
vb2_queue_release(fimc-vid_cap.vbq);
}
 
@@ -546,30 +574,6 @@ static int fimc_cap_dqbuf(struct file *file, void *priv,
return vb2_dqbuf(fimc-vid_cap.vbq, buf, file-f_flags  O_NONBLOCK);
 }
 
-static int fimc_cap_s_ctrl(struct file *file, void *priv,
-  struct v4l2_control *ctrl)
-{
-   struct fimc_dev *fimc = video_drvdata(file);
-   struct fimc_ctx *ctx = fimc-vid_cap.ctx;
-   int ret = -EINVAL;
-
-   /* Allow any controls but 90/270 rotation while streaming */
-   if (!fimc_capture_active(ctx-fimc_dev) ||
-   ctrl-id != V4L2_CID_ROTATE ||
-   (ctrl-value != 90  ctrl-value != 270)) {
-   ret = check_ctrl_val(ctx, ctrl);
-   if (!ret) {
-   ret = fimc_s_ctrl(ctx, ctrl);
-   if (!ret)
-   ctx-state |= FIMC_PARAMS;
-   }
-   }
-   if (ret == -EINVAL)
-   ret = v4l2_subdev_call(ctx-fimc_dev-vid_cap.sd,
-  core, s_ctrl, ctrl);
-   return ret;
-}
-
 static int fimc_cap_cropcap(struct file *file, void *fh,
struct v4l2_cropcap *cr)
 {
@@ -656,10 +660,6 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops 
= {
.vidioc_streamon= fimc_cap_streamon,
.vidioc_streamoff   = fimc_cap_streamoff,
 
-   .vidioc_queryctrl   = fimc_vidioc_queryctrl,
-   .vidioc_g_ctrl  = fimc_vidioc_g_ctrl,
-   .vidioc_s_ctrl  = fimc_cap_s_ctrl,
-
.vidioc_g_crop  = fimc_cap_g_crop,
.vidioc_s_crop  = fimc_cap_s_crop,

[PATCH 11/19 v4] s5p-fimc: Correct color format enumeration

2011-09-01 Thread Sylwester Nawrocki
Replace fimc_find_format() and find_mbus_format() with single function
that can return a pointer to the private format description based
on fourcc, media bus code or index in the table.

Create separate VIDIOC_ENUM_FMT ioctl handlers for video capture
and mem-to-mem video node. This is needed because some formats are
valid only for the video capture and some only for the mem-to-mem
video node.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |   32 +
 drivers/media/video/s5p-fimc/fimc-core.c|   62 ++-
 drivers/media/video/s5p-fimc/fimc-core.h|5 +-
 drivers/media/video/s5p-fimc/fimc-mdevice.c |2 +-
 4 files changed, 57 insertions(+), 44 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 6c4dca0..32c2854 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -389,6 +389,22 @@ static int fimc_vidioc_querycap_capture(struct file *file, 
void *priv,
return 0;
 }
 
+static int fimc_cap_enum_fmt_mplane(struct file *file, void *priv,
+   struct v4l2_fmtdesc *f)
+{
+   struct fimc_fmt *fmt;
+
+   fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_CAM | FMT_FLAGS_M2M,
+  f-index);
+   if (!fmt)
+   return -EINVAL;
+   strncpy(f-description, fmt-name, sizeof(f-description) - 1);
+   f-pixelformat = fmt-fourcc;
+   if (fmt-fourcc == V4L2_MBUS_FMT_JPEG_1X8)
+   f-flags |= V4L2_FMT_FLAG_COMPRESSED;
+   return 0;
+}
+
 /* Synchronize formats of the camera interface input and attached  sensor. */
 static int sync_capture_fmt(struct fimc_ctx *ctx)
 {
@@ -407,7 +423,7 @@ static int sync_capture_fmt(struct fimc_ctx *ctx)
}
dbg(w: %d, h: %d, code= %d, fmt-width, fmt-height, fmt-code);
 
-   frame-fmt = find_mbus_format(fmt, FMT_FLAGS_CAM);
+   frame-fmt = fimc_find_format(NULL, fmt-code, FMT_FLAGS_CAM, -1);
if (!frame-fmt) {
err(fimc source format not found\n);
return -EINVAL;
@@ -469,12 +485,10 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void 
*priv,
frame = ctx-d_frame;
 
pix = f-fmt.pix_mp;
-   frame-fmt = find_format(f, FMT_FLAGS_M2M | FMT_FLAGS_CAM);
-   if (!frame-fmt) {
-   v4l2_err(fimc-vid_cap.vfd,
-Not supported capture (FIMC target) color format\n);
+   frame-fmt = fimc_find_format(pix-pixelformat, NULL,
+ FMT_FLAGS_M2M | FMT_FLAGS_CAM, 0);
+   if (WARN(frame-fmt == NULL, Pixel format lookup failed\n))
return -EINVAL;
-   }
 
for (i = 0; i  frame-fmt-colplanes; i++) {
frame-payload[i] =
@@ -654,7 +668,7 @@ static int fimc_cap_s_crop(struct file *file, void *fh, 
struct v4l2_crop *cr)
 static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops = {
.vidioc_querycap= fimc_vidioc_querycap_capture,
 
-   .vidioc_enum_fmt_vid_cap_mplane = fimc_vidioc_enum_fmt_mplane,
+   .vidioc_enum_fmt_vid_cap_mplane = fimc_cap_enum_fmt_mplane,
.vidioc_try_fmt_vid_cap_mplane  = fimc_cap_try_fmt_mplane,
.vidioc_s_fmt_vid_cap_mplane= fimc_cap_s_fmt_mplane,
.vidioc_g_fmt_vid_cap_mplane= fimc_cap_g_fmt_mplane,
@@ -715,7 +729,6 @@ int fimc_register_capture_device(struct fimc_dev *fimc,
struct video_device *vfd;
struct fimc_vid_cap *vid_cap;
struct fimc_ctx *ctx;
-   struct v4l2_format f;
struct fimc_frame *fr;
struct vb2_queue *q;
int ret = -ENOMEM;
@@ -730,9 +743,8 @@ int fimc_register_capture_device(struct fimc_dev *fimc,
ctx-state   = FIMC_CTX_CAP;
 
/* Default format of the output frames */
-   f.fmt.pix.pixelformat = V4L2_PIX_FMT_RGB32;
fr = ctx-d_frame;
-   fr-fmt = find_format(f, FMT_FLAGS_M2M);
+   fr-fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_CAM, 0);
fr-width = fr-f_width = fr-o_width = 640;
fr-height = fr-f_height = fr-o_height = 480;
 
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c 
b/drivers/media/video/s5p-fimc/fimc-core.c
index 565f1dd..3bcf6b7 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -866,18 +866,17 @@ static int fimc_m2m_querycap(struct file *file, void *fh,
return 0;
 }
 
-int fimc_vidioc_enum_fmt_mplane(struct file *file, void *priv,
-   struct v4l2_fmtdesc *f)
+static int fimc_m2m_enum_fmt_mplane(struct file *file, void *priv,
+   struct v4l2_fmtdesc *f)
 {
struct fimc_fmt *fmt;
 
-   if (f-index = ARRAY_SIZE(fimc_formats))
+   fmt = fimc_find_format(NULL, NULL, FMT_FLAGS_M2M, 

[PATCH 06/19 v4] s5p-fimc: Add the media device driver

2011-09-01 Thread Sylwester Nawrocki
Add a top level media device driver aggregating FIMC video devnodes,
MIPI-CSIS and sensor subdevs. This driver gathers all media entities
and creates the possible links between them during initialization. By
default some links will be activated to enable access to all available
sensors in the system. For example if there are sensors S0, S1 listed
in the media device platform data definition they will be by default
assigned to FIMC0, FIMC1 respectively, which in turn will corresponds
to separate /dev/video?.
There is enough FIMC H/W entities to cover all available physical camera
interfaces in the system.

The fimc media device driver is bound to the s5p-fimc-md platform device.
Such platform device should be created by board initialization code
and camera sensors description array need to be specified as its
platform data.

The media device driver also implements various video pipeline operations,
for enabling subdevs power, streaming, etc., which will be used by the
capture video node driver.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/Kconfig |5 +-
 drivers/media/video/s5p-fimc/Makefile   |2 +-
 drivers/media/video/s5p-fimc/fimc-core.c|   33 +-
 drivers/media/video/s5p-fimc/fimc-core.h|   16 +-
 drivers/media/video/s5p-fimc/fimc-mdevice.c |  829 +++
 drivers/media/video/s5p-fimc/fimc-mdevice.h |  118 
 include/media/s5p_fimc.h|2 +
 7 files changed, 983 insertions(+), 22 deletions(-)
 create mode 100644 drivers/media/video/s5p-fimc/fimc-mdevice.c
 create mode 100644 drivers/media/video/s5p-fimc/fimc-mdevice.h

diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 14326d7..6279663 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -949,8 +949,9 @@ config VIDEO_MX2
  Interface
 
 config  VIDEO_SAMSUNG_S5P_FIMC
-   tristate Samsung S5P and EXYNOS4 camera host interface driver
-   depends on VIDEO_V4L2  PLAT_S5P  PM_RUNTIME
+   tristate Samsung S5P and EXYNOS4 camera interface driver 
(EXPERIMENTAL)
+   depends on VIDEO_V4L2  I2C  PLAT_S5P  PM_RUNTIME  \
+   VIDEO_V4L2_SUBDEV_API  EXPERIMENTAL
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
---help---
diff --git a/drivers/media/video/s5p-fimc/Makefile 
b/drivers/media/video/s5p-fimc/Makefile
index df6954a..33dec7f 100644
--- a/drivers/media/video/s5p-fimc/Makefile
+++ b/drivers/media/video/s5p-fimc/Makefile
@@ -1,4 +1,4 @@
-s5p-fimc-objs := fimc-core.o fimc-reg.o fimc-capture.o
+s5p-fimc-objs := fimc-core.o fimc-reg.o fimc-capture.o fimc-mdevice.o
 s5p-csis-objs := mipi-csis.o
 
 obj-$(CONFIG_VIDEO_S5P_MIPI_CSIS)  += s5p-csis.o
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c 
b/drivers/media/video/s5p-fimc/fimc-core.c
index ba3af3a..7bb701b 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -28,6 +28,7 @@
 #include media/videobuf2-dma-contig.h
 
 #include fimc-core.h
+#include fimc-mdevice.h
 
 static char *fimc_clocks[MAX_FIMC_CLOCKS] = {
sclk_fimc, fimc
@@ -1867,6 +1868,7 @@ static struct fimc_pix_limit s5p_pix_limit[4] = {
 static struct samsung_fimc_variant fimc0_variant_s5p = {
.has_inp_rot = 1,
.has_out_rot = 1,
+   .has_cam_if  = 1,
.min_inp_pixsize = 16,
.min_out_pixsize = 16,
.hor_offs_align  = 8,
@@ -1875,6 +1877,7 @@ static struct samsung_fimc_variant fimc0_variant_s5p = {
 };
 
 static struct samsung_fimc_variant fimc2_variant_s5p = {
+   .has_cam_if  = 1,
.min_inp_pixsize = 16,
.min_out_pixsize = 16,
.hor_offs_align  = 8,
@@ -1886,6 +1889,7 @@ static struct samsung_fimc_variant fimc0_variant_s5pv210 
= {
.pix_hoff= 1,
.has_inp_rot = 1,
.has_out_rot = 1,
+   .has_cam_if  = 1,
.min_inp_pixsize = 16,
.min_out_pixsize = 16,
.hor_offs_align  = 8,
@@ -1897,6 +1901,7 @@ static struct samsung_fimc_variant fimc1_variant_s5pv210 
= {
.pix_hoff= 1,
.has_inp_rot = 1,
.has_out_rot = 1,
+   .has_cam_if  = 1,
.has_mainscaler_ext = 1,
.min_inp_pixsize = 16,
.min_out_pixsize = 16,
@@ -1906,6 +1911,7 @@ static struct samsung_fimc_variant fimc1_variant_s5pv210 
= {
 };
 
 static struct samsung_fimc_variant fimc2_variant_s5pv210 = {
+   .has_cam_if  = 1,
.pix_hoff= 1,
.min_inp_pixsize = 16,
.min_out_pixsize = 16,
@@ -1918,6 +1924,7 @@ static struct samsung_fimc_variant fimc0_variant_exynos4 
= {
.pix_hoff= 1,
.has_inp_rot = 1,
.has_out_rot = 1,
+   .has_cam_if  = 1,
.has_cistatus2   = 1,
.has_mainscaler_ext = 1,
.min_inp_pixsize = 16,
@@ -1927,8 +1934,9 @@ static 

[PATCH 19/19 v4] s5p-fimc: Remove single-planar capability flags

2011-09-01 Thread Sylwester Nawrocki
The driver supports only multi-planar API and conversion to single-planar
API should be done in libv4l2. Remove misleading single planar capability
flags to avoid problems in applications and libv4l2.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |3 +--
 drivers/media/video/s5p-fimc/fimc-core.c|1 -
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 9ca9462..de885db 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -615,8 +615,7 @@ static int fimc_vidioc_querycap_capture(struct file *file, 
void *priv,
strncpy(cap-driver, fimc-pdev-name, sizeof(cap-driver) - 1);
strncpy(cap-card, fimc-pdev-name, sizeof(cap-card) - 1);
cap-bus_info[0] = 0;
-   cap-capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE |
-   V4L2_CAP_VIDEO_CAPTURE_MPLANE;
+   cap-capabilities = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE_MPLANE;
 
return 0;
 }
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c 
b/drivers/media/video/s5p-fimc/fimc-core.c
index 8978360..4158cb3 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -864,7 +864,6 @@ static int fimc_m2m_querycap(struct file *file, void *fh,
strncpy(cap-card, fimc-pdev-name, sizeof(cap-card) - 1);
cap-bus_info[0] = 0;
cap-capabilities = V4L2_CAP_STREAMING |
-   V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT |
V4L2_CAP_VIDEO_CAPTURE_MPLANE | V4L2_CAP_VIDEO_OUTPUT_MPLANE;
 
return 0;
-- 
1.7.6

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


[PATCH 14/19 v4] s5p-fimc: Add support for JPEG capture

2011-09-01 Thread Sylwester Nawrocki
Add support for transparent DMA transfer of JPEG data with MIPI-CSI2
USER1 format. In JPEG mode the color effect, scaling and cropping
is not supported as well as image rotation and flipping thus these
controls are marked as inactive if V4L2_PIX_FMT_JPEG pixel format
was selected.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |   17 ++-
 drivers/media/video/s5p-fimc/fimc-core.c|   70 ++-
 drivers/media/video/s5p-fimc/fimc-core.h|7 ++-
 drivers/media/video/s5p-fimc/fimc-reg.c |   31 
 drivers/media/video/s5p-fimc/regs-fimc.h|8 +--
 5 files changed, 81 insertions(+), 52 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 62fd8a1..adbbb63 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -60,7 +60,7 @@ static int fimc_init_capture(struct fimc_dev *fimc)
fimc_hw_set_mainscaler(ctx);
fimc_hw_set_target_format(ctx);
fimc_hw_set_rotation(ctx);
-   fimc_hw_set_effect(ctx);
+   fimc_hw_set_effect(ctx, false);
fimc_hw_set_output_path(ctx);
fimc_hw_set_out_dma(ctx);
clear_bit(ST_CAPT_APPLY_CFG, fimc-state);
@@ -731,6 +731,17 @@ static int fimc_cap_try_fmt_mplane(struct file *file, void 
*fh,
return 0;
 }
 
+static void fimc_capture_mark_jpeg_xfer(struct fimc_ctx *ctx, bool jpeg)
+{
+   ctx-scaler.enabled = !jpeg;
+   fimc_ctrls_activate(ctx, !jpeg);
+
+   if (jpeg)
+   set_bit(ST_CAPT_JPEG, ctx-fimc_dev-state);
+   else
+   clear_bit(ST_CAPT_JPEG, ctx-fimc_dev-state);
+}
+
 static int fimc_capture_set_format(struct fimc_dev *fimc, struct v4l2_format 
*f)
 {
struct fimc_ctx *ctx = fimc-vid_cap.ctx;
@@ -783,6 +794,8 @@ static int fimc_capture_set_format(struct fimc_dev *fimc, 
struct v4l2_format *f)
if (!(ctx-state  FIMC_DST_CROP))
set_frame_crop(ff, 0, 0, pix-width, pix-height);
 
+   fimc_capture_mark_jpeg_xfer(ctx, fimc_fmt_is_jpeg(ff-fmt-color));
+
/* Reset cropping and set format at the camera interface input */
if (!fimc-vid_cap.user_subdev_api) {
ctx-s_frame.fmt = s_fmt;
@@ -1133,6 +1146,8 @@ static int fimc_subdev_set_fmt(struct v4l2_subdev *sd,
*mf = fmt-format;
return 0;
}
+   fimc_capture_mark_jpeg_xfer(ctx, fimc_fmt_is_jpeg(ffmt-color));
+
ff = fmt-pad == FIMC_SD_PAD_SINK ?
ctx-s_frame : ctx-d_frame;
 
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c 
b/drivers/media/video/s5p-fimc/fimc-core.c
index ffcccb2..52f0862 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -159,22 +159,28 @@ static struct fimc_fmt fimc_formats[] = {
.memplanes  = 2,
.colplanes  = 2,
.flags  = FMT_FLAGS_M2M,
+   }, {
+   .name   = JPEG encoded data,
+   .fourcc = V4L2_PIX_FMT_JPEG,
+   .color  = S5P_FIMC_JPEG,
+   .depth  = { 8 },
+   .memplanes  = 1,
+   .colplanes  = 1,
+   .mbus_code  = V4L2_MBUS_FMT_JPEG_1X8,
+   .flags  = FMT_FLAGS_CAM,
},
 };
 
-int fimc_check_scaler_ratio(int sw, int sh, int dw, int dh, int rot)
+int fimc_check_scaler_ratio(struct fimc_ctx *ctx, int sw, int sh,
+   int dw, int dh, int rotation)
 {
-   int tx, ty;
+   if (rotation == 90 || rotation == 270)
+   swap(dw, dh);
 
-   if (rot == 90 || rot == 270) {
-   ty = dw;
-   tx = dh;
-   } else {
-   tx = dw;
-   ty = dh;
-   }
+   if (!ctx-scaler.enabled)
+   return (sw == dw  sh == dh) ? 0 : -EINVAL;
 
-   if ((sw = SCALER_MAX_HRATIO * tx) || (sh = SCALER_MAX_VRATIO * ty))
+   if ((sw = SCALER_MAX_HRATIO * dw) || (sh = SCALER_MAX_VRATIO * dh))
return -EINVAL;
 
return 0;
@@ -321,7 +327,7 @@ static int stop_streaming(struct vb2_queue *q)
return 0;
 }
 
-static void fimc_capture_irq_handler(struct fimc_dev *fimc)
+void fimc_capture_irq_handler(struct fimc_dev *fimc, bool final)
 {
struct fimc_vid_cap *cap = fimc-vid_cap;
struct fimc_vid_buffer *v_buf;
@@ -329,7 +335,7 @@ static void fimc_capture_irq_handler(struct fimc_dev *fimc)
struct timespec ts;
 
if (!list_empty(cap-active_buf_q) 
-   test_bit(ST_CAPT_RUN, fimc-state)) {
+   test_bit(ST_CAPT_RUN, fimc-state)  final) {
ktime_get_real_ts(ts);
 
v_buf = active_queue_pop(cap);
@@ -364,7 

[PATCH 10/19 v4] s5p-fimc: Add PM helper function for streaming control

2011-09-01 Thread Sylwester Nawrocki
Move the camera capture H/W initialization sequence to a separate
function. This is needed for reuse in the following runtime PM code.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |   74 +++
 drivers/media/video/s5p-fimc/fimc-core.c|4 +-
 drivers/media/video/s5p-fimc/fimc-core.h|3 +
 3 files changed, 46 insertions(+), 35 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 95996fb..6c4dca0 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -30,6 +30,44 @@
 #include fimc-mdevice.h
 #include fimc-core.h
 
+static int fimc_init_capture(struct fimc_dev *fimc)
+{
+   struct fimc_ctx *ctx = fimc-vid_cap.ctx;
+   struct fimc_sensor_info *sensor;
+   unsigned long flags;
+   int ret = 0;
+
+   if (fimc-pipeline.sensor == NULL || ctx == NULL)
+   return -ENXIO;
+   if (ctx-s_frame.fmt == NULL)
+   return -EINVAL;
+
+   sensor = v4l2_get_subdev_hostdata(fimc-pipeline.sensor);
+
+   spin_lock_irqsave(fimc-slock, flags);
+   fimc_prepare_dma_offset(ctx, ctx-d_frame);
+   fimc_set_yuv_order(ctx);
+
+   fimc_hw_set_camera_polarity(fimc, sensor-pdata);
+   fimc_hw_set_camera_type(fimc, sensor-pdata);
+   fimc_hw_set_camera_source(fimc, sensor-pdata);
+   fimc_hw_set_camera_offset(fimc, ctx-s_frame);
+
+   ret = fimc_set_scaler_info(ctx);
+   if (!ret) {
+   fimc_hw_set_input_path(ctx);
+   fimc_hw_set_prescaler(ctx);
+   fimc_hw_set_mainscaler(ctx);
+   fimc_hw_set_target_format(ctx);
+   fimc_hw_set_rotation(ctx);
+   fimc_hw_set_effect(ctx);
+   fimc_hw_set_output_path(ctx);
+   fimc_hw_set_out_dma(ctx);
+   }
+   spin_unlock_irqrestore(fimc-slock, flags);
+   return ret;
+}
+
 static void fimc_capture_state_cleanup(struct fimc_dev *fimc)
 {
struct fimc_vid_cap *cap = fimc-vid_cap;
@@ -85,47 +123,17 @@ static int start_streaming(struct vb2_queue *q, unsigned 
int count)
 {
struct fimc_ctx *ctx = q-drv_priv;
struct fimc_dev *fimc = ctx-fimc_dev;
-   struct s5p_fimc_isp_info *isp_info;
+   struct fimc_vid_cap *vid_cap = fimc-vid_cap;
int min_bufs;
int ret;
 
fimc_hw_reset(fimc);
+   vid_cap-frame_count = 0;
 
-   ret = v4l2_subdev_call(fimc-vid_cap.sd, video, s_stream, 1);
-   if (ret  ret != -ENOIOCTLCMD)
-   goto error;
-
-   ret = fimc_prepare_config(ctx, ctx-state);
+   ret = fimc_init_capture(fimc);
if (ret)
goto error;
 
-   isp_info = fimc-pdata-isp_info[fimc-vid_cap.input_index];
-   fimc_hw_set_camera_type(fimc, isp_info);
-   fimc_hw_set_camera_source(fimc, isp_info);
-   fimc_hw_set_camera_offset(fimc, ctx-s_frame);
-
-   if (ctx-state  FIMC_PARAMS) {
-   ret = fimc_set_scaler_info(ctx);
-   if (ret) {
-   err(Scaler setup error);
-   goto error;
-   }
-   fimc_hw_set_input_path(ctx);
-   fimc_hw_set_prescaler(ctx);
-   fimc_hw_set_mainscaler(ctx);
-   fimc_hw_set_target_format(ctx);
-   fimc_hw_set_rotation(ctx);
-   fimc_hw_set_effect(ctx);
-   }
-
-   fimc_hw_set_output_path(ctx);
-   fimc_hw_set_out_dma(ctx);
-
-   INIT_LIST_HEAD(fimc-vid_cap.pending_buf_q);
-   INIT_LIST_HEAD(fimc-vid_cap.active_buf_q);
-   fimc-vid_cap.frame_count = 0;
-   fimc-vid_cap.buf_index = 0;
-
set_bit(ST_CAPT_PEND, fimc-state);
 
min_bufs = fimc-vid_cap.reqbufs_count  1 ? 2 : 1;
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c 
b/drivers/media/video/s5p-fimc/fimc-core.c
index 69ba2cc..565f1dd 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -476,7 +476,7 @@ int fimc_prepare_addr(struct fimc_ctx *ctx, struct 
vb2_buffer *vb,
 }
 
 /* Set order for 1 and 2 plane YCBCR 4:2:2 formats. */
-static void fimc_set_yuv_order(struct fimc_ctx *ctx)
+void fimc_set_yuv_order(struct fimc_ctx *ctx)
 {
/* The one only mode supported in SoC. */
ctx-in_order_2p = S5P_FIMC_LSB_CRCB;
@@ -518,7 +518,7 @@ static void fimc_set_yuv_order(struct fimc_ctx *ctx)
dbg(ctx-out_order_1p= %d, ctx-out_order_1p);
 }
 
-static void fimc_prepare_dma_offset(struct fimc_ctx *ctx, struct fimc_frame *f)
+void fimc_prepare_dma_offset(struct fimc_ctx *ctx, struct fimc_frame *f)
 {
struct samsung_fimc_variant *variant = ctx-fimc_dev-variant;
u32 i, depth = 0;
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h 
b/drivers/media/video/s5p-fimc/fimc-core.h
index 87a89f1..1d2cfda 

[PATCH 03/19 v4] s5p-fimc: Limit number of available inputs to one

2011-09-01 Thread Sylwester Nawrocki
The current driver allowed camera sensors to be used only with single
FIMC H/W instance, FIMC0..FIMC2/3, designated at compile time. Remaining FIMC
entities could be used for video processing only, as mem-to-mem devices.
Required camera could be selected with S_INPUT ioctl at one devnode only.

However in that case it was not possible to use both cameras independently
at the same time, as all sensors were registered to single FIMC capture
driver. In most recent S5P SoC version there is enough FIMC H/W instances
to cover all physical camera interfaces.
Each FIMC instance exports its own video devnode. Thus we distribute
the camera sensors one per each /dev/video? by default. It will allow to
use both camera simultaneously by opening different video node.

The camera sensors at FIMC are now not selected with S_INPUT ioctl, there
is one input only available per /dev/video?.

By default a single sensor is connected at FIMC input as specified by the
media device platform data subdev description table. This assignment
can be changed at runtime through the pipeline reconfiguration at the media
device level.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |   43 ---
 1 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 6efd952..b786c2c 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -577,57 +577,26 @@ static int fimc_cap_s_fmt_mplane(struct file *file, void 
*priv,
 }
 
 static int fimc_cap_enum_input(struct file *file, void *priv,
-struct v4l2_input *i)
+  struct v4l2_input *i)
 {
struct fimc_ctx *ctx = priv;
-   struct s5p_platform_fimc *pldata = ctx-fimc_dev-pdata;
-   struct s5p_fimc_isp_info *isp_info;
 
-   if (i-index = pldata-num_clients)
+   if (i-index != 0)
return -EINVAL;
 
-   isp_info = pldata-isp_info[i-index];
 
i-type = V4L2_INPUT_TYPE_CAMERA;
-   strncpy(i-name, isp_info-board_info-type, 32);
return 0;
 }
 
-static int fimc_cap_s_input(struct file *file, void *priv,
- unsigned int i)
+static int fimc_cap_s_input(struct file *file, void *priv, unsigned int i)
 {
-   struct fimc_ctx *ctx = priv;
-   struct fimc_dev *fimc = ctx-fimc_dev;
-   struct s5p_platform_fimc *pdata = fimc-pdata;
-
-   if (fimc_capture_active(ctx-fimc_dev))
-   return -EBUSY;
-
-   if (i = pdata-num_clients)
-   return -EINVAL;
-
-
-   if (fimc-vid_cap.sd) {
-   int ret = v4l2_subdev_call(fimc-vid_cap.sd, core, s_power, 0);
-   if (ret)
-   err(s_power failed: %d, ret);
-
-   clk_disable(fimc-clock[CLK_CAM]);
-   }
-
-   /* Release the attached sensor subdevice. */
-   fimc_subdev_unregister(fimc);
-
-   return fimc_isp_subdev_init(fimc, i);
+   return i == 0 ? i : -EINVAL;
 }
 
-static int fimc_cap_g_input(struct file *file, void *priv,
-  unsigned int *i)
+static int fimc_cap_g_input(struct file *file, void *priv, unsigned int *i)
 {
-   struct fimc_ctx *ctx = priv;
-   struct fimc_vid_cap *cap = ctx-fimc_dev-vid_cap;
-
-   *i = cap-input_index;
+   *i = 0;
return 0;
 }
 
-- 
1.7.6

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


[PATCH 04/19 v4] s5p-fimc: Remove sensor management code from FIMC capture driver

2011-09-01 Thread Sylwester Nawrocki
The sensor subdevs need to be shared between all available FIMC instances.
Remove their registration from FIMC capture driver so they can then be
registered to the media device driver.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |  139 +--
 drivers/media/video/s5p-fimc/fimc-core.h|2 +-
 2 files changed, 2 insertions(+), 139 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index b786c2c..40f3330 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -16,12 +16,9 @@
 #include linux/bug.h
 #include linux/interrupt.h
 #include linux/device.h
-#include linux/platform_device.h
 #include linux/pm_runtime.h
 #include linux/list.h
 #include linux/slab.h
-#include linux/clk.h
-#include linux/i2c.h
 
 #include linux/videodev2.h
 #include media/v4l2-device.h
@@ -32,126 +29,6 @@
 
 #include fimc-core.h
 
-static struct v4l2_subdev *fimc_subdev_register(struct fimc_dev *fimc,
-   struct s5p_fimc_isp_info *isp_info)
-{
-   struct i2c_adapter *i2c_adap;
-   struct fimc_vid_cap *vid_cap = fimc-vid_cap;
-   struct v4l2_subdev *sd = NULL;
-
-   i2c_adap = i2c_get_adapter(isp_info-i2c_bus_num);
-   if (!i2c_adap)
-   return ERR_PTR(-ENOMEM);
-
-   sd = v4l2_i2c_new_subdev_board(vid_cap-v4l2_dev, i2c_adap,
-  isp_info-board_info, NULL);
-   if (!sd) {
-   v4l2_err(vid_cap-v4l2_dev, failed to acquire subdev\n);
-   return NULL;
-   }
-
-   v4l2_info(vid_cap-v4l2_dev, subdevice %s registered successfuly\n,
-   isp_info-board_info-type);
-
-   return sd;
-}
-
-static void fimc_subdev_unregister(struct fimc_dev *fimc)
-{
-   struct fimc_vid_cap *vid_cap = fimc-vid_cap;
-   struct i2c_client *client;
-
-   if (vid_cap-input_index  0)
-   return; /* Subdevice already released or not registered. */
-
-   if (vid_cap-sd) {
-   v4l2_device_unregister_subdev(vid_cap-sd);
-   client = v4l2_get_subdevdata(vid_cap-sd);
-   i2c_unregister_device(client);
-   i2c_put_adapter(client-adapter);
-   vid_cap-sd = NULL;
-   }
-
-   vid_cap-input_index = -1;
-}
-
-/**
- * fimc_subdev_attach - attach v4l2_subdev to camera host interface
- *
- * @fimc: FIMC device information
- * @index: index to the array of available subdevices,
- *-1 for full array search or non negative value
- *to select specific subdevice
- */
-static int fimc_subdev_attach(struct fimc_dev *fimc, int index)
-{
-   struct fimc_vid_cap *vid_cap = fimc-vid_cap;
-   struct s5p_platform_fimc *pdata = fimc-pdata;
-   struct s5p_fimc_isp_info *isp_info;
-   struct v4l2_subdev *sd;
-   int i;
-
-   for (i = 0; i  pdata-num_clients; ++i) {
-   isp_info = pdata-isp_info[i];
-
-   if (index = 0  i != index)
-   continue;
-
-   sd = fimc_subdev_register(fimc, isp_info);
-   if (!IS_ERR_OR_NULL(sd)) {
-   vid_cap-sd = sd;
-   vid_cap-input_index = i;
-
-   return 0;
-   }
-   }
-
-   vid_cap-input_index = -1;
-   vid_cap-sd = NULL;
-   v4l2_err(vid_cap-v4l2_dev, fimc%d: sensor attach failed\n,
-fimc-id);
-   return -ENODEV;
-}
-
-static int fimc_isp_subdev_init(struct fimc_dev *fimc, unsigned int index)
-{
-   struct s5p_fimc_isp_info *isp_info;
-   struct s5p_platform_fimc *pdata = fimc-pdata;
-   int ret;
-
-   if (index = pdata-num_clients)
-   return -EINVAL;
-
-   isp_info = pdata-isp_info[index];
-
-   if (isp_info-clk_frequency)
-   clk_set_rate(fimc-clock[CLK_CAM], isp_info-clk_frequency);
-
-   ret = clk_enable(fimc-clock[CLK_CAM]);
-   if (ret)
-   return ret;
-
-   ret = fimc_subdev_attach(fimc, index);
-   if (ret)
-   return ret;
-
-   ret = fimc_hw_set_camera_polarity(fimc, isp_info);
-   if (ret)
-   return ret;
-
-   ret = v4l2_subdev_call(fimc-vid_cap.sd, core, s_power, 1);
-   if (!ret)
-   return ret;
-
-   /* enabling power failed so unregister subdev */
-   fimc_subdev_unregister(fimc);
-
-   v4l2_err(fimc-vid_cap.v4l2_dev, ISP initialization failed: %d\n,
-ret);
-
-   return ret;
-}
-
 static void fimc_capture_state_cleanup(struct fimc_dev *fimc)
 {
struct fimc_vid_cap *cap = fimc-vid_cap;
@@ -411,15 +288,7 @@ static int fimc_capture_open(struct file *file)
if (ret)
return ret;
 
-   if (++fimc-vid_cap.refcnt == 1) {
-   ret = 

[PATCH 09/19 v4] s5p-fimc: Add media operations in the capture entity driver

2011-09-01 Thread Sylwester Nawrocki
Add the link_setup handler for the camera capture video node.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |   32 +++
 drivers/media/video/s5p-fimc/fimc-core.h|2 +
 2 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 0c237a7..95996fb 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -669,6 +669,37 @@ static const struct v4l2_ioctl_ops fimc_capture_ioctl_ops 
= {
.vidioc_g_input = fimc_cap_g_input,
 };
 
+/* Media operations */
+static int fimc_link_setup(struct media_entity *entity,
+  const struct media_pad *local,
+  const struct media_pad *remote, u32 flags)
+{
+   struct video_device *vd = media_entity_to_video_device(entity);
+   struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(remote-entity);
+   struct fimc_dev *fimc = video_get_drvdata(vd);
+
+   if (WARN_ON(fimc == NULL))
+   return 0;
+
+   dbg(%s -- %s, flags: 0x%x. input: 0x%x,
+   local-entity-name, remote-entity-name, flags,
+   fimc-vid_cap.input);
+
+   if (flags  MEDIA_LNK_FL_ENABLED) {
+   if (fimc-vid_cap.input != 0)
+   return -EBUSY;
+   fimc-vid_cap.input = sd-grp_id;
+   return 0;
+   }
+
+   fimc-vid_cap.input = 0;
+   return 0;
+}
+
+static const struct media_entity_operations fimc_media_ops = {
+   .link_setup = fimc_link_setup,
+};
+
 /* fimc-lock must be already initialized */
 int fimc_register_capture_device(struct fimc_dev *fimc,
 struct v4l2_device *v4l2_dev)
@@ -743,6 +774,7 @@ int fimc_register_capture_device(struct fimc_dev *fimc,
if (ret)
goto err_ent;
 
+   vfd-entity.ops = fimc_media_ops;
vfd-ctrl_handler = ctx-ctrl_handler;
return 0;
 
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h 
b/drivers/media/video/s5p-fimc/fimc-core.h
index 1825e33..87a89f1 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.h
+++ b/drivers/media/video/s5p-fimc/fimc-core.h
@@ -305,6 +305,7 @@ struct fimc_m2m_device {
  * @reqbufs_count: the number of buffers requested in REQBUFS ioctl
  * @input_index: input (camera sensor) index
  * @refcnt: driver's private reference counter
+ * @input: capture input type, grp_id of the attached subdev
  * @user_subdev_api: true if subdevs are not configured by the host driver
  */
 struct fimc_vid_cap {
@@ -323,6 +324,7 @@ struct fimc_vid_cap {
unsigned intreqbufs_count;
int input_index;
int refcnt;
+   u32 input;
booluser_subdev_api;
 };
 
-- 
1.7.6

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


[PATCH 01/19 v4] s5p-fimc: Remove registration of video nodes from probe()

2011-09-01 Thread Sylwester Nawrocki
Do not register video nodes during FIMC device probe. Also make
fimc_register_m2m_device() public for use by the media device driver.
The video nodes are to be registered during the media device driver
initialization, altogether with the subdev devnodes. The video
capture nodes need to be registered as last ones when the remaining
pipeline elements are already initialized.

Signed-off-by: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Kyungmin Park kyungmin.p...@samsung.com
---
 drivers/media/video/s5p-fimc/fimc-capture.c |   14 +-
 drivers/media/video/s5p-fimc/fimc-core.c|   55 ++
 drivers/media/video/s5p-fimc/fimc-core.h|1 +
 3 files changed, 17 insertions(+), 53 deletions(-)

diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c 
b/drivers/media/video/s5p-fimc/fimc-capture.c
index 19d398b..6efd952 100644
--- a/drivers/media/video/s5p-fimc/fimc-capture.c
+++ b/drivers/media/video/s5p-fimc/fimc-capture.c
@@ -905,19 +905,8 @@ int fimc_register_capture_device(struct fimc_dev *fimc)
if (ret)
goto err_ent;
 
-   ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1);
-   if (ret) {
-   v4l2_err(v4l2_dev, Failed to register video device\n);
-   goto err_vd_reg;
-   }
-
-   v4l2_info(v4l2_dev,
- FIMC capture driver registered as /dev/video%d\n,
- vfd-num);
return 0;
 
-err_vd_reg:
-   media_entity_cleanup(vfd-entity);
 err_ent:
video_device_release(vfd);
 err_v4l2_reg:
@@ -934,7 +923,10 @@ void fimc_unregister_capture_device(struct fimc_dev *fimc)
 
if (vfd) {
media_entity_cleanup(vfd-entity);
+   /* Can also be called if video device was
+  not registered */
video_unregister_device(vfd);
}
kfree(fimc-vid_cap.ctx);
+   fimc-vid_cap.ctx = NULL;
 }
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c 
b/drivers/media/video/s5p-fimc/fimc-core.c
index fdc1d75..e042fdc 100644
--- a/drivers/media/video/s5p-fimc/fimc-core.c
+++ b/drivers/media/video/s5p-fimc/fimc-core.c
@@ -1494,7 +1494,7 @@ static struct v4l2_m2m_ops m2m_ops = {
.job_abort  = fimc_job_abort,
 };
 
-static int fimc_register_m2m_device(struct fimc_dev *fimc)
+int fimc_register_m2m_device(struct fimc_dev *fimc)
 {
struct video_device *vfd;
struct platform_device *pdev;
@@ -1541,22 +1541,9 @@ static int fimc_register_m2m_device(struct fimc_dev 
*fimc)
}
 
ret = media_entity_init(vfd-entity, 0, NULL, 0);
-   if (ret)
-   goto err_m2m_r3;
-
-   ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1);
-   if (ret) {
-   v4l2_err(v4l2_dev,
-%s(): failed to register video device\n, __func__);
-   goto err_m2m_r4;
-   }
-   v4l2_info(v4l2_dev,
- FIMC m2m driver registered as /dev/video%d\n, vfd-num);
+   if (!ret)
+   return 0;
 
-   return 0;
-err_m2m_r4:
-   media_entity_cleanup(vfd-entity);
-err_m2m_r3:
v4l2_m2m_release(fimc-m2m.m2m_dev);
 err_m2m_r2:
video_device_release(fimc-m2m.vfd);
@@ -1566,15 +1553,19 @@ err_m2m_r1:
return ret;
 }
 
-static void fimc_unregister_m2m_device(struct fimc_dev *fimc)
+void fimc_unregister_m2m_device(struct fimc_dev *fimc)
 {
-   if (fimc == NULL)
+   if (!fimc)
return;
 
-   v4l2_m2m_release(fimc-m2m.m2m_dev);
+   if (fimc-m2m.m2m_dev)
+   v4l2_m2m_release(fimc-m2m.m2m_dev);
v4l2_device_unregister(fimc-m2m.v4l2_dev);
-   media_entity_cleanup(fimc-m2m.vfd-entity);
-   video_unregister_device(fimc-m2m.vfd);
+   if (fimc-m2m.vfd) {
+   media_entity_cleanup(fimc-m2m.vfd-entity);
+   /* Can also be called if video device wasn't registered */
+   video_unregister_device(fimc-m2m.vfd);
+   }
 }
 
 static void fimc_clk_put(struct fimc_dev *fimc)
@@ -1739,27 +1730,11 @@ static int fimc_probe(struct platform_device *pdev)
goto err_pm;
}
 
-   ret = fimc_register_m2m_device(fimc);
-   if (ret)
-   goto err_alloc;
-
-   /* At least one camera sensor is required to register capture node */
-   if (cap_input_index = 0) {
-   ret = fimc_register_capture_device(fimc);
-   if (ret)
-   goto err_m2m;
-   }
-
-   dev_dbg(pdev-dev, %s(): fimc-%d registered successfully\n,
-   __func__, fimc-id);
+   dev_dbg(pdev-dev, FIMC.%d registered successfully\n, fimc-id);
 
pm_runtime_put(pdev-dev);
return 0;
 
-err_m2m:
-   fimc_unregister_m2m_device(fimc);
-err_alloc:
-   vb2_dma_contig_cleanup_ctx(fimc-alloc_ctx);
 err_pm:
pm_runtime_put(pdev-dev);
 err_irq:
@@ -1773,7 +1748,6 @@ err_req_region:
kfree(fimc-regs_res);
 err_info:
kfree(fimc);
-
 

[PATCH] gpio: exynos4: Add device tree support

2011-09-01 Thread Thomas Abraham
As gpio chips get registered, a device tree node which represents the
gpio chip is searched and attached to it. A translate function is also
provided to convert the gpio specifier into actual platform settings
for pin function selection, pull up/down and drive strength settings.

Signed-off-by: Thomas Abraham thomas.abra...@linaro.org
---
This patch addes device tree support for exynos4 with minimal changes to
existing code. All the gpio chips that are registered find a corresponding
gpio-controller in the device tree. An example of such a node is:

gpd1: gpio-controller@114000C0 {
compatible = samsung,exynos4-gpio-gpd1, 
samsung,exynos4-gpio;
#gpio-cells = 4;
gpio-controller;
};

Four cells are required to describe a gpio and all its properties. The pin
function selection, pull up/down and drive strength settings are considered
the properties of the gpio pin. This fits well with the hardware organization
of gpio, pinmux, pull up/down and drive strength for exynos4.

The format of the gpio specifier is
[phandle] [gpio_pin] [function] [pull] [drive_strength];

- gpio_pin: Pin number within a gpio-controller.
- function: Pinmux function number (as per the SoC spec).
- pull: Pull up/down setting value (as per the SoC spec).
- drive_strength: Pin Driver strength setting (as per the SoC spec).

Example: A i2c device node which uses two gpio lines is listed below.

i2c@1386 {
compatible = samsung,s3c2440-i2c;
reg = 0x1386 0x100;
interrupts = 122;
gpios = gpd1 0 2 3 0
 gpd1 1 2 3 0;
};

A driver or any other portion of the code that is looking up a gpio number
from a device tree node would first get the gpio number using the of_get_gpio()
function. And then use the gpio_request() function on that gpio number.

This approach has been tested with i2c driver for exynos4.

 drivers/gpio/gpio-exynos4.c |   53 +++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/gpio-exynos4.c b/drivers/gpio/gpio-exynos4.c
index d24b337..aa2d9fb 100644
--- a/drivers/gpio/gpio-exynos4.c
+++ b/drivers/gpio/gpio-exynos4.c
@@ -13,6 +13,10 @@
 #include linux/irq.h
 #include linux/io.h
 #include linux/gpio.h
+#ifdef CONFIG_OF
+#include linux/of.h
+#include linux/slab.h
+#endif
 
 #include mach/map.h
 
@@ -320,6 +324,52 @@ static struct s3c_gpio_chip exynos4_gpio_part3_4bit[] = {
},
 };
 
+#ifdef CONFIG_OF
+int exynos4_gpio_xlate(struct gpio_chip *gc, struct device_node *np,
+const void *gpio_spec, u32 *flags)
+{
+   const __be32 *gpio = gpio_spec;
+   const u32 n = be32_to_cpup(gpio);
+   unsigned int pin = gc-base + be32_to_cpu(gpio[0]);
+
+   if (gc-of_gpio_n_cells  4) {
+   WARN_ON(1);
+   return -EINVAL;
+   }
+
+   if (n  gc-ngpio)
+   return -EINVAL;
+
+   s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(be32_to_cpu(gpio[1])));
+   s3c_gpio_setpull(pin, be32_to_cpu(gpio[2]));
+   s5p_gpio_set_drvstr(pin, be32_to_cpu(gpio[3]));
+   return n;
+}
+
+static __init void exynos4_gpiolib_attach_ofnode(struct gpio_chip *gc)
+{
+   const char exynos4_gpio_compat_base[] = samsung,exynos4-gpio-;
+   char *exynos4_gpio_compat;
+
+   exynos4_gpio_compat = kzalloc(strlen(exynos4_gpio_compat_base) +
+   strlen(gc-label), GFP_KERNEL);
+   if (!exynos4_gpio_compat)
+   return;
+
+   strcpy(exynos4_gpio_compat, exynos4_gpio_compat_base);
+   strcat(exynos4_gpio_compat, gc-label);
+   gc-of_node = of_find_compatible_node(NULL, NULL, exynos4_gpio_compat);
+   gc-of_gpio_n_cells = 4;
+   gc-of_xlate = exynos4_gpio_xlate;
+   kfree(exynos4_gpio_compat);
+}
+#else
+static __init void exynos4_gpiolib_attach_ofnode(struct gpio_chip *chip)
+{
+   return;
+}
+#endif
+
 static __init int exynos4_gpiolib_init(void)
 {
struct s3c_gpio_chip *chip;
@@ -340,6 +390,7 @@ static __init int exynos4_gpiolib_init(void)
}
if (chip-base == NULL)
chip-base = S5P_VA_GPIO1 + (i) * 0x20;
+   exynos4_gpiolib_attach_ofnode(chip-chip);
}
 
samsung_gpiolib_add_4bit_chips(exynos4_gpio_part1_4bit, nr_chips);
@@ -357,6 +408,7 @@ static __init int exynos4_gpiolib_init(void)
}
if (chip-base == NULL)
chip-base = S5P_VA_GPIO2 + (i) * 0x20;
+   exynos4_gpiolib_attach_ofnode(chip-chip);
}
 
samsung_gpiolib_add_4bit_chips(exynos4_gpio_part2_4bit, nr_chips);
@@ -374,6 +426,7 @@ static __init int exynos4_gpiolib_init(void)
}
if (chip-base == NULL)
chip-base = S5P_VA_GPIO3 + (i) * 0x20;
+   exynos4_gpiolib_attach_ofnode(chip-chip);
}
 

Re: [PATCH 0/2] video: s3c-fb: Add window positioning support

2011-09-01 Thread Florian Tobias Schandinat
Hi all,

On 08/25/2011 07:51 PM, Ajay Kumar wrote:
 Just as a note, there are many drivers like mx3fb.c, au1200fb.c and OMAP
 seem to be doing window/plane positioning in their driver code.
 Is it possible to have this window positioning support at a common place?

Good point. Congratulations for figuring out that I like to standardize things.
But I think your suggestion is far from being enough to be useful for userspace
(which is our goal so that applications can be reused along drivers and don't
need to know about individual drivers).

So let me at first summarize how I understand you implemented those things after
having a brief look at some of the drivers:
Windows are rectangular screen areas whose pixel data come from other locations.
The other locations are accessible via other framebuffer devices (e.g. fb1). So
in this area the data of fb1 is shown and not the data of fb0 that would be
normally shown.

So in addition to your proposed positioning I think we should also have the
following to give userspace a useful set of functionality:

- a way to discover how the screen is composited (how many windows are there,
how they are stacked and how to access those)

- a way to enable/disable windows (make them (in)visible)

- reporting and selecting how the window content can be mixed with the root
screen (overwrite, source or destination color keying)

- things like window size and color format could be handled by the usual fb API
used on the window. However there might be restrictions which cause them to be
not 100% API compatible (for example when changing the color format if the
windows are required to have the same format as the root screen)

- do we need to worry about hardware (up/down) scaling of the window content?


So is that what you need for a standardized window implementation?
Any additional things that were useful/needed in this context?
Would you consider adding support for this API in your drivers? (as
standardizing wouldn't be useful if nobody would implement it)


Best regards,

Florian Tobias Schandinat


 
 For instance, we can have a common struture and ioctl number in 
 include/linux/fb.h as below:
 
   #define FBIOPOS_OVERLAY_WIN_IOW('F', 0x21, struct 
 fb_overlay_win_pos)
 
   struct fb_overlay_win_pos {
   __u32 win_pos_x;  /* x-offset of window from LCD(0,0) */
   __u32 win_pos_y;  /* y-offset of window from LCD(0,0) */
   };
 
 where LCD(0,0) means the first pixel of the LCD screen.
 Individual drivers can have implementation for this ioctl.
 
 To Kukjin Kim,
   [PATCH 1/2] ARM: SAMSUNG: Add Window Positioning Support for s3c-fb driver
 
 To Paul Mundt, Florian Tobias Schandinat
   [PATCH 2/2] video: s3c-fb: Modify s3c-fb driver to support window 
 positioning
 
  arch/arm/plat-samsung/include/plat/fb.h |   14 +++
  drivers/video/s3c-fb.c  |   37 ++
  2 files changed, 46 insertions(+), 5 deletions(-)
 
 

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


Re: [PATCH 2/3] ARM: EXYNOS4: Add support for secondary MMC port on ORIGEN

2011-09-01 Thread Tushar Behera

Hi Kukjin,

On Wednesday 31 August 2011 06:23 AM, Kukjin Kim wrote:

Tushar Behera wrote:

-Original Message-
From: Tushar Behera [mailto:tushar.beh...@linaro.org]
Sent: Friday, August 26, 2011 6:39 PM
To: linux-samsung-soc@vger.kernel.org
Cc: linaro-...@lists.linaro.org; kgene@samsung.com; patc...@linaro.org
Subject: [PATCH 2/3] ARM: EXYNOS4: Add support for secondary MMC port on
ORIGEN

Secondary MMC port on ORIGEN is connected to sdhci instance 0. Support
for secondary MMC port is extended by registering sdhci instance 0.

Since sdhci instance 2 can contain a bootable media, sdhci instance 0
is registered after instance 2.


Would be helpful if above comments could be included in codes :)


Signed-off-by: Tushar Beheratushar.beh...@linaro.org
---
  arch/arm/mach-exynos4/Kconfig   |1 +
  arch/arm/mach-exynos4/mach-origen.c |7 +++
  2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index e6925de..4c14d5e 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -229,6 +229,7 @@ config MACH_ORIGEN
select CPU_EXYNOS4210
select S3C_DEV_RTC
select S3C_DEV_WDT
+   select S3C_DEV_HSMMC
select S3C_DEV_HSMMC2
select EXYNOS4_SETUP_SDHCI
help
diff --git a/arch/arm/mach-exynos4/mach-origen.c

b/arch/arm/mach-exynos4/mach-

origen.c
index e280270..ae18812 100644
--- a/arch/arm/mach-exynos4/mach-origen.c
+++ b/arch/arm/mach-exynos4/mach-origen.c
@@ -72,6 +72,11 @@ static struct s3c2410_uartcfg origen_uartcfgs[]

__initdata = {

},
  };

+static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata = {
+   .cd_type= S3C_SDHCI_CD_INTERNAL,
+   .clk_type   = S3C_SDHCI_CLK_DIV_EXTERNAL,
+};
+
  static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata = {
.cd_type= S3C_SDHCI_CD_INTERNAL,
.clk_type   = S3C_SDHCI_CLK_DIV_EXTERNAL,
@@ -79,6 +84,7 @@ static struct s3c_sdhci_platdata origen_hsmmc2_pdata
__initdata = {

  static struct platform_device *origen_devices[] __initdata = {
s3c_device_hsmmc2,
+   s3c_device_hsmmc0,
s3c_device_rtc,
s3c_device_wdt,
  };
@@ -93,6 +99,7 @@ static void __init origen_map_io(void)
  static void __init origen_machine_init(void)
  {
s3c_sdhci2_set_platdata(origen_hsmmc2_pdata);
+   s3c_sdhci0_set_platdata(origen_hsmmc0_pdata);
platform_add_devices(origen_devices, ARRAY_SIZE(origen_devices));
  }

--
1.7.4.1


OK, will apply.
If you don't mind, I will add comments the reason of the ordering when I
apply this.


Thanks. That would be great.


Thanks.

Best regards,
Kgene.
--
Kukjin Kimkgene@samsung.com, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.




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


Re: [PATCH 3/3] ARM: EXYNOS4: Add support for 8-bit bus width in SDHCI for ORIGEN

2011-09-01 Thread Tushar Behera

Hi Kukjin,

On Wednesday 31 August 2011 06:31 AM, Kukjin Kim wrote:

Tushar Behera wrote:


Platform data for SDHCI controller on ORIGEN board is missing the
support for 8-bit bus width. The platform data is extended in sync
with other EXYNOS4 machines.

Signed-off-by: Tushar Beheratushar.beh...@linaro.org
---
  arch/arm/mach-exynos4/mach-origen.c |8 
  1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-exynos4/mach-origen.c

b/arch/arm/mach-exynos4/mach-

origen.c
index ae18812..6b6cd77 100644
--- a/arch/arm/mach-exynos4/mach-origen.c
+++ b/arch/arm/mach-exynos4/mach-origen.c
@@ -75,11 +75,19 @@ static struct s3c2410_uartcfg origen_uartcfgs[]

__initdata =

{
  static struct s3c_sdhci_platdata origen_hsmmc0_pdata __initdata = {
.cd_type= S3C_SDHCI_CD_INTERNAL,
.clk_type   = S3C_SDHCI_CLK_DIV_EXTERNAL,
+#ifdef CONFIG_EXYNOS4_SDHCI_CH0_8BIT
+   .max_width  = 8,
+   .host_caps  = MMC_CAP_8_BIT_DATA,
+#endif
  };

  static struct s3c_sdhci_platdata origen_hsmmc2_pdata __initdata = {
.cd_type= S3C_SDHCI_CD_INTERNAL,
.clk_type   = S3C_SDHCI_CLK_DIV_EXTERNAL,
+#ifdef CONFIG_EXYNOS4_SDHCI_CH2_8BIT
+   .max_width  = 8,
+   .host_caps  = MMC_CAP_8_BIT_DATA,
+#endif
  };

  static struct platform_device *origen_devices[] __initdata = {
--
1.7.4.1


Hi Tushar,

I wonder the bus width of SDHCI controller can be changed manually on ORIGEN
like SMDK board.


I will do further test and update you about the results.


Thanks.

Best regards,
Kgene.
--
Kukjin Kimkgene@samsung.com, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.




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