Re: [PATCH v2 06/15] omap3isp: Refactor device configuration structs for Device Tree

2015-03-25 Thread Tony Lindgren
* Sakari Ailus  [150325 16:00]:
> Make omap3isp configuration data structures more suitable for consumption by
> the DT by separating the I2C bus information of all the sub-devices in a
> group and the ISP bus information from each other. The ISP bus information
> is made a pointer instead of being directly embedded in the struct.
> 
> In the case of the DT only the sensor specific information on the ISP bus
> configuration is retained. The structs are renamed to reflect that.
> 
> After this change the structs needed to describe device configuration can be
> allocated and accessed separately without those needed only in the case of
> platform data. The platform data related structs can be later removed once
> the support for platform data can be removed.
> 
> Signed-off-by: Sakari Ailus 
> Acked-by: Laurent Pinchart 
> Cc: Igor Grinberg 
> Acked-by: Igor Grinberg  (for cm-t35)

There arch/arm/mach-omap2 changes here are OK to merge along with
the driver changes:

Acked-by: Tony Lindgren 

> ---
>  arch/arm/mach-omap2/board-cm-t35.c  |   57 +++---
>  drivers/media/platform/omap3isp/isp.c   |   86 
> +--
>  drivers/media/platform/omap3isp/isp.h   |2 +-
>  drivers/media/platform/omap3isp/ispccdc.c   |   26 
>  drivers/media/platform/omap3isp/ispccp2.c   |   22 +++
>  drivers/media/platform/omap3isp/ispcsi2.c   |8 +--
>  drivers/media/platform/omap3isp/ispcsiphy.c |   21 ---
>  include/media/omap3isp.h|   34 +--
>  8 files changed, 119 insertions(+), 137 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
> b/arch/arm/mach-omap2/board-cm-t35.c
> index 91738a1..b5dfbc1 100644
> --- a/arch/arm/mach-omap2/board-cm-t35.c
> +++ b/arch/arm/mach-omap2/board-cm-t35.c
> @@ -492,51 +492,36 @@ static struct twl4030_platform_data cm_t35_twldata = {
>  #include 
>  #include "devices.h"
>  
> -static struct i2c_board_info cm_t35_isp_i2c_boardinfo[] = {
> +static struct isp_platform_subdev cm_t35_isp_subdevs[] = {
>   {
> - I2C_BOARD_INFO("mt9t001", 0x5d),
> - },
> - {
> - I2C_BOARD_INFO("tvp5150", 0x5c),
> - },
> -};
> -
> -static struct isp_subdev_i2c_board_info cm_t35_isp_primary_subdevs[] = {
> - {
> - .board_info = &cm_t35_isp_i2c_boardinfo[0],
> - .i2c_adapter_id = 3,
> - },
> - { NULL, 0, },
> -};
> -
> -static struct isp_subdev_i2c_board_info cm_t35_isp_secondary_subdevs[] = {
> - {
> - .board_info = &cm_t35_isp_i2c_boardinfo[1],
> + .board_info = &(struct i2c_board_info){
> + I2C_BOARD_INFO("mt9t001", 0x5d)
> + },
>   .i2c_adapter_id = 3,
> - },
> - { NULL, 0, },
> -};
> -
> -static struct isp_v4l2_subdevs_group cm_t35_isp_subdevs[] = {
> - {
> - .subdevs = cm_t35_isp_primary_subdevs,
> - .interface = ISP_INTERFACE_PARALLEL,
> - .bus = {
> - .parallel = {
> - .clk_pol = 1,
> + .bus = &(struct isp_bus_cfg){
> + .interface = ISP_INTERFACE_PARALLEL,
> + .bus = {
> + .parallel = {
> + .clk_pol = 1,
> + },
>   },
>   },
>   },
>   {
> - .subdevs = cm_t35_isp_secondary_subdevs,
> - .interface = ISP_INTERFACE_PARALLEL,
> - .bus = {
> - .parallel = {
> - .clk_pol = 0,
> + .board_info = &(struct i2c_board_info){
> + I2C_BOARD_INFO("tvp5150", 0x5c),
> + },
> + .i2c_adapter_id = 3,
> + .bus = &(struct isp_bus_cfg){
> + .interface = ISP_INTERFACE_PARALLEL,
> + .bus = {
> + .parallel = {
> + .clk_pol = 0,
> + },
>   },
>   },
>   },
> - { NULL, 0, },
> + { 0 },
>  };
>  
>  static struct isp_platform_data cm_t35_isp_pdata = {
> diff --git a/drivers/media/platform/omap3isp/isp.c 
> b/drivers/media/platform/omap3isp/isp.c
> index 537377b..1b5c6df 100644
> --- a/drivers/media/platform/omap3isp/isp.c
> +++ b/drivers/media/platform/omap3isp/isp.c
> @@ -447,7 +447,7 @@ static void isp_core_init(struct isp_device *isp, int 
> idle)
>   */
>  void omap3isp_configure_bridge(struct isp_device *isp,
>  enum ccdc_input_entity input,
> -const struct isp_parallel_platform_data *pdata,
> +const struct isp_parallel_cfg *parcfg,
>  unsigned int shift, unsigned int bridge)
>  {
>   u32 ispctrl_val;
> @@ -462,8 +462,8 @@ void omap3isp_configure_bridge(struct isp_device *isp,

[PATCH v2 06/15] omap3isp: Refactor device configuration structs for Device Tree

2015-03-25 Thread Sakari Ailus
Make omap3isp configuration data structures more suitable for consumption by
the DT by separating the I2C bus information of all the sub-devices in a
group and the ISP bus information from each other. The ISP bus information
is made a pointer instead of being directly embedded in the struct.

In the case of the DT only the sensor specific information on the ISP bus
configuration is retained. The structs are renamed to reflect that.

After this change the structs needed to describe device configuration can be
allocated and accessed separately without those needed only in the case of
platform data. The platform data related structs can be later removed once
the support for platform data can be removed.

Signed-off-by: Sakari Ailus 
Acked-by: Laurent Pinchart 
Cc: Igor Grinberg 
Acked-by: Igor Grinberg  (for cm-t35)
---
 arch/arm/mach-omap2/board-cm-t35.c  |   57 +++---
 drivers/media/platform/omap3isp/isp.c   |   86 +--
 drivers/media/platform/omap3isp/isp.h   |2 +-
 drivers/media/platform/omap3isp/ispccdc.c   |   26 
 drivers/media/platform/omap3isp/ispccp2.c   |   22 +++
 drivers/media/platform/omap3isp/ispcsi2.c   |8 +--
 drivers/media/platform/omap3isp/ispcsiphy.c |   21 ---
 include/media/omap3isp.h|   34 +--
 8 files changed, 119 insertions(+), 137 deletions(-)

diff --git a/arch/arm/mach-omap2/board-cm-t35.c 
b/arch/arm/mach-omap2/board-cm-t35.c
index 91738a1..b5dfbc1 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -492,51 +492,36 @@ static struct twl4030_platform_data cm_t35_twldata = {
 #include 
 #include "devices.h"
 
-static struct i2c_board_info cm_t35_isp_i2c_boardinfo[] = {
+static struct isp_platform_subdev cm_t35_isp_subdevs[] = {
{
-   I2C_BOARD_INFO("mt9t001", 0x5d),
-   },
-   {
-   I2C_BOARD_INFO("tvp5150", 0x5c),
-   },
-};
-
-static struct isp_subdev_i2c_board_info cm_t35_isp_primary_subdevs[] = {
-   {
-   .board_info = &cm_t35_isp_i2c_boardinfo[0],
-   .i2c_adapter_id = 3,
-   },
-   { NULL, 0, },
-};
-
-static struct isp_subdev_i2c_board_info cm_t35_isp_secondary_subdevs[] = {
-   {
-   .board_info = &cm_t35_isp_i2c_boardinfo[1],
+   .board_info = &(struct i2c_board_info){
+   I2C_BOARD_INFO("mt9t001", 0x5d)
+   },
.i2c_adapter_id = 3,
-   },
-   { NULL, 0, },
-};
-
-static struct isp_v4l2_subdevs_group cm_t35_isp_subdevs[] = {
-   {
-   .subdevs = cm_t35_isp_primary_subdevs,
-   .interface = ISP_INTERFACE_PARALLEL,
-   .bus = {
-   .parallel = {
-   .clk_pol = 1,
+   .bus = &(struct isp_bus_cfg){
+   .interface = ISP_INTERFACE_PARALLEL,
+   .bus = {
+   .parallel = {
+   .clk_pol = 1,
+   },
},
},
},
{
-   .subdevs = cm_t35_isp_secondary_subdevs,
-   .interface = ISP_INTERFACE_PARALLEL,
-   .bus = {
-   .parallel = {
-   .clk_pol = 0,
+   .board_info = &(struct i2c_board_info){
+   I2C_BOARD_INFO("tvp5150", 0x5c),
+   },
+   .i2c_adapter_id = 3,
+   .bus = &(struct isp_bus_cfg){
+   .interface = ISP_INTERFACE_PARALLEL,
+   .bus = {
+   .parallel = {
+   .clk_pol = 0,
+   },
},
},
},
-   { NULL, 0, },
+   { 0 },
 };
 
 static struct isp_platform_data cm_t35_isp_pdata = {
diff --git a/drivers/media/platform/omap3isp/isp.c 
b/drivers/media/platform/omap3isp/isp.c
index 537377b..1b5c6df 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -447,7 +447,7 @@ static void isp_core_init(struct isp_device *isp, int idle)
  */
 void omap3isp_configure_bridge(struct isp_device *isp,
   enum ccdc_input_entity input,
-  const struct isp_parallel_platform_data *pdata,
+  const struct isp_parallel_cfg *parcfg,
   unsigned int shift, unsigned int bridge)
 {
u32 ispctrl_val;
@@ -462,8 +462,8 @@ void omap3isp_configure_bridge(struct isp_device *isp,
switch (input) {
case CCDC_INPUT_PARALLEL:
ispctrl_val |= ISPCTRL_PAR_SER_CLK_SEL_PARALLEL;
-   ispctrl_val |= pdata->clk_pol << ISPCTRL_PAR_CLK_POL_SHIFT;
-   shift += pdata->data_lane_shift * 2;
+   ispc