Re: [PATCH v2 02/23] OMAPDSS: outputs: Create and register output instances

2012-08-31 Thread Tomi Valkeinen
On Thu, 2012-08-30 at 17:10 +0530, Archit Taneja wrote:
 Add output structs to output driver's private data. Register output instances 
 by
 having an init function in the probes of the platform device drivers for
 different outputs. The *_init_output for each output registers the output and
 fill up the output's plaform device, type and id fields.
 
 In the probe of each interface driver, the output entities are initialized
 before the *_probe_pdata() functions intentionally. This is done to ensure 
 that
 the output entity is prepared before the panels connected to the output are
 registered. We need the output entities to be ready because OMAPDSS will try
 to make connections between overlays, managers, outputs and devices during the
 panel's probe.
 
 Signed-off-by: Archit Taneja arc...@ti.com
 ---
  drivers/video/omap2/dss/dpi.c  |   15 +++
  drivers/video/omap2/dss/dsi.c  |   18 ++
  drivers/video/omap2/dss/hdmi.c |   15 +++
  drivers/video/omap2/dss/rfbi.c |   17 +
  drivers/video/omap2/dss/sdi.c  |   15 +++
  drivers/video/omap2/dss/venc.c |   15 +++
  6 files changed, 95 insertions(+)
 
 diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
 index 25fb895..9a7aee5 100644
 --- a/drivers/video/omap2/dss/dpi.c
 +++ b/drivers/video/omap2/dss/dpi.c
 @@ -45,6 +45,8 @@ static struct {
   struct omap_video_timings timings;
   struct dss_lcd_mgr_config mgr_config;
   int data_lines;
 +
 + struct omap_dss_output output;
  } dpi;
  
  static struct platform_device *dpi_get_dsidev(enum omap_dss_clk_source clk)
 @@ -410,10 +412,23 @@ static void __init dpi_probe_pdata(struct 
 platform_device *pdev)
   }
  }
  
 +static void __init dpi_init_output(struct platform_device *pdev)
 +{
 + struct omap_dss_output *out = dpi.output;
 +
 + dss_register_output(out);
 +
 + out-pdev = pdev;
 + out-id = OMAP_DSS_OUTPUT_DPI;
 + out-type = OMAP_DISPLAY_TYPE_DPI;
 +}

I think you should first initialize the output, and then register it.
Not the other way around.

I believe you need to implement unregister also. Normally unregister
won't be done, but the probe of an output driver can fail after the
output has been registered, and thus the output needs to be unregistered
at cleanup.

And it doesn't harm to unregister at the driver's remove.

 Tomi



signature.asc
Description: This is a digitally signed message part


Re: [PATCH v2 02/23] OMAPDSS: outputs: Create and register output instances

2012-08-31 Thread Archit Taneja

On Friday 31 August 2012 05:27 PM, Tomi Valkeinen wrote:

On Thu, 2012-08-30 at 17:10 +0530, Archit Taneja wrote:

Add output structs to output driver's private data. Register output instances by
having an init function in the probes of the platform device drivers for
different outputs. The *_init_output for each output registers the output and
fill up the output's plaform device, type and id fields.

In the probe of each interface driver, the output entities are initialized
before the *_probe_pdata() functions intentionally. This is done to ensure that
the output entity is prepared before the panels connected to the output are
registered. We need the output entities to be ready because OMAPDSS will try
to make connections between overlays, managers, outputs and devices during the
panel's probe.

Signed-off-by: Archit Taneja arc...@ti.com
---
  drivers/video/omap2/dss/dpi.c  |   15 +++
  drivers/video/omap2/dss/dsi.c  |   18 ++
  drivers/video/omap2/dss/hdmi.c |   15 +++
  drivers/video/omap2/dss/rfbi.c |   17 +
  drivers/video/omap2/dss/sdi.c  |   15 +++
  drivers/video/omap2/dss/venc.c |   15 +++
  6 files changed, 95 insertions(+)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 25fb895..9a7aee5 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -45,6 +45,8 @@ static struct {
struct omap_video_timings timings;
struct dss_lcd_mgr_config mgr_config;
int data_lines;
+
+   struct omap_dss_output output;
  } dpi;

  static struct platform_device *dpi_get_dsidev(enum omap_dss_clk_source clk)
@@ -410,10 +412,23 @@ static void __init dpi_probe_pdata(struct platform_device 
*pdev)
}
  }

+static void __init dpi_init_output(struct platform_device *pdev)
+{
+   struct omap_dss_output *out = dpi.output;
+
+   dss_register_output(out);
+
+   out-pdev = pdev;
+   out-id = OMAP_DSS_OUTPUT_DPI;
+   out-type = OMAP_DISPLAY_TYPE_DPI;
+}


I think you should first initialize the output, and then register it.
Not the other way around.


Ok.



I believe you need to implement unregister also. Normally unregister
won't be done, but the probe of an output driver can fail after the
output has been registered, and thus the output needs to be unregistered
at cleanup.


Ah, right.



And it doesn't harm to unregister at the driver's remove.


I'll fix these, thanks.

Archit

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


