Re: [PATCH v2 15/23] OMAPDSS: RFBI: Add dssdev pointers as arguments to all exported functions

2012-08-31 Thread Archit Taneja

On Friday 31 August 2012 07:50 PM, Tomi Valkeinen wrote:

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

All functions of an interface driver used by a panel driver should have an
omap_dss_device pointer as an argument. This may not be needed by some of the
interfaces now as driver data is globally visible in them. The correct way
to retrieve driver data is to extract the platform device from the output,
and then extract the driver data from the platform device.

Add dssdev arguments from functions used by panel drivers which currently miss
it. This will come to use when the RFBI functions retrieve the driver data
in the correct manner.


This and the similar patch for HDMI could probably also be left out for
now. Again I agree that this is correct direction, but this is not
really needed (right?) for output work or writeback. And we'll
eventually just change these parameters again.

The motivation for this patch was probably to have common format for the
output driver's functions, so that you can use func pointers in an ops
struct?


Yes, or the fact that we need the function to pass something related to 
the output to configure it. Things work now since we just have one 
instance of hdmi/rfbi, and that we have a global struct from which we 
can get the required info. We definitely need to pass something to these 
functions, whether we should pass the panel, or the output itself isn't 
clear yet.




Let's delay that work until the common panel framework gets a bit more
solid.


I get your point. We might need to replace the dssdevs with outputs (or 
something similar) in the future. Hence it would lead to churn.




Sorry if I'm saying "leave this patch out" for most of the patches =). I
just want to avoid extra churn, going back and forth with the code. The
most important things now are to get the output work in a state that WB
can be used, and on the other hand to remove the dssdev dependencies so
that at some point we can remove dssdev totally.


That's okay. If we keep this stuff, it'll be us who have to change it 
later :)


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


Re: [PATCH v2 15/23] OMAPDSS: RFBI: Add dssdev pointers as arguments to all exported functions

2012-08-31 Thread Tomi Valkeinen
On Thu, 2012-08-30 at 17:10 +0530, Archit Taneja wrote:
> All functions of an interface driver used by a panel driver should have an
> omap_dss_device pointer as an argument. This may not be needed by some of the
> interfaces now as driver data is globally visible in them. The correct way
> to retrieve driver data is to extract the platform device from the output,
> and then extract the driver data from the platform device.
> 
> Add dssdev arguments from functions used by panel drivers which currently miss
> it. This will come to use when the RFBI functions retrieve the driver data
> in the correct manner.

This and the similar patch for HDMI could probably also be left out for
now. Again I agree that this is correct direction, but this is not
really needed (right?) for output work or writeback. And we'll
eventually just change these parameters again.

The motivation for this patch was probably to have common format for the
output driver's functions, so that you can use func pointers in an ops
struct?

Let's delay that work until the common panel framework gets a bit more
solid.

Sorry if I'm saying "leave this patch out" for most of the patches =). I
just want to avoid extra churn, going back and forth with the code. The
most important things now are to get the output work in a state that WB
can be used, and on the other hand to remove the dssdev dependencies so
that at some point we can remove dssdev totally.

 Tomi



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


[PATCH v2 15/23] OMAPDSS: RFBI: Add dssdev pointers as arguments to all exported functions

2012-08-30 Thread Archit Taneja
All functions of an interface driver used by a panel driver should have an
omap_dss_device pointer as an argument. This may not be needed by some of the
interfaces now as driver data is globally visible in them. The correct way
to retrieve driver data is to extract the platform device from the output,
and then extract the driver data from the platform device.

Add dssdev arguments from functions used by panel drivers which currently miss
it. This will come to use when the RFBI functions retrieve the driver data
in the correct manner.

Signed-off-by: Archit Taneja 
---
 drivers/video/omap2/displays/panel-n8x0.c |   55 -
 drivers/video/omap2/dss/rfbi.c|   25 +++--
 include/video/omapdss.h   |   25 +++--
 3 files changed, 60 insertions(+), 45 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-n8x0.c 
b/drivers/video/omap2/displays/panel-n8x0.c
index 17ae85e..e3a8c44 100644
--- a/drivers/video/omap2/displays/panel-n8x0.c
+++ b/drivers/video/omap2/displays/panel-n8x0.c
@@ -88,27 +88,30 @@ struct panel_drv_data *get_drv_data(const struct 
omap_dss_device *dssdev)
 }
 
 
-static inline void blizzard_cmd(u8 cmd)
+static inline void blizzard_cmd(struct omap_dss_device *dssdev, u8 cmd)
 {
-   omap_rfbi_write_command(&cmd, 1);
+   omap_rfbi_write_command(dssdev, &cmd, 1);
 }
 
-static inline void blizzard_write(u8 cmd, const u8 *buf, int len)
+static inline void blizzard_write(struct omap_dss_device *dssdev, u8 cmd,
+   const u8 *buf, int len)
 {
-   omap_rfbi_write_command(&cmd, 1);
-   omap_rfbi_write_data(buf, len);
+   omap_rfbi_write_command(dssdev, &cmd, 1);
+   omap_rfbi_write_data(dssdev, buf, len);
 }
 
-static inline void blizzard_read(u8 cmd, u8 *buf, int len)
+static inline void blizzard_read(struct omap_dss_device *dssdev, u8 cmd,
+   u8 *buf, int len)
 {
-   omap_rfbi_write_command(&cmd, 1);
-   omap_rfbi_read_data(buf, len);
+   omap_rfbi_write_command(dssdev, &cmd, 1);
+   omap_rfbi_read_data(dssdev, buf, len);
 }
 
-static u8 blizzard_read_reg(u8 cmd)
+static u8 blizzard_read_reg(struct omap_dss_device *dssdev, u8 cmd)
 {
u8 data;
-   blizzard_read(cmd, &data, 1);
+
+   blizzard_read(dssdev, cmd, &data, 1);
return data;
 }
 
@@ -155,7 +158,7 @@ static void blizzard_ctrl_setup_update(struct 
omap_dss_device *dssdev,
 
omap_rfbi_configure(dssdev);
 
-   blizzard_write(BLIZZARD_INPUT_WIN_X_START_0, tmp, 18);
+   blizzard_write(dssdev, BLIZZARD_INPUT_WIN_X_START_0, tmp, 18);
 
omapdss_rfbi_set_pixel_size(dssdev, 16);
omapdss_rfbi_set_data_lines(dssdev, 16);
@@ -313,8 +316,8 @@ static int n8x0_panel_power_on(struct omap_dss_device 
*dssdev)
if (r)
goto err_rfbi_en;
 
-   rev = blizzard_read_reg(BLIZZARD_REV_CODE);
-   conf = blizzard_read_reg(BLIZZARD_CONFIG);
+   rev = blizzard_read_reg(dssdev, BLIZZARD_REV_CODE);
+   conf = blizzard_read_reg(dssdev, BLIZZARD_CONFIG);
 
switch (rev & 0xfc) {
case 0x9c:
@@ -536,11 +539,11 @@ static int n8x0_panel_enable(struct omap_dss_device 
*dssdev)
 
mutex_lock(&ddata->lock);
 
-   rfbi_bus_lock();
+   rfbi_bus_lock(dssdev);
 
r = n8x0_panel_power_on(dssdev);
 
-   rfbi_bus_unlock();
+   rfbi_bus_unlock(dssdev);
 
if (r) {
mutex_unlock(&ddata->lock);
@@ -562,11 +565,11 @@ static void n8x0_panel_disable(struct omap_dss_device 
*dssdev)
 
mutex_lock(&ddata->lock);
 
-   rfbi_bus_lock();
+   rfbi_bus_lock(dssdev);
 
n8x0_panel_power_off(dssdev);
 
-   rfbi_bus_unlock();
+   rfbi_bus_unlock(dssdev);
 
dssdev->state = OMAP_DSS_DISPLAY_DISABLED;
 
@@ -581,11 +584,11 @@ static int n8x0_panel_suspend(struct omap_dss_device 
*dssdev)
 
mutex_lock(&ddata->lock);
 
-   rfbi_bus_lock();
+   rfbi_bus_lock(dssdev);
 
n8x0_panel_power_off(dssdev);
 
-   rfbi_bus_unlock();
+   rfbi_bus_unlock(dssdev);
 
dssdev->state = OMAP_DSS_DISPLAY_SUSPENDED;
 
@@ -603,11 +606,11 @@ static int n8x0_panel_resume(struct omap_dss_device 
*dssdev)
 
mutex_lock(&ddata->lock);
 
-   rfbi_bus_lock();
+   rfbi_bus_lock(dssdev);
 
r = n8x0_panel_power_on(dssdev);
 
-   rfbi_bus_unlock();
+   rfbi_bus_unlock(dssdev);
 
if (r) {
mutex_unlock(&ddata->lock);
@@ -630,7 +633,9 @@ static void n8x0_panel_get_resolution(struct 
omap_dss_device *dssdev,
 
 static void update_done(void *data)
 {
-   rfbi_bus_unlock();
+   struct omap_dss_device *dssdev = (struct omap_dss_device *) data;
+
+   rfbi_bus_unlock(dssdev);
 }
 
 static int n8x0_panel_update(struct omap_dss_device *dssdev,
@@ -651,7 +656,7 @@ static int n8x0_panel_update(struct omap_dss_device *dssdev,
}
 
mutex_lock(&ddata->lock);
-   rfbi_bus_lock();
+   rfbi_bus_lock(dssdev);