[PATCH v2 02/23] OMAPDSS: outputs: Create and register output instances

2012-08-30 Thread Archit Taneja
Add output structs to output driver's private data. Register output instances by
having an init function in the probes of the platform device drivers for
different outputs. The *_init_output for each output registers the output and
fill up the output's plaform device, type and id fields.

In the probe of each interface driver, the output entities are initialized
before the *_probe_pdata() functions intentionally. This is done to ensure that
the output entity is prepared before the panels connected to the output are
registered. We need the output entities to be ready because OMAPDSS will try
to make connections between overlays, managers, outputs and devices during the
panel's probe.

Signed-off-by: Archit Taneja arc...@ti.com
---
 drivers/video/omap2/dss/dpi.c  |   15 +++
 drivers/video/omap2/dss/dsi.c  |   18 ++
 drivers/video/omap2/dss/hdmi.c |   15 +++
 drivers/video/omap2/dss/rfbi.c |   17 +
 drivers/video/omap2/dss/sdi.c  |   15 +++
 drivers/video/omap2/dss/venc.c |   15 +++
 6 files changed, 95 insertions(+)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 25fb895..9a7aee5 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -45,6 +45,8 @@ static struct {
struct omap_video_timings timings;
struct dss_lcd_mgr_config mgr_config;
int data_lines;
+
+   struct omap_dss_output output;
 } dpi;
 
 static struct platform_device *dpi_get_dsidev(enum omap_dss_clk_source clk)
@@ -410,10 +412,23 @@ static void __init dpi_probe_pdata(struct platform_device 
*pdev)
}
 }
 
+static void __init dpi_init_output(struct platform_device *pdev)
+{
+   struct omap_dss_output *out = dpi.output;
+
+   dss_register_output(out);
+
+   out-pdev = pdev;
+   out-id = OMAP_DSS_OUTPUT_DPI;
+   out-type = OMAP_DISPLAY_TYPE_DPI;
+}
+
 static int __init omap_dpi_probe(struct platform_device *pdev)
 {
mutex_init(dpi.lock);
 
+   dpi_init_output(pdev);
+
dpi_probe_pdata(pdev);
 
return 0;
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 659b6cd..6a83ab7 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -337,6 +337,8 @@ struct dsi_data {
enum omap_dss_dsi_pixel_format pix_fmt;
enum omap_dss_dsi_mode mode;
struct omap_dss_dsi_videomode_timings vm_timings;
+
+   struct omap_dss_output output;
 };
 
 struct dsi_packet_sent_handler_data {
@@ -4903,6 +4905,20 @@ static void __init dsi_probe_pdata(struct 
platform_device *dsidev)
}
 }
 
+static void __init dsi_init_output(struct platform_device *dsidev,
+   struct dsi_data *dsi)
+{
+   struct omap_dss_output *out = dsi-output;
+
+   dss_register_output(out);
+
+   out-pdev = dsidev;
+   out-id = dsi-module_id == 0 ?
+   OMAP_DSS_OUTPUT_DSI1 : OMAP_DSS_OUTPUT_DSI2;
+
+   out-type = OMAP_DISPLAY_TYPE_DSI;
+}
+
 /* DSI1 HW IP initialisation */
 static int __init omap_dsihw_probe(struct platform_device *dsidev)
 {
@@ -4997,6 +5013,8 @@ static int __init omap_dsihw_probe(struct platform_device 
*dsidev)
else
dsi-num_lanes_supported = 3;
 
+   dsi_init_output(dsidev, dsi);
+
dsi_probe_pdata(dsidev);
 
dsi_runtime_put(dsidev);
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index 0cdf246..d93954d 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -61,6 +61,8 @@ static struct {
struct hdmi_ip_data ip_data;
 
struct clk *sys_clk;
+
+   struct omap_dss_output output;
 } hdmi;
 
 /*
@@ -890,6 +892,17 @@ static void __init hdmi_probe_pdata(struct platform_device 
*pdev)
}
 }
 
+static void __init hdmi_init_output(struct platform_device *pdev)
+{
+   struct omap_dss_output *out = hdmi.output;
+
+   dss_register_output(out);
+
+   out-pdev = pdev;
+   out-id = OMAP_DSS_OUTPUT_HDMI;
+   out-type = OMAP_DISPLAY_TYPE_HDMI;
+}
+
 /* HDMI HW IP initialisation */
 static int __init omapdss_hdmihw_probe(struct platform_device *pdev)
 {
@@ -933,6 +946,8 @@ static int __init omapdss_hdmihw_probe(struct 
platform_device *pdev)
 
dss_debugfs_create_file(hdmi, hdmi_dump_regs);
 
+   hdmi_init_output(pdev);
+
hdmi_probe_pdata(pdev);
 
return 0;
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 5a9c0e9..3450f51 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -116,6 +116,8 @@ static struct {
int pixel_size;
int data_lines;
struct rfbi_timings intf_timings;
+
+   struct omap_dss_output output;
 } rfbi;
 
 static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val)
@@ -967,6 +969,19 @@ static void __init rfbi_probe_pdata(struct platform_device 
*pdev)
}
 }