[PATCH 00/65] OMAPDSS: manager/apply improvements

2011-11-22 Thread Tomi Valkeinen
I started writing this patch series to get DSS's fifo-merge feature working,
but in the end the series grew a bit...

The reason why fifo-merge is tricky is that enabling or disabling the
fifo-merge affects multiple overlays and overlay managers at the same time. In
practice this means we need to enable and disable fifo-merge in steps, doing
first one thing, then waiting for the changes to be synchronized with all the
overlay managers, then doing another thing, etc... This could be done with a
complex state machine, or more simply with blocking functions.

The basic idea to get this done is to divide ovl  mgr functions into two sets.
First set is non-blocking, using only spinlocks, and used to change settings
which affect only that one ovl or mgr. set/get_info() and apply() functions are
in this set. The second set may block. The rest of the functions are in this
set, for example overlay enable/disable. 

To get there wasn't as simple as I thought, so the patch series grew. I am
quite content with the end result, though, as it cleans up the whole
apply-mechanism of omapdss rather lot, and the locking scheme should finally be
valid. There are still holes in the locking scheme, related to the panel
drivers, but the locks in apply.c should be solid.

Almost all of the changes are not visible to the users of the omapdss, but some
changes are visible. The notable changes to the users of omapdss in this series
are:

* Overlays enable/disable is no longer handled through the overlay_info struct,
  but functions. The overlay struct contains enable, disable and is_enabled
  functions to handle that. Note: enable and disable may block!
* Ovl/mgr infos are no longer visible directly, but need to be gotten with the
  get_info functions.
* Partial update for manual update displays has been removed. To my knowledge
  partial update is not used, it doesn't work exactly right, using it requires
  the user to know limitations about the underlying HW, and lastly and most
  importantly, it makes the configuration code really messy.

And the original reason for this series, fifo-merge, is actually still missing.
There are some problems with it when using two displays at the same time, and
it's still under study. Also OMAP4's more advanced fifo-configuration is under
work, and I plan to push both of those later. For those interested, the current
fifo-merge patches can be found from my git tree, on top of this series, from:

git://gitorious.org/linux-omap-dss2/linux.git manager-work

 Tomi

Tomi Valkeinen (65):
  OMAPDSS: DISPC: add missing prototype
  OMAPDSS: Remove old fifomerge hacks
  OMAPDSS: remove L4_EXAMPLE code
  OMAPDSS: DISPC: make dispc_ovl_set_channel_out() public
  OMAPDSS: DISPC: make dispc_ovl_set_fifo_threshold() public
  OMAPDSS: remove partial update from the overlay manager
  OMAPDSS: remove partial update from DSI
  OMAPDSS: remove partial update from panel-taal
  OMAPDSS: pass ovl manager to dss_start_update
  OMAPDSS: DISPC: handle 0 out_width/out_height in ovl_setup()
  OMAPDSS: handle ilace/replication when configuring overlay
  OMAPDSS: separate FIFO threshold setup from ovl_setup
  OMAPDSS: separate overlay channel from ovl_setup
  OMAPDSS: setup manager with dispc_mgr_setup()
  OMAPDSS: DISPC: remove unused functions
  OMAPDSS: remove unneeded dss_ovl_wait_for_go()
  OMAPDSS: add ovl/mgr_manual_update() helpers
  OMAPDSS: split omap_dss_mgr_apply() to smaller funcs
  OMAPDSS: apply affects only one overlay manager
  OMAPDSS: create apply.c
  OMAPDSS: hide manager's enable/disable()
  OMAPDSS: APPLY: track whether a manager is enabled
  OMAPDSS: APPLY: skip isr register and config for manual update
displays
  OMAPDSS: APPLY: skip isr register and config for disabled displays
  OMAPDSS: APPLY: cleanup dss_start_update
  OMAPDSS: store overlays in an array
  OMAPDSS: store managers in an array
  OMAPDSS: store overlays in a list for each manager
  OMAPDSS: APPLY: separate vsync isr register/unregister
  OMAPDSS: DISPC: Add dispc_mgr_get_vsync_irq()
  OMAPDSS: APPLY: use dispc_mgr_get_vsync_irq()
  OMAPDSS: APPLY: configure_* funcs take ovl/manager as args
  OMAPDSS: APPLY: rename overlay_cache_data
  OMAPDSS: APPLY: rename manager_cache_data
  OMAPDSS: APPLY: move spinlock outside the struct
  OMAPDSS: APPLY: rename dss_cache to dss_data
  OMAPDSS: APPLY: move ovl funcs to apply.c
  OMAPDSS: APPLY: move mgr funcs to apply.c
  OMAPDSS: remove ovl/mgr check-code temporarily
  OMAPDSS: APPLY: add mutex
  OMAPDSS: APPLY: add missing uses of spinlock
  OMAPDSS: DSI: call mgr_enable/disable for cmd mode displays
  OMAPDSS: APPLY: move mgr-enabled to mgr_priv_data
  OMAPDSS: APPLY: add busy field to mgr_priv_data
  OMAPDSS: APPLY: rewrite overlay enable/disable
  OMAPDSS: APPLY: rewrite register writing
  OMAPDSS: DISPC: add dispc_mgr_get_framedone_irq
  OMAPDSS: APPLY: add updating flag
  OMAPDSS: APPLY: clean up isr_handler
  OMAPDSS: APPLY: move mgr-info to apply.c
  OMAPDSS: APPLY: move ovl-info to 

[PATCH 01/65] OMAPDSS: DISPC: add missing prototype

2011-11-22 Thread Tomi Valkeinen
dispc_mgr_is_enabled() was missing a prototype in dss.h

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dss.h |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 6308fc5..3310f10 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -414,6 +414,7 @@ void dispc_mgr_set_cpr_coef(enum omap_channel channel,
struct omap_dss_cpr_coefs *coefs);
 bool dispc_mgr_go_busy(enum omap_channel channel);
 void dispc_mgr_go(enum omap_channel channel);
+bool dispc_mgr_is_enabled(enum omap_channel channel);
 void dispc_mgr_enable(enum omap_channel channel, bool enable);
 bool dispc_mgr_is_channel_enabled(enum omap_channel channel);
 void dispc_mgr_set_io_pad_mode(enum dss_io_pad_mode mode);
-- 
1.7.4.1

--
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 02/65] OMAPDSS: Remove old fifomerge hacks

2011-11-22 Thread Tomi Valkeinen
Once in a time omapdss had basic support for fifomerge. Fifomerge was
removed as the implementation didn't work properly, and a proper
implementation is a complex problem.

However, some unused fifo-merge related code was left behind. This patch
removes those.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/manager.c |   26 +-
 1 files changed, 1 insertions(+), 25 deletions(-)

diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index 6e63845..1be5f47 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -1313,8 +1313,6 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager 
*mgr)
struct manager_cache_data *mc;
int i;
struct omap_overlay *ovl;
-   int num_planes_enabled = 0;
-   bool use_fifomerge;
unsigned long flags;
int r;
 
@@ -1347,11 +1345,8 @@ static int omap_dss_mgr_apply(struct 
omap_overlay_manager *mgr)
continue;
}
 
-   if (!ovl-info_dirty) {
-   if (oc-enabled)
-   ++num_planes_enabled;
+   if (!ovl-info_dirty)
continue;
-   }
 
dssdev = ovl-manager-device;
 
@@ -1375,8 +1370,6 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager 
*mgr)
oc-channel = ovl-manager-id;
 
oc-enabled = true;
-
-   ++num_planes_enabled;
}
 
/* Configure managers */
@@ -1406,21 +1399,6 @@ static int omap_dss_mgr_apply(struct 
omap_overlay_manager *mgr)
dssdev-caps  OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
}
 
-   /* XXX TODO: Try to get fifomerge working. The problem is that it
-* affects both managers, not individually but at the same time. This
-* means the change has to be well synchronized. I guess the proper way
-* is to have a two step process for fifo merge:
-*fifomerge enable:
-* 1. disable other planes, leaving one plane enabled
-* 2. wait until the planes are disabled on HW
-* 3. config merged fifo thresholds, enable fifomerge
-*fifomerge disable:
-* 1. config unmerged fifo thresholds, disable fifomerge
-* 2. wait until fifo changes are in HW
-* 3. enable planes
-*/
-   use_fifomerge = false;
-
/* Configure overlay fifos */
for (i = 0; i  omap_dss_get_num_overlays(); ++i) {
struct omap_dss_device *dssdev;
@@ -1436,8 +1414,6 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager 
*mgr)
dssdev = ovl-manager-device;
 
size = dispc_ovl_get_fifo_size(ovl-id);
-   if (use_fifomerge)
-   size *= 3;
 
burst_size = dispc_ovl_get_burst_size(ovl-id);
 
-- 
1.7.4.1

--
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 03/65] OMAPDSS: remove L4_EXAMPLE code

2011-11-22 Thread Tomi Valkeinen
Some old example code has been left lying around. Remove the example
code.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dss.h |3 ---
 drivers/video/omap2/dss/overlay.c |   36 
 2 files changed, 0 insertions(+), 39 deletions(-)

diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 3310f10..7d2b6dd 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -192,9 +192,6 @@ void dss_init_overlays(struct platform_device *pdev);
 void dss_uninit_overlays(struct platform_device *pdev);
 int dss_check_overlay(struct omap_overlay *ovl, struct omap_dss_device 
*dssdev);
 void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr);
-#ifdef L4_EXAMPLE
-void dss_overlay_setup_l4_manager(struct omap_overlay_manager *mgr);
-#endif
 void dss_recheck_connections(struct omap_dss_device *dssdev, bool force);
 
 /* DSS */
diff --git a/drivers/video/omap2/dss/overlay.c 
b/drivers/video/omap2/dss/overlay.c
index ab8e40e..d15b826 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -641,15 +641,6 @@ void dss_overlay_setup_dispc_manager(struct 
omap_overlay_manager *mgr)
mgr-overlays = dispc_overlays;
 }
 
-#ifdef L4_EXAMPLE
-static struct omap_overlay *l4_overlays[1];
-void dss_overlay_setup_l4_manager(struct omap_overlay_manager *mgr)
-{
-   mgr-num_overlays = 1;
-   mgr-overlays = l4_overlays;
-}
-#endif
-
 void dss_init_overlays(struct platform_device *pdev)
 {
int i, r;
@@ -716,33 +707,6 @@ void dss_init_overlays(struct platform_device *pdev)
 
dispc_overlays[i] = ovl;
}
-
-#ifdef L4_EXAMPLE
-   {
-   struct omap_overlay *ovl;
-   ovl = kzalloc(sizeof(*ovl), GFP_KERNEL);
-
-   BUG_ON(ovl == NULL);
-
-   ovl-name = l4;
-   ovl-supported_modes = OMAP_DSS_COLOR_RGB24U;
-
-   ovl-set_manager = omap_dss_set_manager;
-   ovl-unset_manager = omap_dss_unset_manager;
-   ovl-set_overlay_info = dss_ovl_set_overlay_info;
-   ovl-get_overlay_info = dss_ovl_get_overlay_info;
-
-   omap_dss_add_overlay(ovl);
-
-   r = kobject_init_and_add(ovl-kobj, overlay_ktype,
-   pdev-dev.kobj, overlayl4);
-
-   if (r)
-   DSSERR(failed to create sysfs file\n);
-
-   l4_overlays[0] = ovl;
-   }
-#endif
 }
 
 /* connect overlays to the new device, if not already connected. if force
-- 
1.7.4.1

--
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 04/65] OMAPDSS: DISPC: make dispc_ovl_set_channel_out() public

2011-11-22 Thread Tomi Valkeinen
Make dispc_ovl_set_channel_out() public so that later patches can handle
changing overlay's manager.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c |3 +--
 drivers/video/omap2/dss/dss.h   |2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 5c81533..b2865ef 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -875,8 +875,7 @@ static void dispc_ovl_set_color_mode(enum omap_plane plane,
REG_FLD_MOD(DISPC_OVL_ATTRIBUTES(plane), m, 4, 1);
 }
 
-static void dispc_ovl_set_channel_out(enum omap_plane plane,
-   enum omap_channel channel)
+void dispc_ovl_set_channel_out(enum omap_plane plane, enum omap_channel 
channel)
 {
int shift;
u32 val;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 7d2b6dd..f899f0f 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -402,6 +402,8 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
bool ilace, enum omap_channel channel, bool replication,
u32 fifo_low, u32 fifo_high);
 int dispc_ovl_enable(enum omap_plane plane, bool enable);
+void dispc_ovl_set_channel_out(enum omap_plane plane,
+   enum omap_channel channel);
 
 
 void dispc_mgr_enable_fifohandcheck(enum omap_channel channel, bool enable);
-- 
1.7.4.1

--
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 05/65] OMAPDSS: DISPC: make dispc_ovl_set_fifo_threshold() public

2011-11-22 Thread Tomi Valkeinen
Make dispc_ovl_set_fifo_threshold() public so that later patches can
handle overlay fifo configuration.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c |3 +--
 drivers/video/omap2/dss/dss.h   |1 +
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index b2865ef..7387e23 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1056,8 +1056,7 @@ u32 dispc_ovl_get_fifo_size(enum omap_plane plane)
return dispc.fifo_size[plane];
 }
 
-static void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low,
-   u32 high)
+void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high)
 {
u8 hi_start, hi_end, lo_start, lo_end;
u32 unit;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index f899f0f..313a7ca 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -396,6 +396,7 @@ int dispc_calc_clock_rates(unsigned long dispc_fclk_rate,
struct dispc_clock_info *cinfo);
 
 
+void dispc_ovl_set_fifo_threshold(enum omap_plane plane, u32 low, u32 high);
 u32 dispc_ovl_get_fifo_size(enum omap_plane plane);
 u32 dispc_ovl_get_burst_size(enum omap_plane plane);
 int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
-- 
1.7.4.1

--
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 06/65] OMAPDSS: remove partial update from the overlay manager

2011-11-22 Thread Tomi Valkeinen
Partial update for manual update displays has never worked quite well:
* The HW has limitations on the update area, and the x and width need to
  be even.
* Showing a part of a scaled overlay causes artifacts.
* Makes the management of dispc very complex

Considering the above points and the fact that partial update is not
used anywhere, this and the following patches remove the partial update
support. This will greatly simplify the following re-write of the apply
mechanism to get proper locking and additional features like fifo-merge.

This patch removes the partial update from the manager.c.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dsi.c |2 -
 drivers/video/omap2/dss/dss.h |3 -
 drivers/video/omap2/dss/manager.c |  333 +
 drivers/video/omap2/dss/rfbi.c|1 -
 4 files changed, 6 insertions(+), 333 deletions(-)

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 5abf8e7..787cebd 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4172,8 +4172,6 @@ int omap_dsi_prepare_update(struct omap_dss_device 
*dssdev,
 
dsi_perf_mark_setup(dsidev);
 
-   dss_setup_partial_planes(dssdev, x, y, w, h,
-   enlarge_update_area);
dispc_mgr_set_lcd_size(dssdev-manager-id, *w, *h);
 
return 0;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 313a7ca..7f6a612 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -182,9 +182,6 @@ void default_get_overlay_fifo_thresholds(enum omap_plane 
plane,
 int dss_init_overlay_managers(struct platform_device *pdev);
 void dss_uninit_overlay_managers(struct platform_device *pdev);
 int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl);
-void dss_setup_partial_planes(struct omap_dss_device *dssdev,
-   u16 *x, u16 *y, u16 *w, u16 *h,
-   bool enlarge_update_area);
 void dss_start_update(struct omap_dss_device *dssdev);
 
 /* overlay */
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index 1be5f47..c616f85 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -530,13 +530,6 @@ struct manager_cache_data {
 
bool manual_update;
bool do_manual_update;
-
-   /* manual update region */
-   u16 x, y, w, h;
-
-   /* enlarge the update area if the update area contains scaled
-* overlays */
-   bool enlarge_update_area;
 };
 
 static struct {
@@ -762,65 +755,11 @@ static int overlay_enabled(struct omap_overlay *ovl)
return ovl-info.enabled  ovl-manager  ovl-manager-device;
 }
 
-/* Is rect1 a subset of rect2? */
-static bool rectangle_subset(int x1, int y1, int w1, int h1,
-   int x2, int y2, int w2, int h2)
-{
-   if (x1  x2 || y1  y2)
-   return false;
-
-   if (x1 + w1  x2 + w2)
-   return false;
-
-   if (y1 + h1  y2 + h2)
-   return false;
-
-   return true;
-}
-
-/* Do rect1 and rect2 overlap? */
-static bool rectangle_intersects(int x1, int y1, int w1, int h1,
-   int x2, int y2, int w2, int h2)
-{
-   if (x1 = x2 + w2)
-   return false;
-
-   if (x2 = x1 + w1)
-   return false;
-
-   if (y1 = y2 + h2)
-   return false;
-
-   if (y2 = y1 + h1)
-   return false;
-
-   return true;
-}
-
-static bool dispc_is_overlay_scaled(struct overlay_cache_data *oc)
-{
-   struct omap_overlay_info *oi = oc-info;
-
-   if (oi-out_width != 0  oi-width != oi-out_width)
-   return true;
-
-   if (oi-out_height != 0  oi-height != oi-out_height)
-   return true;
-
-   return false;
-}
-
 static int configure_overlay(enum omap_plane plane)
 {
struct overlay_cache_data *c;
-   struct manager_cache_data *mc;
-   struct omap_overlay_info *oi, new_oi;
-   struct omap_overlay_manager_info *mi;
-   u16 outw, outh;
-   u16 x, y, w, h;
-   u32 paddr;
+   struct omap_overlay_info *oi;
int r;
-   u16 orig_w, orig_h, orig_outw, orig_outh;
 
DSSDBGF(%d, plane);
 
@@ -832,120 +771,7 @@ static int configure_overlay(enum omap_plane plane)
return 0;
}
 
-   mc = dss_cache.manager_cache[c-channel];
-   mi = mc-info;
-
-   x = oi-pos_x;
-   y = oi-pos_y;
-   w = oi-width;
-   h = oi-height;
-   outw = oi-out_width == 0 ? oi-width : oi-out_width;
-   outh = oi-out_height == 0 ? oi-height : oi-out_height;
-   paddr = oi-paddr;
-
-   orig_w = w;
-   orig_h = h;
-   orig_outw = outw;
-   orig_outh = outh;
-
-   if (mc-manual_update  mc-do_manual_update) {
-   unsigned bpp;
-   unsigned scale_x_m = w, scale_x_d = outw;
-   unsigned scale_y_m = h, 

[PATCH 08/65] OMAPDSS: remove partial update from panel-taal

2011-11-22 Thread Tomi Valkeinen
Partial update for manual update displays has never worked quite well:
* The HW has limitations on the update area, and the x and width need to
  be even.
* Showing a part of a scaled overlay causes artifacts.
* Makes the management of dispc very complex

Considering the above points and the fact that partial update is not
used anywhere, this and the following patches remove the partial update
support. This will greatly simplify the following re-write of the apply
mechanism to get proper locking and additional features like fifo-merge.

This patch removes the partial update from the panel-taal.c.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/displays/panel-taal.c |   16 
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-taal.c 
b/drivers/video/omap2/displays/panel-taal.c
index 0aa6c5d..dd64bd1 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -198,12 +198,6 @@ struct taal_data {
bool te_enabled;
 
atomic_t do_update;
-   struct {
-   u16 x;
-   u16 y;
-   u16 w;
-   u16 h;
-   } update_region;
int channel;
 
struct delayed_work te_timeout_work;
@@ -1440,16 +1434,14 @@ static int taal_update(struct omap_dss_device *dssdev,
goto err;
}
 
-   r = taal_set_update_window(td, x, y, w, h);
+   /* XXX no need to send this every frame, but dsi break if not done */
+   r = taal_set_update_window(td, 0, 0,
+   td-panel_config-timings.x_res,
+   td-panel_config-timings.y_res);
if (r)
goto err;
 
if (td-te_enabled  panel_data-use_ext_te) {
-   td-update_region.x = x;
-   td-update_region.y = y;
-   td-update_region.w = w;
-   td-update_region.h = h;
-   barrier();
schedule_delayed_work(td-te_timeout_work,
msecs_to_jiffies(250));
atomic_set(td-do_update, 1);
-- 
1.7.4.1

--
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 07/65] OMAPDSS: remove partial update from DSI

2011-11-22 Thread Tomi Valkeinen
Partial update for manual update displays has never worked quite well:
* The HW has limitations on the update area, and the x and width need to
  be even.
* Showing a part of a scaled overlay causes artifacts.
* Makes the management of dispc very complex

Considering the above points and the fact that partial update is not
used anywhere, this and the following patches remove the partial update
support. This will greatly simplify the following re-write of the apply
mechanism to get proper locking and additional features like fifo-merge.

This patch removes the partial update from the dsi.c.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/displays/panel-taal.c |   16 ++
 drivers/video/omap2/dss/dsi.c |   79 +++-
 include/video/omapdss.h   |7 +--
 3 files changed, 25 insertions(+), 77 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-taal.c 
b/drivers/video/omap2/displays/panel-taal.c
index 80c3f6a..0aa6c5d 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -1394,12 +1394,8 @@ static irqreturn_t taal_te_isr(int irq, void *data)
if (old) {
cancel_delayed_work(td-te_timeout_work);
 
-   r = omap_dsi_update(dssdev, td-channel,
-   td-update_region.x,
-   td-update_region.y,
-   td-update_region.w,
-   td-update_region.h,
-   taal_framedone_cb, dssdev);
+   r = omap_dsi_update(dssdev, td-channel, taal_framedone_cb,
+   dssdev);
if (r)
goto err;
}
@@ -1444,10 +1440,6 @@ static int taal_update(struct omap_dss_device *dssdev,
goto err;
}
 
-   r = omap_dsi_prepare_update(dssdev, x, y, w, h, true);
-   if (r)
-   goto err;
-
r = taal_set_update_window(td, x, y, w, h);
if (r)
goto err;
@@ -1462,8 +1454,8 @@ static int taal_update(struct omap_dss_device *dssdev,
msecs_to_jiffies(250));
atomic_set(td-do_update, 1);
} else {
-   r = omap_dsi_update(dssdev, td-channel, x, y, w, h,
-   taal_framedone_cb, dssdev);
+   r = omap_dsi_update(dssdev, td-channel, taal_framedone_cb,
+   dssdev);
if (r)
goto err;
}
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 787cebd..9ef04ff 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -236,11 +236,6 @@ enum dsi_lane {
DSI_DATA4_N = 1  9,
 };
 
-struct dsi_update_region {
-   u16 x, y, w, h;
-   struct omap_dss_device *device;
-};
-
 struct dsi_irq_stats {
unsigned long last_reset;
unsigned irq_count;
@@ -290,7 +285,9 @@ struct dsi_data {
struct dsi_isr_tables isr_tables_copy;
 
int update_channel;
-   struct dsi_update_region update_region;
+#ifdef DEBUG
+   unsigned update_bytes;
+#endif
 
bool te_enabled;
bool ulps_enabled;
@@ -454,7 +451,6 @@ static void dsi_perf_mark_start(struct platform_device 
*dsidev)
 static void dsi_perf_show(struct platform_device *dsidev, const char *name)
 {
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
-   struct omap_dss_device *dssdev = dsi-update_region.device;
ktime_t t, setup_time, trans_time;
u32 total_bytes;
u32 setup_us, trans_us, total_us;
@@ -476,9 +472,7 @@ static void dsi_perf_show(struct platform_device *dsidev, 
const char *name)
 
total_us = setup_us + trans_us;
 
-   total_bytes = dsi-update_region.w *
-   dsi-update_region.h *
-   dsi_get_pixel_size(dssdev-panel.dsi_pix_fmt) / 8;
+   total_bytes = dsi-update_bytes;
 
printk(KERN_INFO DSI(%s): %u us + %u us = %u us (%uHz), 
%u bytes, %u kbytes/sec\n,
@@ -4006,7 +4000,7 @@ void dsi_video_mode_disable(struct omap_dss_device 
*dssdev, int channel)
 EXPORT_SYMBOL(dsi_video_mode_disable);
 
 static void dsi_update_screen_dispc(struct omap_dss_device *dssdev,
-   u16 x, u16 y, u16 w, u16 h)
+   u16 w, u16 h)
 {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
struct dsi_data *dsi = dsi_get_dsidrv_data(dsidev);
@@ -4021,8 +4015,7 @@ static void dsi_update_screen_dispc(struct 
omap_dss_device *dssdev,
const unsigned channel = dsi-update_channel;
const unsigned line_buf_size = dsi_get_line_buf_size(dsidev);
 
-   DSSDBG(dsi_update_screen_dispc(%d,%d %dx%d)\n,
-   x, y, w, h);
+   DSSDBG(dsi_update_screen_dispc(%dx%d)\n, w, h);
 
dsi_vc_config_source(dsidev, channel, 

[PATCH 09/65] OMAPDSS: pass ovl manager to dss_start_update

2011-11-22 Thread Tomi Valkeinen
dss_start_update() takes currently the dss device as a parameter. Change
the parameter to ovl manager, as that is what the dss_start_update()
actually needs.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dsi.c |2 +-
 drivers/video/omap2/dss/dss.h |2 +-
 drivers/video/omap2/dss/manager.c |7 ++-
 3 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 9ef04ff..e5a2dcc 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4063,7 +4063,7 @@ static void dsi_update_screen_dispc(struct 
omap_dss_device *dssdev,
msecs_to_jiffies(250));
BUG_ON(r == 0);
 
-   dss_start_update(dssdev);
+   dss_start_update(dssdev-manager);
 
if (dsi-te_enabled) {
/* disable LP_RX_TO, so that we can receive TE.  Time to wait
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 7f6a612..0937bd8 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -182,7 +182,7 @@ void default_get_overlay_fifo_thresholds(enum omap_plane 
plane,
 int dss_init_overlay_managers(struct platform_device *pdev);
 void dss_uninit_overlay_managers(struct platform_device *pdev);
 int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl);
-void dss_start_update(struct omap_dss_device *dssdev);
+void dss_start_update(struct omap_overlay_manager *mgr);
 
 /* overlay */
 void dss_init_overlays(struct platform_device *pdev);
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index c616f85..bc28bfa 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -896,17 +896,14 @@ static int configure_dispc(void)
return r;
 }
 
-void dss_start_update(struct omap_dss_device *dssdev)
+void dss_start_update(struct omap_overlay_manager *mgr)
 {
struct manager_cache_data *mc;
struct overlay_cache_data *oc;
const int num_ovls = dss_feat_get_num_ovls();
const int num_mgrs = dss_feat_get_num_mgrs();
-   struct omap_overlay_manager *mgr;
int i;
 
-   mgr = dssdev-manager;
-
mc = dss_cache.manager_cache[mgr-id];
 
mc-do_manual_update = true;
@@ -929,7 +926,7 @@ void dss_start_update(struct omap_dss_device *dssdev)
mc-shadow_dirty = false;
}
 
-   dssdev-manager-enable(dssdev-manager);
+   mgr-enable(mgr);
 }
 
 static void dss_apply_irq_handler(void *data, u32 mask)
-- 
1.7.4.1

--
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 10/65] OMAPDSS: DISPC: handle 0 out_width/out_height in ovl_setup()

2011-11-22 Thread Tomi Valkeinen
Overlay out_width/height are set to 0 when scaling is not used by the
users of omapdss. Currently ovl_setup() expects the caller of
ovl_setup() to convert those zero values to width or height.

This patch makes ovl_setup() accept zero values for out_width/height,
making calling ovl_setup() a bit simpler as the overlay_info can be
just passed to this function without modifications.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c |   22 +-
 1 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 7387e23..49f97db 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1781,6 +1781,7 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
s32 pix_inc;
u16 frame_height = oi-height;
unsigned int field_offset = 0;
+   u16 outw, outh;
 
DSSDBG(dispc_ovl_setup %d, pa %x, pa_uv %x, sw %d, %d,%d, %dx%d - 
%dx%d, cmode %x, rot %d, mir %d, ilace %d chan %d repl %d 
@@ -1792,25 +1793,28 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
if (oi-paddr == 0)
return -EINVAL;
 
-   if (ilace  oi-height == oi-out_height)
+   outw = oi-out_width == 0 ? oi-width : oi-out_width;
+   outh = oi-out_height == 0 ? oi-height : oi-out_height;
+
+   if (ilace  oi-height == outh)
fieldmode = 1;
 
if (ilace) {
if (fieldmode)
oi-height /= 2;
oi-pos_y /= 2;
-   oi-out_height /= 2;
+   outh /= 2;
 
DSSDBG(adjusting for ilace: height %d, pos_y %d, 
out_height %d\n,
-   oi-height, oi-pos_y, oi-out_height);
+   oi-height, oi-pos_y, outh);
}
 
if (!dss_feat_color_mode_supported(plane, oi-color_mode))
return -EINVAL;
 
r = dispc_ovl_calc_scaling(plane, channel, oi-width, oi-height,
-   oi-out_width, oi-out_height, oi-color_mode,
+   outw, outh, oi-color_mode,
five_taps);
if (r)
return r;
@@ -1828,10 +1832,10 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
 * so the integer part must be added to the base address of the
 * bottom field.
 */
-   if (!oi-height || oi-height == oi-out_height)
+   if (!oi-height || oi-height == outh)
field_offset = 0;
else
-   field_offset = oi-height / oi-out_height / 2;
+   field_offset = oi-height / outh / 2;
}
 
/* Fields are independent but interleaved in memory. */
@@ -1867,7 +1871,7 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
dispc_ovl_set_pix_inc(plane, pix_inc);
 
DSSDBG(%d,%d %dx%d - %dx%d\n, oi-pos_x, oi-pos_y, oi-width,
-   oi-height, oi-out_width, oi-out_height);
+   oi-height, outw, outh);
 
dispc_ovl_set_pos(plane, oi-pos_x, oi-pos_y);
 
@@ -1875,10 +1879,10 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
 
if (ovl-caps  OMAP_DSS_OVL_CAP_SCALE) {
dispc_ovl_set_scaling(plane, oi-width, oi-height,
-  oi-out_width, oi-out_height,
+  outw, outh,
   ilace, five_taps, fieldmode,
   oi-color_mode, oi-rotation);
-   dispc_ovl_set_vid_size(plane, oi-out_width, oi-out_height);
+   dispc_ovl_set_vid_size(plane, outw, outh);
dispc_ovl_set_vid_color_conv(plane, cconv);
}
 
-- 
1.7.4.1

--
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 11/65] OMAPDSS: handle ilace/replication when configuring overlay

2011-11-22 Thread Tomi Valkeinen
Move the configuration of interlace and replication from
omap_dss_mgr_apply() to configure_overlay(). This removes the need to
store the values into the cache data.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/manager.c |   19 ++-
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index bc28bfa..626f6b7 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -510,8 +510,6 @@ struct overlay_cache_data {
struct omap_overlay_info info;
 
enum omap_channel channel;
-   bool replication;
-   bool ilace;
 
u32 fifo_low;
u32 fifo_high;
@@ -757,8 +755,10 @@ static int overlay_enabled(struct omap_overlay *ovl)
 
 static int configure_overlay(enum omap_plane plane)
 {
+   struct omap_overlay *ovl;
struct overlay_cache_data *c;
struct omap_overlay_info *oi;
+   bool ilace, replication;
int r;
 
DSSDBGF(%d, plane);
@@ -771,8 +771,14 @@ static int configure_overlay(enum omap_plane plane)
return 0;
}
 
-   r = dispc_ovl_setup(plane, oi, c-ilace, c-channel,
-   c-replication, c-fifo_low, c-fifo_high);
+   ovl = omap_dss_get_overlay(plane);
+
+   replication = dss_use_replication(ovl-manager-device, oi-color_mode);
+
+   ilace = ovl-manager-device-type == OMAP_DISPLAY_TYPE_VENC;
+
+   r = dispc_ovl_setup(plane, oi, ilace, c-channel,
+   replication, c-fifo_low, c-fifo_high);
if (r) {
/* this shouldn't happen */
DSSERR(dispc_ovl_setup failed for ovl %d\n, plane);
@@ -1038,11 +1044,6 @@ static int omap_dss_mgr_apply(struct 
omap_overlay_manager *mgr)
oc-dirty = true;
oc-info = ovl-info;
 
-   oc-replication =
-   dss_use_replication(dssdev, ovl-info.color_mode);
-
-   oc-ilace = dssdev-type == OMAP_DISPLAY_TYPE_VENC;
-
oc-channel = ovl-manager-id;
 
oc-enabled = true;
-- 
1.7.4.1

--
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 12/65] OMAPDSS: separate FIFO threshold setup from ovl_setup

2011-11-22 Thread Tomi Valkeinen
Overlay FIFO thresholds are configured with ovl_setup, with all the
other overlay attributes. This patch separates FIFO threshold setup so
that we can later configure FIFO thresholds only when needed.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c   |   10 --
 drivers/video/omap2/dss/dss.h |3 +--
 drivers/video/omap2/dss/manager.c |5 +++--
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 49f97db..55cfbc9 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -1769,8 +1769,7 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane,
 }
 
 int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
-   bool ilace, enum omap_channel channel, bool replication,
-   u32 fifo_low, u32 fifo_high)
+   bool ilace, enum omap_channel channel, bool replication)
 {
struct omap_overlay *ovl = omap_dss_get_overlay(plane);
bool five_taps = false;
@@ -1784,11 +1783,11 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
u16 outw, outh;
 
DSSDBG(dispc_ovl_setup %d, pa %x, pa_uv %x, sw %d, %d,%d, %dx%d - 
-   %dx%d, cmode %x, rot %d, mir %d, ilace %d chan %d repl %d 
-   fifo_low %d fifo high %d\n, plane, oi-paddr, oi-p_uv_addr,
+   %dx%d, cmode %x, rot %d, mir %d, ilace %d chan %d repl %d\n,
+   plane, oi-paddr, oi-p_uv_addr,
oi-screen_width, oi-pos_x, oi-pos_y, oi-width, oi-height,
oi-out_width, oi-out_height, oi-color_mode, oi-rotation,
-   oi-mirror, ilace, channel, replication, fifo_low, fifo_high);
+   oi-mirror, ilace, channel, replication);
 
if (oi-paddr == 0)
return -EINVAL;
@@ -1896,7 +1895,6 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
dispc_ovl_set_channel_out(plane, channel);
 
dispc_ovl_enable_replication(plane, replication);
-   dispc_ovl_set_fifo_threshold(plane, fifo_low, fifo_high);
 
return 0;
 }
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 0937bd8..61001c3 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -397,8 +397,7 @@ void dispc_ovl_set_fifo_threshold(enum omap_plane plane, 
u32 low, u32 high);
 u32 dispc_ovl_get_fifo_size(enum omap_plane plane);
 u32 dispc_ovl_get_burst_size(enum omap_plane plane);
 int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
-   bool ilace, enum omap_channel channel, bool replication,
-   u32 fifo_low, u32 fifo_high);
+   bool ilace, enum omap_channel channel, bool replication);
 int dispc_ovl_enable(enum omap_plane plane, bool enable);
 void dispc_ovl_set_channel_out(enum omap_plane plane,
enum omap_channel channel);
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index 626f6b7..b47c1fa 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -777,8 +777,7 @@ static int configure_overlay(enum omap_plane plane)
 
ilace = ovl-manager-device-type == OMAP_DISPLAY_TYPE_VENC;
 
-   r = dispc_ovl_setup(plane, oi, ilace, c-channel,
-   replication, c-fifo_low, c-fifo_high);
+   r = dispc_ovl_setup(plane, oi, ilace, c-channel, replication);
if (r) {
/* this shouldn't happen */
DSSERR(dispc_ovl_setup failed for ovl %d\n, plane);
@@ -786,6 +785,8 @@ static int configure_overlay(enum omap_plane plane)
return r;
}
 
+   dispc_ovl_set_fifo_threshold(plane, c-fifo_low, c-fifo_high);
+
dispc_ovl_enable(plane, 1);
 
return 0;
-- 
1.7.4.1

--
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 13/65] OMAPDSS: separate overlay channel from ovl_setup

2011-11-22 Thread Tomi Valkeinen
Overlay channel is configured with ovl_setup, with all the other overlay
attriutes. This patch separates overlay channel setup so that we can
later configure the channel only when needed.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c   |   40 ++--
 drivers/video/omap2/dss/dss.h |2 +-
 drivers/video/omap2/dss/manager.c |4 ++-
 3 files changed, 41 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 55cfbc9..ab86a78 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -922,6 +922,39 @@ void dispc_ovl_set_channel_out(enum omap_plane plane, enum 
omap_channel channel)
dispc_write_reg(DISPC_OVL_ATTRIBUTES(plane), val);
 }
 
+static enum omap_channel dispc_ovl_get_channel_out(enum omap_plane plane)
+{
+   int shift;
+   u32 val;
+   enum omap_channel channel;
+
+   switch (plane) {
+   case OMAP_DSS_GFX:
+   shift = 8;
+   break;
+   case OMAP_DSS_VIDEO1:
+   case OMAP_DSS_VIDEO2:
+   case OMAP_DSS_VIDEO3:
+   shift = 16;
+   break;
+   default:
+   BUG();
+   }
+
+   val = dispc_read_reg(DISPC_OVL_ATTRIBUTES(plane));
+
+   if (dss_has_feature(FEAT_MGR_LCD2)) {
+   if (FLD_GET(val, 31, 30) == 0)
+   channel = FLD_GET(val, shift, shift);
+   else
+   channel = OMAP_DSS_CHANNEL_LCD2;
+   } else {
+   channel = FLD_GET(val, shift, shift);
+   }
+
+   return channel;
+}
+
 static void dispc_ovl_set_burst_size(enum omap_plane plane,
enum omap_burst_size burst_size)
 {
@@ -1769,7 +1802,7 @@ static int dispc_ovl_calc_scaling(enum omap_plane plane,
 }
 
 int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
-   bool ilace, enum omap_channel channel, bool replication)
+   bool ilace, bool replication)
 {
struct omap_overlay *ovl = omap_dss_get_overlay(plane);
bool five_taps = false;
@@ -1781,6 +1814,9 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
u16 frame_height = oi-height;
unsigned int field_offset = 0;
u16 outw, outh;
+   enum omap_channel channel;
+
+   channel = dispc_ovl_get_channel_out(plane);
 
DSSDBG(dispc_ovl_setup %d, pa %x, pa_uv %x, sw %d, %d,%d, %dx%d - 
%dx%d, cmode %x, rot %d, mir %d, ilace %d chan %d repl %d\n,
@@ -1892,8 +1928,6 @@ int dispc_ovl_setup(enum omap_plane plane, struct 
omap_overlay_info *oi,
dispc_ovl_set_pre_mult_alpha(plane, oi-pre_mult_alpha);
dispc_ovl_setup_global_alpha(plane, oi-global_alpha);
 
-   dispc_ovl_set_channel_out(plane, channel);
-
dispc_ovl_enable_replication(plane, replication);
 
return 0;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 61001c3..bc1b2cc 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -397,7 +397,7 @@ void dispc_ovl_set_fifo_threshold(enum omap_plane plane, 
u32 low, u32 high);
 u32 dispc_ovl_get_fifo_size(enum omap_plane plane);
 u32 dispc_ovl_get_burst_size(enum omap_plane plane);
 int dispc_ovl_setup(enum omap_plane plane, struct omap_overlay_info *oi,
-   bool ilace, enum omap_channel channel, bool replication);
+   bool ilace, bool replication);
 int dispc_ovl_enable(enum omap_plane plane, bool enable);
 void dispc_ovl_set_channel_out(enum omap_plane plane,
enum omap_channel channel);
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index b47c1fa..42740d3 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -777,7 +777,9 @@ static int configure_overlay(enum omap_plane plane)
 
ilace = ovl-manager-device-type == OMAP_DISPLAY_TYPE_VENC;
 
-   r = dispc_ovl_setup(plane, oi, ilace, c-channel, replication);
+   dispc_ovl_set_channel_out(plane, c-channel);
+
+   r = dispc_ovl_setup(plane, oi, ilace, replication);
if (r) {
/* this shouldn't happen */
DSSERR(dispc_ovl_setup failed for ovl %d\n, plane);
-- 
1.7.4.1

--
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 14/65] OMAPDSS: setup manager with dispc_mgr_setup()

2011-11-22 Thread Tomi Valkeinen
Change manager configuration to be similar to overlay configuration by
creating dispc_mgr_setup() which takes omap_overlay_manager_info as
parameter.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c   |   26 --
 drivers/video/omap2/dss/dss.h |   11 ++-
 drivers/video/omap2/dss/manager.c |9 +
 3 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index ab86a78..3f2efdc 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -996,7 +996,7 @@ void dispc_enable_gamma_table(bool enable)
REG_FLD_MOD(DISPC_CONFIG, enable, 9, 9);
 }
 
-void dispc_mgr_enable_cpr(enum omap_channel channel, bool enable)
+static void dispc_mgr_enable_cpr(enum omap_channel channel, bool enable)
 {
u16 reg;
 
@@ -1010,7 +1010,7 @@ void dispc_mgr_enable_cpr(enum omap_channel channel, bool 
enable)
REG_FLD_MOD(reg, enable, 15, 15);
 }
 
-void dispc_mgr_set_cpr_coef(enum omap_channel channel,
+static void dispc_mgr_set_cpr_coef(enum omap_channel channel,
struct omap_dss_cpr_coefs *coefs)
 {
u32 coef_r, coef_g, coef_b;
@@ -2158,7 +2158,7 @@ void dispc_set_loadmode(enum omap_dss_load_mode mode)
 }
 
 
-void dispc_mgr_set_default_color(enum omap_channel channel, u32 color)
+static void dispc_mgr_set_default_color(enum omap_channel channel, u32 color)
 {
dispc_write_reg(DISPC_DEFAULT_COLOR(channel), color);
 }
@@ -2176,7 +2176,7 @@ u32 dispc_mgr_get_default_color(enum omap_channel channel)
return l;
 }
 
-void dispc_mgr_set_trans_key(enum omap_channel ch,
+static void dispc_mgr_set_trans_key(enum omap_channel ch,
enum omap_dss_trans_key_type type,
u32 trans_key)
 {
@@ -2209,7 +2209,7 @@ void dispc_mgr_get_trans_key(enum omap_channel ch,
*trans_key = dispc_read_reg(DISPC_TRANS_COLOR(ch));
 }
 
-void dispc_mgr_enable_trans_key(enum omap_channel ch, bool enable)
+static void dispc_mgr_enable_trans_key(enum omap_channel ch, bool enable)
 {
if (ch == OMAP_DSS_CHANNEL_LCD)
REG_FLD_MOD(DISPC_CONFIG, enable, 10, 10);
@@ -2219,7 +2219,8 @@ void dispc_mgr_enable_trans_key(enum omap_channel ch, 
bool enable)
REG_FLD_MOD(DISPC_CONFIG2, enable, 10, 10);
 }
 
-void dispc_mgr_enable_alpha_fixed_zorder(enum omap_channel ch, bool enable)
+static void dispc_mgr_enable_alpha_fixed_zorder(enum omap_channel ch,
+   bool enable)
 {
if (!dss_has_feature(FEAT_ALPHA_FIXED_ZORDER))
return;
@@ -2263,6 +2264,19 @@ bool dispc_mgr_trans_key_enabled(enum omap_channel ch)
return enabled;
 }
 
+void dispc_mgr_setup(enum omap_channel channel,
+   struct omap_overlay_manager_info *info)
+{
+   dispc_mgr_set_default_color(channel, info-default_color);
+   dispc_mgr_set_trans_key(channel, info-trans_key_type, info-trans_key);
+   dispc_mgr_enable_trans_key(channel, info-trans_enabled);
+   dispc_mgr_enable_alpha_fixed_zorder(channel,
+   info-partial_alpha_enabled);
+   if (dss_has_feature(FEAT_CPR)) {
+   dispc_mgr_enable_cpr(channel, info-cpr_enable);
+   dispc_mgr_set_cpr_coef(channel, info-cpr_coefs);
+   }
+}
 
 void dispc_mgr_set_tft_data_lines(enum omap_channel channel, u8 data_lines)
 {
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index bc1b2cc..3e01bba 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -405,9 +405,6 @@ void dispc_ovl_set_channel_out(enum omap_plane plane,
 
 void dispc_mgr_enable_fifohandcheck(enum omap_channel channel, bool enable);
 void dispc_mgr_set_lcd_size(enum omap_channel channel, u16 width, u16 height);
-void dispc_mgr_enable_cpr(enum omap_channel channel, bool enable);
-void dispc_mgr_set_cpr_coef(enum omap_channel channel,
-   struct omap_dss_cpr_coefs *coefs);
 bool dispc_mgr_go_busy(enum omap_channel channel);
 void dispc_mgr_go(enum omap_channel channel);
 bool dispc_mgr_is_enabled(enum omap_channel channel);
@@ -418,16 +415,10 @@ void dispc_mgr_enable_stallmode(enum omap_channel 
channel, bool enable);
 void dispc_mgr_set_tft_data_lines(enum omap_channel channel, u8 data_lines);
 void dispc_mgr_set_lcd_display_type(enum omap_channel channel,
enum omap_lcd_display_type type);
-void dispc_mgr_set_default_color(enum omap_channel channel, u32 color);
 u32 dispc_mgr_get_default_color(enum omap_channel channel);
-void dispc_mgr_set_trans_key(enum omap_channel ch,
-   enum omap_dss_trans_key_type type,
-   u32 trans_key);
 void dispc_mgr_get_trans_key(enum omap_channel ch,
enum omap_dss_trans_key_type *type,
u32 *trans_key);
-void dispc_mgr_enable_trans_key(enum omap_channel ch, bool enable);
-void dispc_mgr_enable_alpha_fixed_zorder(enum 

[PATCH 15/65] OMAPDSS: DISPC: remove unused functions

2011-11-22 Thread Tomi Valkeinen
Remove unused functions:

dispc_mgr_get_default_color
dispc_mgr_get_trans_key
dispc_mgr_trans_key_enabled
dispc_mgr_alpha_fixed_zorder_enabled

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c |   65 ---
 drivers/video/omap2/dss/dss.h   |6 ---
 2 files changed, 0 insertions(+), 71 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 3f2efdc..5ac00a2 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -2163,19 +2163,6 @@ static void dispc_mgr_set_default_color(enum 
omap_channel channel, u32 color)
dispc_write_reg(DISPC_DEFAULT_COLOR(channel), color);
 }
 
-u32 dispc_mgr_get_default_color(enum omap_channel channel)
-{
-   u32 l;
-
-   BUG_ON(channel != OMAP_DSS_CHANNEL_DIGIT 
-   channel != OMAP_DSS_CHANNEL_LCD 
-   channel != OMAP_DSS_CHANNEL_LCD2);
-
-   l = dispc_read_reg(DISPC_DEFAULT_COLOR(channel));
-
-   return l;
-}
-
 static void dispc_mgr_set_trans_key(enum omap_channel ch,
enum omap_dss_trans_key_type type,
u32 trans_key)
@@ -2190,25 +2177,6 @@ static void dispc_mgr_set_trans_key(enum omap_channel ch,
dispc_write_reg(DISPC_TRANS_COLOR(ch), trans_key);
 }
 
-void dispc_mgr_get_trans_key(enum omap_channel ch,
-   enum omap_dss_trans_key_type *type,
-   u32 *trans_key)
-{
-   if (type) {
-   if (ch == OMAP_DSS_CHANNEL_LCD)
-   *type = REG_GET(DISPC_CONFIG, 11, 11);
-   else if (ch == OMAP_DSS_CHANNEL_DIGIT)
-   *type = REG_GET(DISPC_CONFIG, 13, 13);
-   else if (ch == OMAP_DSS_CHANNEL_LCD2)
-   *type = REG_GET(DISPC_CONFIG2, 11, 11);
-   else
-   BUG();
-   }
-
-   if (trans_key)
-   *trans_key = dispc_read_reg(DISPC_TRANS_COLOR(ch));
-}
-
 static void dispc_mgr_enable_trans_key(enum omap_channel ch, bool enable)
 {
if (ch == OMAP_DSS_CHANNEL_LCD)
@@ -2231,39 +2199,6 @@ static void dispc_mgr_enable_alpha_fixed_zorder(enum 
omap_channel ch,
REG_FLD_MOD(DISPC_CONFIG, enable, 19, 19);
 }
 
-bool dispc_mgr_alpha_fixed_zorder_enabled(enum omap_channel ch)
-{
-   bool enabled;
-
-   if (!dss_has_feature(FEAT_ALPHA_FIXED_ZORDER))
-   return false;
-
-   if (ch == OMAP_DSS_CHANNEL_LCD)
-   enabled = REG_GET(DISPC_CONFIG, 18, 18);
-   else if (ch == OMAP_DSS_CHANNEL_DIGIT)
-   enabled = REG_GET(DISPC_CONFIG, 19, 19);
-   else
-   BUG();
-
-   return enabled;
-}
-
-bool dispc_mgr_trans_key_enabled(enum omap_channel ch)
-{
-   bool enabled;
-
-   if (ch == OMAP_DSS_CHANNEL_LCD)
-   enabled = REG_GET(DISPC_CONFIG, 10, 10);
-   else if (ch == OMAP_DSS_CHANNEL_DIGIT)
-   enabled = REG_GET(DISPC_CONFIG, 12, 12);
-   else if (ch == OMAP_DSS_CHANNEL_LCD2)
-   enabled = REG_GET(DISPC_CONFIG2, 10, 10);
-   else
-   BUG();
-
-   return enabled;
-}
-
 void dispc_mgr_setup(enum omap_channel channel,
struct omap_overlay_manager_info *info)
 {
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 3e01bba..2d6081e 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -415,12 +415,6 @@ void dispc_mgr_enable_stallmode(enum omap_channel channel, 
bool enable);
 void dispc_mgr_set_tft_data_lines(enum omap_channel channel, u8 data_lines);
 void dispc_mgr_set_lcd_display_type(enum omap_channel channel,
enum omap_lcd_display_type type);
-u32 dispc_mgr_get_default_color(enum omap_channel channel);
-void dispc_mgr_get_trans_key(enum omap_channel ch,
-   enum omap_dss_trans_key_type *type,
-   u32 *trans_key);
-bool dispc_mgr_trans_key_enabled(enum omap_channel ch);
-bool dispc_mgr_alpha_fixed_zorder_enabled(enum omap_channel ch);
 void dispc_mgr_set_lcd_timings(enum omap_channel channel,
struct omap_video_timings *timings);
 void dispc_mgr_set_pol_freq(enum omap_channel channel,
-- 
1.7.4.1

--
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 16/65] OMAPDSS: remove unneeded dss_ovl_wait_for_go()

2011-11-22 Thread Tomi Valkeinen
There's an unnecessary wrapper function, dss_ovl_wait_for_go(), which
does nothing else than call dss_mgr_wait_for_go_ovl(). The
dss_ovl_wait_for_go() function can be removed.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/overlay.c |7 +--
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/drivers/video/omap2/dss/overlay.c 
b/drivers/video/omap2/dss/overlay.c
index d15b826..0ab14fa 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -548,11 +548,6 @@ static void dss_ovl_get_overlay_info(struct omap_overlay 
*ovl,
*info = ovl-info;
 }
 
-static int dss_ovl_wait_for_go(struct omap_overlay *ovl)
-{
-   return dss_mgr_wait_for_go_ovl(ovl);
-}
-
 static int omap_dss_set_manager(struct omap_overlay *ovl,
struct omap_overlay_manager *mgr)
 {
@@ -689,7 +684,7 @@ void dss_init_overlays(struct platform_device *pdev)
ovl-unset_manager = omap_dss_unset_manager;
ovl-set_overlay_info = dss_ovl_set_overlay_info;
ovl-get_overlay_info = dss_ovl_get_overlay_info;
-   ovl-wait_for_go = dss_ovl_wait_for_go;
+   ovl-wait_for_go = dss_mgr_wait_for_go_ovl;
 
ovl-caps = dss_feat_get_overlay_caps(ovl-id);
ovl-supported_modes =
-- 
1.7.4.1

--
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 18/65] OMAPDSS: split omap_dss_mgr_apply() to smaller funcs

2011-11-22 Thread Tomi Valkeinen
Split omap_dss_mgr_apply() into smaller functions for clarity.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/manager.c |  168 +
 1 files changed, 94 insertions(+), 74 deletions(-)

diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index e8838d3..3aca2b4 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -993,107 +993,92 @@ end:
spin_unlock(dss_cache.lock);
 }
 
-static int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
+static int omap_dss_mgr_apply_ovl(struct omap_overlay *ovl)
 {
struct overlay_cache_data *oc;
-   struct manager_cache_data *mc;
-   int i;
-   struct omap_overlay *ovl;
-   unsigned long flags;
-   int r;
-
-   DSSDBG(omap_dss_mgr_apply(%s)\n, mgr-name);
+   struct omap_dss_device *dssdev;
 
-   r = dispc_runtime_get();
-   if (r)
-   return r;
+   oc = dss_cache.overlay_cache[ovl-id];
 
-   spin_lock_irqsave(dss_cache.lock, flags);
+   if (ovl-manager_changed) {
+   ovl-manager_changed = false;
+   ovl-info_dirty  = true;
+   }
 
-   /* Configure overlays */
-   for (i = 0; i  omap_dss_get_num_overlays(); ++i) {
-   struct omap_dss_device *dssdev;
+   if (!overlay_enabled(ovl)) {
+   if (oc-enabled) {
+   oc-enabled = false;
+   oc-dirty = true;
+   }
+   return 0;
+   }
 
-   ovl = omap_dss_get_overlay(i);
+   if (!ovl-info_dirty)
+   return 0;
 
-   oc = dss_cache.overlay_cache[ovl-id];
+   dssdev = ovl-manager-device;
 
-   if (ovl-manager_changed) {
-   ovl-manager_changed = false;
-   ovl-info_dirty  = true;
+   if (dss_check_overlay(ovl, dssdev)) {
+   if (oc-enabled) {
+   oc-enabled = false;
+   oc-dirty = true;
}
+   return -EINVAL;
+   }
 
-   if (!overlay_enabled(ovl)) {
-   if (oc-enabled) {
-   oc-enabled = false;
-   oc-dirty = true;
-   }
-   continue;
-   }
+   ovl-info_dirty = false;
+   oc-dirty = true;
+   oc-info = ovl-info;
 
-   if (!ovl-info_dirty)
-   continue;
+   oc-channel = ovl-manager-id;
 
-   dssdev = ovl-manager-device;
+   oc-enabled = true;
 
-   if (dss_check_overlay(ovl, dssdev)) {
-   if (oc-enabled) {
-   oc-enabled = false;
-   oc-dirty = true;
-   }
-   continue;
-   }
+   return 0;
+}
 
-   ovl-info_dirty = false;
-   oc-dirty = true;
-   oc-info = ovl-info;
+static void omap_dss_mgr_apply_mgr(struct omap_overlay_manager *mgr)
+{
+   struct manager_cache_data *mc;
 
-   oc-channel = ovl-manager-id;
+   mc = dss_cache.manager_cache[mgr-id];
 
-   oc-enabled = true;
+   if (mgr-device_changed) {
+   mgr-device_changed = false;
+   mgr-info_dirty  = true;
}
 
-   /* Configure managers */
-   list_for_each_entry(mgr, manager_list, list) {
-   mc = dss_cache.manager_cache[mgr-id];
-
-   if (mgr-device_changed) {
-   mgr-device_changed = false;
-   mgr-info_dirty  = true;
-   }
+   if (!mgr-info_dirty)
+   return;
 
-   if (!mgr-info_dirty)
-   continue;
+   if (!mgr-device)
+   return;
 
-   if (!mgr-device)
-   continue;
+   mgr-info_dirty = false;
+   mc-dirty = true;
+   mc-info = mgr-info;
 
-   mgr-info_dirty = false;
-   mc-dirty = true;
-   mc-info = mgr-info;
-
-   mc-manual_update = mgr_manual_update(mgr);
-   }
-
-   /* Configure overlay fifos */
-   for (i = 0; i  omap_dss_get_num_overlays(); ++i) {
-   struct omap_dss_device *dssdev;
-   u32 size, burst_size;
+   mc-manual_update = mgr_manual_update(mgr);
+}
 
-   ovl = omap_dss_get_overlay(i);
+static void omap_dss_mgr_apply_ovl_fifos(struct omap_overlay *ovl)
+{
+   struct overlay_cache_data *oc;
+   struct omap_dss_device *dssdev;
+   u32 size, burst_size;
 
-   oc = dss_cache.overlay_cache[ovl-id];
+   oc = dss_cache.overlay_cache[ovl-id];
 
-   if (!oc-enabled)
-   continue;
+   if (!oc-enabled)
+   return;
 
-   dssdev = 

[PATCH 22/65] OMAPDSS: APPLY: track whether a manager is enabled

2011-11-22 Thread Tomi Valkeinen
Add enabled field to struct omap_overlay_manager, which tells if the
output is enabled or not. This will be used in apply.c in the following
patches.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |2 ++
 include/video/omapdss.h |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index ebc0ae1..9af5809 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -657,10 +657,12 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 void dss_mgr_enable(struct omap_overlay_manager *mgr)
 {
dispc_mgr_enable(mgr-id, true);
+   mgr-enabled = true;
 }
 
 void dss_mgr_disable(struct omap_overlay_manager *mgr)
 {
dispc_mgr_enable(mgr-id, false);
+   mgr-enabled = false;
 }
 
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 04741cd..d61efc3 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -432,6 +432,8 @@ struct omap_overlay_manager {
struct omap_dss_device *device;
struct omap_overlay_manager_info info;
 
+   bool enabled;
+
bool device_changed;
/* if true, info has been changed but not applied() yet */
bool info_dirty;
-- 
1.7.4.1

--
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 19/65] OMAPDSS: apply affects only one overlay manager

2011-11-22 Thread Tomi Valkeinen
omap_dss_mgr_apply currently applies settings to all overlays and
overlay managers. The reason for this was to support cases where
configuration changes affecting multiple managers are made. However, the
current code doesn't support changing such configurations, so the
functionality is not needed.

Change the apply to affect only the manager given as an argument, and
the overlays attached to that manager.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/manager.c |   19 ---
 1 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index 3aca2b4..5c120ac 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -1114,23 +1114,28 @@ static int omap_dss_mgr_apply(struct 
omap_overlay_manager *mgr)
spin_lock_irqsave(dss_cache.lock, flags);
 
/* Configure overlays */
-   for (i = 0; i  omap_dss_get_num_overlays(); ++i) {
+   for (i = 0; i  mgr-num_overlays; ++i) {
struct omap_overlay *ovl;
 
-   ovl = omap_dss_get_overlay(i);
+   ovl = mgr-overlays[i];
+
+   if (ovl-manager != mgr)
+   continue;
 
omap_dss_mgr_apply_ovl(ovl);
}
 
-   /* Configure managers */
-   list_for_each_entry(mgr, manager_list, list)
-   omap_dss_mgr_apply_mgr(mgr);
+   /* Configure manager */
+   omap_dss_mgr_apply_mgr(mgr);
 
/* Configure overlay fifos */
-   for (i = 0; i  omap_dss_get_num_overlays(); ++i) {
+   for (i = 0; i  mgr-num_overlays; ++i) {
struct omap_overlay *ovl;
 
-   ovl = omap_dss_get_overlay(i);
+   ovl = mgr-overlays[i];
+
+   if (ovl-manager != mgr)
+   continue;
 
omap_dss_mgr_apply_ovl_fifos(ovl);
}
-- 
1.7.4.1

--
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 23/65] OMAPDSS: APPLY: skip isr register and config for manual update displays

2011-11-22 Thread Tomi Valkeinen
The mechanism to cache manager and overlay settings and configure them
into the HW registers in VSYNC is meant only for auto-update displays,
as it doesn't make sense (and doesn't work) for manual-update displays.

This patchs adds a check so that we skip the above for manual update
displays.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   27 +++
 1 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 9af5809..04f3ff5 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -629,23 +629,26 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
}
 
r = 0;
-   if (!dss_cache.irq_enabled) {
-   u32 mask;
+   if (!mgr_manual_update(mgr)) {
+   if (!dss_cache.irq_enabled) {
+   u32 mask;
 
-   mask = DISPC_IRQ_VSYNC  | DISPC_IRQ_EVSYNC_ODD |
-   DISPC_IRQ_EVSYNC_EVEN;
-   if (dss_has_feature(FEAT_MGR_LCD2))
-   mask |= DISPC_IRQ_VSYNC2;
+   mask = DISPC_IRQ_VSYNC  | DISPC_IRQ_EVSYNC_ODD |
+   DISPC_IRQ_EVSYNC_EVEN;
+   if (dss_has_feature(FEAT_MGR_LCD2))
+   mask |= DISPC_IRQ_VSYNC2;
 
-   r = omap_dispc_register_isr(dss_apply_irq_handler, NULL, mask);
+   r = omap_dispc_register_isr(dss_apply_irq_handler,
+   NULL, mask);
 
-   if (r)
-   DSSERR(failed to register apply isr\n);
+   if (r)
+   DSSERR(failed to register apply isr\n);
 
-   dss_cache.irq_enabled = true;
-   }
+   dss_cache.irq_enabled = true;
+   }
 
-   configure_dispc();
+   configure_dispc();
+   }
 
spin_unlock_irqrestore(dss_cache.lock, flags);
 
-- 
1.7.4.1

--
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 24/65] OMAPDSS: APPLY: skip isr register and config for disabled displays

2011-11-22 Thread Tomi Valkeinen
There's no need to register the vsync ISR and configure the hardware if
the overlay manager is disabled, so this patch adds a check for disabled
managers to the omap_dss_mgr_apply() function.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 04f3ff5..cf68c9e 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -629,7 +629,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
}
 
r = 0;
-   if (!mgr_manual_update(mgr)) {
+   if (mgr-enabled  !mgr_manual_update(mgr)) {
if (!dss_cache.irq_enabled) {
u32 mask;
 
-- 
1.7.4.1

--
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 27/65] OMAPDSS: store managers in an array

2011-11-22 Thread Tomi Valkeinen
Overlay managers are stored in a linked list. There's no need for this
list, as an array would do just as fine.

This patch changes the code to use an array for overlay managers.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/manager.c |   49 +
 include/video/omapdss.h   |1 -
 2 files changed, 17 insertions(+), 33 deletions(-)

diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index 780a307..a08cc6e 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -34,7 +34,7 @@
 #include dss_features.h
 
 static int num_managers;
-static struct list_head manager_list;
+static struct omap_overlay_manager *managers;
 
 static ssize_t manager_name_show(struct omap_overlay_manager *mgr, char *buf)
 {
@@ -585,25 +585,19 @@ static void omap_dss_mgr_get_info(struct 
omap_overlay_manager *mgr,
*info = mgr-info;
 }
 
-static void omap_dss_add_overlay_manager(struct omap_overlay_manager *manager)
-{
-   ++num_managers;
-   list_add_tail(manager-list, manager_list);
-}
-
 int dss_init_overlay_managers(struct platform_device *pdev)
 {
int i, r;
 
-   INIT_LIST_HEAD(manager_list);
+   num_managers = dss_feat_get_num_mgrs();
 
-   num_managers = 0;
+   managers = kzalloc(sizeof(struct omap_overlay_manager) * num_managers,
+   GFP_KERNEL);
 
-   for (i = 0; i  dss_feat_get_num_mgrs(); ++i) {
-   struct omap_overlay_manager *mgr;
-   mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
+   BUG_ON(managers == NULL);
 
-   BUG_ON(mgr == NULL);
+   for (i = 0; i  num_managers; ++i) {
+   struct omap_overlay_manager *mgr = managers[i];
 
switch (i) {
case 0:
@@ -634,15 +628,11 @@ int dss_init_overlay_managers(struct platform_device 
*pdev)
 
dss_overlay_setup_dispc_manager(mgr);
 
-   omap_dss_add_overlay_manager(mgr);
-
r = kobject_init_and_add(mgr-kobj, manager_ktype,
pdev-dev.kobj, manager%d, i);
 
-   if (r) {
+   if (r)
DSSERR(failed to create sysfs file\n);
-   continue;
-   }
}
 
return 0;
@@ -650,17 +640,17 @@ int dss_init_overlay_managers(struct platform_device 
*pdev)
 
 void dss_uninit_overlay_managers(struct platform_device *pdev)
 {
-   struct omap_overlay_manager *mgr;
+   int i;
+
+   for (i = 0; i  num_managers; ++i) {
+   struct omap_overlay_manager *mgr = managers[i];
 
-   while (!list_empty(manager_list)) {
-   mgr = list_first_entry(manager_list,
-   struct omap_overlay_manager, list);
-   list_del(mgr-list);
kobject_del(mgr-kobj);
kobject_put(mgr-kobj);
-   kfree(mgr);
}
 
+   kfree(managers);
+   managers = NULL;
num_managers = 0;
 }
 
@@ -672,15 +662,10 @@ EXPORT_SYMBOL(omap_dss_get_num_overlay_managers);
 
 struct omap_overlay_manager *omap_dss_get_overlay_manager(int num)
 {
-   int i = 0;
-   struct omap_overlay_manager *mgr;
-
-   list_for_each_entry(mgr, manager_list, list) {
-   if (i++ == num)
-   return mgr;
-   }
+   if (num = num_managers)
+   return NULL;
 
-   return NULL;
+   return managers[num];
 }
 EXPORT_SYMBOL(omap_dss_get_overlay_manager);
 
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index d61efc3..fd5a96c 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -418,7 +418,6 @@ struct omap_overlay_manager_info {
 
 struct omap_overlay_manager {
struct kobject kobj;
-   struct list_head list;
 
/* static fields */
const char *name;
-- 
1.7.4.1

--
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 28/65] OMAPDSS: store overlays in a list for each manager

2011-11-22 Thread Tomi Valkeinen
Current way of handling overlay-manager links is a bit strange: each
manager has a static array, containing pointers to all the overlays
(even those used by other managers). The overlays contain a pointer to
the manager being used.

This patch makes the system a bit saner: each manager has a linked list
of overlays, and only the overlays linked to that manager are in the
list.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c   |   33 +++--
 drivers/video/omap2/dss/manager.c |   10 --
 drivers/video/omap2/dss/overlay.c |   12 ++--
 include/video/omapdss.h   |3 +--
 4 files changed, 14 insertions(+), 44 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index cfcf816..cca5732 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -398,8 +398,7 @@ void dss_start_update(struct omap_overlay_manager *mgr)
 {
struct manager_cache_data *mc;
struct overlay_cache_data *oc;
-   const int num_ovls = dss_feat_get_num_ovls();
-   int i;
+   struct omap_overlay *ovl;
 
mc = dss_cache.manager_cache[mgr-id];
 
@@ -407,11 +406,8 @@ void dss_start_update(struct omap_overlay_manager *mgr)
configure_dispc();
mc-do_manual_update = false;
 
-   for (i = 0; i  num_ovls; ++i) {
-   oc = dss_cache.overlay_cache[i];
-   if (oc-channel != mgr-id)
-   continue;
-
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   oc = dss_cache.overlay_cache[ovl-id];
oc-shadow_dirty = false;
}
 
@@ -584,8 +580,9 @@ static void omap_dss_mgr_apply_ovl_fifos(struct 
omap_overlay *ovl)
 
 int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 {
-   int i, r;
+   int r;
unsigned long flags;
+   struct omap_overlay *ovl;
 
DSSDBG(omap_dss_mgr_apply(%s)\n, mgr-name);
 
@@ -596,31 +593,15 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
spin_lock_irqsave(dss_cache.lock, flags);
 
/* Configure overlays */
-   for (i = 0; i  mgr-num_overlays; ++i) {
-   struct omap_overlay *ovl;
-
-   ovl = mgr-overlays[i];
-
-   if (ovl-manager != mgr)
-   continue;
-
+   list_for_each_entry(ovl, mgr-overlays, list)
omap_dss_mgr_apply_ovl(ovl);
-   }
 
/* Configure manager */
omap_dss_mgr_apply_mgr(mgr);
 
/* Configure overlay fifos */
-   for (i = 0; i  mgr-num_overlays; ++i) {
-   struct omap_overlay *ovl;
-
-   ovl = mgr-overlays[i];
-
-   if (ovl-manager != mgr)
-   continue;
-
+   list_for_each_entry(ovl, mgr-overlays, list)
omap_dss_mgr_apply_ovl_fifos(ovl);
-   }
 
r = 0;
if (mgr-enabled  !mgr_manual_update(mgr)) {
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index a08cc6e..62bcc38 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -470,8 +470,8 @@ static struct kobj_type manager_ktype = {
 static int omap_dss_set_device(struct omap_overlay_manager *mgr,
struct omap_dss_device *dssdev)
 {
-   int i;
int r;
+   struct omap_overlay *ovl;
 
if (dssdev-manager) {
DSSERR(display '%s' already has a manager '%s'\n,
@@ -485,10 +485,8 @@ static int omap_dss_set_device(struct omap_overlay_manager 
*mgr,
return -EINVAL;
}
 
-   for (i = 0; i  mgr-num_overlays; i++) {
-   struct omap_overlay *ovl = mgr-overlays[i];
-
-   if (ovl-manager != mgr || !ovl-info.enabled)
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   if (!ovl-info.enabled)
continue;
 
r = dss_check_overlay(ovl, dssdev);
@@ -626,7 +624,7 @@ int dss_init_overlay_managers(struct platform_device *pdev)
mgr-supported_displays =
dss_feat_get_supported_displays(mgr-id);
 
-   dss_overlay_setup_dispc_manager(mgr);
+   INIT_LIST_HEAD(mgr-overlays);
 
r = kobject_init_and_add(mgr-kobj, manager_ktype,
pdev-dev.kobj, manager%d, i);
diff --git a/drivers/video/omap2/dss/overlay.c 
b/drivers/video/omap2/dss/overlay.c
index ccd6127..3c94065 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -566,6 +566,7 @@ static int omap_dss_set_manager(struct omap_overlay *ovl,
}
 
ovl-manager = mgr;
+   list_add_tail(ovl-list, mgr-overlays);
ovl-manager_changed = true;
 
/* XXX: When there is an overlay on a DSI manual update display, and
@@ -597,6 +598,7 @@ static int omap_dss_unset_manager(struct omap_overlay *ovl)
}
 
ovl-manager = 

[PATCH 30/65] OMAPDSS: DISPC: Add dispc_mgr_get_vsync_irq()

2011-11-22 Thread Tomi Valkeinen
Add dispc_mgr_get_vsync_irq() which returns the irq number for vsync on
the given channel.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c |   14 ++
 drivers/video/omap2/dss/dss.h   |2 +-
 2 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 5ac00a2..27a2cff 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -438,6 +438,20 @@ static struct omap_dss_device *dispc_mgr_get_device(enum 
omap_channel channel)
return mgr ? mgr-device : NULL;
 }
 
+u32 dispc_mgr_get_vsync_irq(enum omap_channel channel)
+{
+   switch (channel) {
+   case OMAP_DSS_CHANNEL_LCD:
+   return DISPC_IRQ_VSYNC;
+   case OMAP_DSS_CHANNEL_LCD2:
+   return DISPC_IRQ_VSYNC2;
+   case OMAP_DSS_CHANNEL_DIGIT:
+   return DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN;
+   default:
+   BUG();
+   }
+}
+
 bool dispc_mgr_go_busy(enum omap_channel channel)
 {
int bit;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 66fed79..5a6f1db 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -409,9 +409,9 @@ int dispc_ovl_enable(enum omap_plane plane, bool enable);
 void dispc_ovl_set_channel_out(enum omap_plane plane,
enum omap_channel channel);
 
-
 void dispc_mgr_enable_fifohandcheck(enum omap_channel channel, bool enable);
 void dispc_mgr_set_lcd_size(enum omap_channel channel, u16 width, u16 height);
+u32 dispc_mgr_get_vsync_irq(enum omap_channel channel);
 bool dispc_mgr_go_busy(enum omap_channel channel);
 void dispc_mgr_go(enum omap_channel channel);
 bool dispc_mgr_is_enabled(enum omap_channel channel);
-- 
1.7.4.1

--
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 31/65] OMAPDSS: APPLY: use dispc_mgr_get_vsync_irq()

2011-11-22 Thread Tomi Valkeinen
Use dispc_mgr_get_vsync_irq() to get the interrupt numbers for vsync,
instead of hardcoding the values depending on the display type.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   36 
 1 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 6aad0fd..84ac2d4 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -131,13 +131,7 @@ int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
if (mgr_manual_update(mgr))
return 0;
 
-   if (dssdev-type == OMAP_DISPLAY_TYPE_VENC
-   || dssdev-type == OMAP_DISPLAY_TYPE_HDMI) {
-   irq = DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN;
-   } else {
-   irq = (dssdev-manager-id == OMAP_DSS_CHANNEL_LCD) ?
-   DISPC_IRQ_VSYNC : DISPC_IRQ_VSYNC2;
-   }
+   irq = dispc_mgr_get_vsync_irq(mgr-id);
 
mc = dss_cache.manager_cache[mgr-id];
i = 0;
@@ -200,13 +194,7 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
if (ovl_manual_update(ovl))
return 0;
 
-   if (dssdev-type == OMAP_DISPLAY_TYPE_VENC
-   || dssdev-type == OMAP_DISPLAY_TYPE_HDMI) {
-   irq = DISPC_IRQ_EVSYNC_ODD | DISPC_IRQ_EVSYNC_EVEN;
-   } else {
-   irq = (dssdev-manager-id == OMAP_DSS_CHANNEL_LCD) ?
-   DISPC_IRQ_VSYNC : DISPC_IRQ_VSYNC2;
-   }
+   irq = dispc_mgr_get_vsync_irq(ovl-manager-id);
 
oc = dss_cache.overlay_cache[ovl-id];
i = 0;
@@ -421,13 +409,13 @@ static void dss_apply_irq_handler(void *data, u32 mask);
 
 static void dss_register_vsync_isr(void)
 {
+   const int num_mgrs = dss_feat_get_num_mgrs();
u32 mask;
-   int r;
+   int r, i;
 
-   mask = DISPC_IRQ_VSYNC  | DISPC_IRQ_EVSYNC_ODD |
-   DISPC_IRQ_EVSYNC_EVEN;
-   if (dss_has_feature(FEAT_MGR_LCD2))
-   mask |= DISPC_IRQ_VSYNC2;
+   mask = 0;
+   for (i = 0; i  num_mgrs; ++i)
+   mask |= dispc_mgr_get_vsync_irq(i);
 
r = omap_dispc_register_isr(dss_apply_irq_handler, NULL, mask);
WARN_ON(r);
@@ -437,13 +425,13 @@ static void dss_register_vsync_isr(void)
 
 static void dss_unregister_vsync_isr(void)
 {
+   const int num_mgrs = dss_feat_get_num_mgrs();
u32 mask;
-   int r;
+   int r, i;
 
-   mask = DISPC_IRQ_VSYNC | DISPC_IRQ_EVSYNC_ODD |
-   DISPC_IRQ_EVSYNC_EVEN;
-   if (dss_has_feature(FEAT_MGR_LCD2))
-   mask |= DISPC_IRQ_VSYNC2;
+   mask = 0;
+   for (i = 0; i  num_mgrs; ++i)
+   mask |= dispc_mgr_get_vsync_irq(i);
 
r = omap_dispc_unregister_isr(dss_apply_irq_handler, NULL, mask);
WARN_ON(r);
-- 
1.7.4.1

--
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 33/65] OMAPDSS: APPLY: rename overlay_cache_data

2011-11-22 Thread Tomi Valkeinen
overlay_cache_data is not a suitable name for the struct. It is more of
a private data for the overlay.

Rename the struct to ovl_priv_data, and add a function,
get_ovl_priv(ovl), to get a pointer to the data.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   99 +--
 1 files changed, 53 insertions(+), 46 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 1c97069..d07bcc9 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -54,7 +54,7 @@
  * ++
  */
 
-struct overlay_cache_data {
+struct ovl_priv_data {
/* If true, cache changed, but not written to shadow registers. Set
 * in apply(), cleared when registers written. */
bool dirty;
@@ -90,12 +90,17 @@ struct manager_cache_data {
 
 static struct {
spinlock_t lock;
-   struct overlay_cache_data overlay_cache[MAX_DSS_OVERLAYS];
+   struct ovl_priv_data ovl_priv_data_array[MAX_DSS_OVERLAYS];
struct manager_cache_data manager_cache[MAX_DSS_MANAGERS];
 
bool irq_enabled;
 } dss_cache;
 
+static struct ovl_priv_data *get_ovl_priv(struct omap_overlay *ovl)
+{
+   return dss_cache.ovl_priv_data_array[ovl-id];
+}
+
 void dss_apply_init(void)
 {
spin_lock_init(dss_cache.lock);
@@ -177,7 +182,7 @@ int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
 int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
 {
unsigned long timeout = msecs_to_jiffies(500);
-   struct overlay_cache_data *oc;
+   struct ovl_priv_data *op;
struct omap_dss_device *dssdev;
u32 irq;
int r;
@@ -196,15 +201,15 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
 
irq = dispc_mgr_get_vsync_irq(ovl-manager-id);
 
-   oc = dss_cache.overlay_cache[ovl-id];
+   op = get_ovl_priv(ovl);
i = 0;
while (1) {
unsigned long flags;
bool shadow_dirty, dirty;
 
spin_lock_irqsave(dss_cache.lock, flags);
-   dirty = oc-dirty;
-   shadow_dirty = oc-shadow_dirty;
+   dirty = op-dirty;
+   shadow_dirty = op-shadow_dirty;
spin_unlock_irqrestore(dss_cache.lock, flags);
 
if (!dirty  !shadow_dirty) {
@@ -239,17 +244,17 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
 
 static int dss_ovl_write_regs(struct omap_overlay *ovl)
 {
-   struct overlay_cache_data *c;
+   struct ovl_priv_data *op;
struct omap_overlay_info *oi;
bool ilace, replication;
int r;
 
DSSDBGF(%d, ovl-id);
 
-   c = dss_cache.overlay_cache[ovl-id];
-   oi = c-info;
+   op = get_ovl_priv(ovl);
+   oi = op-info;
 
-   if (!c-enabled) {
+   if (!op-enabled) {
dispc_ovl_enable(ovl-id, 0);
return 0;
}
@@ -258,7 +263,7 @@ static int dss_ovl_write_regs(struct omap_overlay *ovl)
 
ilace = ovl-manager-device-type == OMAP_DISPLAY_TYPE_VENC;
 
-   dispc_ovl_set_channel_out(ovl-id, c-channel);
+   dispc_ovl_set_channel_out(ovl-id, op-channel);
 
r = dispc_ovl_setup(ovl-id, oi, ilace, replication);
if (r) {
@@ -268,7 +273,7 @@ static int dss_ovl_write_regs(struct omap_overlay *ovl)
return r;
}
 
-   dispc_ovl_set_fifo_threshold(ovl-id, c-fifo_low, c-fifo_high);
+   dispc_ovl_set_fifo_threshold(ovl-id, op-fifo_low, op-fifo_high);
 
dispc_ovl_enable(ovl-id, 1);
 
@@ -294,7 +299,7 @@ static int dss_write_regs(void)
 {
struct omap_overlay *ovl;
struct omap_overlay_manager *mgr;
-   struct overlay_cache_data *oc;
+   struct ovl_priv_data *op;
struct manager_cache_data *mc;
const int num_ovls = dss_feat_get_num_ovls();
const int num_mgrs = dss_feat_get_num_mgrs();
@@ -315,16 +320,16 @@ static int dss_write_regs(void)
/* Commit overlay settings */
for (i = 0; i  num_ovls; ++i) {
ovl = omap_dss_get_overlay(i);
-   oc = dss_cache.overlay_cache[i];
-   mc = dss_cache.manager_cache[oc-channel];
+   op = get_ovl_priv(ovl);
+   mc = dss_cache.manager_cache[op-channel];
 
-   if (!oc-dirty)
+   if (!op-dirty)
continue;
 
if (mc-manual_update  !mc-do_manual_update)
continue;
 
-   if (mgr_busy[oc-channel]) {
+   if (mgr_busy[op-channel]) {
busy = true;
continue;
}
@@ -333,9 +338,9 @@ static int dss_write_regs(void)
if (r)
DSSERR(dss_ovl_write_regs %d failed\n, i);
 
-   oc-dirty = false;
-   oc-shadow_dirty = true;
-   mgr_go[oc-channel] = true;
+   op-dirty = 

[PATCH 34/65] OMAPDSS: APPLY: rename manager_cache_data

2011-11-22 Thread Tomi Valkeinen
manager_cache_data is not a suitable name for the struct. It is more of
a private data for the manager.

Rename the struct to mgr_priv_data, and add a function,
get_mgr_priv(mgr), to get a pointer to the data.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   72 +-
 1 files changed, 40 insertions(+), 32 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index d07bcc9..23c723a 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -73,7 +73,7 @@ struct ovl_priv_data {
u32 fifo_high;
 };
 
-struct manager_cache_data {
+struct mgr_priv_data {
/* If true, cache changed, but not written to shadow registers. Set
 * in apply(), cleared when registers written. */
bool dirty;
@@ -91,7 +91,7 @@ struct manager_cache_data {
 static struct {
spinlock_t lock;
struct ovl_priv_data ovl_priv_data_array[MAX_DSS_OVERLAYS];
-   struct manager_cache_data manager_cache[MAX_DSS_MANAGERS];
+   struct mgr_priv_data mgr_priv_data_array[MAX_DSS_MANAGERS];
 
bool irq_enabled;
 } dss_cache;
@@ -101,6 +101,11 @@ static struct ovl_priv_data *get_ovl_priv(struct 
omap_overlay *ovl)
return dss_cache.ovl_priv_data_array[ovl-id];
 }
 
+static struct mgr_priv_data *get_mgr_priv(struct omap_overlay_manager *mgr)
+{
+   return dss_cache.mgr_priv_data_array[mgr-id];
+}
+
 void dss_apply_init(void)
 {
spin_lock_init(dss_cache.lock);
@@ -124,7 +129,7 @@ static int overlay_enabled(struct omap_overlay *ovl)
 int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
 {
unsigned long timeout = msecs_to_jiffies(500);
-   struct manager_cache_data *mc;
+   struct mgr_priv_data *mp;
u32 irq;
int r;
int i;
@@ -138,15 +143,15 @@ int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
 
irq = dispc_mgr_get_vsync_irq(mgr-id);
 
-   mc = dss_cache.manager_cache[mgr-id];
+   mp = get_mgr_priv(mgr);
i = 0;
while (1) {
unsigned long flags;
bool shadow_dirty, dirty;
 
spin_lock_irqsave(dss_cache.lock, flags);
-   dirty = mc-dirty;
-   shadow_dirty = mc-shadow_dirty;
+   dirty = mp-dirty;
+   shadow_dirty = mp-shadow_dirty;
spin_unlock_irqrestore(dss_cache.lock, flags);
 
if (!dirty  !shadow_dirty) {
@@ -282,11 +287,13 @@ static int dss_ovl_write_regs(struct omap_overlay *ovl)
 
 static void dss_mgr_write_regs(struct omap_overlay_manager *mgr)
 {
+   struct mgr_priv_data *mp;
struct omap_overlay_manager_info *mi;
 
DSSDBGF(%d, mgr-id);
 
-   mi = dss_cache.manager_cache[mgr-id].info;
+   mp = get_mgr_priv(mgr);
+   mi = mp-info;
 
dispc_mgr_setup(mgr-id, mi);
 }
@@ -300,7 +307,7 @@ static int dss_write_regs(void)
struct omap_overlay *ovl;
struct omap_overlay_manager *mgr;
struct ovl_priv_data *op;
-   struct manager_cache_data *mc;
+   struct mgr_priv_data *mp;
const int num_ovls = dss_feat_get_num_ovls();
const int num_mgrs = dss_feat_get_num_mgrs();
int i;
@@ -321,12 +328,13 @@ static int dss_write_regs(void)
for (i = 0; i  num_ovls; ++i) {
ovl = omap_dss_get_overlay(i);
op = get_ovl_priv(ovl);
-   mc = dss_cache.manager_cache[op-channel];
 
if (!op-dirty)
continue;
 
-   if (mc-manual_update  !mc-do_manual_update)
+   mp = get_mgr_priv(ovl-manager);
+
+   if (mp-manual_update  !mp-do_manual_update)
continue;
 
if (mgr_busy[op-channel]) {
@@ -346,12 +354,12 @@ static int dss_write_regs(void)
/* Commit manager settings */
for (i = 0; i  num_mgrs; ++i) {
mgr = omap_dss_get_overlay_manager(i);
-   mc = dss_cache.manager_cache[i];
+   mp = get_mgr_priv(mgr);
 
-   if (!mc-dirty)
+   if (!mp-dirty)
continue;
 
-   if (mc-manual_update  !mc-do_manual_update)
+   if (mp-manual_update  !mp-do_manual_update)
continue;
 
if (mgr_busy[i]) {
@@ -360,14 +368,15 @@ static int dss_write_regs(void)
}
 
dss_mgr_write_regs(mgr);
-   mc-dirty = false;
-   mc-shadow_dirty = true;
+   mp-dirty = false;
+   mp-shadow_dirty = true;
mgr_go[i] = true;
}
 
/* set GO */
for (i = 0; i  num_mgrs; ++i) {
-   mc = dss_cache.manager_cache[i];
+   mgr = omap_dss_get_overlay_manager(i);
+   mp = get_mgr_priv(mgr);
 
if (!mgr_go[i])
continue;
@@ 

[PATCH 35/65] OMAPDSS: APPLY: move spinlock outside the struct

2011-11-22 Thread Tomi Valkeinen
dss_cache struct contains a spinlock used to protect the struct. A more
logical place for the spinlock is outside the struct that it is
protecting. So move it there.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   22 --
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 23c723a..17639c0 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -89,13 +89,15 @@ struct mgr_priv_data {
 };
 
 static struct {
-   spinlock_t lock;
struct ovl_priv_data ovl_priv_data_array[MAX_DSS_OVERLAYS];
struct mgr_priv_data mgr_priv_data_array[MAX_DSS_MANAGERS];
 
bool irq_enabled;
 } dss_cache;
 
+/* protects dss_cache */
+static spinlock_t data_lock;
+
 static struct ovl_priv_data *get_ovl_priv(struct omap_overlay *ovl)
 {
return dss_cache.ovl_priv_data_array[ovl-id];
@@ -108,7 +110,7 @@ static struct mgr_priv_data *get_mgr_priv(struct 
omap_overlay_manager *mgr)
 
 void dss_apply_init(void)
 {
-   spin_lock_init(dss_cache.lock);
+   spin_lock_init(data_lock);
 }
 
 static bool ovl_manual_update(struct omap_overlay *ovl)
@@ -149,10 +151,10 @@ int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
unsigned long flags;
bool shadow_dirty, dirty;
 
-   spin_lock_irqsave(dss_cache.lock, flags);
+   spin_lock_irqsave(data_lock, flags);
dirty = mp-dirty;
shadow_dirty = mp-shadow_dirty;
-   spin_unlock_irqrestore(dss_cache.lock, flags);
+   spin_unlock_irqrestore(data_lock, flags);
 
if (!dirty  !shadow_dirty) {
r = 0;
@@ -212,10 +214,10 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
unsigned long flags;
bool shadow_dirty, dirty;
 
-   spin_lock_irqsave(dss_cache.lock, flags);
+   spin_lock_irqsave(data_lock, flags);
dirty = op-dirty;
shadow_dirty = op-shadow_dirty;
-   spin_unlock_irqrestore(dss_cache.lock, flags);
+   spin_unlock_irqrestore(data_lock, flags);
 
if (!dirty  !shadow_dirty) {
r = 0;
@@ -464,7 +466,7 @@ static void dss_apply_irq_handler(void *data, u32 mask)
for (i = 0; i  num_mgrs; i++)
mgr_busy[i] = dispc_mgr_go_busy(i);
 
-   spin_lock(dss_cache.lock);
+   spin_lock(data_lock);
 
for (i = 0; i  num_ovls; ++i) {
ovl = omap_dss_get_overlay(i);
@@ -498,7 +500,7 @@ static void dss_apply_irq_handler(void *data, u32 mask)
dss_unregister_vsync_isr();
 
 end:
-   spin_unlock(dss_cache.lock);
+   spin_unlock(data_lock);
 }
 
 static int omap_dss_mgr_apply_ovl(struct omap_overlay *ovl)
@@ -620,7 +622,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
if (r)
return r;
 
-   spin_lock_irqsave(dss_cache.lock, flags);
+   spin_lock_irqsave(data_lock, flags);
 
/* Configure overlays */
list_for_each_entry(ovl, mgr-overlays, list)
@@ -641,7 +643,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
dss_write_regs();
}
 
-   spin_unlock_irqrestore(dss_cache.lock, flags);
+   spin_unlock_irqrestore(data_lock, flags);
 
dispc_runtime_put();
 
-- 
1.7.4.1

--
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 36/65] OMAPDSS: APPLY: rename dss_cache to dss_data

2011-11-22 Thread Tomi Valkeinen
dss_cache struct contains private data used to manage dispc. cache is
not a good word for it, so rename it to dss_data.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 17639c0..46d6a5c 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -38,7 +38,7 @@
  *apply()
  *  v
  * ++
- * | dss_cache  |
+ * |   info |
  * ++
  *  v
  *  write_regs()
@@ -93,19 +93,19 @@ static struct {
struct mgr_priv_data mgr_priv_data_array[MAX_DSS_MANAGERS];
 
bool irq_enabled;
-} dss_cache;
+} dss_data;
 
-/* protects dss_cache */
+/* protects dss_data */
 static spinlock_t data_lock;
 
 static struct ovl_priv_data *get_ovl_priv(struct omap_overlay *ovl)
 {
-   return dss_cache.ovl_priv_data_array[ovl-id];
+   return dss_data.ovl_priv_data_array[ovl-id];
 }
 
 static struct mgr_priv_data *get_mgr_priv(struct omap_overlay_manager *mgr)
 {
-   return dss_cache.mgr_priv_data_array[mgr-id];
+   return dss_data.mgr_priv_data_array[mgr-id];
 }
 
 void dss_apply_init(void)
@@ -433,7 +433,7 @@ static void dss_register_vsync_isr(void)
r = omap_dispc_register_isr(dss_apply_irq_handler, NULL, mask);
WARN_ON(r);
 
-   dss_cache.irq_enabled = true;
+   dss_data.irq_enabled = true;
 }
 
 static void dss_unregister_vsync_isr(void)
@@ -449,7 +449,7 @@ static void dss_unregister_vsync_isr(void)
r = omap_dispc_unregister_isr(dss_apply_irq_handler, NULL, mask);
WARN_ON(r);
 
-   dss_cache.irq_enabled = false;
+   dss_data.irq_enabled = false;
 }
 
 static void dss_apply_irq_handler(void *data, u32 mask)
@@ -637,7 +637,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 
r = 0;
if (mgr-enabled  !mgr_manual_update(mgr)) {
-   if (!dss_cache.irq_enabled)
+   if (!dss_data.irq_enabled)
dss_register_vsync_isr();
 
dss_write_regs();
-- 
1.7.4.1

--
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 32/65] OMAPDSS: APPLY: configure_* funcs take ovl/manager as args

2011-11-22 Thread Tomi Valkeinen
Make configure_overlay() and configure_manager() take overlay/manager
pointer as an argument, instead of the ovl/mgr id. This will be useful
with the future patches.

Also rename the functions to be a bit more informative:
dss_ovl_write_regs, dss_mgr_write_regs, dss_write_regs.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   54 +++---
 1 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 84ac2d4..1c97069 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -41,7 +41,7 @@
  * | dss_cache  |
  * ++
  *  v
- *  configure()
+ *  write_regs()
  *  v
  * ++
  * |  shadow registers  |
@@ -237,65 +237,63 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
return r;
 }
 
-static int configure_overlay(enum omap_plane plane)
+static int dss_ovl_write_regs(struct omap_overlay *ovl)
 {
-   struct omap_overlay *ovl;
struct overlay_cache_data *c;
struct omap_overlay_info *oi;
bool ilace, replication;
int r;
 
-   DSSDBGF(%d, plane);
+   DSSDBGF(%d, ovl-id);
 
-   c = dss_cache.overlay_cache[plane];
+   c = dss_cache.overlay_cache[ovl-id];
oi = c-info;
 
if (!c-enabled) {
-   dispc_ovl_enable(plane, 0);
+   dispc_ovl_enable(ovl-id, 0);
return 0;
}
 
-   ovl = omap_dss_get_overlay(plane);
-
replication = dss_use_replication(ovl-manager-device, oi-color_mode);
 
ilace = ovl-manager-device-type == OMAP_DISPLAY_TYPE_VENC;
 
-   dispc_ovl_set_channel_out(plane, c-channel);
+   dispc_ovl_set_channel_out(ovl-id, c-channel);
 
-   r = dispc_ovl_setup(plane, oi, ilace, replication);
+   r = dispc_ovl_setup(ovl-id, oi, ilace, replication);
if (r) {
/* this shouldn't happen */
-   DSSERR(dispc_ovl_setup failed for ovl %d\n, plane);
-   dispc_ovl_enable(plane, 0);
+   DSSERR(dispc_ovl_setup failed for ovl %d\n, ovl-id);
+   dispc_ovl_enable(ovl-id, 0);
return r;
}
 
-   dispc_ovl_set_fifo_threshold(plane, c-fifo_low, c-fifo_high);
+   dispc_ovl_set_fifo_threshold(ovl-id, c-fifo_low, c-fifo_high);
 
-   dispc_ovl_enable(plane, 1);
+   dispc_ovl_enable(ovl-id, 1);
 
return 0;
 }
 
-static void configure_manager(enum omap_channel channel)
+static void dss_mgr_write_regs(struct omap_overlay_manager *mgr)
 {
struct omap_overlay_manager_info *mi;
 
-   DSSDBGF(%d, channel);
+   DSSDBGF(%d, mgr-id);
 
-   /* picking info from the cache */
-   mi = dss_cache.manager_cache[channel].info;
+   mi = dss_cache.manager_cache[mgr-id].info;
 
-   dispc_mgr_setup(channel, mi);
+   dispc_mgr_setup(mgr-id, mi);
 }
 
-/* configure_dispc() tries to write values from cache to shadow registers.
+/* dss_write_regs() tries to write values from cache to shadow registers.
  * It writes only to those managers/overlays that are not busy.
  * returns 0 if everything could be written to shadow registers.
  * returns 1 if not everything could be written to shadow registers. */
-static int configure_dispc(void)
+static int dss_write_regs(void)
 {
+   struct omap_overlay *ovl;
+   struct omap_overlay_manager *mgr;
struct overlay_cache_data *oc;
struct manager_cache_data *mc;
const int num_ovls = dss_feat_get_num_ovls();
@@ -316,6 +314,7 @@ static int configure_dispc(void)
 
/* Commit overlay settings */
for (i = 0; i  num_ovls; ++i) {
+   ovl = omap_dss_get_overlay(i);
oc = dss_cache.overlay_cache[i];
mc = dss_cache.manager_cache[oc-channel];
 
@@ -330,9 +329,9 @@ static int configure_dispc(void)
continue;
}
 
-   r = configure_overlay(i);
+   r = dss_ovl_write_regs(ovl);
if (r)
-   DSSERR(configure_overlay %d failed\n, i);
+   DSSERR(dss_ovl_write_regs %d failed\n, i);
 
oc-dirty = false;
oc-shadow_dirty = true;
@@ -341,6 +340,7 @@ static int configure_dispc(void)
 
/* Commit manager settings */
for (i = 0; i  num_mgrs; ++i) {
+   mgr = omap_dss_get_overlay_manager(i);
mc = dss_cache.manager_cache[i];
 
if (!mc-dirty)
@@ -354,7 +354,7 @@ static int configure_dispc(void)
continue;
}
 
-   configure_manager(i);
+   dss_mgr_write_regs(mgr);
mc-dirty = false;
mc-shadow_dirty = true;
mgr_go[i] = true;
@@ -391,7 +391,7 @@ void dss_start_update(struct omap_overlay_manager *mgr)

[PATCH 29/65] OMAPDSS: APPLY: separate vsync isr register/unregister

2011-11-22 Thread Tomi Valkeinen
Create separate functions for the vsync isr register/unregister code for
cleaner code.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   61 +++---
 1 files changed, 37 insertions(+), 24 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index cca5732..6aad0fd 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -417,6 +417,40 @@ void dss_start_update(struct omap_overlay_manager *mgr)
dispc_mgr_enable(mgr-id, true);
 }
 
+static void dss_apply_irq_handler(void *data, u32 mask);
+
+static void dss_register_vsync_isr(void)
+{
+   u32 mask;
+   int r;
+
+   mask = DISPC_IRQ_VSYNC  | DISPC_IRQ_EVSYNC_ODD |
+   DISPC_IRQ_EVSYNC_EVEN;
+   if (dss_has_feature(FEAT_MGR_LCD2))
+   mask |= DISPC_IRQ_VSYNC2;
+
+   r = omap_dispc_register_isr(dss_apply_irq_handler, NULL, mask);
+   WARN_ON(r);
+
+   dss_cache.irq_enabled = true;
+}
+
+static void dss_unregister_vsync_isr(void)
+{
+   u32 mask;
+   int r;
+
+   mask = DISPC_IRQ_VSYNC | DISPC_IRQ_EVSYNC_ODD |
+   DISPC_IRQ_EVSYNC_EVEN;
+   if (dss_has_feature(FEAT_MGR_LCD2))
+   mask |= DISPC_IRQ_VSYNC2;
+
+   r = omap_dispc_unregister_isr(dss_apply_irq_handler, NULL, mask);
+   WARN_ON(r);
+
+   dss_cache.irq_enabled = false;
+}
+
 static void dss_apply_irq_handler(void *data, u32 mask)
 {
struct manager_cache_data *mc;
@@ -425,7 +459,6 @@ static void dss_apply_irq_handler(void *data, u32 mask)
const int num_mgrs = dss_feat_get_num_mgrs();
int i, r;
bool mgr_busy[MAX_DSS_MANAGERS];
-   u32 irq_mask;
 
for (i = 0; i  num_mgrs; i++)
mgr_busy[i] = dispc_mgr_go_busy(i);
@@ -459,13 +492,7 @@ static void dss_apply_irq_handler(void *data, u32 mask)
goto end;
}
 
-   irq_mask = DISPC_IRQ_VSYNC | DISPC_IRQ_EVSYNC_ODD |
-   DISPC_IRQ_EVSYNC_EVEN;
-   if (dss_has_feature(FEAT_MGR_LCD2))
-   irq_mask |= DISPC_IRQ_VSYNC2;
-
-   omap_dispc_unregister_isr(dss_apply_irq_handler, NULL, irq_mask);
-   dss_cache.irq_enabled = false;
+   dss_unregister_vsync_isr();
 
 end:
spin_unlock(dss_cache.lock);
@@ -605,22 +632,8 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 
r = 0;
if (mgr-enabled  !mgr_manual_update(mgr)) {
-   if (!dss_cache.irq_enabled) {
-   u32 mask;
-
-   mask = DISPC_IRQ_VSYNC  | DISPC_IRQ_EVSYNC_ODD |
-   DISPC_IRQ_EVSYNC_EVEN;
-   if (dss_has_feature(FEAT_MGR_LCD2))
-   mask |= DISPC_IRQ_VSYNC2;
-
-   r = omap_dispc_register_isr(dss_apply_irq_handler,
-   NULL, mask);
-
-   if (r)
-   DSSERR(failed to register apply isr\n);
-
-   dss_cache.irq_enabled = true;
-   }
+   if (!dss_cache.irq_enabled)
+   dss_register_vsync_isr();
 
configure_dispc();
}
-- 
1.7.4.1

--
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 25/65] OMAPDSS: APPLY: cleanup dss_start_update

2011-11-22 Thread Tomi Valkeinen
dss_start_update() has a loop, of which sole purpose is to find the
manager used for this update. The whole loop is extra, as we already
know the manager.

Remove the loop.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   10 ++
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index cf68c9e..cfcf816 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -399,7 +399,6 @@ void dss_start_update(struct omap_overlay_manager *mgr)
struct manager_cache_data *mc;
struct overlay_cache_data *oc;
const int num_ovls = dss_feat_get_num_ovls();
-   const int num_mgrs = dss_feat_get_num_mgrs();
int i;
 
mc = dss_cache.manager_cache[mgr-id];
@@ -416,13 +415,8 @@ void dss_start_update(struct omap_overlay_manager *mgr)
oc-shadow_dirty = false;
}
 
-   for (i = 0; i  num_mgrs; ++i) {
-   mc = dss_cache.manager_cache[i];
-   if (mgr-id != i)
-   continue;
-
-   mc-shadow_dirty = false;
-   }
+   mc = dss_cache.manager_cache[mgr-id];
+   mc-shadow_dirty = false;
 
dispc_mgr_enable(mgr-id, true);
 }
-- 
1.7.4.1

--
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 38/65] OMAPDSS: APPLY: move mgr funcs to apply.c

2011-11-22 Thread Tomi Valkeinen
apply.c will handle the management of dispc in the future patches. This
patch moves overlay manager related functions to apply.c so that they
will have access to the private data and functions of apply.c.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c   |   83 +
 drivers/video/omap2/dss/dss.h |9 
 drivers/video/omap2/dss/manager.c |   91 ++---
 3 files changed, 97 insertions(+), 86 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index b120f95..543a10b 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -662,6 +662,89 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
mgr-enabled = false;
 }
 
+int dss_mgr_set_info(struct omap_overlay_manager *mgr,
+   struct omap_overlay_manager_info *info)
+{
+   int r;
+   struct omap_overlay_manager_info old_info;
+
+   old_info = mgr-info;
+   mgr-info = *info;
+
+   r = dss_check_manager(mgr);
+   if (r) {
+   mgr-info = old_info;
+   return r;
+   }
+
+   mgr-info_dirty = true;
+
+   return 0;
+}
+
+void dss_mgr_get_info(struct omap_overlay_manager *mgr,
+   struct omap_overlay_manager_info *info)
+{
+   *info = mgr-info;
+}
+
+int dss_mgr_set_device(struct omap_overlay_manager *mgr,
+   struct omap_dss_device *dssdev)
+{
+   int r;
+   struct omap_overlay *ovl;
+
+   if (dssdev-manager) {
+   DSSERR(display '%s' already has a manager '%s'\n,
+  dssdev-name, dssdev-manager-name);
+   return -EINVAL;
+   }
+
+   if ((mgr-supported_displays  dssdev-type) == 0) {
+   DSSERR(display '%s' does not support manager '%s'\n,
+  dssdev-name, mgr-name);
+   return -EINVAL;
+   }
+
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   if (!ovl-info.enabled)
+   continue;
+
+   r = dss_check_overlay(ovl, dssdev);
+   if (r)
+   return r;
+   }
+
+   dssdev-manager = mgr;
+   mgr-device = dssdev;
+   mgr-device_changed = true;
+
+   return 0;
+}
+
+int dss_mgr_unset_device(struct omap_overlay_manager *mgr)
+{
+   if (!mgr-device) {
+   DSSERR(failed to unset display, display not set.\n);
+   return -EINVAL;
+   }
+
+   /*
+* Don't allow currently enabled displays to have the overlay manager
+* pulled out from underneath them
+*/
+   if (mgr-device-state != OMAP_DSS_DISPLAY_DISABLED)
+   return -EINVAL;
+
+   mgr-device-manager = NULL;
+   mgr-device = NULL;
+   mgr-device_changed = true;
+
+   return 0;
+}
+
+
+
 int dss_ovl_set_info(struct omap_overlay *ovl,
struct omap_overlay_info *info)
 {
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index ee155a1..afe9713 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -169,8 +169,16 @@ int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr);
 int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl);
 void dss_start_update(struct omap_overlay_manager *mgr);
 int omap_dss_mgr_apply(struct omap_overlay_manager *mgr);
+
 void dss_mgr_enable(struct omap_overlay_manager *mgr);
 void dss_mgr_disable(struct omap_overlay_manager *mgr);
+int dss_mgr_set_info(struct omap_overlay_manager *mgr,
+   struct omap_overlay_manager_info *info);
+void dss_mgr_get_info(struct omap_overlay_manager *mgr,
+   struct omap_overlay_manager_info *info);
+int dss_mgr_set_device(struct omap_overlay_manager *mgr,
+   struct omap_dss_device *dssdev);
+int dss_mgr_unset_device(struct omap_overlay_manager *mgr);
 
 int dss_ovl_set_info(struct omap_overlay *ovl,
struct omap_overlay_info *info);
@@ -198,6 +206,7 @@ void default_get_overlay_fifo_thresholds(enum omap_plane 
plane,
 /* manager */
 int dss_init_overlay_managers(struct platform_device *pdev);
 void dss_uninit_overlay_managers(struct platform_device *pdev);
+int dss_check_manager(struct omap_overlay_manager *mgr);
 
 /* overlay */
 void dss_init_overlays(struct platform_device *pdev);
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index 62bcc38..ab0b61b 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -467,61 +467,6 @@ static struct kobj_type manager_ktype = {
.default_attrs = manager_sysfs_attrs,
 };
 
-static int omap_dss_set_device(struct omap_overlay_manager *mgr,
-   struct omap_dss_device *dssdev)
-{
-   int r;
-   struct omap_overlay *ovl;
-
-   if (dssdev-manager) {
-   DSSERR(display '%s' already has a manager '%s'\n,
-  

[PATCH 37/65] OMAPDSS: APPLY: move ovl funcs to apply.c

2011-11-22 Thread Tomi Valkeinen
apply.c will handle the management of dispc in the future patches. This
patch moves overlay related functions to apply.c so that they will have
access to the private data and functions of apply.c.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c   |   84 
 drivers/video/omap2/dss/dss.h |8 +++
 drivers/video/omap2/dss/overlay.c |   96 ++--
 3 files changed, 98 insertions(+), 90 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 46d6a5c..b120f95 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -662,3 +662,87 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
mgr-enabled = false;
 }
 
+int dss_ovl_set_info(struct omap_overlay *ovl,
+   struct omap_overlay_info *info)
+{
+   int r;
+   struct omap_overlay_info old_info;
+
+   old_info = ovl-info;
+   ovl-info = *info;
+
+   if (ovl-manager) {
+   r = dss_check_overlay(ovl, ovl-manager-device);
+   if (r) {
+   ovl-info = old_info;
+   return r;
+   }
+   }
+
+   ovl-info_dirty = true;
+
+   return 0;
+}
+
+void dss_ovl_get_info(struct omap_overlay *ovl,
+   struct omap_overlay_info *info)
+{
+   *info = ovl-info;
+}
+
+int dss_ovl_set_manager(struct omap_overlay *ovl,
+   struct omap_overlay_manager *mgr)
+{
+   if (!mgr)
+   return -EINVAL;
+
+   if (ovl-manager) {
+   DSSERR(overlay '%s' already has a manager '%s'\n,
+   ovl-name, ovl-manager-name);
+   return -EINVAL;
+   }
+
+   if (ovl-info.enabled) {
+   DSSERR(overlay has to be disabled to change the manager\n);
+   return -EINVAL;
+   }
+
+   ovl-manager = mgr;
+   list_add_tail(ovl-list, mgr-overlays);
+   ovl-manager_changed = true;
+
+   /* XXX: When there is an overlay on a DSI manual update display, and
+* the overlay is first disabled, then moved to tv, and enabled, we
+* seem to get SYNC_LOST_DIGIT error.
+*
+* Waiting doesn't seem to help, but updating the manual update display
+* after disabling the overlay seems to fix this. This hints that the
+* overlay is perhaps somehow tied to the LCD output until the output
+* is updated.
+*
+* Userspace workaround for this is to update the LCD after disabling
+* the overlay, but before moving the overlay to TV.
+*/
+
+   return 0;
+}
+
+int dss_ovl_unset_manager(struct omap_overlay *ovl)
+{
+   if (!ovl-manager) {
+   DSSERR(failed to detach overlay: manager not set\n);
+   return -EINVAL;
+   }
+
+   if (ovl-info.enabled) {
+   DSSERR(overlay has to be disabled to unset the manager\n);
+   return -EINVAL;
+   }
+
+   ovl-manager = NULL;
+   list_del(ovl-list);
+   ovl-manager_changed = true;
+
+   return 0;
+}
+
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 5a6f1db..ee155a1 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -172,6 +172,14 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr);
 void dss_mgr_enable(struct omap_overlay_manager *mgr);
 void dss_mgr_disable(struct omap_overlay_manager *mgr);
 
+int dss_ovl_set_info(struct omap_overlay *ovl,
+   struct omap_overlay_info *info);
+void dss_ovl_get_info(struct omap_overlay *ovl,
+   struct omap_overlay_info *info);
+int dss_ovl_set_manager(struct omap_overlay *ovl,
+   struct omap_overlay_manager *mgr);
+int dss_ovl_unset_manager(struct omap_overlay *ovl);
+
 /* display */
 int dss_suspend_all_devices(void);
 int dss_resume_all_devices(void);
diff --git a/drivers/video/omap2/dss/overlay.c 
b/drivers/video/omap2/dss/overlay.c
index 3c94065..00c01a3 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -520,90 +520,6 @@ int dss_check_overlay(struct omap_overlay *ovl, struct 
omap_dss_device *dssdev)
return 0;
 }
 
-static int dss_ovl_set_overlay_info(struct omap_overlay *ovl,
-   struct omap_overlay_info *info)
-{
-   int r;
-   struct omap_overlay_info old_info;
-
-   old_info = ovl-info;
-   ovl-info = *info;
-
-   if (ovl-manager) {
-   r = dss_check_overlay(ovl, ovl-manager-device);
-   if (r) {
-   ovl-info = old_info;
-   return r;
-   }
-   }
-
-   ovl-info_dirty = true;
-
-   return 0;
-}
-
-static void dss_ovl_get_overlay_info(struct omap_overlay *ovl,
-   struct omap_overlay_info *info)
-{
-   *info = ovl-info;
-}
-
-static int omap_dss_set_manager(struct 

[PATCH 26/65] OMAPDSS: store overlays in an array

2011-11-22 Thread Tomi Valkeinen
Overlays are stored in a linked list. There's no need for this list, as
an array would do just as fine.

This patch changes the code to use an array for overlays.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/overlay.c |   49 +
 1 files changed, 17 insertions(+), 32 deletions(-)

diff --git a/drivers/video/omap2/dss/overlay.c 
b/drivers/video/omap2/dss/overlay.c
index 0ab14fa..ccd6127 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -38,7 +38,7 @@
 #include dss_features.h
 
 static int num_overlays;
-static struct list_head overlay_list;
+static struct omap_overlay *overlays;
 
 static ssize_t overlay_name_show(struct omap_overlay *ovl, char *buf)
 {
@@ -610,24 +610,13 @@ EXPORT_SYMBOL(omap_dss_get_num_overlays);
 
 struct omap_overlay *omap_dss_get_overlay(int num)
 {
-   int i = 0;
-   struct omap_overlay *ovl;
+   if (num = num_overlays)
+   return NULL;
 
-   list_for_each_entry(ovl, overlay_list, list) {
-   if (i++ == num)
-   return ovl;
-   }
-
-   return NULL;
+   return overlays[num];
 }
 EXPORT_SYMBOL(omap_dss_get_overlay);
 
-static void omap_dss_add_overlay(struct omap_overlay *overlay)
-{
-   ++num_overlays;
-   list_add_tail(overlay-list, overlay_list);
-}
-
 static struct omap_overlay *dispc_overlays[MAX_DSS_OVERLAYS];
 
 void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr)
@@ -640,15 +629,15 @@ void dss_init_overlays(struct platform_device *pdev)
 {
int i, r;
 
-   INIT_LIST_HEAD(overlay_list);
+   num_overlays = dss_feat_get_num_ovls();
 
-   num_overlays = 0;
+   overlays = kzalloc(sizeof(struct omap_overlay) * num_overlays,
+   GFP_KERNEL);
 
-   for (i = 0; i  dss_feat_get_num_ovls(); ++i) {
-   struct omap_overlay *ovl;
-   ovl = kzalloc(sizeof(*ovl), GFP_KERNEL);
+   BUG_ON(overlays == NULL);
 
-   BUG_ON(ovl == NULL);
+   for (i = 0; i  num_overlays; ++i) {
+   struct omap_overlay *ovl = overlays[i];
 
switch (i) {
case 0:
@@ -690,15 +679,11 @@ void dss_init_overlays(struct platform_device *pdev)
ovl-supported_modes =
dss_feat_get_supported_color_modes(ovl-id);
 
-   omap_dss_add_overlay(ovl);
-
r = kobject_init_and_add(ovl-kobj, overlay_ktype,
pdev-dev.kobj, overlay%d, i);
 
-   if (r) {
+   if (r)
DSSERR(failed to create sysfs file\n);
-   continue;
-   }
 
dispc_overlays[i] = ovl;
}
@@ -765,17 +750,17 @@ void dss_recheck_connections(struct omap_dss_device 
*dssdev, bool force)
 
 void dss_uninit_overlays(struct platform_device *pdev)
 {
-   struct omap_overlay *ovl;
+   int i;
+
+   for (i = 0; i  num_overlays; ++i) {
+   struct omap_overlay *ovl = overlays[i];
 
-   while (!list_empty(overlay_list)) {
-   ovl = list_first_entry(overlay_list,
-   struct omap_overlay, list);
-   list_del(ovl-list);
kobject_del(ovl-kobj);
kobject_put(ovl-kobj);
-   kfree(ovl);
}
 
+   kfree(overlays);
+   overlays = NULL;
num_overlays = 0;
 }
 
-- 
1.7.4.1

--
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 43/65] OMAPDSS: APPLY: move mgr-enabled to mgr_priv_data

2011-11-22 Thread Tomi Valkeinen
struct omap_overlay_manager contains enabled-field, used to track if
the manager is enabled or not. This field should be internal to apply.c.

This patch moves the field to mgr_priv_data, and applies the necessary
locking when accessing the field.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   26 +++---
 include/video/omapdss.h |2 --
 2 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 66f4c56..c38bd76 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -86,6 +86,9 @@ struct mgr_priv_data {
 
bool manual_update;
bool do_manual_update;
+
+   /* If true, a display is enabled using this manager */
+   bool enabled;
 };
 
 static struct {
@@ -609,6 +612,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
int r;
unsigned long flags;
struct omap_overlay *ovl;
+   struct mgr_priv_data *mp = get_mgr_priv(mgr);
 
DSSDBG(omap_dss_mgr_apply(%s)\n, mgr-name);
 
@@ -630,7 +634,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
omap_dss_mgr_apply_ovl_fifos(ovl);
 
r = 0;
-   if (mgr-enabled  !mgr_manual_update(mgr)) {
+   if (mp-enabled  !mgr_manual_update(mgr)) {
if (!dss_data.irq_enabled)
dss_register_vsync_isr();
 
@@ -646,22 +650,38 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 
 void dss_mgr_enable(struct omap_overlay_manager *mgr)
 {
+   struct mgr_priv_data *mp = get_mgr_priv(mgr);
+   unsigned long flags;
+
mutex_lock(apply_lock);
 
if (!mgr_manual_update(mgr))
dispc_mgr_enable(mgr-id, true);
-   mgr-enabled = true;
+
+   spin_lock_irqsave(data_lock, flags);
+
+   mp-enabled = true;
+
+   spin_unlock_irqrestore(data_lock, flags);
 
mutex_unlock(apply_lock);
 }
 
 void dss_mgr_disable(struct omap_overlay_manager *mgr)
 {
+   struct mgr_priv_data *mp = get_mgr_priv(mgr);
+   unsigned long flags;
+
mutex_lock(apply_lock);
 
if (!mgr_manual_update(mgr))
dispc_mgr_enable(mgr-id, false);
-   mgr-enabled = false;
+
+   spin_lock_irqsave(data_lock, flags);
+
+   mp-enabled = false;
+
+   spin_unlock_irqrestore(data_lock, flags);
 
mutex_unlock(apply_lock);
 }
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 25ef771..6e3e7a7 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -430,8 +430,6 @@ struct omap_overlay_manager {
struct omap_dss_device *device;
struct omap_overlay_manager_info info;
 
-   bool enabled;
-
bool device_changed;
/* if true, info has been changed but not applied() yet */
bool info_dirty;
-- 
1.7.4.1

--
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 44/65] OMAPDSS: APPLY: add busy field to mgr_priv_data

2011-11-22 Thread Tomi Valkeinen
Add a new field to mgr_priv data, busy, which is used to track the
status of GO bit with the manager. As manual update displays never use
the GO bit, the field is always false for managers used for manual
update displays.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   55 +-
 1 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index c38bd76..323cffa 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -87,6 +87,10 @@ struct mgr_priv_data {
bool manual_update;
bool do_manual_update;
 
+   /* If true, GO bit is up and shadow registers cannot be written.
+* Never true for manual update displays */
+   bool busy;
+
/* If true, a display is enabled using this manager */
bool enabled;
 };
@@ -319,18 +323,12 @@ static int dss_write_regs(void)
const int num_mgrs = dss_feat_get_num_mgrs();
int i;
int r;
-   bool mgr_busy[MAX_DSS_MANAGERS];
-   bool mgr_go[MAX_DSS_MANAGERS];
+   bool mgr_go[MAX_DSS_MANAGERS] = { false };
bool busy;
 
r = 0;
busy = false;
 
-   for (i = 0; i  num_mgrs; i++) {
-   mgr_busy[i] = dispc_mgr_go_busy(i);
-   mgr_go[i] = false;
-   }
-
/* Commit overlay settings */
for (i = 0; i  num_ovls; ++i) {
ovl = omap_dss_get_overlay(i);
@@ -344,7 +342,7 @@ static int dss_write_regs(void)
if (mp-manual_update  !mp-do_manual_update)
continue;
 
-   if (mgr_busy[op-channel]) {
+   if (mp-busy) {
busy = true;
continue;
}
@@ -369,7 +367,7 @@ static int dss_write_regs(void)
if (mp-manual_update  !mp-do_manual_update)
continue;
 
-   if (mgr_busy[i]) {
+   if (mp-busy) {
busy = true;
continue;
}
@@ -391,8 +389,10 @@ static int dss_write_regs(void)
/* We don't need GO with manual update display. LCD iface will
 * always be turned off after frame, and new settings will be
 * taken in to use at next update */
-   if (!mp-manual_update)
+   if (!mp-manual_update) {
+   mp-busy = true;
dispc_mgr_go(i);
+   }
}
 
if (busy)
@@ -471,24 +471,34 @@ static void dss_apply_irq_handler(void *data, u32 mask)
const int num_ovls = dss_feat_get_num_ovls();
const int num_mgrs = dss_feat_get_num_mgrs();
int i, r;
-   bool mgr_busy[MAX_DSS_MANAGERS];
-
-   for (i = 0; i  num_mgrs; i++)
-   mgr_busy[i] = dispc_mgr_go_busy(i);
 
spin_lock(data_lock);
 
+   for (i = 0; i  num_mgrs; i++) {
+   mgr = omap_dss_get_overlay_manager(i);
+   mp = get_mgr_priv(mgr);
+
+   mp-busy = dispc_mgr_go_busy(i);
+   }
+
for (i = 0; i  num_ovls; ++i) {
ovl = omap_dss_get_overlay(i);
op = get_ovl_priv(ovl);
-   if (!mgr_busy[op-channel])
+
+   if (!op-enabled)
+   continue;
+
+   mp = get_mgr_priv(ovl-manager);
+
+   if (!mp-busy)
op-shadow_dirty = false;
}
 
for (i = 0; i  num_mgrs; ++i) {
mgr = omap_dss_get_overlay_manager(i);
mp = get_mgr_priv(mgr);
-   if (!mgr_busy[i])
+
+   if (!mp-busy)
mp-shadow_dirty = false;
}
 
@@ -497,13 +507,20 @@ static void dss_apply_irq_handler(void *data, u32 mask)
goto end;
 
/* re-read busy flags */
-   for (i = 0; i  num_mgrs; i++)
-   mgr_busy[i] = dispc_mgr_go_busy(i);
+   for (i = 0; i  num_mgrs; i++) {
+   mgr = omap_dss_get_overlay_manager(i);
+   mp = get_mgr_priv(mgr);
+
+   mp-busy = dispc_mgr_go_busy(i);
+   }
 
/* keep running as long as there are busy managers, so that
 * we can collect overlay-applied information */
for (i = 0; i  num_mgrs; ++i) {
-   if (mgr_busy[i])
+   mgr = omap_dss_get_overlay_manager(i);
+   mp = get_mgr_priv(mgr);
+
+   if (mp-busy)
goto end;
}
 
-- 
1.7.4.1

--
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 45/65] OMAPDSS: APPLY: rewrite overlay enable/disable

2011-11-22 Thread Tomi Valkeinen
Overlays are currently enabled and disabled with a boolean in the struct
omap_overlay_info. The overlay info is set with ovl-set_overlay_info(),
and made into use with mgr-apply().

This doesn't work properly, as the enable/disable status may affect also
other overlays, for example when using fifo-merge. Thus the enabling and
disabling of the overlay needs to be done outside the normal overlay
configuration.

This patch achieves that by doing the following things:

1) Add function pointers to struct omap_overlay: enable(), disable() and
is_enabled(). These are used to do the obvious. The functions may block.

2) Move the enabled field from struct omap_overlay to ovl_priv_data.

3) Add a new route for settings to be applied to the HW, called
extra_info. The status of the normal info and extra_info are tracked
separately.

The point here is to allow the normal info to be changed and
applied in non-blocking matter, whereas the extra_info can only be
changed when holding the mutex. This makes it possible to, for example,
set the overlay enable flag, apply it, and wait until the HW has taken
the flag into use.

This is not possible if the enable flag would be in the normal info, as
a new value for the flag could be set at any time from the users of
omapdss.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/media/video/omap/omap_vout.c  |   33 +++---
 drivers/video/omap2/dss/apply.c   |  163 -
 drivers/video/omap2/dss/dss.h |3 +
 drivers/video/omap2/dss/overlay.c |   20 ++--
 drivers/video/omap2/omapfb/omapfb-ioctl.c |   30 +++---
 drivers/video/omap2/omapfb/omapfb-main.c  |2 +
 drivers/video/omap2/omapfb/omapfb-sysfs.c |4 +-
 drivers/video/omap2/omapfb/omapfb.h   |   11 +--
 include/video/omapdss.h   |6 +-
 9 files changed, 190 insertions(+), 82 deletions(-)

diff --git a/drivers/media/video/omap/omap_vout.c 
b/drivers/media/video/omap/omap_vout.c
index 9c5c19f..27c19fe 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -423,7 +423,7 @@ static int omapvid_setup_overlay(struct omap_vout_device 
*vout,
%s enable=%d addr=%x width=%d\n height=%d color_mode=%d\n
rotation=%d mirror=%d posx=%d posy=%d out_width = %d \n
out_height=%d rotation_type=%d screen_width=%d\n,
-   __func__, info.enabled, info.paddr, info.width, info.height,
+   __func__, ovl-is_enabled(ovl), info.paddr, info.width, 
info.height,
info.color_mode, info.rotation, info.mirror, info.pos_x,
info.pos_y, info.out_width, info.out_height, info.rotation_type,
info.screen_width);
@@ -942,12 +942,8 @@ static int omap_vout_release(struct file *file)
/* Disable all the overlay managers connected with this interface */
for (i = 0; i  ovid-num_overlays; i++) {
struct omap_overlay *ovl = ovid-overlays[i];
-   if (ovl-manager  ovl-manager-device) {
-   struct omap_overlay_info info;
-   ovl-get_overlay_info(ovl, info);
-   info.enabled = 0;
-   ovl-set_overlay_info(ovl, info);
-   }
+   if (ovl-manager  ovl-manager-device)
+   ovl-disable(ovl);
}
/* Turn off the pipeline */
ret = omapvid_apply_changes(vout);
@@ -1667,7 +1663,6 @@ static int vidioc_streamon(struct file *file, void *fh, 
enum v4l2_buf_type i)
if (ovl-manager  ovl-manager-device) {
struct omap_overlay_info info;
ovl-get_overlay_info(ovl, info);
-   info.enabled = 1;
info.paddr = addr;
if (ovl-set_overlay_info(ovl, info)) {
ret = -EINVAL;
@@ -1686,6 +1681,16 @@ static int vidioc_streamon(struct file *file, void *fh, 
enum v4l2_buf_type i)
if (ret)
v4l2_err(vout-vid_dev-v4l2_dev, failed to change mode\n);
 
+   for (j = 0; j  ovid-num_overlays; j++) {
+   struct omap_overlay *ovl = ovid-overlays[j];
+
+   if (ovl-manager  ovl-manager-device) {
+   ret = ovl-enable(ovl);
+   if (ret)
+   goto streamon_err1;
+   }
+   }
+
ret = 0;
 
 streamon_err1:
@@ -1715,16 +1720,8 @@ static int vidioc_streamoff(struct file *file, void *fh, 
enum v4l2_buf_type i)
for (j = 0; j  ovid-num_overlays; j++) {
struct omap_overlay *ovl = ovid-overlays[j];
 
-   if (ovl-manager  ovl-manager-device) {
-   struct omap_overlay_info info;
-
-   ovl-get_overlay_info(ovl, info);
-   info.enabled = 0;
-   ret = ovl-set_overlay_info(ovl, info);
-   

[PATCH 47/65] OMAPDSS: DISPC: add dispc_mgr_get_framedone_irq

2011-11-22 Thread Tomi Valkeinen
Add dispc_mgr_get_framedone_irq() which returns the irq number for
FRAMEDONE for the given channel.

Note that the function returns always 0 for DIGIT channel, even if OMAP4
does have FRAMEDONE_TV interrupt. The reason for this is that this
function is currently used only to track manual updates, and thus
FRAMEDONE_TV is not needed.

If there's need in the future to also get the FRAMEDONE_TV this needs
revisiting. However, as FRAMEDONE_TV doesn't exist on OMAP2/3, the use
of this function for that purpose needs some extra code to handle the
OMAP2/3 case.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dispc.c |   14 ++
 drivers/video/omap2/dss/dss.h   |1 +
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 27a2cff..8ce0c81 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -452,6 +452,20 @@ u32 dispc_mgr_get_vsync_irq(enum omap_channel channel)
}
 }
 
+u32 dispc_mgr_get_framedone_irq(enum omap_channel channel)
+{
+   switch (channel) {
+   case OMAP_DSS_CHANNEL_LCD:
+   return DISPC_IRQ_FRAMEDONE;
+   case OMAP_DSS_CHANNEL_LCD2:
+   return DISPC_IRQ_FRAMEDONE2;
+   case OMAP_DSS_CHANNEL_DIGIT:
+   return 0;
+   default:
+   BUG();
+   }
+}
+
 bool dispc_mgr_go_busy(enum omap_channel channel)
 {
int bit;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index b597485..c6caf2f 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -430,6 +430,7 @@ void dispc_ovl_set_channel_out(enum omap_plane plane,
 void dispc_mgr_enable_fifohandcheck(enum omap_channel channel, bool enable);
 void dispc_mgr_set_lcd_size(enum omap_channel channel, u16 width, u16 height);
 u32 dispc_mgr_get_vsync_irq(enum omap_channel channel);
+u32 dispc_mgr_get_framedone_irq(enum omap_channel channel);
 bool dispc_mgr_go_busy(enum omap_channel channel);
 void dispc_mgr_go(enum omap_channel channel);
 bool dispc_mgr_is_enabled(enum omap_channel channel);
-- 
1.7.4.1

--
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 48/65] OMAPDSS: APPLY: add updating flag

2011-11-22 Thread Tomi Valkeinen
Add updating flag to mgr_priv_data, which is used to track whether the
manager is currently actively working, i.e. updating the screen.

For auto-update displays updating is always true when the display is
enabled, but for manual update displays the flag is true only during
frame transfers.

The flag is used to manage registers properly, for example when updating
is false and a register for a manager is written, there's no need to set
shadow_dirty flag nor set the GO bit, as the settings will be taken into
use by the HW automatically when the output is enabled.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   79 +--
 1 files changed, 51 insertions(+), 28 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index c4106b6..b2c0462 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -92,6 +92,9 @@ struct mgr_priv_data {
 * Never true for manual update displays */
bool busy;
 
+   /* If true, dispc output is enabled */
+   bool updating;
+
/* If true, a display is enabled using this manager */
bool enabled;
 };
@@ -151,28 +154,31 @@ static bool need_isr(void)
if (!mp-enabled)
continue;
 
-   if (mgr_manual_update(mgr))
-   continue;
-
-   /* to catch GO bit going down */
-   if (mp-busy)
-   return true;
+   if (mgr_manual_update(mgr)) {
+   /* to catch FRAMEDONE */
+   if (mp-updating)
+   return true;
+   } else {
+   /* to catch GO bit going down */
+   if (mp-busy)
+   return true;
 
-   /* to write new values to registers */
-   if (mp-dirty)
-   return true;
+   /* to write new values to registers */
+   if (mp-dirty)
+   return true;
 
-   list_for_each_entry(ovl, mgr-overlays, list) {
-   struct ovl_priv_data *op;
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   struct ovl_priv_data *op;
 
-   op = get_ovl_priv(ovl);
+   op = get_ovl_priv(ovl);
 
-   if (!op-enabled)
-   continue;
+   if (!op-enabled)
+   continue;
 
-   /* to write new values to registers */
-   if (op-dirty || op-extra_info_dirty)
-   return true;
+   /* to write new values to registers */
+   if (op-dirty || op-extra_info_dirty)
+   return true;
+   }
}
}
 
@@ -325,6 +331,7 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl)
struct ovl_priv_data *op = get_ovl_priv(ovl);
struct omap_overlay_info *oi;
bool ilace, replication;
+   struct mgr_priv_data *mp;
int r;
 
DSSDBGF(%d, ovl-id);
@@ -356,13 +363,17 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl)
 
dispc_ovl_set_fifo_threshold(ovl-id, op-fifo_low, op-fifo_high);
 
+   mp = get_mgr_priv(ovl-manager);
+
op-dirty = false;
-   op-shadow_dirty = true;
+   if (mp-updating)
+   op-shadow_dirty = true;
 }
 
 static void dss_ovl_write_regs_extra(struct omap_overlay *ovl)
 {
struct ovl_priv_data *op = get_ovl_priv(ovl);
+   struct mgr_priv_data *mp;
 
DSSDBGF(%d, ovl-id);
 
@@ -374,8 +385,11 @@ static void dss_ovl_write_regs_extra(struct omap_overlay 
*ovl)
 
dispc_ovl_enable(ovl-id, op-enabled);
 
+   mp = get_mgr_priv(ovl-manager);
+
op-extra_info_dirty = false;
-   op-shadow_extra_info_dirty = true;
+   if (mp-updating)
+   op-shadow_extra_info_dirty = true;
 }
 
 static void dss_mgr_write_regs(struct omap_overlay_manager *mgr)
@@ -400,7 +414,8 @@ static void dss_mgr_write_regs(struct omap_overlay_manager 
*mgr)
dispc_mgr_setup(mgr-id, mp-info);
 
mp-dirty = false;
-   mp-shadow_dirty = true;
+   if (mp-updating)
+   mp-shadow_dirty = true;
}
 }
 
@@ -435,21 +450,18 @@ static void dss_write_regs(void)
 void dss_start_update(struct omap_overlay_manager *mgr)
 {
struct mgr_priv_data *mp = get_mgr_priv(mgr);
-   struct ovl_priv_data *op;
-   struct omap_overlay *ovl;
unsigned long flags;
 
spin_lock_irqsave(data_lock, flags);
 
+   WARN_ON(mp-updating);
+
dss_mgr_write_regs(mgr);
 
-   

[PATCH 50/65] OMAPDSS: APPLY: move mgr-info to apply.c

2011-11-22 Thread Tomi Valkeinen
struct omap_overlay_manager contains info and info_dirty fields, both of
which should be internal to apply.c.

This patch moves those fields into mgr_priv data, and names them
user_info and user_info_dirty.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c   |   20 +---
 drivers/video/omap2/dss/manager.c |   35 +--
 include/video/omapdss.h   |3 ---
 3 files changed, 42 insertions(+), 16 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 601dbc7..de1ac24 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -78,6 +78,10 @@ struct ovl_priv_data {
 };
 
 struct mgr_priv_data {
+
+   bool user_info_dirty;
+   struct omap_overlay_manager_info user_info;
+
/* If true, cache changed, but not written to shadow registers. Set
 * in apply(), cleared when registers written. */
bool dirty;
@@ -592,15 +596,15 @@ static void omap_dss_mgr_apply_mgr(struct 
omap_overlay_manager *mgr)
 
if (mgr-device_changed) {
mgr-device_changed = false;
-   mgr-info_dirty  = true;
+   mp-user_info_dirty  = true;
}
 
-   if (!mgr-info_dirty)
+   if (!mp-user_info_dirty)
return;
 
-   mgr-info_dirty = false;
+   mp-user_info_dirty = false;
mp-dirty = true;
-   mp-info = mgr-info;
+   mp-info = mp-user_info;
 }
 
 static void omap_dss_mgr_apply_ovl_fifos(struct omap_overlay *ovl)
@@ -720,12 +724,13 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
 int dss_mgr_set_info(struct omap_overlay_manager *mgr,
struct omap_overlay_manager_info *info)
 {
+   struct mgr_priv_data *mp = get_mgr_priv(mgr);
unsigned long flags;
 
spin_lock_irqsave(data_lock, flags);
 
-   mgr-info = *info;
-   mgr-info_dirty = true;
+   mp-user_info = *info;
+   mp-user_info_dirty = true;
 
spin_unlock_irqrestore(data_lock, flags);
 
@@ -735,11 +740,12 @@ int dss_mgr_set_info(struct omap_overlay_manager *mgr,
 void dss_mgr_get_info(struct omap_overlay_manager *mgr,
struct omap_overlay_manager_info *info)
 {
+   struct mgr_priv_data *mp = get_mgr_priv(mgr);
unsigned long flags;
 
spin_lock_irqsave(data_lock, flags);
 
-   *info = mgr-info;
+   *info = mp-user_info;
 
spin_unlock_irqrestore(data_lock, flags);
 }
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index d7fd494..8c967ef 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -104,7 +104,11 @@ put_device:
 static ssize_t manager_default_color_show(struct omap_overlay_manager *mgr,
  char *buf)
 {
-   return snprintf(buf, PAGE_SIZE, %#x\n, mgr-info.default_color);
+   struct omap_overlay_manager_info info;
+
+   mgr-get_manager_info(mgr, info);
+
+   return snprintf(buf, PAGE_SIZE, %#x\n, info.default_color);
 }
 
 static ssize_t manager_default_color_store(struct omap_overlay_manager *mgr,
@@ -142,8 +146,11 @@ static ssize_t manager_trans_key_type_show(struct 
omap_overlay_manager *mgr,
   char *buf)
 {
enum omap_dss_trans_key_type key_type;
+   struct omap_overlay_manager_info info;
+
+   mgr-get_manager_info(mgr, info);
 
-   key_type = mgr-info.trans_key_type;
+   key_type = info.trans_key_type;
BUG_ON(key_type = ARRAY_SIZE(trans_key_type_str));
 
return snprintf(buf, PAGE_SIZE, %s\n, trans_key_type_str[key_type]);
@@ -183,7 +190,11 @@ static ssize_t manager_trans_key_type_store(struct 
omap_overlay_manager *mgr,
 static ssize_t manager_trans_key_value_show(struct omap_overlay_manager *mgr,
char *buf)
 {
-   return snprintf(buf, PAGE_SIZE, %#x\n, mgr-info.trans_key);
+   struct omap_overlay_manager_info info;
+
+   mgr-get_manager_info(mgr, info);
+
+   return snprintf(buf, PAGE_SIZE, %#x\n, info.trans_key);
 }
 
 static ssize_t manager_trans_key_value_store(struct omap_overlay_manager *mgr,
@@ -215,7 +226,11 @@ static ssize_t manager_trans_key_value_store(struct 
omap_overlay_manager *mgr,
 static ssize_t manager_trans_key_enabled_show(struct omap_overlay_manager *mgr,
  char *buf)
 {
-   return snprintf(buf, PAGE_SIZE, %d\n, mgr-info.trans_enabled);
+   struct omap_overlay_manager_info info;
+
+   mgr-get_manager_info(mgr, info);
+
+   return snprintf(buf, PAGE_SIZE, %d\n, info.trans_enabled);
 }
 
 static ssize_t manager_trans_key_enabled_store(struct omap_overlay_manager 
*mgr,
@@ -247,10 +262,14 @@ static ssize_t manager_trans_key_enabled_store(struct 
omap_overlay_manager *mgr,
 static ssize_t manager_alpha_blending_enabled_show(
struct 

[PATCH 49/65] OMAPDSS: APPLY: clean up isr_handler

2011-11-22 Thread Tomi Valkeinen
Add a helper function mgr_clear_shadow_dirty(), which clears the
shadow_dirty flags for the given manager and for the overlays on that
manager.

This lets us simplify the code in the dss_apply_irq_handler().

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   52 +--
 1 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index b2c0462..601dbc7 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -508,47 +508,51 @@ static void dss_unregister_vsync_isr(void)
dss_data.irq_enabled = false;
 }
 
-static void dss_apply_irq_handler(void *data, u32 mask)
+static void mgr_clear_shadow_dirty(struct omap_overlay_manager *mgr)
 {
struct omap_overlay *ovl;
-   struct omap_overlay_manager *mgr;
struct mgr_priv_data *mp;
struct ovl_priv_data *op;
-   const int num_ovls = dss_feat_get_num_ovls();
+
+   mp = get_mgr_priv(mgr);
+   mp-shadow_dirty = false;
+
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   op = get_ovl_priv(ovl);
+   op-shadow_dirty = false;
+   op-shadow_extra_info_dirty = false;
+   }
+}
+
+static void dss_apply_irq_handler(void *data, u32 mask)
+{
const int num_mgrs = dss_feat_get_num_mgrs();
int i;
 
spin_lock(data_lock);
 
+   /* clear busy, updating flags, shadow_dirty flags */
for (i = 0; i  num_mgrs; i++) {
+   struct omap_overlay_manager *mgr;
+   struct mgr_priv_data *mp;
+
mgr = omap_dss_get_overlay_manager(i);
mp = get_mgr_priv(mgr);
 
-   mp-busy = dispc_mgr_go_busy(i);
-   mp-updating = dispc_mgr_is_enabled(i);
-   }
-
-   for (i = 0; i  num_ovls; ++i) {
-   ovl = omap_dss_get_overlay(i);
-   op = get_ovl_priv(ovl);
-
-   if (!op-enabled)
+   if (!mp-enabled)
continue;
 
-   mp = get_mgr_priv(ovl-manager);
-
-   if (!mp-busy) {
-   op-shadow_dirty = false;
-   op-shadow_extra_info_dirty = false;
-   }
-   }
+   mp-updating = dispc_mgr_is_enabled(i);
 
-   for (i = 0; i  num_mgrs; ++i) {
-   mgr = omap_dss_get_overlay_manager(i);
-   mp = get_mgr_priv(mgr);
+   if (!mgr_manual_update(mgr)) {
+   mp-busy = dispc_mgr_go_busy(i);
 
-   if (!mp-busy)
-   mp-shadow_dirty = false;
+   if (!mp-busy)
+   mgr_clear_shadow_dirty(mgr);
+   } else {
+   if (!mp-updating)
+   mgr_clear_shadow_dirty(mgr);
+   }
}
 
dss_write_regs();
-- 
1.7.4.1

--
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 53/65] OMAPDSS: APPLY: move fifo thresholds to extra_info set

2011-11-22 Thread Tomi Valkeinen
Setting overlay's fifo thresholds is currently handled at the same time
as other overlay attributes. This is not right, as the normal attributes
should only affect one overlay and manager, but changing the fifo
thresholds are needed in cases like fifo-merge, where multiple managers
are affected.

This patch moves the channel field into the extra_info set, handled
together with channel and enabled-status.

This also lets us to calculate the fifos only when needed, specifically,
when an overlay or a manager is enabled.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   95 +++---
 1 files changed, 57 insertions(+), 38 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 3e345d7..0e93ae5 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -69,14 +69,12 @@ struct ovl_priv_data {
 
struct omap_overlay_info info;
 
-   u32 fifo_low;
-   u32 fifo_high;
-
bool extra_info_dirty;
bool shadow_extra_info_dirty;
 
bool enabled;
enum omap_channel channel;
+   u32 fifo_low, fifo_high;
 };
 
 struct mgr_priv_data {
@@ -396,8 +394,6 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl)
return;
}
 
-   dispc_ovl_set_fifo_threshold(ovl-id, op-fifo_low, op-fifo_high);
-
mp = get_mgr_priv(ovl-manager);
 
op-dirty = false;
@@ -420,6 +416,7 @@ static void dss_ovl_write_regs_extra(struct omap_overlay 
*ovl)
 
dispc_ovl_enable(ovl-id, op-enabled);
dispc_ovl_set_channel_out(ovl-id, op-channel);
+   dispc_ovl_set_fifo_threshold(ovl-id, op-fifo_low, op-fifo_high);
 
mp = get_mgr_priv(ovl-manager);
 
@@ -632,13 +629,42 @@ static void omap_dss_mgr_apply_mgr(struct 
omap_overlay_manager *mgr)
mp-info = mp-user_info;
 }
 
-static void omap_dss_mgr_apply_ovl_fifos(struct omap_overlay *ovl)
+int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 {
-   struct ovl_priv_data *op;
+   int r;
+   unsigned long flags;
+   struct omap_overlay *ovl;
+
+   DSSDBG(omap_dss_mgr_apply(%s)\n, mgr-name);
+
+   r = dispc_runtime_get();
+   if (r)
+   return r;
+
+   spin_lock_irqsave(data_lock, flags);
+
+   /* Configure overlays */
+   list_for_each_entry(ovl, mgr-overlays, list)
+   omap_dss_mgr_apply_ovl(ovl);
+
+   /* Configure manager */
+   omap_dss_mgr_apply_mgr(mgr);
+
+   dss_write_regs();
+
+   spin_unlock_irqrestore(data_lock, flags);
+
+   dispc_runtime_put();
+
+   return r;
+}
+
+static void dss_ovl_setup_fifo(struct omap_overlay *ovl)
+{
+   struct ovl_priv_data *op = get_ovl_priv(ovl);
struct omap_dss_device *dssdev;
u32 size, burst_size;
-
-   op = get_ovl_priv(ovl);
+   u32 fifo_low, fifo_high;
 
dssdev = ovl-manager-device;
 
@@ -653,53 +679,42 @@ static void omap_dss_mgr_apply_ovl_fifos(struct 
omap_overlay *ovl)
case OMAP_DISPLAY_TYPE_VENC:
case OMAP_DISPLAY_TYPE_HDMI:
default_get_overlay_fifo_thresholds(ovl-id, size,
-   burst_size, op-fifo_low,
-   op-fifo_high);
+   burst_size, fifo_low, fifo_high);
break;
 #ifdef CONFIG_OMAP2_DSS_DSI
case OMAP_DISPLAY_TYPE_DSI:
dsi_get_overlay_fifo_thresholds(ovl-id, size,
-   burst_size, op-fifo_low,
-   op-fifo_high);
+   burst_size, fifo_low, fifo_high);
break;
 #endif
default:
BUG();
}
+
+   op-fifo_low = fifo_low;
+   op-fifo_high = fifo_high;
+   op-extra_info_dirty = true;
 }
 
-int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
+static void dss_mgr_setup_fifos(struct omap_overlay_manager *mgr)
 {
-   int r;
-   unsigned long flags;
struct omap_overlay *ovl;
+   struct ovl_priv_data *op;
+   struct mgr_priv_data *mp;
 
-   DSSDBG(omap_dss_mgr_apply(%s)\n, mgr-name);
-
-   r = dispc_runtime_get();
-   if (r)
-   return r;
-
-   spin_lock_irqsave(data_lock, flags);
-
-   /* Configure overlays */
-   list_for_each_entry(ovl, mgr-overlays, list)
-   omap_dss_mgr_apply_ovl(ovl);
-
-   /* Configure manager */
-   omap_dss_mgr_apply_mgr(mgr);
-
-   /* Configure overlay fifos */
-   list_for_each_entry(ovl, mgr-overlays, list)
-   omap_dss_mgr_apply_ovl_fifos(ovl);
+   mp = get_mgr_priv(mgr);
 
-   dss_write_regs();
+   if (!mp-enabled)
+   return;
 
-   spin_unlock_irqrestore(data_lock, flags);
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   op = get_ovl_priv(ovl);
 
-   dispc_runtime_put();
+   if (!op-enabled)
+

[PATCH 54/65] OMAPDSS: APPLY: rename dirty shadow_dirty

2011-11-22 Thread Tomi Valkeinen
Rename ovl_priv_data's and mgr_priv_data's dirty and shadow_dirty fields
to info_dirty and shadow_info_dirty to better reflect what they mean.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   62 +--
 1 files changed, 27 insertions(+), 35 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 0e93ae5..fdd53b6 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -31,8 +31,10 @@
  * We have 4 levels of cache for the dispc settings. First two are in SW and
  * the latter two in HW.
  *
+ *   set_info()
+ *  v
  * ++
- * |overlay/manager_info|
+ * | user_info  |
  * ++
  *  v
  *apply()
@@ -59,16 +61,11 @@ struct ovl_priv_data {
bool user_info_dirty;
struct omap_overlay_info user_info;
 
-   /* If true, cache changed, but not written to shadow registers. Set
-* in apply(), cleared when registers written. */
-   bool dirty;
-   /* If true, shadow registers contain changed values not yet in real
-* registers. Set when writing to shadow registers, cleared at
-* VSYNC/EVSYNC */
-   bool shadow_dirty;
-
+   bool info_dirty;
struct omap_overlay_info info;
 
+   bool shadow_info_dirty;
+
bool extra_info_dirty;
bool shadow_extra_info_dirty;
 
@@ -82,16 +79,11 @@ struct mgr_priv_data {
bool user_info_dirty;
struct omap_overlay_manager_info user_info;
 
-   /* If true, cache changed, but not written to shadow registers. Set
-* in apply(), cleared when registers written. */
-   bool dirty;
-   /* If true, shadow registers contain changed values not yet in real
-* registers. Set when writing to shadow registers, cleared at
-* VSYNC/EVSYNC */
-   bool shadow_dirty;
-
+   bool info_dirty;
struct omap_overlay_manager_info info;
 
+   bool shadow_info_dirty;
+
/* If true, GO bit is up and shadow registers cannot be written.
 * Never true for manual update displays */
bool busy;
@@ -199,7 +191,7 @@ static bool need_isr(void)
return true;
 
/* to write new values to registers */
-   if (mp-dirty)
+   if (mp-info_dirty)
return true;
 
list_for_each_entry(ovl, mgr-overlays, list) {
@@ -211,7 +203,7 @@ static bool need_isr(void)
continue;
 
/* to write new values to registers */
-   if (op-dirty || op-extra_info_dirty)
+   if (op-info_dirty || op-extra_info_dirty)
return true;
}
}
@@ -228,12 +220,12 @@ static bool need_go(struct omap_overlay_manager *mgr)
 
mp = get_mgr_priv(mgr);
 
-   if (mp-shadow_dirty)
+   if (mp-shadow_info_dirty)
return true;
 
list_for_each_entry(ovl, mgr-overlays, list) {
op = get_ovl_priv(ovl);
-   if (op-shadow_dirty || op-shadow_extra_info_dirty)
+   if (op-shadow_info_dirty || op-shadow_extra_info_dirty)
return true;
}
 
@@ -264,8 +256,8 @@ int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
bool shadow_dirty, dirty;
 
spin_lock_irqsave(data_lock, flags);
-   dirty = mp-dirty;
-   shadow_dirty = mp-shadow_dirty;
+   dirty = mp-info_dirty;
+   shadow_dirty = mp-shadow_info_dirty;
spin_unlock_irqrestore(data_lock, flags);
 
if (!dirty  !shadow_dirty) {
@@ -327,8 +319,8 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
bool shadow_dirty, dirty;
 
spin_lock_irqsave(data_lock, flags);
-   dirty = op-dirty;
-   shadow_dirty = op-shadow_dirty;
+   dirty = op-info_dirty;
+   shadow_dirty = op-shadow_info_dirty;
spin_unlock_irqrestore(data_lock, flags);
 
if (!dirty  !shadow_dirty) {
@@ -371,7 +363,7 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl)
 
DSSDBGF(%d, ovl-id);
 
-   if (!op-enabled || !op-dirty)
+   if (!op-enabled || !op-info_dirty)
return;
 
oi = op-info;
@@ -396,9 +388,9 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl)
 
mp = get_mgr_priv(ovl-manager);
 
-   op-dirty = false;
+   op-info_dirty = false;
if (mp-updating)
-   op-shadow_dirty = true;
+   op-shadow_info_dirty = true;
 }
 
 static void dss_ovl_write_regs_extra(struct omap_overlay *ovl)
@@ -443,12 +435,12 @@ static void 

[PATCH 57/65] OMAPDSS: APPLY: skip enable/disable if already enabled/disabled

2011-11-22 Thread Tomi Valkeinen
Add checks to dss_mgr_enable, dss_mgr_disable, dss_ovl_enable,
dss_ovl_disable that check if the state is already the same as given in
the parameters, and exit if so.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   18 ++
 1 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index cfc17c0..76b5b02 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -724,6 +724,9 @@ void dss_mgr_enable(struct omap_overlay_manager *mgr)
 
mutex_lock(apply_lock);
 
+   if (mp-enabled)
+   goto out;
+
spin_lock_irqsave(data_lock, flags);
 
mp-enabled = true;
@@ -740,6 +743,7 @@ void dss_mgr_enable(struct omap_overlay_manager *mgr)
if (!mgr_manual_update(mgr))
dispc_mgr_enable(mgr-id, true);
 
+out:
mutex_unlock(apply_lock);
 }
 
@@ -750,6 +754,9 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
 
mutex_lock(apply_lock);
 
+   if (!mp-enabled)
+   goto out;
+
if (!mgr_manual_update(mgr))
dispc_mgr_enable(mgr-id, false);
 
@@ -760,6 +767,7 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
 
spin_unlock_irqrestore(data_lock, flags);
 
+out:
mutex_unlock(apply_lock);
 }
 
@@ -1005,6 +1013,11 @@ int dss_ovl_enable(struct omap_overlay *ovl)
 
mutex_lock(apply_lock);
 
+   if (op-enabled) {
+   r = 0;
+   goto err;
+   }
+
if (ovl-manager == NULL || ovl-manager-device == NULL) {
r = -EINVAL;
goto err;
@@ -1036,6 +1049,11 @@ int dss_ovl_disable(struct omap_overlay *ovl)
 
mutex_lock(apply_lock);
 
+   if (!op-enabled) {
+   r = 0;
+   goto err;
+   }
+
if (ovl-manager == NULL || ovl-manager-device == NULL) {
r = -EINVAL;
goto err;
-- 
1.7.4.1

--
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 55/65] OMAPDSS: APPLY: remove device_changed field

2011-11-22 Thread Tomi Valkeinen
omap_overlay_manager contains device_changed field, which no longer has
any use. So remove the field and the few places where it is touched.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |7 ---
 include/video/omapdss.h |2 --
 2 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index fdd53b6..916acd7 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -608,11 +608,6 @@ static void omap_dss_mgr_apply_mgr(struct 
omap_overlay_manager *mgr)
 
mp = get_mgr_priv(mgr);
 
-   if (mgr-device_changed) {
-   mgr-device_changed = false;
-   mp-user_info_dirty  = true;
-   }
-
if (!mp-user_info_dirty)
return;
 
@@ -807,7 +802,6 @@ int dss_mgr_set_device(struct omap_overlay_manager *mgr,
 
dssdev-manager = mgr;
mgr-device = dssdev;
-   mgr-device_changed = true;
 
mutex_unlock(apply_lock);
 
@@ -840,7 +834,6 @@ int dss_mgr_unset_device(struct omap_overlay_manager *mgr)
 
mgr-device-manager = NULL;
mgr-device = NULL;
-   mgr-device_changed = true;
 
mutex_unlock(apply_lock);
 
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index e629b0d..98fc026 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -426,8 +426,6 @@ struct omap_overlay_manager {
/* dynamic fields */
struct omap_dss_device *device;
 
-   bool device_changed;
-
int (*set_device)(struct omap_overlay_manager *mgr,
struct omap_dss_device *dssdev);
int (*unset_device)(struct omap_overlay_manager *mgr);
-- 
1.7.4.1

--
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 56/65] OMAPDSS: APPLY: add dss_apply_ovl_enable()

2011-11-22 Thread Tomi Valkeinen
Add a helper function dss_apply_ovl_enable(), which is similar to the
main apply() function: dss_apply_ovl_enable() applies the given overlay
enable-status to ovl_priv_data, and sets the dirty flag.

The difference between the helper function and the previous direct use
of the fields is that the helper function will not do anything if the
enable state is already the same as given in the parameter.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   19 +++
 1 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 916acd7..cfc17c0 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -646,6 +646,19 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
return r;
 }
 
+static void dss_apply_ovl_enable(struct omap_overlay *ovl, bool enable)
+{
+   struct ovl_priv_data *op;
+
+   op = get_ovl_priv(ovl);
+
+   if (op-enabled == enable)
+   return;
+
+   op-enabled = enable;
+   op-extra_info_dirty = true;
+}
+
 static void dss_ovl_setup_fifo(struct omap_overlay *ovl)
 {
struct ovl_priv_data *op = get_ovl_priv(ovl);
@@ -999,8 +1012,7 @@ int dss_ovl_enable(struct omap_overlay *ovl)
 
spin_lock_irqsave(data_lock, flags);
 
-   op-enabled = true;
-   op-extra_info_dirty = true;
+   dss_apply_ovl_enable(ovl, true);
 
dss_ovl_setup_fifo(ovl);
 
@@ -1031,8 +1043,7 @@ int dss_ovl_disable(struct omap_overlay *ovl)
 
spin_lock_irqsave(data_lock, flags);
 
-   op-enabled = false;
-   op-extra_info_dirty = true;
+   dss_apply_ovl_enable(ovl, false);
 
dss_write_regs();
 
-- 
1.7.4.1

--
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 60/65] OMAPDSS: Add comments about blocking of ovl/mgr functions

2011-11-22 Thread Tomi Valkeinen
Add comments specifying what ovl/mgr functions may block.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 include/video/omapdss.h |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 98fc026..39862b8 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -384,6 +384,17 @@ struct omap_overlay {
/* dynamic fields */
struct omap_overlay_manager *manager;
 
+   /*
+* The following functions do not block:
+*
+* is_enabled
+* set_overlay_info
+* get_overlay_info
+*
+* The rest of the functions may block and cannot be called from
+* interrupt context
+*/
+
int (*enable)(struct omap_overlay *ovl);
int (*disable)(struct omap_overlay *ovl);
bool (*is_enabled)(struct omap_overlay *ovl);
@@ -426,6 +437,17 @@ struct omap_overlay_manager {
/* dynamic fields */
struct omap_dss_device *device;
 
+   /*
+* The following functions do not block:
+*
+* set_manager_info
+* get_manager_info
+* apply
+*
+* The rest of the functions may block and cannot be called from
+* interrupt context
+*/
+
int (*set_device)(struct omap_overlay_manager *mgr,
struct omap_dss_device *dssdev);
int (*unset_device)(struct omap_overlay_manager *mgr);
-- 
1.7.4.1

--
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 59/65] OMAPDSS: APPLY: remove runtime_get

2011-11-22 Thread Tomi Valkeinen
apply.c no longer touches any registers if an output is not enabled.
This means that we don't need to do dispc_runtime_get() anymore, and the
calls can be removed.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |9 +
 1 files changed, 1 insertions(+), 8 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 75db522..6a50ee0 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -688,16 +688,11 @@ static void omap_dss_mgr_apply_mgr(struct 
omap_overlay_manager *mgr)
 
 int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 {
-   int r;
unsigned long flags;
struct omap_overlay *ovl;
 
DSSDBG(omap_dss_mgr_apply(%s)\n, mgr-name);
 
-   r = dispc_runtime_get();
-   if (r)
-   return r;
-
spin_lock_irqsave(data_lock, flags);
 
/* Configure overlays */
@@ -711,9 +706,7 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 
spin_unlock_irqrestore(data_lock, flags);
 
-   dispc_runtime_put();
-
-   return r;
+   return 0;
 }
 
 static void dss_apply_ovl_enable(struct omap_overlay *ovl, bool enable)
-- 
1.7.4.1

--
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 61/65] OMAPDSS: APPLY: add dss_ovl_simple_check()

2011-11-22 Thread Tomi Valkeinen
Add dss_ovl_simple_check() which is used to check the validity of
certain overlay attributes. Only attributes that can be checked
independently, without knowing the display being used, is done here
(thus simple).

We can use this function in dss_ovl_set_info().

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   40 +++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 6a50ee0..c1c4597 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -928,12 +928,52 @@ err:
 }
 
 
+static int dss_ovl_simple_check(struct omap_overlay *ovl,
+   const struct omap_overlay_info *info)
+{
+   if (info-paddr == 0) {
+   DSSERR(check_overlay: paddr cannot be 0\n);
+   return -EINVAL;
+   }
+
+   if ((ovl-caps  OMAP_DSS_OVL_CAP_SCALE) == 0) {
+   if (info-out_width != 0  info-width != info-out_width) {
+   DSSERR(check_overlay: overlay %d doesn't support 
+   scaling\n, ovl-id);
+   return -EINVAL;
+   }
+
+   if (info-out_height != 0  info-height != info-out_height) {
+   DSSERR(check_overlay: overlay %d doesn't support 
+   scaling\n, ovl-id);
+   return -EINVAL;
+   }
+   }
+
+   if ((ovl-supported_modes  info-color_mode) == 0) {
+   DSSERR(check_overlay: overlay %d doesn't support mode %d\n,
+   ovl-id, info-color_mode);
+   return -EINVAL;
+   }
+
+   if (info-zorder = omap_dss_get_num_overlays()) {
+   DSSERR(check_overlay: zorder %d too high\n, info-zorder);
+   return -EINVAL;
+   }
+
+   return 0;
+}
 
 int dss_ovl_set_info(struct omap_overlay *ovl,
struct omap_overlay_info *info)
 {
struct ovl_priv_data *op = get_ovl_priv(ovl);
unsigned long flags;
+   int r;
+
+   r = dss_ovl_simple_check(ovl, info);
+   if (r)
+   return r;
 
spin_lock_irqsave(data_lock, flags);
 
-- 
1.7.4.1

--
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 62/65] OMAPDSS: APPLY: add dss_mgr_simple_check()

2011-11-22 Thread Tomi Valkeinen
Add dss_mgr_simple_check() which is used to check the validity of
certain manager attributes. Only attributes that can be checked
independently, without knowing the display being used, is done here
(thus simple).

We can use this function in dss_mgr_set_info().

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   24 
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index c1c4597..5d933b9 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -834,11 +834,35 @@ out:
mutex_unlock(apply_lock);
 }
 
+static int dss_mgr_simple_check(struct omap_overlay_manager *mgr,
+   const struct omap_overlay_manager_info *info)
+{
+   if (dss_has_feature(FEAT_ALPHA_FIXED_ZORDER)) {
+   /*
+* OMAP3 supports only graphics source transparency color key
+* and alpha blending simultaneously. See TRM 15.4.2.4.2.2
+* Alpha Mode.
+*/
+   if (info-partial_alpha_enabled  info-trans_enabled
+info-trans_key_type != OMAP_DSS_COLOR_KEY_GFX_DST) {
+   DSSERR(check_manager: illegal transparency key\n);
+   return -EINVAL;
+   }
+   }
+
+   return 0;
+}
+
 int dss_mgr_set_info(struct omap_overlay_manager *mgr,
struct omap_overlay_manager_info *info)
 {
struct mgr_priv_data *mp = get_mgr_priv(mgr);
unsigned long flags;
+   int r;
+
+   r = dss_mgr_simple_check(mgr, info);
+   if (r)
+   return r;
 
spin_lock_irqsave(data_lock, flags);
 
-- 
1.7.4.1

--
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 63/65] OMAPDSS: APPLY: add checking of ovls/mgrs settings

2011-11-22 Thread Tomi Valkeinen
Add checks for overlay and manager settings. The checks are a bit
complex, as we need to observe the bigger picture instead of overlays
and managers independently. Things like the used display and the zorder
of other overlays affect the validity of the settings.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |  215 ++-
 1 files changed, 212 insertions(+), 3 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 5d933b9..72afa85 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -166,6 +166,169 @@ static bool mgr_manual_update(struct omap_overlay_manager 
*mgr)
return mgr-device-caps  OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
 }
 
+/* Check if overlay parameters are compatible with display */
+static int dss_ovl_check(struct omap_overlay *ovl,
+   struct omap_overlay_info *info, struct omap_dss_device *dssdev)
+{
+   u16 outw, outh;
+   u16 dw, dh;
+
+   if (dssdev == NULL)
+   return 0;
+
+   dssdev-driver-get_resolution(dssdev, dw, dh);
+
+   if ((ovl-caps  OMAP_DSS_OVL_CAP_SCALE) == 0) {
+   outw = info-width;
+   outh = info-height;
+   } else {
+   if (info-out_width == 0)
+   outw = info-width;
+   else
+   outw = info-out_width;
+
+   if (info-out_height == 0)
+   outh = info-height;
+   else
+   outh = info-out_height;
+   }
+
+   if (dw  info-pos_x + outw) {
+   DSSERR(overlay %d horizontally not inside the display area 
+   (%d + %d = %d)\n,
+   ovl-id, info-pos_x, outw, dw);
+   return -EINVAL;
+   }
+
+   if (dh  info-pos_y + outh) {
+   DSSERR(overlay %d vertically not inside the display area 
+   (%d + %d = %d)\n,
+   ovl-id, info-pos_y, outh, dh);
+   return -EINVAL;
+   }
+
+   return 0;
+}
+
+static int dss_mgr_check_zorder(struct omap_overlay_manager *mgr,
+   struct omap_overlay_info **overlay_infos)
+{
+   struct omap_overlay *ovl1, *ovl2;
+   struct ovl_priv_data *op1, *op2;
+   struct omap_overlay_info *info1, *info2;
+
+   list_for_each_entry(ovl1, mgr-overlays, list) {
+   op1 = get_ovl_priv(ovl1);
+   info1 = overlay_infos[ovl1-id];
+
+   if (info1 == NULL)
+   continue;
+
+   list_for_each_entry(ovl2, mgr-overlays, list) {
+   if (ovl1 == ovl2)
+   continue;
+
+   op2 = get_ovl_priv(ovl2);
+   info2 = overlay_infos[ovl2-id];
+
+   if (info2 == NULL)
+   continue;
+
+   if (info1-zorder == info2-zorder) {
+   DSSERR(overlays %d and %d have the same 
+   zorder %d\n,
+   ovl1-id, ovl2-id, info1-zorder);
+   return -EINVAL;
+   }
+   }
+   }
+
+   return 0;
+}
+
+static int dss_mgr_check(struct omap_overlay_manager *mgr,
+   struct omap_dss_device *dssdev,
+   struct omap_overlay_manager_info *info,
+   struct omap_overlay_info **overlay_infos)
+{
+   struct omap_overlay *ovl;
+   int r;
+
+   if (dss_has_feature(FEAT_ALPHA_FREE_ZORDER)) {
+   r = dss_mgr_check_zorder(mgr, overlay_infos);
+   if (r)
+   return r;
+   }
+
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   struct omap_overlay_info *oi;
+   int r;
+
+   oi = overlay_infos[ovl-id];
+
+   if (oi == NULL)
+   continue;
+
+   r = dss_ovl_check(ovl, oi, dssdev);
+   if (r)
+   return r;
+   }
+
+   return 0;
+}
+static int dss_check_settings_low(struct omap_overlay_manager *mgr,
+   struct omap_dss_device *dssdev, bool applying)
+{
+   struct omap_overlay_info *oi;
+   struct omap_overlay_manager_info *mi;
+   struct omap_overlay *ovl;
+   struct omap_overlay_info *ois[MAX_DSS_OVERLAYS];
+   struct ovl_priv_data *op;
+   struct mgr_priv_data *mp;
+
+   mp = get_mgr_priv(mgr);
+
+   if (applying  mp-user_info_dirty)
+   mi = mp-user_info;
+   else
+   mi = mp-info;
+
+   /* collect the infos to be tested into the array */
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   op = get_ovl_priv(ovl);
+
+   if (!op-enabled)
+   oi = 

[PATCH 64/65] OMAPDSS: APPLY: add return value to dss_mgr_enable()

2011-11-22 Thread Tomi Valkeinen
Now that dss_mgr_enable() can fail due to checks, make it return the
error value.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   12 +---
 drivers/video/omap2/dss/dss.h   |2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 72afa85..1ce4c00 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -967,7 +967,7 @@ static void dss_mgr_setup_fifos(struct omap_overlay_manager 
*mgr)
}
 }
 
-void dss_mgr_enable(struct omap_overlay_manager *mgr)
+int dss_mgr_enable(struct omap_overlay_manager *mgr)
 {
struct mgr_priv_data *mp = get_mgr_priv(mgr);
unsigned long flags;
@@ -986,8 +986,7 @@ void dss_mgr_enable(struct omap_overlay_manager *mgr)
if (r) {
DSSERR(failed to enable manager %d: check_settings failed\n,
mgr-id);
-   spin_unlock_irqrestore(data_lock, flags);
-   goto out;
+   goto err;
}
 
mp-enabled = true;
@@ -1006,6 +1005,13 @@ void dss_mgr_enable(struct omap_overlay_manager *mgr)
 
 out:
mutex_unlock(apply_lock);
+
+   return 0;
+
+err:
+   spin_unlock_irqrestore(data_lock, flags);
+   mutex_unlock(apply_lock);
+   return r;
 }
 
 void dss_mgr_disable(struct omap_overlay_manager *mgr)
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index c6caf2f..f91eba3 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -170,7 +170,7 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl);
 void dss_start_update(struct omap_overlay_manager *mgr);
 int omap_dss_mgr_apply(struct omap_overlay_manager *mgr);
 
-void dss_mgr_enable(struct omap_overlay_manager *mgr);
+int dss_mgr_enable(struct omap_overlay_manager *mgr);
 void dss_mgr_disable(struct omap_overlay_manager *mgr);
 int dss_mgr_set_info(struct omap_overlay_manager *mgr,
struct omap_overlay_manager_info *info);
-- 
1.7.4.1

--
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 65/65] OMAPDSS: check the return value of dss_mgr_enable()

2011-11-22 Thread Tomi Valkeinen
Now that dss_mgr_enable returns an error value, check it in all the
places dss_mgr_enable is used, and bail out properly.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/dpi.c  |5 -
 drivers/video/omap2/dss/dsi.c  |   11 ++-
 drivers/video/omap2/dss/hdmi.c |9 -
 drivers/video/omap2/dss/sdi.c  |6 +-
 drivers/video/omap2/dss/venc.c |   26 +++---
 5 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 79c4df3..395d658 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -223,10 +223,13 @@ int omapdss_dpi_display_enable(struct omap_dss_device 
*dssdev)
 
mdelay(2);
 
-   dss_mgr_enable(dssdev-manager);
+   r = dss_mgr_enable(dssdev-manager);
+   if (r)
+   goto err_mgr_enable;
 
return 0;
 
+err_mgr_enable:
 err_set_mode:
if (dpi_use_dsi_pll(dssdev))
dsi_pll_uninit(dpi.dsidev, true);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index a35f3fb..57fda24 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -3945,6 +3945,7 @@ int dsi_enable_video_output(struct omap_dss_device 
*dssdev, int channel)
int bpp = dsi_get_pixel_size(dssdev-panel.dsi_pix_fmt);
u8 data_type;
u16 word_count;
+   int r;
 
if (dssdev-panel.dsi_mode == OMAP_DSS_DSI_VIDEO_MODE) {
switch (dssdev-panel.dsi_pix_fmt) {
@@ -3979,7 +3980,15 @@ int dsi_enable_video_output(struct omap_dss_device 
*dssdev, int channel)
dsi_if_enable(dsidev, true);
}
 
-   dss_mgr_enable(dssdev-manager);
+   r = dss_mgr_enable(dssdev-manager);
+   if (r) {
+   if (dssdev-panel.dsi_mode == OMAP_DSS_DSI_VIDEO_MODE) {
+   dsi_if_enable(dsidev, false);
+   dsi_vc_enable(dsidev, channel, false);
+   }
+
+   return r;
+   }
 
return 0;
 }
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index e245a2b..b064762 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -387,9 +387,16 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
hdmi.ip_data.ops-video_enable(hdmi.ip_data, 1);
 
-   dss_mgr_enable(dssdev-manager);
+   r = dss_mgr_enable(dssdev-manager);
+   if (r)
+   goto err_mgr_enable;
 
return 0;
+
+err_mgr_enable:
+   hdmi.ip_data.ops-video_enable(hdmi.ip_data, 0);
+   hdmi.ip_data.ops-phy_disable(hdmi.ip_data);
+   hdmi.ip_data.ops-pll_disable(hdmi.ip_data);
 err:
hdmi_runtime_put();
return -EIO;
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 02da8be..8266ca0 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -123,10 +123,14 @@ int omapdss_sdi_display_enable(struct omap_dss_device 
*dssdev)
goto err_sdi_enable;
mdelay(2);
 
-   dss_mgr_enable(dssdev-manager);
+   r = dss_mgr_enable(dssdev-manager);
+   if (r)
+   goto err_mgr_enable;
 
return 0;
 
+err_mgr_enable:
+   dss_sdi_disable();
 err_sdi_enable:
 err_set_dispc_clock_div:
 err_set_dss_clock_div:
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 101fcd7..b3e9f90 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -417,9 +417,10 @@ static const struct venc_config *venc_timings_to_config(
BUG();
 }
 
-static void venc_power_on(struct omap_dss_device *dssdev)
+static int venc_power_on(struct omap_dss_device *dssdev)
 {
u32 l;
+   int r;
 
venc_reset();
venc_write_config(venc_timings_to_config(dssdev-panel.timings));
@@ -447,7 +448,22 @@ static void venc_power_on(struct omap_dss_device *dssdev)
if (dssdev-platform_enable)
dssdev-platform_enable(dssdev);
 
-   dss_mgr_enable(dssdev-manager);
+   r = dss_mgr_enable(dssdev-manager);
+   if (r)
+   goto err;
+
+   return 0;
+
+err:
+   venc_write_reg(VENC_OUTPUT_CONTROL, 0);
+   dss_set_dac_pwrdn_bgz(0);
+
+   if (dssdev-platform_disable)
+   dssdev-platform_disable(dssdev);
+
+   regulator_disable(venc.vdda_dac_reg);
+
+   return r;
 }
 
 static void venc_power_off(struct omap_dss_device *dssdev)
@@ -504,7 +520,9 @@ static int venc_panel_enable(struct omap_dss_device *dssdev)
if (r)
goto err1;
 
-   venc_power_on(dssdev);
+   r = venc_power_on(dssdev);
+   if (r)
+   goto err2;
 
venc.wss_data = 0;
 
@@ -512,6 +530,8 @@ static int venc_panel_enable(struct omap_dss_device *dssdev)
 
mutex_unlock(venc.venc_lock);
return 0;
+err2:
+   venc_runtime_put();
 err1:

[PATCH 58/65] OMAPDSS: APPLY: add wait_pending_extra_info_updates()

2011-11-22 Thread Tomi Valkeinen
Add wait_pending_extra_info_updates() function which can be used to wait
until any extra_info changes have been taken into use by the hardware.
This can be only called when holding the apply mutex, so that other
threads cannot insert new extra_info changes.

This will be used to handle fifo-configurations.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   70 +++
 1 files changed, 70 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 76b5b02..75db522 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -106,6 +106,7 @@ static struct {
 static spinlock_t data_lock;
 /* lock for blocking functions */
 static DEFINE_MUTEX(apply_lock);
+static DECLARE_COMPLETION(extra_updated_completion);
 
 static void dss_register_vsync_isr(void);
 
@@ -232,6 +233,70 @@ static bool need_go(struct omap_overlay_manager *mgr)
return false;
 }
 
+/* returns true if an extra_info field is currently being updated */
+static bool extra_info_update_ongoing(void)
+{
+   const int num_ovls = omap_dss_get_num_overlays();
+   struct ovl_priv_data *op;
+   struct omap_overlay *ovl;
+   struct mgr_priv_data *mp;
+   int i;
+   bool eid;
+
+   for (i = 0; i  num_ovls; ++i) {
+   ovl = omap_dss_get_overlay(i);
+   op = get_ovl_priv(ovl);
+
+   if (!op-enabled)
+   continue;
+
+   mp = get_mgr_priv(ovl-manager);
+
+   if (!mp-enabled)
+   continue;
+
+   eid = op-extra_info_dirty || op-shadow_extra_info_dirty;
+
+   if (!eid)
+   continue;
+
+   if (ovl_manual_update(ovl)  !mp-updating)
+   continue;
+
+   return true;
+   }
+
+   return false;
+}
+
+/* wait until no extra_info updates are pending */
+static void wait_pending_extra_info_updates(void)
+{
+   bool updating;
+   unsigned long flags;
+   unsigned long t;
+
+   spin_lock_irqsave(data_lock, flags);
+
+   updating = extra_info_update_ongoing();
+
+   if (!updating) {
+   spin_unlock_irqrestore(data_lock, flags);
+   return;
+   }
+
+   init_completion(extra_updated_completion);
+
+   spin_unlock_irqrestore(data_lock, flags);
+
+   t = msecs_to_jiffies(500);
+   wait_for_completion_timeout(extra_updated_completion, t);
+
+   updating = extra_info_update_ongoing();
+
+   WARN_ON(updating);
+}
+
 int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
 {
unsigned long timeout = msecs_to_jiffies(500);
@@ -553,6 +618,7 @@ static void dss_apply_irq_handler(void *data, u32 mask)
 {
const int num_mgrs = dss_feat_get_num_mgrs();
int i;
+   bool extra_updating;
 
spin_lock(data_lock);
 
@@ -582,6 +648,10 @@ static void dss_apply_irq_handler(void *data, u32 mask)
 
dss_write_regs();
 
+   extra_updating = extra_info_update_ongoing();
+   if (!extra_updating)
+   complete_all(extra_updated_completion);
+
if (!need_isr())
dss_unregister_vsync_isr();
 
-- 
1.7.4.1

--
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 52/65] OMAPDSS: APPLY: move channel-field to extra_info set

2011-11-22 Thread Tomi Valkeinen
Setting overlay's output channel is currently handled at the same time
as other overlay attributes. This is not right, as the normal attributes
should only affect one overlay and manager, but changing the channel
affects two managers.

This patch moves the channel field into the extra_info set, handled
together with enabled-status.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   21 +++--
 include/video/omapdss.h |2 --
 2 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index eac0041..3e345d7 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -69,8 +69,6 @@ struct ovl_priv_data {
 
struct omap_overlay_info info;
 
-   enum omap_channel channel;
-
u32 fifo_low;
u32 fifo_high;
 
@@ -78,7 +76,7 @@ struct ovl_priv_data {
bool shadow_extra_info_dirty;
 
bool enabled;
-
+   enum omap_channel channel;
 };
 
 struct mgr_priv_data {
@@ -384,8 +382,6 @@ static void dss_ovl_write_regs(struct omap_overlay *ovl)
 
ilace = ovl-manager-device-type == OMAP_DISPLAY_TYPE_VENC;
 
-   dispc_ovl_set_channel_out(ovl-id, op-channel);
-
r = dispc_ovl_setup(ovl-id, oi, ilace, replication);
if (r) {
/*
@@ -423,6 +419,7 @@ static void dss_ovl_write_regs_extra(struct omap_overlay 
*ovl)
 * disabled */
 
dispc_ovl_enable(ovl-id, op-enabled);
+   dispc_ovl_set_channel_out(ovl-id, op-channel);
 
mp = get_mgr_priv(ovl-manager);
 
@@ -608,19 +605,12 @@ static void omap_dss_mgr_apply_ovl(struct omap_overlay 
*ovl)
 
op = get_ovl_priv(ovl);
 
-   if (ovl-manager_changed) {
-   ovl-manager_changed = false;
-   op-user_info_dirty  = true;
-   }
-
if (!op-user_info_dirty)
return;
 
op-user_info_dirty = false;
op-dirty = true;
op-info = op-user_info;
-
-   op-channel = ovl-manager-id;
 }
 
 static void omap_dss_mgr_apply_mgr(struct omap_overlay_manager *mgr)
@@ -910,9 +900,11 @@ int dss_ovl_set_manager(struct omap_overlay *ovl,
goto err;
}
 
+   op-channel = mgr-id;
+   op-extra_info_dirty = true;
+
ovl-manager = mgr;
list_add_tail(ovl-list, mgr-overlays);
-   ovl-manager_changed = true;
 
spin_unlock_irqrestore(data_lock, flags);
 
@@ -960,9 +952,10 @@ int dss_ovl_unset_manager(struct omap_overlay *ovl)
goto err;
}
 
+   op-channel = -1;
+
ovl-manager = NULL;
list_del(ovl-list);
-   ovl-manager_changed = true;
 
spin_unlock_irqrestore(data_lock, flags);
 
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 2e2c53f..e629b0d 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -384,8 +384,6 @@ struct omap_overlay {
/* dynamic fields */
struct omap_overlay_manager *manager;
 
-   bool manager_changed;
-
int (*enable)(struct omap_overlay *ovl);
int (*disable)(struct omap_overlay *ovl);
bool (*is_enabled)(struct omap_overlay *ovl);
-- 
1.7.4.1

--
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 51/65] OMAPDSS: APPLY: move ovl-info to apply.c

2011-11-22 Thread Tomi Valkeinen
struct omap_overlayr contains info and info_dirty fields, both of which
should be internal to apply.c.

This patch moves those fields into ovl_priv data, and names them
user_info and user_info_dirty.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c   |   51 
 drivers/video/omap2/dss/overlay.c |   53 +++--
 drivers/video/omap2/omapfb/omapfb-ioctl.c |   12 +++---
 drivers/video/omap2/omapfb/omapfb-main.c  |   12 --
 include/video/omapdss.h   |3 --
 5 files changed, 93 insertions(+), 38 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index de1ac24..eac0041 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -55,6 +55,10 @@
  */
 
 struct ovl_priv_data {
+
+   bool user_info_dirty;
+   struct omap_overlay_info user_info;
+
/* If true, cache changed, but not written to shadow registers. Set
 * in apply(), cleared when registers written. */
bool dirty;
@@ -129,7 +133,38 @@ static struct mgr_priv_data *get_mgr_priv(struct 
omap_overlay_manager *mgr)
 
 void dss_apply_init(void)
 {
+   const int num_ovls = dss_feat_get_num_ovls();
+   int i;
+
spin_lock_init(data_lock);
+
+   for (i = 0; i  num_ovls; ++i) {
+   struct ovl_priv_data *op;
+
+   op = dss_data.ovl_priv_data_array[i];
+
+   op-info.global_alpha = 255;
+
+   switch (i) {
+   case 0:
+   op-info.zorder = 0;
+   break;
+   case 1:
+   op-info.zorder =
+   dss_has_feature(FEAT_ALPHA_FREE_ZORDER) ? 3 : 0;
+   break;
+   case 2:
+   op-info.zorder =
+   dss_has_feature(FEAT_ALPHA_FREE_ZORDER) ? 2 : 0;
+   break;
+   case 3:
+   op-info.zorder =
+   dss_has_feature(FEAT_ALPHA_FREE_ZORDER) ? 1 : 0;
+   break;
+   }
+
+   op-user_info = op-info;
+   }
 }
 
 static bool ovl_manual_update(struct omap_overlay *ovl)
@@ -575,15 +610,15 @@ static void omap_dss_mgr_apply_ovl(struct omap_overlay 
*ovl)
 
if (ovl-manager_changed) {
ovl-manager_changed = false;
-   ovl-info_dirty  = true;
+   op-user_info_dirty  = true;
}
 
-   if (!ovl-info_dirty)
+   if (!op-user_info_dirty)
return;
 
-   ovl-info_dirty = false;
+   op-user_info_dirty = false;
op-dirty = true;
-   op-info = ovl-info;
+   op-info = op-user_info;
 
op-channel = ovl-manager-id;
 }
@@ -821,12 +856,13 @@ err:
 int dss_ovl_set_info(struct omap_overlay *ovl,
struct omap_overlay_info *info)
 {
+   struct ovl_priv_data *op = get_ovl_priv(ovl);
unsigned long flags;
 
spin_lock_irqsave(data_lock, flags);
 
-   ovl-info = *info;
-   ovl-info_dirty = true;
+   op-user_info = *info;
+   op-user_info_dirty = true;
 
spin_unlock_irqrestore(data_lock, flags);
 
@@ -836,11 +872,12 @@ int dss_ovl_set_info(struct omap_overlay *ovl,
 void dss_ovl_get_info(struct omap_overlay *ovl,
struct omap_overlay_info *info)
 {
+   struct ovl_priv_data *op = get_ovl_priv(ovl);
unsigned long flags;
 
spin_lock_irqsave(data_lock, flags);
 
-   *info = ovl-info;
+   *info = op-user_info;
 
spin_unlock_irqrestore(data_lock, flags);
 }
diff --git a/drivers/video/omap2/dss/overlay.c 
b/drivers/video/omap2/dss/overlay.c
index 7d7cdf6..8d036e6 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -124,19 +124,31 @@ err:
 
 static ssize_t overlay_input_size_show(struct omap_overlay *ovl, char *buf)
 {
+   struct omap_overlay_info info;
+
+   ovl-get_overlay_info(ovl, info);
+
return snprintf(buf, PAGE_SIZE, %d,%d\n,
-   ovl-info.width, ovl-info.height);
+   info.width, info.height);
 }
 
 static ssize_t overlay_screen_width_show(struct omap_overlay *ovl, char *buf)
 {
-   return snprintf(buf, PAGE_SIZE, %d\n, ovl-info.screen_width);
+   struct omap_overlay_info info;
+
+   ovl-get_overlay_info(ovl, info);
+
+   return snprintf(buf, PAGE_SIZE, %d\n, info.screen_width);
 }
 
 static ssize_t overlay_position_show(struct omap_overlay *ovl, char *buf)
 {
+   struct omap_overlay_info info;
+
+   ovl-get_overlay_info(ovl, info);
+
return snprintf(buf, PAGE_SIZE, %d,%d\n,
-   ovl-info.pos_x, ovl-info.pos_y);
+   info.pos_x, info.pos_y);
 }
 
 static ssize_t overlay_position_store(struct omap_overlay *ovl,
@@ -170,8 +182,12 @@ static ssize_t 

[PATCH 46/65] OMAPDSS: APPLY: rewrite register writing

2011-11-22 Thread Tomi Valkeinen
The functions writing to the DISPC registers in apply.c are more complex
than needed. This patch cleans things up.

Two helper functions are added: need_isr(), which returns if an isr for
VSYNC is needed, and need_go(), which tells if there has been a write to
the shadow registers and we need to set the GO bit.

The functions that call the actual dispc write functions will set the
dirty and shadow_dirty flags themselves, instead of that being done on
the caller side. The writing functions also check if the dirty flag is
even set, and return immediately if not.

This allows us to clean up dss_write_regs().

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |  290 +-
 1 files changed, 130 insertions(+), 160 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 2c60e77..c4106b6 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -88,9 +88,6 @@ struct mgr_priv_data {
 
struct omap_overlay_manager_info info;
 
-   bool manual_update;
-   bool do_manual_update;
-
/* If true, GO bit is up and shadow registers cannot be written.
 * Never true for manual update displays */
bool busy;
@@ -111,6 +108,8 @@ static spinlock_t data_lock;
 /* lock for blocking functions */
 static DEFINE_MUTEX(apply_lock);
 
+static void dss_register_vsync_isr(void);
+
 static struct ovl_priv_data *get_ovl_priv(struct omap_overlay *ovl)
 {
return dss_data.ovl_priv_data_array[ovl-id];
@@ -136,6 +135,70 @@ static bool mgr_manual_update(struct omap_overlay_manager 
*mgr)
return mgr-device-caps  OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
 }
 
+static bool need_isr(void)
+{
+   const int num_mgrs = dss_feat_get_num_mgrs();
+   int i;
+
+   for (i = 0; i  num_mgrs; ++i) {
+   struct omap_overlay_manager *mgr;
+   struct mgr_priv_data *mp;
+   struct omap_overlay *ovl;
+
+   mgr = omap_dss_get_overlay_manager(i);
+   mp = get_mgr_priv(mgr);
+
+   if (!mp-enabled)
+   continue;
+
+   if (mgr_manual_update(mgr))
+   continue;
+
+   /* to catch GO bit going down */
+   if (mp-busy)
+   return true;
+
+   /* to write new values to registers */
+   if (mp-dirty)
+   return true;
+
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   struct ovl_priv_data *op;
+
+   op = get_ovl_priv(ovl);
+
+   if (!op-enabled)
+   continue;
+
+   /* to write new values to registers */
+   if (op-dirty || op-extra_info_dirty)
+   return true;
+   }
+   }
+
+   return false;
+}
+
+static bool need_go(struct omap_overlay_manager *mgr)
+{
+   struct omap_overlay *ovl;
+   struct mgr_priv_data *mp;
+   struct ovl_priv_data *op;
+
+   mp = get_mgr_priv(mgr);
+
+   if (mp-shadow_dirty)
+   return true;
+
+   list_for_each_entry(ovl, mgr-overlays, list) {
+   op = get_ovl_priv(ovl);
+   if (op-shadow_dirty || op-shadow_extra_info_dirty)
+   return true;
+   }
+
+   return false;
+}
+
 int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
 {
unsigned long timeout = msecs_to_jiffies(500);
@@ -257,20 +320,19 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
return r;
 }
 
-static int dss_ovl_write_regs(struct omap_overlay *ovl)
+static void dss_ovl_write_regs(struct omap_overlay *ovl)
 {
-   struct ovl_priv_data *op;
+   struct ovl_priv_data *op = get_ovl_priv(ovl);
struct omap_overlay_info *oi;
bool ilace, replication;
int r;
 
DSSDBGF(%d, ovl-id);
 
-   op = get_ovl_priv(ovl);
-   oi = op-info;
+   if (!op-enabled || !op-dirty)
+   return;
 
-   if (!op-enabled)
-   return 0;
+   oi = op-info;
 
replication = dss_use_replication(ovl-manager-device, oi-color_mode);
 
@@ -280,15 +342,22 @@ static int dss_ovl_write_regs(struct omap_overlay *ovl)
 
r = dispc_ovl_setup(ovl-id, oi, ilace, replication);
if (r) {
-   /* this shouldn't happen */
+   /*
+* We can't do much here, as this function can be called from
+* vsync interrupt.
+*/
DSSERR(dispc_ovl_setup failed for ovl %d\n, ovl-id);
-   dispc_ovl_enable(ovl-id, 0);
-   return r;
+
+   /* This will leave fifo configurations in a nonoptimal state */
+   op-enabled = false;
+   dispc_ovl_enable(ovl-id, false);
+   return;
}
 

[PATCH 42/65] OMAPDSS: DSI: call mgr_enable/disable for cmd mode displays

2011-11-22 Thread Tomi Valkeinen
The current code uses dsi_video_mode_enable/disable functions to
enable/disable DISPC output for video mode displays. For command mode
displays we have no notion in the DISPC side of whether the panel is
enabled, except when a dss_start_update() call is made.

However, to properly maintain the DISPC state in apply.c, we need to
know if a manager used for a manual update display is currently in use.

This patch achieves that by changing dsi_video_mode_enable/disable to
dsi_enable/disable_video_output, which is called by both video and
command mode displays. For video mode displays it starts the actual
pixel stream, as it did before. For command mode displays it doesn't do
anything else than mark that the manager is currently in use.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/displays/panel-taal.c |6 ++
 drivers/video/omap2/dss/apply.c   |6 ++-
 drivers/video/omap2/dss/dsi.c |   73 +++-
 include/video/omapdss.h   |4 +-
 4 files changed, 51 insertions(+), 38 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-taal.c 
b/drivers/video/omap2/displays/panel-taal.c
index dd64bd1..00c5c61 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -1182,6 +1182,10 @@ static int taal_power_on(struct omap_dss_device *dssdev)
if (r)
goto err;
 
+   r = dsi_enable_video_output(dssdev, td-channel);
+   if (r)
+   goto err;
+
td-enabled = 1;
 
if (!td-intro_printed) {
@@ -1211,6 +1215,8 @@ static void taal_power_off(struct omap_dss_device *dssdev)
struct taal_data *td = dev_get_drvdata(dssdev-dev);
int r;
 
+   dsi_disable_video_output(dssdev, td-channel);
+
r = taal_dcs_write_0(td, MIPI_DCS_SET_DISPLAY_OFF);
if (!r)
r = taal_sleep_in(td);
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 9ad2a36..66f4c56 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -648,7 +648,8 @@ void dss_mgr_enable(struct omap_overlay_manager *mgr)
 {
mutex_lock(apply_lock);
 
-   dispc_mgr_enable(mgr-id, true);
+   if (!mgr_manual_update(mgr))
+   dispc_mgr_enable(mgr-id, true);
mgr-enabled = true;
 
mutex_unlock(apply_lock);
@@ -658,7 +659,8 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
 {
mutex_lock(apply_lock);
 
-   dispc_mgr_enable(mgr-id, false);
+   if (!mgr_manual_update(mgr))
+   dispc_mgr_enable(mgr-id, false);
mgr-enabled = false;
 
mutex_unlock(apply_lock);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 08d3de90..a35f3fb 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -3939,65 +3939,70 @@ static void dsi_proto_timings(struct omap_dss_device 
*dssdev)
}
 }
 
-int dsi_video_mode_enable(struct omap_dss_device *dssdev, int channel)
+int dsi_enable_video_output(struct omap_dss_device *dssdev, int channel)
 {
struct platform_device *dsidev = dsi_get_dsidev_from_dssdev(dssdev);
int bpp = dsi_get_pixel_size(dssdev-panel.dsi_pix_fmt);
u8 data_type;
u16 word_count;
 
-   switch (dssdev-panel.dsi_pix_fmt) {
-   case OMAP_DSS_DSI_FMT_RGB888:
-   data_type = MIPI_DSI_PACKED_PIXEL_STREAM_24;
-   break;
-   case OMAP_DSS_DSI_FMT_RGB666:
-   data_type = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
-   break;
-   case OMAP_DSS_DSI_FMT_RGB666_PACKED:
-   data_type = MIPI_DSI_PACKED_PIXEL_STREAM_18;
-   break;
-   case OMAP_DSS_DSI_FMT_RGB565:
-   data_type = MIPI_DSI_PACKED_PIXEL_STREAM_16;
-   break;
-   default:
-   BUG();
-   };
+   if (dssdev-panel.dsi_mode == OMAP_DSS_DSI_VIDEO_MODE) {
+   switch (dssdev-panel.dsi_pix_fmt) {
+   case OMAP_DSS_DSI_FMT_RGB888:
+   data_type = MIPI_DSI_PACKED_PIXEL_STREAM_24;
+   break;
+   case OMAP_DSS_DSI_FMT_RGB666:
+   data_type = MIPI_DSI_PIXEL_STREAM_3BYTE_18;
+   break;
+   case OMAP_DSS_DSI_FMT_RGB666_PACKED:
+   data_type = MIPI_DSI_PACKED_PIXEL_STREAM_18;
+   break;
+   case OMAP_DSS_DSI_FMT_RGB565:
+   data_type = MIPI_DSI_PACKED_PIXEL_STREAM_16;
+   break;
+   default:
+   BUG();
+   };
 
-   dsi_if_enable(dsidev, false);
-   dsi_vc_enable(dsidev, channel, false);
+   dsi_if_enable(dsidev, false);
+   dsi_vc_enable(dsidev, channel, false);
 
-   /* MODE, 1 = video mode */
-   REG_FLD_MOD(dsidev, DSI_VC_CTRL(channel), 1, 4, 4);
+

[PATCH 41/65] OMAPDSS: APPLY: add missing uses of spinlock

2011-11-22 Thread Tomi Valkeinen
The functions in apply.c, called mostly via function pointers in overlay
and overlay_manager structs, will be divided into two groups. The other
group will not sleep and can be called from interrupts, and the other
group may sleep.

The idea is that the non-sleeping functions may only change certain
settings in overlays and managers, and those settings may only affect
the particular overlay/manager. For example, set the base address of the
overlay.

The blocking functions, however, will handle more complex configuration
changes. For example, when an overlay is enabled and fifo-merge feature
is used, we need to do the enable in multiple steps, waiting in between,
and the change affects multiple overlays and managers.

apply.c already contains a spinlock, which has been used to protect
(badly) the dss_data. This patch adds locks/unlocks of the spinlock to
the missing places, and the lock should now properly protect dss_data.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   29 +
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index fb6d3c2..9ad2a36 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -405,6 +405,9 @@ void dss_start_update(struct omap_overlay_manager *mgr)
struct mgr_priv_data *mp = get_mgr_priv(mgr);
struct ovl_priv_data *op;
struct omap_overlay *ovl;
+   unsigned long flags;
+
+   spin_lock_irqsave(data_lock, flags);
 
mp-do_manual_update = true;
dss_write_regs();
@@ -418,6 +421,8 @@ void dss_start_update(struct omap_overlay_manager *mgr)
mp-shadow_dirty = false;
 
dispc_mgr_enable(mgr-id, true);
+
+   spin_unlock_irqrestore(data_lock, flags);
 }
 
 static void dss_apply_irq_handler(void *data, u32 mask);
@@ -662,16 +667,28 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
 int dss_mgr_set_info(struct omap_overlay_manager *mgr,
struct omap_overlay_manager_info *info)
 {
+   unsigned long flags;
+
+   spin_lock_irqsave(data_lock, flags);
+
mgr-info = *info;
mgr-info_dirty = true;
 
+   spin_unlock_irqrestore(data_lock, flags);
+
return 0;
 }
 
 void dss_mgr_get_info(struct omap_overlay_manager *mgr,
struct omap_overlay_manager_info *info)
 {
+   unsigned long flags;
+
+   spin_lock_irqsave(data_lock, flags);
+
*info = mgr-info;
+
+   spin_unlock_irqrestore(data_lock, flags);
 }
 
 int dss_mgr_set_device(struct omap_overlay_manager *mgr,
@@ -745,16 +762,28 @@ err:
 int dss_ovl_set_info(struct omap_overlay *ovl,
struct omap_overlay_info *info)
 {
+   unsigned long flags;
+
+   spin_lock_irqsave(data_lock, flags);
+
ovl-info = *info;
ovl-info_dirty = true;
 
+   spin_unlock_irqrestore(data_lock, flags);
+
return 0;
 }
 
 void dss_ovl_get_info(struct omap_overlay *ovl,
struct omap_overlay_info *info)
 {
+   unsigned long flags;
+
+   spin_lock_irqsave(data_lock, flags);
+
*info = ovl-info;
+
+   spin_unlock_irqrestore(data_lock, flags);
 }
 
 int dss_ovl_set_manager(struct omap_overlay *ovl,
-- 
1.7.4.1

--
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 39/65] OMAPDSS: remove ovl/mgr check-code temporarily

2011-11-22 Thread Tomi Valkeinen
DSS currently tries to check that the given overlay and overlay manager
settings are acceptable, but the code does not work quite properly.
Things may change between the check and the actual use of the settings.

Furthermore, the following patches will rewrite how settings are
configured and managed, and trying to keep the (broken) settings
checking working during the rewrite would be very difficult.

This patch removes the checking code, and a working version of checking
will be added back after the settings rewrite has been done.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c   |   53 +
 drivers/video/omap2/dss/dss.h |2 -
 drivers/video/omap2/dss/manager.c |   17 ---
 drivers/video/omap2/dss/overlay.c |   90 -
 4 files changed, 3 insertions(+), 159 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 543a10b..b935264 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -503,10 +503,9 @@ end:
spin_unlock(data_lock);
 }
 
-static int omap_dss_mgr_apply_ovl(struct omap_overlay *ovl)
+static void omap_dss_mgr_apply_ovl(struct omap_overlay *ovl)
 {
struct ovl_priv_data *op;
-   struct omap_dss_device *dssdev;
 
op = get_ovl_priv(ovl);
 
@@ -520,21 +519,11 @@ static int omap_dss_mgr_apply_ovl(struct omap_overlay 
*ovl)
op-enabled = false;
op-dirty = true;
}
-   return 0;
+   return;
}
 
if (!ovl-info_dirty)
-   return 0;
-
-   dssdev = ovl-manager-device;
-
-   if (dss_check_overlay(ovl, dssdev)) {
-   if (op-enabled) {
-   op-enabled = false;
-   op-dirty = true;
-   }
-   return -EINVAL;
-   }
+   return;
 
ovl-info_dirty = false;
op-dirty = true;
@@ -543,8 +532,6 @@ static int omap_dss_mgr_apply_ovl(struct omap_overlay *ovl)
op-channel = ovl-manager-id;
 
op-enabled = true;
-
-   return 0;
 }
 
 static void omap_dss_mgr_apply_mgr(struct omap_overlay_manager *mgr)
@@ -665,18 +652,7 @@ void dss_mgr_disable(struct omap_overlay_manager *mgr)
 int dss_mgr_set_info(struct omap_overlay_manager *mgr,
struct omap_overlay_manager_info *info)
 {
-   int r;
-   struct omap_overlay_manager_info old_info;
-
-   old_info = mgr-info;
mgr-info = *info;
-
-   r = dss_check_manager(mgr);
-   if (r) {
-   mgr-info = old_info;
-   return r;
-   }
-
mgr-info_dirty = true;
 
return 0;
@@ -692,7 +668,6 @@ int dss_mgr_set_device(struct omap_overlay_manager *mgr,
struct omap_dss_device *dssdev)
 {
int r;
-   struct omap_overlay *ovl;
 
if (dssdev-manager) {
DSSERR(display '%s' already has a manager '%s'\n,
@@ -706,15 +681,6 @@ int dss_mgr_set_device(struct omap_overlay_manager *mgr,
return -EINVAL;
}
 
-   list_for_each_entry(ovl, mgr-overlays, list) {
-   if (!ovl-info.enabled)
-   continue;
-
-   r = dss_check_overlay(ovl, dssdev);
-   if (r)
-   return r;
-   }
-
dssdev-manager = mgr;
mgr-device = dssdev;
mgr-device_changed = true;
@@ -748,20 +714,7 @@ int dss_mgr_unset_device(struct omap_overlay_manager *mgr)
 int dss_ovl_set_info(struct omap_overlay *ovl,
struct omap_overlay_info *info)
 {
-   int r;
-   struct omap_overlay_info old_info;
-
-   old_info = ovl-info;
ovl-info = *info;
-
-   if (ovl-manager) {
-   r = dss_check_overlay(ovl, ovl-manager-device);
-   if (r) {
-   ovl-info = old_info;
-   return r;
-   }
-   }
-
ovl-info_dirty = true;
 
return 0;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index afe9713..0ef0e08 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -206,12 +206,10 @@ void default_get_overlay_fifo_thresholds(enum omap_plane 
plane,
 /* manager */
 int dss_init_overlay_managers(struct platform_device *pdev);
 void dss_uninit_overlay_managers(struct platform_device *pdev);
-int dss_check_manager(struct omap_overlay_manager *mgr);
 
 /* overlay */
 void dss_init_overlays(struct platform_device *pdev);
 void dss_uninit_overlays(struct platform_device *pdev);
-int dss_check_overlay(struct omap_overlay *ovl, struct omap_dss_device 
*dssdev);
 void dss_overlay_setup_dispc_manager(struct omap_overlay_manager *mgr);
 void dss_recheck_connections(struct omap_dss_device *dssdev, bool force);
 
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index 

[PATCH 40/65] OMAPDSS: APPLY: add mutex

2011-11-22 Thread Tomi Valkeinen
The functions in apply.c, called mostly via function pointers in overlay
and overlay_manager structs, will be divided into two groups. The other
group will not sleep and can be called from interrupts, and the other
group may sleep.

The idea is that the non-sleeping functions may only change certain
settings in overlays and managers, and those settings may only affect
the particular overlay/manager. For example, set the base address of the
overlay.

The blocking functions, however, will handle more complex configuration
changes. For example, when an overlay is enabled and fifo-merge feature
is used, we need to do the enable in multiple steps, waiting in between,
and the change affects multiple overlays and managers.

This patch adds the mutex which is used in the blocking functions to
have exclusive access to overlays and overlay managers.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c |   71 ++-
 1 files changed, 62 insertions(+), 9 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index b935264..fb6d3c2 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -97,6 +97,8 @@ static struct {
 
 /* protects dss_data */
 static spinlock_t data_lock;
+/* lock for blocking functions */
+static DEFINE_MUTEX(apply_lock);
 
 static struct ovl_priv_data *get_ovl_priv(struct omap_overlay *ovl)
 {
@@ -639,14 +641,22 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
 
 void dss_mgr_enable(struct omap_overlay_manager *mgr)
 {
+   mutex_lock(apply_lock);
+
dispc_mgr_enable(mgr-id, true);
mgr-enabled = true;
+
+   mutex_unlock(apply_lock);
 }
 
 void dss_mgr_disable(struct omap_overlay_manager *mgr)
 {
+   mutex_lock(apply_lock);
+
dispc_mgr_enable(mgr-id, false);
mgr-enabled = false;
+
+   mutex_unlock(apply_lock);
 }
 
 int dss_mgr_set_info(struct omap_overlay_manager *mgr,
@@ -669,44 +679,65 @@ int dss_mgr_set_device(struct omap_overlay_manager *mgr,
 {
int r;
 
+   mutex_lock(apply_lock);
+
if (dssdev-manager) {
DSSERR(display '%s' already has a manager '%s'\n,
   dssdev-name, dssdev-manager-name);
-   return -EINVAL;
+   r = -EINVAL;
+   goto err;
}
 
if ((mgr-supported_displays  dssdev-type) == 0) {
DSSERR(display '%s' does not support manager '%s'\n,
   dssdev-name, mgr-name);
-   return -EINVAL;
+   r = -EINVAL;
+   goto err;
}
 
dssdev-manager = mgr;
mgr-device = dssdev;
mgr-device_changed = true;
 
+   mutex_unlock(apply_lock);
+
return 0;
+err:
+   mutex_unlock(apply_lock);
+   return r;
 }
 
 int dss_mgr_unset_device(struct omap_overlay_manager *mgr)
 {
+   int r;
+
+   mutex_lock(apply_lock);
+
if (!mgr-device) {
DSSERR(failed to unset display, display not set.\n);
-   return -EINVAL;
+   r = -EINVAL;
+   goto err;
}
 
/*
 * Don't allow currently enabled displays to have the overlay manager
 * pulled out from underneath them
 */
-   if (mgr-device-state != OMAP_DSS_DISPLAY_DISABLED)
-   return -EINVAL;
+   if (mgr-device-state != OMAP_DSS_DISPLAY_DISABLED) {
+   r = -EINVAL;
+   goto err;
+   }
 
mgr-device-manager = NULL;
mgr-device = NULL;
mgr-device_changed = true;
 
+   mutex_unlock(apply_lock);
+
return 0;
+err:
+   mutex_unlock(apply_lock);
+   return r;
 }
 
 
@@ -729,18 +760,24 @@ void dss_ovl_get_info(struct omap_overlay *ovl,
 int dss_ovl_set_manager(struct omap_overlay *ovl,
struct omap_overlay_manager *mgr)
 {
+   int r;
+
if (!mgr)
return -EINVAL;
 
+   mutex_lock(apply_lock);
+
if (ovl-manager) {
DSSERR(overlay '%s' already has a manager '%s'\n,
ovl-name, ovl-manager-name);
-   return -EINVAL;
+   r = -EINVAL;
+   goto err;
}
 
if (ovl-info.enabled) {
DSSERR(overlay has to be disabled to change the manager\n);
-   return -EINVAL;
+   r = -EINVAL;
+   goto err;
}
 
ovl-manager = mgr;
@@ -760,25 +797,41 @@ int dss_ovl_set_manager(struct omap_overlay *ovl,
 * the overlay, but before moving the overlay to TV.
 */
 
+   mutex_unlock(apply_lock);
+
return 0;
+err:
+   mutex_unlock(apply_lock);
+   return r;
 }
 
 int dss_ovl_unset_manager(struct omap_overlay *ovl)
 {
+   int r;
+
+   mutex_lock(apply_lock);
+
if (!ovl-manager) {
DSSERR(failed to detach overlay: 

[PATCH 21/65] OMAPDSS: hide manager's enable/disable()

2011-11-22 Thread Tomi Valkeinen
omap_overlay_manager struct contains enable() and disable() functions.
However, these are only meant to be used from inside omapdss, and thus
it's bad to expose the functions.

This patch adds dss_mgr_enable() and dss_mgr_disable() functions to
apply.c, which handle enabling and disabling the output.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/apply.c   |   12 +++-
 drivers/video/omap2/dss/dpi.c |4 ++--
 drivers/video/omap2/dss/dsi.c |4 ++--
 drivers/video/omap2/dss/dss.h |2 ++
 drivers/video/omap2/dss/hdmi.c|6 +++---
 drivers/video/omap2/dss/manager.c |   15 ---
 drivers/video/omap2/dss/sdi.c |4 ++--
 drivers/video/omap2/dss/venc.c|4 ++--
 include/video/omapdss.h   |3 ---
 9 files changed, 24 insertions(+), 30 deletions(-)

diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
index 32dc6e6..ebc0ae1 100644
--- a/drivers/video/omap2/dss/apply.c
+++ b/drivers/video/omap2/dss/apply.c
@@ -424,7 +424,7 @@ void dss_start_update(struct omap_overlay_manager *mgr)
mc-shadow_dirty = false;
}
 
-   mgr-enable(mgr);
+   dispc_mgr_enable(mgr-id, true);
 }
 
 static void dss_apply_irq_handler(void *data, u32 mask)
@@ -654,3 +654,13 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
return r;
 }
 
+void dss_mgr_enable(struct omap_overlay_manager *mgr)
+{
+   dispc_mgr_enable(mgr-id, true);
+}
+
+void dss_mgr_disable(struct omap_overlay_manager *mgr)
+{
+   dispc_mgr_enable(mgr-id, false);
+}
+
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 976ac23..79c4df3 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -223,7 +223,7 @@ int omapdss_dpi_display_enable(struct omap_dss_device 
*dssdev)
 
mdelay(2);
 
-   dssdev-manager-enable(dssdev-manager);
+   dss_mgr_enable(dssdev-manager);
 
return 0;
 
@@ -249,7 +249,7 @@ EXPORT_SYMBOL(omapdss_dpi_display_enable);
 
 void omapdss_dpi_display_disable(struct omap_dss_device *dssdev)
 {
-   dssdev-manager-disable(dssdev-manager);
+   dss_mgr_disable(dssdev-manager);
 
if (dpi_use_dsi_pll(dssdev)) {
dss_select_dispc_clk_source(OMAP_DSS_CLK_SRC_FCK);
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index e5a2dcc..08d3de90 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -3976,7 +3976,7 @@ int dsi_video_mode_enable(struct omap_dss_device *dssdev, 
int channel)
dsi_vc_enable(dsidev, channel, true);
dsi_if_enable(dsidev, true);
 
-   dssdev-manager-enable(dssdev-manager);
+   dss_mgr_enable(dssdev-manager);
 
return 0;
 }
@@ -3995,7 +3995,7 @@ void dsi_video_mode_disable(struct omap_dss_device 
*dssdev, int channel)
dsi_vc_enable(dsidev, channel, true);
dsi_if_enable(dsidev, true);
 
-   dssdev-manager-disable(dssdev-manager);
+   dss_mgr_disable(dssdev-manager);
 }
 EXPORT_SYMBOL(dsi_video_mode_disable);
 
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 6fbbee4..66fed79 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -169,6 +169,8 @@ int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr);
 int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl);
 void dss_start_update(struct omap_overlay_manager *mgr);
 int omap_dss_mgr_apply(struct omap_overlay_manager *mgr);
+void dss_mgr_enable(struct omap_overlay_manager *mgr);
+void dss_mgr_disable(struct omap_overlay_manager *mgr);
 
 /* display */
 int dss_suspend_all_devices(void);
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index c56378c..e245a2b 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -333,7 +333,7 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
if (r)
return r;
 
-   dispc_mgr_enable(OMAP_DSS_CHANNEL_DIGIT, 0);
+   dss_mgr_disable(dssdev-manager);
 
p = dssdev-panel.timings;
 
@@ -387,7 +387,7 @@ static int hdmi_power_on(struct omap_dss_device *dssdev)
 
hdmi.ip_data.ops-video_enable(hdmi.ip_data, 1);
 
-   dispc_mgr_enable(OMAP_DSS_CHANNEL_DIGIT, 1);
+   dss_mgr_enable(dssdev-manager);
 
return 0;
 err:
@@ -397,7 +397,7 @@ err:
 
 static void hdmi_power_off(struct omap_dss_device *dssdev)
 {
-   dispc_mgr_enable(OMAP_DSS_CHANNEL_DIGIT, 0);
+   dss_mgr_disable(dssdev-manager);
 
hdmi.ip_data.ops-video_enable(hdmi.ip_data, 0);
hdmi.ip_data.ops-phy_disable(hdmi.ip_data);
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index f9e691b..780a307 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -585,18 +585,6 @@ static void omap_dss_mgr_get_info(struct 
omap_overlay_manager *mgr,
*info = mgr-info;
 

[PATCH 20/65] OMAPDSS: create apply.c

2011-11-22 Thread Tomi Valkeinen
Create a new file, apply.c, and move code about handling the
apply-mechanism and configuration of the managers and overlays from
manager.c to apply.c.

Not all related code is moved in this patch, but only the core
apply/configure functions. The later patches move rest of the code from
overlay.c and manager.c, adding necessary locking at the same time.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/Makefile  |3 +-
 drivers/video/omap2/dss/apply.c   |  656 +
 drivers/video/omap2/dss/core.c|2 +
 drivers/video/omap2/dss/dss.h |9 +-
 drivers/video/omap2/dss/manager.c |  621 ---
 5 files changed, 667 insertions(+), 624 deletions(-)
 create mode 100644 drivers/video/omap2/dss/apply.c

diff --git a/drivers/video/omap2/dss/Makefile b/drivers/video/omap2/dss/Makefile
index bd34ac5..8594522 100644
--- a/drivers/video/omap2/dss/Makefile
+++ b/drivers/video/omap2/dss/Makefile
@@ -1,5 +1,6 @@
 obj-$(CONFIG_OMAP2_DSS) += omapdss.o
-omapdss-y := core.o dss.o dss_features.o dispc.o display.o manager.o overlay.o
+omapdss-y := core.o dss.o dss_features.o dispc.o display.o manager.o overlay.o 
\
+   apply.o
 omapdss-$(CONFIG_OMAP2_DSS_DPI) += dpi.o
 omapdss-$(CONFIG_OMAP2_DSS_RFBI) += rfbi.o
 omapdss-$(CONFIG_OMAP2_DSS_VENC) += venc.o
diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
new file mode 100644
index 000..32dc6e6
--- /dev/null
+++ b/drivers/video/omap2/dss/apply.c
@@ -0,0 +1,656 @@
+/*
+ * Copyright (C) 2011 Texas Instruments
+ * Author: Tomi Valkeinen tomi.valkei...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program.  If not, see http://www.gnu.org/licenses/.
+ */
+
+#define DSS_SUBSYS_NAME APPLY
+
+#include linux/kernel.h
+#include linux/slab.h
+#include linux/spinlock.h
+#include linux/jiffies.h
+
+#include video/omapdss.h
+
+#include dss.h
+#include dss_features.h
+
+/*
+ * We have 4 levels of cache for the dispc settings. First two are in SW and
+ * the latter two in HW.
+ *
+ * ++
+ * |overlay/manager_info|
+ * ++
+ *  v
+ *apply()
+ *  v
+ * ++
+ * | dss_cache  |
+ * ++
+ *  v
+ *  configure()
+ *  v
+ * ++
+ * |  shadow registers  |
+ * ++
+ *  v
+ * VFP or lcd/digit_enable
+ *  v
+ * ++
+ * |  registers |
+ * ++
+ */
+
+struct overlay_cache_data {
+   /* If true, cache changed, but not written to shadow registers. Set
+* in apply(), cleared when registers written. */
+   bool dirty;
+   /* If true, shadow registers contain changed values not yet in real
+* registers. Set when writing to shadow registers, cleared at
+* VSYNC/EVSYNC */
+   bool shadow_dirty;
+
+   bool enabled;
+
+   struct omap_overlay_info info;
+
+   enum omap_channel channel;
+
+   u32 fifo_low;
+   u32 fifo_high;
+};
+
+struct manager_cache_data {
+   /* If true, cache changed, but not written to shadow registers. Set
+* in apply(), cleared when registers written. */
+   bool dirty;
+   /* If true, shadow registers contain changed values not yet in real
+* registers. Set when writing to shadow registers, cleared at
+* VSYNC/EVSYNC */
+   bool shadow_dirty;
+
+   struct omap_overlay_manager_info info;
+
+   bool manual_update;
+   bool do_manual_update;
+};
+
+static struct {
+   spinlock_t lock;
+   struct overlay_cache_data overlay_cache[MAX_DSS_OVERLAYS];
+   struct manager_cache_data manager_cache[MAX_DSS_MANAGERS];
+
+   bool irq_enabled;
+} dss_cache;
+
+void dss_apply_init(void)
+{
+   spin_lock_init(dss_cache.lock);
+}
+
+static bool ovl_manual_update(struct omap_overlay *ovl)
+{
+   return ovl-manager-device-caps  OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
+}
+
+static bool mgr_manual_update(struct omap_overlay_manager *mgr)
+{
+   return mgr-device-caps  OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
+}
+
+static int overlay_enabled(struct omap_overlay *ovl)
+{
+   return ovl-info.enabled  ovl-manager  ovl-manager-device;
+}
+
+int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
+{
+   unsigned long timeout = msecs_to_jiffies(500);
+   struct manager_cache_data *mc;
+   u32 irq;
+   int r;
+   

[PATCH 17/65] OMAPDSS: add ovl/mgr_manual_update() helpers

2011-11-22 Thread Tomi Valkeinen
Add helper functions ovl_manual_update() and mgr_manual_update() which
return whether the overlay or manager is used with a manual update
display.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 drivers/video/omap2/dss/manager.c |   19 +++
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index fc19f01..e8838d3 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -538,7 +538,15 @@ static struct {
bool irq_enabled;
 } dss_cache;
 
+static bool ovl_manual_update(struct omap_overlay *ovl)
+{
+   return ovl-manager-device-caps  OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
+}
 
+static bool mgr_manual_update(struct omap_overlay_manager *mgr)
+{
+   return mgr-device-caps  OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
+}
 
 static int omap_dss_set_device(struct omap_overlay_manager *mgr,
struct omap_dss_device *dssdev)
@@ -627,7 +635,7 @@ static int dss_mgr_wait_for_go(struct omap_overlay_manager 
*mgr)
if (!dssdev || dssdev-state != OMAP_DSS_DISPLAY_ACTIVE)
return 0;
 
-   if (dssdev-caps  OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE)
+   if (mgr_manual_update(mgr))
return 0;
 
if (dssdev-type == OMAP_DISPLAY_TYPE_VENC
@@ -696,7 +704,7 @@ int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl)
if (!dssdev || dssdev-state != OMAP_DSS_DISPLAY_ACTIVE)
return 0;
 
-   if (dssdev-caps  OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE)
+   if (ovl_manual_update(ovl))
return 0;
 
if (dssdev-type == OMAP_DISPLAY_TYPE_VENC
@@ -1047,8 +1055,6 @@ static int omap_dss_mgr_apply(struct omap_overlay_manager 
*mgr)
 
/* Configure managers */
list_for_each_entry(mgr, manager_list, list) {
-   struct omap_dss_device *dssdev;
-
mc = dss_cache.manager_cache[mgr-id];
 
if (mgr-device_changed) {
@@ -1062,14 +1068,11 @@ static int omap_dss_mgr_apply(struct 
omap_overlay_manager *mgr)
if (!mgr-device)
continue;
 
-   dssdev = mgr-device;
-
mgr-info_dirty = false;
mc-dirty = true;
mc-info = mgr-info;
 
-   mc-manual_update =
-   dssdev-caps  OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
+   mc-manual_update = mgr_manual_update(mgr);
}
 
/* Configure overlay fifos */
-- 
1.7.4.1

--
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] omap_dss: add FocalTech ETM070003DH6 display support

2011-11-22 Thread Tomi Valkeinen
On Sun, 2011-11-20 at 19:15 +0100, Ilya Yanok wrote:
 Add data for the FocalTech ETM070003DH6 display to the generic_dpi_panel
 display driver.
 
 Signed-off-by: Ilya Yanok ya...@emcraft.com
 ---
 Changes from V1:
  - acb, acbi, power_on_delay and power_off_delay fields removed.
 
  drivers/video/omap2/displays/panel-generic-dpi.c |   20 
  1 files changed, 20 insertions(+), 0 deletions(-)

Thanks, applied to DSS tree.

 Tomi



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


USB video capture shuts up - 2

2011-11-22 Thread Andrew Pushkin
Hello. I need to use USB Web camera with TI AM3505 and TI AM3517 . I
use kernel 2.6.37 from arago. I test it, its work but sometimes I have
problems, that other users see in other TI CPU:
http://thread.gmane.org/gmane.linux.ports.arm.omap/35912/focus=36095
Sometimes camera do not work after 10-15 min of working. This is dmesg
(when this bug is reproduced) (I do not disconnect web camera but
linux think so(?)):
[   53.696228] ehci-omap ehci-omap.0: remove, state 1
[   53.696258] usb usb1: USB disconnect, address 1
[   53.696350] usb 1-1: USB disconnect, address 2
[   53.696350] usb 1-1.4: USB disconnect, address 3
[   53.773498] ehci-omap ehci-omap.0: force halt; handshake fa064814
c000  - -110
[   54.113677] ehci-omap ehci-omap.0: USB bus 1 deregistered
[   54.524505] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[   54.524658] ehci-omap.0 supply hsusb0 not found, using dummy regulator
[   55.532257] ehci-omap ehci-omap.0: OMAP-EHCI Host Controller
[   55.532318] ehci-omap ehci-omap.0: new USB bus registered, assigned
bus number 1
[   55.540313] ehci-omap ehci-omap.0: irq 77, io mem 0x48064800
[   55.555725] ehci-omap ehci-omap.0: USB 2.0 started, EHCI 1.00
[   55.555877] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
[   55.555877] usb usb1: New USB device strings: Mfr=3, Product=2,
SerialNumber=1
[   55.555908] usb usb1: Product: OMAP-EHCI Host Controller
[   55.555908] usb usb1: Manufacturer: Linux 2.6.37-svn1014 ehci_hcd
[   55.555938] usb usb1: SerialNumber: ehci-omap.0
And camera and other USB devices do not work until reboot.
I test it with various web cameras, with and without USB hub with
external power. This bug is exists.

-- 
Andrew Pushkin
--
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


Inclusion of ARM perf tree in linux-next

2011-11-22 Thread Will Deacon
Hi Stephen,

I maintain the ARM perf backend and would be very grateful if you could
please include this branch in linux-next:

git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git for-next/perf

This request has arisen specifically from some work with the OMAP guys
where it would be useful to spot any conflicts for 3.3, however I think it's
generally a good idea for me to give some of the perf changes an airing
before they get merged anyway.

The merge path for these patches into mainline is usually via Russell, but
platform updates may go via arm-soc (Arnd).

Thanks,

Will
--
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: [RFC 1/3] pinctrl: add a driver for the OMAP pinmux

2011-11-22 Thread Thomas Abraham
Hi Linus,

On 17 November 2011 19:27, Linus Walleij linus.wall...@linaro.org wrote:
 On Thu, Nov 17, 2011 at 12:26 PM, Thomas Abraham
 thomas.abra...@linaro.org wrote:

 For now, the Samsung GPIO, Pinconfig and Pinmux information is
 represented in device tree as listed below.

 Does this mean that the understanding of this format is merged into
 the mainline kernel drivers or is it keps out-of-tree?


All existing dt support in samsung drivers use this format and it
works fine. But I could not complete work on time and pull request for
samsung-dt support for 3.2 was delayed and hence rejected. So for now,
it is out of tree but available in linux-next.


 i2c@1C004000 {
          compatible = ...;
          reg = 0x... 0x..;
           gpios = gpa0 2 2 3 0,
                      gpa0 3 2 3 0;
          ...
 };

 The format of the gpio specifier is
 [Pad Controller phandle] [pin number within the controller] [Pin Mux
 Function] [Pull Up/Down] [Drive Strength]

 From a perspective of writing a 'gpios' property for a device node,
 this is quite simple. Looking up the hardware manual of the SoC can
 provide all the values that should be used in the gpio specifier.

 That may not be as simple as it seems if all you have is the
 device tree and no manual, but I get the picture.

 The GPIO/PinCtrl driver can provide a translate function that picks up
 the values for the gpio specifier and writes the same value to the
 pad-controller registers. But, this a deviation from the existing
 pinctrl subsystem code which mainly relies on name of the pin-group
 and pin-function.

 Does this seem to be a feasible option for specifying
 gpio/pinconfig/pinmux dt bindings?

 I would prefer the above to use the nice generic enums from the
 pin control subsystem's pinmux and pinconf properties in the
 end so the device tree on its own is understandable without
 any manual whatsoever, but we'll see about that.


This may lead to linux specific information getting into the device
tree. And that might not be acceptable.


 Maybe I'm mistaken about the device tree ambitions, but
 I was sort of hoping that it would not contain too much
 custom magic numbers that need to be cross-referenced
 elsewhere ... or rather - the more understandable the device
 tree is, the more we win.

Device tree is expected to describe the hardware. So to
cross-reference the hardware manual to understand device tree should
be fine I guess. For instance, GPIO numbers in dts would be written as
a numeric number and not a enum or other format. And by looking up the
manual, we understand the actual details of the GPIO pin.

If dt-compiler had a option to support #define like in C, the numbers
could have been made more easier to understand. Like, 3 to mean
GPIO_PULL_UP in Exynos dts file.

Thanks,
Thomas.
--
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 0/7] Introducing a generic AMP framework

2011-11-22 Thread Ohad Ben-Cohen
On Wed, Oct 26, 2011 at 6:00 AM, Rusty Russell ru...@rustcorp.com.au wrote:
 On Tue, 25 Oct 2011 11:48:19 +0200, Ohad Ben-Cohen o...@wizery.com wrote:
 Modern SoCs typically employ a central symmetric multiprocessing (SMP)
 application processor running Linux, with several other asymmetric
 multiprocessing (AMP) heterogeneous processors running different instances
 of operating system, whether Linux or any other flavor of real-time OS.

 OK, I'm not even sure who this should go through

We shortly discussed this in ELCE, and this can either go through the
arm-soc tree or directly to Linus; however Arnd prefers really.

The previous RFC iteration was reviewed quite extensively (especially
by Grant. thanks Grant!) but I was hoping to get some more review or
feedback on this iteration as well (any form of Acked-by, Reviewed-by,
+1-by or No-way-by are welcome).

At this point I know of at least four vendors (besides TI) who are
actively looking into supporting this, and it's getting a bit hard to
collaborate, so I plan to get this into linux-next later this week
(minus the virtio-spec.txt change which I'll send directly to you,
Rusty) in the hope of getting this merged into 3.3.

, but no objections here

Can I add your Acked-by on the virtio parts (mainly patches 3 and 6) ?

Thanks!
Ohad.
--
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 06/65] OMAPDSS: remove partial update from the overlay manager

2011-11-22 Thread Archit Taneja

On Tuesday 22 November 2011 02:51 PM, Tomi Valkeinen wrote:

Partial update for manual update displays has never worked quite well:
* The HW has limitations on the update area, and the x and width need to
   be even.


There are also some issues with partial update on OMAP4 even when 'x and 
width are even'. There seems to be DISPC timeouts when the update area 
is too small. Its easy to reproduce it by running the 'rect' test for a 
while. For those who are interested, the rect testcase can be found in:


git://gitorious.org/linux-omap-dss2/omapfb-tests.git

Archit


* Showing a part of a scaled overlay causes artifacts.
* Makes the management of dispc very complex

Considering the above points and the fact that partial update is not
used anywhere, this and the following patches remove the partial update
support. This will greatly simplify the following re-write of the apply
mechanism to get proper locking and additional features like fifo-merge.

This patch removes the partial update from the manager.c.

Signed-off-by: Tomi Valkeinentomi.valkei...@ti.com
---
  drivers/video/omap2/dss/dsi.c |2 -
  drivers/video/omap2/dss/dss.h |3 -
  drivers/video/omap2/dss/manager.c |  333 +
  drivers/video/omap2/dss/rfbi.c|1 -
  4 files changed, 6 insertions(+), 333 deletions(-)

diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 5abf8e7..787cebd 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -4172,8 +4172,6 @@ int omap_dsi_prepare_update(struct omap_dss_device 
*dssdev,

dsi_perf_mark_setup(dsidev);

-   dss_setup_partial_planes(dssdev, x, y, w, h,
-   enlarge_update_area);
dispc_mgr_set_lcd_size(dssdev-manager-id, *w, *h);

return 0;
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 313a7ca..7f6a612 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -182,9 +182,6 @@ void default_get_overlay_fifo_thresholds(enum omap_plane 
plane,
  int dss_init_overlay_managers(struct platform_device *pdev);
  void dss_uninit_overlay_managers(struct platform_device *pdev);
  int dss_mgr_wait_for_go_ovl(struct omap_overlay *ovl);
-void dss_setup_partial_planes(struct omap_dss_device *dssdev,
-   u16 *x, u16 *y, u16 *w, u16 *h,
-   bool enlarge_update_area);
  void dss_start_update(struct omap_dss_device *dssdev);

  /* overlay */
diff --git a/drivers/video/omap2/dss/manager.c 
b/drivers/video/omap2/dss/manager.c
index 1be5f47..c616f85 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -530,13 +530,6 @@ struct manager_cache_data {

bool manual_update;
bool do_manual_update;
-
-   /* manual update region */
-   u16 x, y, w, h;
-
-   /* enlarge the update area if the update area contains scaled
-* overlays */
-   bool enlarge_update_area;
  };

  static struct {
@@ -762,65 +755,11 @@ static int overlay_enabled(struct omap_overlay *ovl)
return ovl-info.enabled  ovl-manager  ovl-manager-device;
  }

-/* Is rect1 a subset of rect2? */
-static bool rectangle_subset(int x1, int y1, int w1, int h1,
-   int x2, int y2, int w2, int h2)
-{
-   if (x1  x2 || y1  y2)
-   return false;
-
-   if (x1 + w1  x2 + w2)
-   return false;
-
-   if (y1 + h1  y2 + h2)
-   return false;
-
-   return true;
-}
-
-/* Do rect1 and rect2 overlap? */
-static bool rectangle_intersects(int x1, int y1, int w1, int h1,
-   int x2, int y2, int w2, int h2)
-{
-   if (x1= x2 + w2)
-   return false;
-
-   if (x2= x1 + w1)
-   return false;
-
-   if (y1= y2 + h2)
-   return false;
-
-   if (y2= y1 + h1)
-   return false;
-
-   return true;
-}
-
-static bool dispc_is_overlay_scaled(struct overlay_cache_data *oc)
-{
-   struct omap_overlay_info *oi =oc-info;
-
-   if (oi-out_width != 0  oi-width != oi-out_width)
-   return true;
-
-   if (oi-out_height != 0  oi-height != oi-out_height)
-   return true;
-
-   return false;
-}
-
  static int configure_overlay(enum omap_plane plane)
  {
struct overlay_cache_data *c;
-   struct manager_cache_data *mc;
-   struct omap_overlay_info *oi, new_oi;
-   struct omap_overlay_manager_info *mi;
-   u16 outw, outh;
-   u16 x, y, w, h;
-   u32 paddr;
+   struct omap_overlay_info *oi;
int r;
-   u16 orig_w, orig_h, orig_outw, orig_outh;

DSSDBGF(%d, plane);

@@ -832,120 +771,7 @@ static int configure_overlay(enum omap_plane plane)
return 0;
}

-   mc =dss_cache.manager_cache[c-channel];
-   mi =mc-info;
-
-   x = oi-pos_x;
-   y = oi-pos_y;
-   w = oi-width;
-   h = oi-height;
-   outw 

Re: [PATCH 08/65] OMAPDSS: remove partial update from panel-taal

2011-11-22 Thread Archit Taneja

On Tuesday 22 November 2011 02:51 PM, Tomi Valkeinen wrote:

Partial update for manual update displays has never worked quite well:
* The HW has limitations on the update area, and the x and width need to
   be even.
* Showing a part of a scaled overlay causes artifacts.
* Makes the management of dispc very complex

Considering the above points and the fact that partial update is not
used anywhere, this and the following patches remove the partial update
support. This will greatly simplify the following re-write of the apply
mechanism to get proper locking and additional features like fifo-merge.

This patch removes the partial update from the panel-taal.c.

Signed-off-by: Tomi Valkeinentomi.valkei...@ti.com
---
  drivers/video/omap2/displays/panel-taal.c |   16 
  1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/video/omap2/displays/panel-taal.c 
b/drivers/video/omap2/displays/panel-taal.c
index 0aa6c5d..dd64bd1 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -198,12 +198,6 @@ struct taal_data {
bool te_enabled;

atomic_t do_update;
-   struct {
-   u16 x;
-   u16 y;
-   u16 w;
-   u16 h;
-   } update_region;
int channel;

struct delayed_work te_timeout_work;
@@ -1440,16 +1434,14 @@ static int taal_update(struct omap_dss_device *dssdev,
goto err;
}

-   r = taal_set_update_window(td, x, y, w, h);
+   /* XXX no need to send this every frame, but dsi break if not done */
+   r = taal_set_update_window(td, 0, 0,
+   td-panel_config-timings.x_res,
+   td-panel_config-timings.y_res);


How about sending a null short packet, and a BTA after that. This will 
keep automatic TE mode in place, and we'll need to send 1 short packet 
instead of 2 long packets every frame.


We should of course do this if we aren't planning to get partial update 
back in the near future.


Archit


if (r)
goto err;

if (td-te_enabled  panel_data-use_ext_te) {
-   td-update_region.x = x;
-   td-update_region.y = y;
-   td-update_region.w = w;
-   td-update_region.h = h;
-   barrier();
schedule_delayed_work(td-te_timeout_work,
msecs_to_jiffies(250));
atomic_set(td-do_update, 1);


--
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: [RFC 1/3] pinctrl: add a driver for the OMAP pinmux

2011-11-22 Thread Linus Walleij
On Tue, Nov 22, 2011 at 12:09 PM, Thomas Abraham
thomas.abra...@linaro.org wrote:
 On 17 November 2011 19:27, Linus Walleij linus.wall...@linaro.org wrote:

 Maybe I'm mistaken about the device tree ambitions, but
 I was sort of hoping that it would not contain too much
 custom magic numbers that need to be cross-referenced
 elsewhere ... or rather - the more understandable the device
 tree is, the more we win.

 Device tree is expected to describe the hardware. So to
 cross-reference the hardware manual to understand device tree should
 be fine I guess. For instance, GPIO numbers in dts would be written as
 a numeric number and not a enum or other format. And by looking up the
 manual, we understand the actual details of the GPIO pin.

 If dt-compiler had a option to support #define like in C, the numbers
 could have been made more easier to understand. Like, 3 to mean
 GPIO_PULL_UP in Exynos dts file.

OK I think I get it now, so DT bindings shall really NOT be read
by any of the pinctrl core, it is *supposed* to be all driver-specific.
Then it makes perfect sense to have it as it is.

So for example in the pinctrl-coh901xxx.c example driver I have
locally defined registers presets like:

#define U300_FLOATING_INPUT { \
.bias_mode = PIN_CONFIG_BIAS_HIGH_IMPEDANCE, \
.output = false, \
}

#define U300_PULL_UP_INPUT { \
.bias_mode = PIN_CONFIG_BIAS_PULL_UP, \
.output = false, \
}

Then this type of stuff shall keep its custom format in the device
tree, and the driver for coh901xxx reads that out.

Thanks for helping me understand this crucial assumption of how
it works...

Yours,
Linus Walleij
--
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 08/65] OMAPDSS: remove partial update from panel-taal

2011-11-22 Thread Tomi Valkeinen
On Tue, 2011-11-22 at 17:23 +0530, Archit Taneja wrote:
  - r = taal_set_update_window(td, x, y, w, h);
  + /* XXX no need to send this every frame, but dsi break if not
 done */
  + r = taal_set_update_window(td, 0, 0,
  + td-panel_config-timings.x_res,
  + td-panel_config-timings.y_res);
 
 How about sending a null short packet, and a BTA after that. This
 will 
 keep automatic TE mode in place, and we'll need to send 1 short
 packet 
 instead of 2 long packets every frame.

To be honest, I didn't spend any time with this. True, sending a null
packet and BTA instead of the 2 long packets is possible. But probably
even better would be to track the TE status, and send a BTA only when
needed.

 Tomi



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


Re: [PATCH v3 5/5] clk: export tree topology and clk data via sysfs

2011-11-22 Thread Arnd Bergmann
On Tuesday 22 November 2011, Mike Turquette wrote:
 Introduces kobject support for the common struct clk, exports per-clk
 data via read-only callbacks and models the clk tree topology in sysfs.
 
 Also adds support for generating the clk tree in clk_init and migrating
 nodes when input sources are switches in clk_set_parent.
 
 Signed-off-by: Mike Turquette mturque...@linaro.org
 ---
  drivers/clk/Kconfig |   10 +++
  drivers/clk/Makefile|1 +
  drivers/clk/clk-sysfs.c |  199 
 +++
  drivers/clk/clk.c   |5 +-
  include/linux/clk.h |   36 -
  5 files changed, 248 insertions(+), 3 deletions(-)
  create mode 100644 drivers/clk/clk-sysfs.c

Since this introduces a new top-level hierarchy in sysfs, it certainly needs
to be reviewed by Greg K-H (on Cc now). Also, you have to add a proper
documentation for every new node and attribute in Documentation/ABI along
with the code.

 +static struct kobject *clk_kobj;
 +LIST_HEAD(kobj_list);

The list head should be static.

Arnd
--
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 v3 2/2] OMAPDSS: HDMI: Disable DDC internal pull up

2011-11-22 Thread K, Mythri P
Hi,

On Fri, Nov 18, 2011 at 1:00 PM, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 On Tue, 2011-11-15 at 19:20 +0530, mythr...@ti.com wrote:
 From: Mythri P K mythr...@ti.com

 Disables the internal pull resistor for SDA and SCL which are enabled by
 default, as there are expernal pull up's in 4460 and 4430 ES2.3
 SDP, Blaze and Panda Boards, It is done to avoid the EDID read failure.

 Signed-off-by: Ricardo Salveti de Araujo ricardo.salv...@linaro.org
 Signed-off-by: Mythri P K mythr...@ti.com
 ---
  arch/arm/mach-omap2/board-4430sdp.c    |   13 -
  arch/arm/mach-omap2/board-omap4panda.c |   14 +-
  arch/arm/mach-omap2/display.c          |   17 ++---
  include/video/omapdss.h                |    4 +++-
  4 files changed, 42 insertions(+), 6 deletions(-)

 diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
 b/arch/arm/mach-omap2/board-4430sdp.c
 index c3bd640..d0a82f9 100644
 --- a/arch/arm/mach-omap2/board-4430sdp.c
 +++ b/arch/arm/mach-omap2/board-4430sdp.c
 @@ -826,7 +826,18 @@ static void omap_4430sdp_display_init(void)
       sdp4430_lcd_init();
       sdp4430_picodlp_init();
       omap_display_init(sdp4430_dss_data);
 -     omap_hdmi_init();
 +     /*
 +      * CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
 +      * HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
 +      * internal pull up resistor - This is a change needed in
 +      * OMAP4460 and OMAP4430 ES2.3 SDP, Blaze and Panda as the
 +      * external pull up are present. This is needed to avoid
 +      * EDID read failure.
 +      */

 I don't think this comment makes sense here. The register and bit
 details are not seen here, they are handled in the display.c.

 Also, the comment is still speaking of OMAP versions. This is about
 board revisions. And this is SDP board file, no need to talk about
 Panda.

 So the text should be something like 44xxSDP rev XYZ and later have
 external HDMI I2C line pull up. We detect the board revision with the
 OMAP revision.
I shall update the comment and re-post.

 +     if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))

 If you compare omap_rev() you should also use cpu_is_omap at the same
 time. In this case (cpu_is_omap443x()  omap_rev() 
 OMAP4430_REV_ES2_2). Otherwise the omap_rev check could match, say,
 omap3 or omap5 boards.
Hmmm I am not really sure if that is needed, I dont think omap3 or
omap5 boards would be named with rev OMAP4430_REV_ES2_2 ???

Thanks and regards,
Mythri.

 +             omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP);
 +     else
 +             omap_hdmi_init(0);
  }

  #ifdef CONFIG_OMAP_MUX
 diff --git a/arch/arm/mach-omap2/board-omap4panda.c 
 b/arch/arm/mach-omap2/board-omap4panda.c
 index d95df2e..44ff8e0 100644
 --- a/arch/arm/mach-omap2/board-omap4panda.c
 +++ b/arch/arm/mach-omap2/board-omap4panda.c
 @@ -541,7 +541,19 @@ void omap4_panda_display_init(void)
               pr_err(error initializing panda DVI\n);

       omap_display_init(omap4_panda_dss_data);
 -     omap_hdmi_init();
 +
 +     /*
 +      * CONTROL_I2C_1: HDMI_DDC_SDA_PULLUPRESX (bit 28) and
 +      * HDMI_DDC_SCL_PULLUPRESX (bit 24) are set to disable
 +      * internal pull up resistor - This is a change needed in
 +      * OMAP4460 and OMAP4430 ES2.3 SDP, Blaze and Panda as the
 +      * external pull up are present. This is needed to avoid
 +      * EDID read failure.
 +      */
 +     if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
 +             omap_hdmi_init(OMAP_HDMI_EXTERNAL_PULLUP);
 +     else
 +             omap_hdmi_init(0);
  }

  static void __init omap4_panda_init(void)
 diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
 index 8436088..a75e179 100644
 --- a/arch/arm/mach-omap2/display.c
 +++ b/arch/arm/mach-omap2/display.c
 @@ -97,8 +97,11 @@ static const struct omap_dss_hwmod_data 
 omap4_dss_hwmod_data[] __initdata = {
       { dss_hdmi, omapdss_hdmi, -1 },
  };

 -static void omap4_hdmi_mux_pads()
 +static void omap4_hdmi_mux_pads(int flags)
  {
 +     u32 reg;
 +     u16 control_i2c_1;
 +
       /* PAD0_HDMI_HPD_PAD1_HDMI_CEC */
       omap_mux_init_signal(hdmi_hpd,
                       OMAP_PIN_INPUT_PULLUP);
 @@ -109,6 +112,14 @@ static void omap4_hdmi_mux_pads()
                       OMAP_PIN_INPUT_PULLUP);
       omap_mux_init_signal(hdmi_ddc_sda,
                       OMAP_PIN_INPUT_PULLUP);
 +
 +     if (flags  OMAP_HDMI_EXTERNAL_PULLUP) {
 +             control_i2c_1 = OMAP4_CTRL_MODULE_PAD_CORE_CONTROL_I2C_1;
 +             reg = omap4_ctrl_pad_readl(control_i2c_1);
 +             reg |= (OMAP4_HDMI_DDC_SDA_PULLUPRESX_MASK |
 +             OMAP4_HDMI_DDC_SCL_PULLUPRESX_MASK);

 Indent is wrong here, and the parenthesis are extra.

  Tomi


--
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 3/4] OMAPDSS: HDMI: change the timing match logic

2011-11-22 Thread K, Mythri P
Hi Tomi,

On Fri, Nov 18, 2011 at 12:46 PM, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 On Wed, 2011-11-16 at 11:01 +0530, K, Mythri P wrote:
 On Mon, Nov 14, 2011 at 1:03 PM, Tomi Valkeinen tomi.valkei...@ti.com 
 wrote:
  On Fri, 2011-11-11 at 18:39 +0530, mythr...@ti.com wrote:

  -static int get_timings_index(void)
  +static bool hdmi_find_code(const struct hdmi_config *timings_arr,
  +                     int len, struct hdmi_config *timing)
   {
  -     int code;
  +     int i;
 
  -     if (hdmi.mode == 0)
  -             code = code_vesa[hdmi.code];
  -     else
  -             code = code_cea[hdmi.code];
  +     for (i = 0; i  len; i++) {
  +             if (timings_arr[i].cm.code == hdmi.code) {
  +                     *timing = timings_arr[i];
  +                     return true;
  +             }
  +     }
  +
  +     return false;
  +}
 
  You could return the hdmi_config pointer instead of making a copy and
  returning a bool.
 In this function i'm passing the timing value and finally there needs
 to be one copy whether it is in this function or after the return,
 because the timings array is a const and dssdev-paneltimings and
 config timings are not, so do you see any benefit of doing that later
 or suggest any other method?

 Well, I think it's just good design, even if it wouldn't help in this
 particular case.

 hdmi_find_code is a small utility function, and functions like that
 should be designed to be usable in any situation. In this particular
 situation you will anyway make a copy, and it doesn't matter if it's the
 utility function that does the copy.

 But in some other case you could perhaps be interested in only one value
 in the hdmi_config that is found. In that case doing a copy is extra,
 and it'd be better to return the const struct pointer.

 Also, it is a standard design pattern that a find function returns
 pointer to the found item, whereas your version returning a bool and
 making a copy of the found item is not very standard.

Well i shall update the change to the standard way then :-).

Thanks and regards,
Mythri.
  Tomi


--
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 v3 4/5] clk: basic gateable and fixed-rate clks

2011-11-22 Thread Arnd Bergmann
On Tuesday 22 November 2011, Mike Turquette wrote:
 +static void clk_hw_gate_set_bit(struct clk *clk)
 +{
 +   struct clk_hw_gate *gate = to_clk_hw_gate(clk);
 +   u32 reg;
 +
 +   reg = __raw_readl(gate-reg);
 +   reg |= BIT(gate-bit_idx);
 +   __raw_writel(reg, gate-reg);
 +}

You cannot rely on __raw_readl() to do the right thing, especially
in architecture independent code. The safe (but slightly inefficient)
solution would be readl/writel. For ARM-only code, it would be best
to use readl_relaxed()/writel_relaxed(), but most architectures do
not implement that. We can probably add a set of helpers in asm-generic/
to define them to the default functions, like #define readl_relaxed(x)
readl(x), which I think is a good idea anyway.

Arnd
--
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 v3 2/2] OMAPDSS: HDMI: Disable DDC internal pull up

2011-11-22 Thread Tomi Valkeinen
On Tue, 2011-11-22 at 18:37 +0530, K, Mythri P wrote:
  + if (cpu_is_omap446x() || (omap_rev()  OMAP4430_REV_ES2_2))
 
  If you compare omap_rev() you should also use cpu_is_omap at the
 same
  time. In this case (cpu_is_omap443x()  omap_rev() 
  OMAP4430_REV_ES2_2). Otherwise the omap_rev check could match, say,
  omap3 or omap5 boards.
 Hmmm I am not really sure if that is needed, I dont think omap3 or
 omap5 boards would be named with rev OMAP4430_REV_ES2_2 ??? 

OMAP4430_REV_ES2_2 is just a symbolic name for a define for some number.
There's no reason why OMAP3430_REV_ES1_0 wouldn't be defined to the same
number.

That said, looking at arch/arm/plat-omap/include/plat/cpu.h shows that
the REV defines do include an OMAP class number, and so omap_rev() does
return a number with cpu ID. So it seems you indeed do not need
cpu_is_omap443x() there.

 Tomi



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


[PATCH v2 2/4] omap-serial: Use default clock speed (48Mhz) if not specified

2011-11-22 Thread Rajendra Nayak
Use a default clock speed of 48Mhz, instead of ending up with 0,
if platforms fail to specify a valid clock speed.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 drivers/tty/serial/omap-serial.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index a02cc9f..f14b9c5 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -43,6 +43,8 @@
 #include plat/dmtimer.h
 #include plat/omap-serial.h
 
+#define DEFAULT_CLK_SPEED 4800 /* 48Mhz*/
+
 static struct uart_omap_port *ui[OMAP_MAX_HSUART_PORTS];
 
 /* Forward declaration of functions */
@@ -1386,6 +1388,11 @@ static int serial_omap_probe(struct platform_device 
*pdev)
 
up-port.flags = omap_up_info-flags;
up-port.uartclk = omap_up_info-uartclk;
+   if (!up-port.uartclk) {
+   up-port.uartclk = DEFAULT_CLK_SPEED;
+   dev_warn(pdev-dev, No clock speed specified: using default:
+   %d\n, DEFAULT_CLK_SPEED);
+   }
up-uart_dma.uart_base = mem-start;
up-errata = omap_up_info-errata;
 
-- 
1.7.1

--
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 0/4] OMAP serial device tree support

2011-11-22 Thread Rajendra Nayak
v2 is based on the latest omap-serial runtime patches, which
can be found here[1]

The series passes minimal data that allows serial console
boot, with UART's initialised from device tree.
However some of low power support for UART and remote
wakeup needs more work.
Boot tested on OMAP4 panda and OMAP4 sdp boards.

Patches can be found here..
git://gitorious.org/omap-pm/linux.git for-dt/serial

Changes in v2:
-1- Got rid of binding to define which uart is console
-2- Added checks to default clock speed to 48Mhz
-3- Added compatible for each OMAP family
-4- Used of_alias_get_id to populate port.line

regards,
Rajendra

[1] git://gitorious.org/runtime_3-0/runtime_3-0.git 3.2-rc2_uart_runtime

Rajendra Nayak (4):
  omap-serial: Get rid of all pdev-id usage
  omap-serial: Use default clock speed (48Mhz) if not specified
  omap-serial: Add minimal device tree support
  ARM: omap: pass minimal SoC/board data for UART from dt

 .../devicetree/bindings/serial/omap_serial.txt |   10 +++
 arch/arm/boot/dts/omap3.dtsi   |   31 
 arch/arm/boot/dts/omap4.dtsi   |   28 +++
 arch/arm/mach-omap2/board-generic.c|1 -
 drivers/tty/serial/omap-serial.c   |   80 +++
 5 files changed, 132 insertions(+), 18 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/serial/omap_serial.txt

--
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 3/4] omap-serial: Add minimal device tree support

2011-11-22 Thread Rajendra Nayak
Adapt the driver to device tree and pass minimal platform
data from device tree needed for console boot.
No power management features will be suppported for now
since it requires more tweaks around OCP settings
to toggle forceidle/noidle/smaridle bits and handling
remote wakeup and dynamic muxing.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 .../devicetree/bindings/serial/omap_serial.txt |   10 
 drivers/tty/serial/omap-serial.c   |   45 ++-
 2 files changed, 52 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/serial/omap_serial.txt

diff --git a/Documentation/devicetree/bindings/serial/omap_serial.txt 
b/Documentation/devicetree/bindings/serial/omap_serial.txt
new file mode 100644
index 000..342eedd
--- /dev/null
+++ b/Documentation/devicetree/bindings/serial/omap_serial.txt
@@ -0,0 +1,10 @@
+OMAP UART controller
+
+Required properties:
+- compatible : should be ti,omap2-uart for OMAP2 controllers
+- compatible : should be ti,omap3-uart for OMAP3 controllers
+- compatible : should be ti,omap4-uart for OMAP4 controllers
+- ti,hwmods : Must be uartn, n being the instance number (1-based)
+
+Optional properties:
+- clock-frequency : frequency of the clock input to the UART
diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index f14b9c5..5aa524e 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -38,6 +38,7 @@
 #include linux/serial_core.h
 #include linux/irq.h
 #include linux/pm_runtime.h
+#include linux/of.h
 
 #include plat/dma.h
 #include plat/dmtimer.h
@@ -1324,6 +1325,19 @@ static void uart_tx_dma_callback(int lch, u16 ch_status, 
void *data)
return;
 }
 
+static struct omap_uart_port_info *of_get_uart_port_info(struct device *dev)
+{
+   struct omap_uart_port_info *omap_up_info;
+
+   omap_up_info = devm_kzalloc(dev, sizeof(*omap_up_info), GFP_KERNEL);
+   if (!omap_up_info)
+   return NULL; /* out of memory */
+
+   of_property_read_u32(dev-of_node, clock-frequency,
+omap_up_info-uartclk);
+   return omap_up_info;
+}
+
 static int serial_omap_probe(struct platform_device *pdev)
 {
struct uart_omap_port   *up;
@@ -1331,6 +1345,9 @@ static int serial_omap_probe(struct platform_device *pdev)
struct omap_uart_port_info *omap_up_info = pdev-dev.platform_data;
int ret = -ENOSPC;
 
+   if (pdev-dev.of_node)
+   omap_up_info = of_get_uart_port_info(pdev-dev);
+
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) {
dev_err(pdev-dev, no mem resource?\n);
@@ -1375,9 +1392,20 @@ static int serial_omap_probe(struct platform_device 
*pdev)
up-port.regshift = 2;
up-port.fifosize = 64;
up-port.ops = serial_omap_pops;
-   up-port.line = pdev-id;
-   sprintf(up-name, OMAP UART%d, up-port.line);
 
+   if (pdev-dev.of_node)
+   up-port.line = of_alias_get_id(pdev-dev.of_node, serial);
+   else
+   up-port.line = pdev-id;
+
+   if (up-port.line  0) {
+   dev_err(pdev-dev, failed to get alias/pdev id, errno %d\n,
+   up-port.line);
+   ret = -ENODEV;
+   goto err;
+   }
+
+   sprintf(up-name, OMAP UART%d, up-port.line);
up-port.mapbase = mem-start;
up-port.membase = ioremap(mem-start, resource_size(mem));
if (!up-port.membase) {
@@ -1530,7 +1558,7 @@ static int serial_omap_runtime_suspend(struct device *dev)
if (!up)
return -EINVAL;
 
-   if (!pdata-enable_wakeup)
+   if (!pdata || !pdata-enable_wakeup)
return 0;
 
if (pdata-get_context_loss_count)
@@ -1591,12 +1619,23 @@ static const struct dev_pm_ops serial_omap_dev_pm_ops = 
{
serial_omap_runtime_resume, NULL)
 };
 
+#if defined(CONFIG_OF)
+static const struct of_device_id omap_serial_of_match[] = {
+   { .compatible = ti,omap2-uart },
+   { .compatible = ti,omap3-uart },
+   { .compatible = ti,omap4-uart },
+   {},
+};
+MODULE_DEVICE_TABLE(of, omap_serial_of_match);
+#endif
+
 static struct platform_driver serial_omap_driver = {
.probe  = serial_omap_probe,
.remove = serial_omap_remove,
.driver = {
.name   = DRIVER_NAME,
.pm = serial_omap_dev_pm_ops,
+   .of_match_table = of_match_ptr(omap_serial_of_match),
},
 };
 
-- 
1.7.1

--
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 1/4] omap-serial: Get rid of all pdev-id usage

2011-11-22 Thread Rajendra Nayak
With Device tree, pdev-id would no longer be Valid.
Hence get rid of all instances of its usage in the
driver. Device tree support for the driver is added
in subsequent patches.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 drivers/tty/serial/omap-serial.c |   30 +++---
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index f3ff0ca..a02cc9f 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -115,7 +115,7 @@ static void serial_omap_enable_ms(struct uart_port *port)
 {
struct uart_omap_port *up = (struct uart_omap_port *)port;
 
-   dev_dbg(up-port.dev, serial_omap_enable_ms+%d\n, up-pdev-id);
+   dev_dbg(up-port.dev, serial_omap_enable_ms+%d\n, up-port.line);
 
pm_runtime_get_sync(up-pdev-dev);
up-ier |= UART_IER_MSI;
@@ -418,7 +418,7 @@ static unsigned int serial_omap_tx_empty(struct uart_port 
*port)
unsigned int ret = 0;
 
pm_runtime_get_sync(up-pdev-dev);
-   dev_dbg(up-port.dev, serial_omap_tx_empty+%d\n, up-pdev-id);
+   dev_dbg(up-port.dev, serial_omap_tx_empty+%d\n, up-port.line);
spin_lock_irqsave(up-port.lock, flags);
ret = serial_in(up, UART_LSR)  UART_LSR_TEMT ? TIOCSER_TEMT : 0;
spin_unlock_irqrestore(up-port.lock, flags);
@@ -436,7 +436,7 @@ static unsigned int serial_omap_get_mctrl(struct uart_port 
*port)
status = check_modem_status(up);
pm_runtime_put(up-pdev-dev);
 
-   dev_dbg(up-port.dev, serial_omap_get_mctrl+%d\n, up-pdev-id);
+   dev_dbg(up-port.dev, serial_omap_get_mctrl+%d\n, up-port.line);
 
if (status  UART_MSR_DCD)
ret |= TIOCM_CAR;
@@ -454,7 +454,7 @@ static void serial_omap_set_mctrl(struct uart_port *port, 
unsigned int mctrl)
struct uart_omap_port *up = (struct uart_omap_port *)port;
unsigned char mcr = 0;
 
-   dev_dbg(up-port.dev, serial_omap_set_mctrl+%d\n, up-pdev-id);
+   dev_dbg(up-port.dev, serial_omap_set_mctrl+%d\n, up-port.line);
if (mctrl  TIOCM_RTS)
mcr |= UART_MCR_RTS;
if (mctrl  TIOCM_DTR)
@@ -478,7 +478,7 @@ static void serial_omap_break_ctl(struct uart_port *port, 
int break_state)
struct uart_omap_port *up = (struct uart_omap_port *)port;
unsigned long flags = 0;
 
-   dev_dbg(up-port.dev, serial_omap_break_ctl+%d\n, up-pdev-id);
+   dev_dbg(up-port.dev, serial_omap_break_ctl+%d\n, up-port.line);
pm_runtime_get_sync(up-pdev-dev);
spin_lock_irqsave(up-port.lock, flags);
if (break_state == -1)
@@ -504,7 +504,7 @@ static int serial_omap_startup(struct uart_port *port)
if (retval)
return retval;
 
-   dev_dbg(up-port.dev, serial_omap_startup+%d\n, up-pdev-id);
+   dev_dbg(up-port.dev, serial_omap_startup+%d\n, up-port.line);
 
pm_runtime_get_sync(up-pdev-dev);
/*
@@ -545,7 +545,7 @@ static int serial_omap_startup(struct uart_port *port)
0);
init_timer((up-uart_dma.rx_timer));
up-uart_dma.rx_timer.function = serial_omap_rxdma_poll;
-   up-uart_dma.rx_timer.data = up-pdev-id;
+   up-uart_dma.rx_timer.data = up-port.line;
/* Currently the buffer size is 4KB. Can increase it */
up-uart_dma.rx_buf = dma_alloc_coherent(NULL,
up-uart_dma.rx_buf_size,
@@ -573,7 +573,7 @@ static void serial_omap_shutdown(struct uart_port *port)
struct uart_omap_port *up = (struct uart_omap_port *)port;
unsigned long flags = 0;
 
-   dev_dbg(up-port.dev, serial_omap_shutdown+%d\n, up-pdev-id);
+   dev_dbg(up-port.dev, serial_omap_shutdown+%d\n, up-port.line);
 
pm_runtime_get_sync(up-pdev-dev);
/*
@@ -883,7 +883,7 @@ serial_omap_set_termios(struct uart_port *port, struct 
ktermios *termios,
 
spin_unlock_irqrestore(up-port.lock, flags);
pm_runtime_put(up-pdev-dev);
-   dev_dbg(up-port.dev, serial_omap_set_termios+%d\n, up-pdev-id);
+   dev_dbg(up-port.dev, serial_omap_set_termios+%d\n, up-port.line);
 }
 
 static void
@@ -893,7 +893,7 @@ serial_omap_pm(struct uart_port *port, unsigned int state,
struct uart_omap_port *up = (struct uart_omap_port *)port;
unsigned char efr;
 
-   dev_dbg(up-port.dev, serial_omap_pm+%d\n, up-pdev-id);
+   dev_dbg(up-port.dev, serial_omap_pm+%d\n, up-port.line);
 
pm_runtime_get_sync(up-pdev-dev);
serial_out(up, UART_LCR, UART_LCR_CONF_MODE_B);
@@ -932,7 +932,7 @@ static void serial_omap_config_port(struct uart_port *port, 
int flags)
struct uart_omap_port *up = (struct uart_omap_port *)port;
 
dev_dbg(up-port.dev, serial_omap_config_port+%d\n,
-   up-pdev-id);
+   up-port.line);
 

[PATCH v2 4/4] ARM: omap: pass minimal SoC/board data for UART from dt

2011-11-22 Thread Rajendra Nayak
Pass minimal data needed for console boot, from dt, for
OMAP4 panda/sdp and OMAP3 beagle boards, and get rid of the
static initialization from generic board file.

Signed-off-by: Rajendra Nayak rna...@ti.com
---
 arch/arm/boot/dts/omap3.dtsi|   31 +++
 arch/arm/boot/dts/omap4.dtsi|   28 
 arch/arm/mach-omap2/board-generic.c |1 -
 3 files changed, 59 insertions(+), 1 deletions(-)

diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi
index d202bb5..216c331 100644
--- a/arch/arm/boot/dts/omap3.dtsi
+++ b/arch/arm/boot/dts/omap3.dtsi
@@ -13,6 +13,13 @@
 / {
compatible = ti,omap3430, ti,omap3;
 
+   aliases {
+   serial0 = uart1;
+   serial1 = uart2;
+   serial2 = uart3;
+   serial3 = uart4;
+   };
+
cpus {
cpu@0 {
compatible = arm,cortex-a8;
@@ -59,5 +66,29 @@
interrupt-controller;
#interrupt-cells = 1;
};
+
+   uart1: serial@0x4806a000 {
+   compatible = ti,omap3-uart;
+   ti,hwmods = uart1;
+   clock-frequency = 4800;
+   };
+
+   uart2: serial@0x4806c000 {
+   compatible = ti,omap3-uart;
+   ti,hwmods = uart2;
+   clock-frequency = 4800;
+   };
+
+   uart3: serial@0x4902 {
+   compatible = ti,omap3-uart;
+   ti,hwmods = uart3;
+   clock-frequency = 4800;
+   };
+
+   uart4: serial@0x49042000 {
+   compatible = ti,omap3-uart;
+   ti,hwmods = uart4;
+   clock-frequency = 4800;
+   };
};
 };
diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 4c61c82..e8fe75f 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -21,6 +21,10 @@
interrupt-parent = gic;
 
aliases {
+   serial0 = uart1;
+   serial1 = uart2;
+   serial2 = uart3;
+   serial3 = uart4;
};
 
cpus {
@@ -99,5 +103,29 @@
reg = 0x48241000 0x1000,
  0x48240100 0x0100;
};
+
+   uart1: serial@0x4806a000 {
+   compatible = ti,omap4-uart;
+   ti,hwmods = uart1;
+   clock-frequency = 4800;
+   };
+
+   uart2: serial@0x4806c000 {
+   compatible = ti,omap4-uart;
+   ti,hwmods = uart2;
+   clock-frequency = 4800;
+   };
+
+   uart3: serial@0x4802 {
+   compatible = ti,omap4-uart;
+   ti,hwmods = uart3;
+   clock-frequency = 4800;
+   };
+
+   uart4: serial@0x4806e000 {
+   compatible = ti,omap4-uart;
+   ti,hwmods = uart4;
+   clock-frequency = 4800;
+   };
};
 };
diff --git a/arch/arm/mach-omap2/board-generic.c 
b/arch/arm/mach-omap2/board-generic.c
index fb55fa3..bb72809 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -70,7 +70,6 @@ static void __init omap_generic_init(void)
if (node)
irq_domain_add_simple(node, 0);
 
-   omap_serial_init();
omap_sdrc_init(NULL, NULL);
 
of_platform_populate(NULL, omap_dt_match_table, NULL, NULL);
-- 
1.7.1

--
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 1/3] omap_hsmmc: consider MMC_PM_KEEP_POWER on suspend/resume

2011-11-22 Thread Eliad Peller
When an mmc card has the MMC_PM_KEEP_POWER flag, it shouldn't
be powered off on suspend (and thus doesn't have to be powered-on
on resume)

While on it, change the suspend flow a bit, to make it a bit
easier to follow.

Signed-off-by: Eliad Peller el...@wizery.com
---
 drivers/mmc/host/omap_hsmmc.c |   24 +++-
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index 21e4a79..ec7c83c 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -2174,13 +2174,7 @@ static int omap_hsmmc_suspend(struct device *dev)
cancel_work_sync(host-mmc_carddetect_work);
ret = mmc_suspend_host(host-mmc);
 
-   if (ret == 0) {
-   omap_hsmmc_disable_irq(host);
-   OMAP_HSMMC_WRITE(host-base, HCTL,
-   OMAP_HSMMC_READ(host-base, HCTL)  ~SDBP);
-   if (host-got_dbclk)
-   clk_disable(host-dbclk);
-   } else {
+   if (ret) {
host-suspended = 0;
if (host-pdata-resume) {
ret = host-pdata-resume(pdev-dev,
@@ -2189,9 +2183,20 @@ static int omap_hsmmc_suspend(struct device *dev)
dev_dbg(mmc_dev(host-mmc),
Unmask interrupt failed\n);
}
+   goto err;
}
-   pm_runtime_put_sync(host-dev);
+
+   if (!(host-mmc-pm_flags  MMC_PM_KEEP_POWER)) {
+   omap_hsmmc_disable_irq(host);
+   OMAP_HSMMC_WRITE(host-base, HCTL,
+   OMAP_HSMMC_READ(host-base, HCTL)  ~SDBP);
+   }
+   if (host-got_dbclk)
+   clk_disable(host-dbclk);
+
}
+err:
+   pm_runtime_put_sync(host-dev);
return ret;
 }
 
@@ -2211,7 +2216,8 @@ static int omap_hsmmc_resume(struct device *dev)
if (host-got_dbclk)
clk_enable(host-dbclk);
 
-   omap_hsmmc_conf_bus_power(host);
+   if (!(host-mmc-pm_flags  MMC_PM_KEEP_POWER))
+   omap_hsmmc_conf_bus_power(host);
 
if (host-pdata-resume) {
ret = host-pdata-resume(pdev-dev, host-slot_id);
-- 
1.7.6.401.g6a319

--
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 2/3] omap_hsmmc: add pm_caps field

2011-11-22 Thread Eliad Peller
Add pm_caps field to omap2_hsmmc_info and omap_mmc_slot_data
structs, so we will be able to indicate mmc pm capabilities
in the board file.

Signed-off-by: Eliad Peller el...@wizery.com
---
 arch/arm/mach-omap2/hsmmc.c   |1 +
 arch/arm/mach-omap2/hsmmc.h   |1 +
 arch/arm/plat-omap/include/plat/mmc.h |1 +
 drivers/mmc/host/omap_hsmmc.c |2 ++
 4 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index 097a42d..d00a54a 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -306,6 +306,7 @@ static int __init omap_hsmmc_pdata_init(struct 
omap2_hsmmc_info *c,
mmc-slots[0].name = hc_name;
mmc-nr_slots = 1;
mmc-slots[0].caps = c-caps;
+   mmc-slots[0].pm_caps = c-pm_caps;
mmc-slots[0].internal_clock = !c-ext_clock;
mmc-dma_mask = 0x;
if (cpu_is_omap44xx())
diff --git a/arch/arm/mach-omap2/hsmmc.h b/arch/arm/mach-omap2/hsmmc.h
index f757e78..c440973 100644
--- a/arch/arm/mach-omap2/hsmmc.h
+++ b/arch/arm/mach-omap2/hsmmc.h
@@ -12,6 +12,7 @@ struct omap2_hsmmc_info {
u8  mmc;/* controller 1/2/3 */
u32 caps;   /* 4/8 wires and any additional host
 * capabilities OR'd (ref. linux/mmc/host.h) */
+   u32 pm_caps;/* PM capabilities */
booltransceiver;/* MMC-2 option */
boolext_clock;  /* use external pin for input clock */
boolcover_only; /* No card detect - just cover switch */
diff --git a/arch/arm/plat-omap/include/plat/mmc.h 
b/arch/arm/plat-omap/include/plat/mmc.h
index c7b8741..d3263ac 100644
--- a/arch/arm/plat-omap/include/plat/mmc.h
+++ b/arch/arm/plat-omap/include/plat/mmc.h
@@ -79,6 +79,7 @@ struct omap_mmc_platform_data {
 */
u8  wires;  /* Used for the MMC driver on omap1 and 2420 */
u32 caps;   /* Used for the MMC driver on 2430 and later */
+   u32 pm_caps;/* PM capabilities of the mmc */
 
/*
 * nomux means standard muxing is wrong on this board, and
diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c
index ec7c83c..2bc964a6 100644
--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -1985,6 +1985,8 @@ static int __init omap_hsmmc_probe(struct platform_device 
*pdev)
if (mmc_slot(host).nonremovable)
mmc-caps |= MMC_CAP_NONREMOVABLE;
 
+   mmc-pm_caps = mmc_slot(host).pm_caps;
+
omap_hsmmc_conf_bus_power(host);
 
/* Select DMA lines */
-- 
1.7.6.401.g6a319

--
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 3/3] omap: board-sdp4430: declare support for MMC_PM_KEEP_POWER

2011-11-22 Thread Eliad Peller
Declare support for keeping the power of the wlan chip
while suspended. this is needed for Wakeup-On-Wireless.

Signed-off-by: Eliad Peller el...@wizery.com
---
 arch/arm/mach-omap2/board-4430sdp.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index c7cef44..fd8b2a5 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -420,6 +420,7 @@ static struct omap2_hsmmc_info mmc[] = {
{
.mmc= 5,
.caps   = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
+   .pm_caps= MMC_PM_KEEP_POWER,
.gpio_cd= -EINVAL,
.gpio_wp= -EINVAL,
.ocr_mask   = MMC_VDD_165_195,
-- 
1.7.6.401.g6a319

--
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 0/5] Support for OMAP4 Digital Microphone interface

2011-11-22 Thread Peter Ujfalusi
Hello,

The following series will add support for OMAP4 DMIC interface, and enable them
on sdp4430/Blaze boards.

Mark: The Panda support will be based on this series with the conversion of the
sdp4430 ASoC machine driver to platform device/driver to prepare it for DT.
The DT bindings for the dmic driver will be sent shortly as well.

Regards,
Peter
---
Peter Ujfalusi (5):
  OMAP4: hwmod: Add names for DMIC memory address space
  ASoC: OMAP4: omap-dmic: Initial support for OMAP DMIC
  OMAP4: devices: Register OMAP4 DMIC platform device
  OMAP4: board-4430sdp: Register platform device for digimic codec
  ASoC: sdp4430: Add support for digital microphones

 arch/arm/mach-omap2/board-4430sdp.c|6 +
 arch/arm/mach-omap2/devices.c  |   22 ++
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 +
 sound/soc/omap/Kconfig |5 +
 sound/soc/omap/Makefile|2 +
 sound/soc/omap/omap-dmic.c |  494 
 sound/soc/omap/omap-dmic.h |   73 
 sound/soc/omap/sdp4430.c   |   84 -
 8 files changed, 677 insertions(+), 11 deletions(-)
 create mode 100644 sound/soc/omap/omap-dmic.c
 create mode 100644 sound/soc/omap/omap-dmic.h

-- 
1.7.8.rc3

--
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 1/5] OMAP4: hwmod: Add names for DMIC memory address space

2011-11-22 Thread Peter Ujfalusi
To be able to get the memory resources by name from
the DMIC driver (for MPU and for DMA).

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 7695e5d..8b75c60 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -1028,6 +1028,7 @@ static struct omap_hwmod_dma_info 
omap44xx_dmic_sdma_reqs[] = {
 
 static struct omap_hwmod_addr_space omap44xx_dmic_addrs[] = {
{
+   .name   = mpu,
.pa_start   = 0x4012e000,
.pa_end = 0x4012e07f,
.flags  = ADDR_TYPE_RT
@@ -1046,6 +1047,7 @@ static struct omap_hwmod_ocp_if omap44xx_l4_abe__dmic = {
 
 static struct omap_hwmod_addr_space omap44xx_dmic_dma_addrs[] = {
{
+   .name   = dma,
.pa_start   = 0x4902e000,
.pa_end = 0x4902e07f,
.flags  = ADDR_TYPE_RT
-- 
1.7.8.rc3

--
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 2/5] ASoC: OMAP4: omap-dmic: Initial support for OMAP DMIC

2011-11-22 Thread Peter Ujfalusi
Add support for OMAP4 Digital Microphone interface.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 sound/soc/omap/Kconfig |3 +
 sound/soc/omap/Makefile|2 +
 sound/soc/omap/omap-dmic.c |  494 
 sound/soc/omap/omap-dmic.h |   73 +++
 4 files changed, 572 insertions(+), 0 deletions(-)
 create mode 100644 sound/soc/omap/omap-dmic.c
 create mode 100644 sound/soc/omap/omap-dmic.h

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index fe83d0d..052254a 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -2,6 +2,9 @@ config SND_OMAP_SOC
tristate SoC Audio for the Texas Instruments OMAP chips
depends on ARCH_OMAP
 
+config SND_OMAP_SOC_DMIC
+   tristate
+
 config SND_OMAP_SOC_MCBSP
tristate
select OMAP_MCBSP
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 052fd75..1fd723f 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -1,10 +1,12 @@
 # OMAP Platform Support
 snd-soc-omap-objs := omap-pcm.o
+snd-soc-omap-dmic-objs := omap-dmic.o
 snd-soc-omap-mcbsp-objs := omap-mcbsp.o
 snd-soc-omap-mcpdm-objs := omap-mcpdm.o
 snd-soc-omap-hdmi-objs := omap-hdmi.o
 
 obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
+obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
 obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
 obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
 obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
new file mode 100644
index 000..5c7e6ca
--- /dev/null
+++ b/sound/soc/omap/omap-dmic.c
@@ -0,0 +1,494 @@
+/*
+ * omap-dmic.c  --  OMAP ASoC DMIC DAI driver
+ *
+ * Copyright (C) 2010 - 2011 Texas Instruments
+ *
+ * Author: David Lambert dlamb...@ti.com
+ *Misael Lopez Cruz misael.lo...@ti.com
+ *Liam Girdwood l...@ti.com
+ *Peter Ujfalusi peter.ujfal...@ti.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include linux/init.h
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/err.h
+#include linux/clk.h
+#include linux/io.h
+#include linux/slab.h
+#include linux/pm_runtime.h
+#include plat/dma.h
+
+#include sound/core.h
+#include sound/pcm.h
+#include sound/pcm_params.h
+#include sound/initval.h
+#include sound/soc.h
+
+#include omap-pcm.h
+#include omap-dmic.h
+
+#define OMAP_DMIC_RATES(SNDRV_PCM_RATE_96000 | 
SNDRV_PCM_RATE_192000)
+#define OMAP_DMIC_FORMATS  SNDRV_PCM_FMTBIT_S32_LE
+
+struct omap_dmic {
+   struct device *dev;
+   void __iomem *io_base;
+   int clk_freq;
+   int sysclk;
+   int threshold;
+   int abe_mode;
+   u32 ch_enabled;
+   struct mutex mutex;
+};
+
+/*
+ * Stream DMA parameters
+ */
+static struct omap_pcm_dma_data omap_dmic_dai_dma_params = {
+   .name   = DMIC capture,
+   .data_type  = OMAP_DMA_DATA_TYPE_S32,
+   .sync_mode  = OMAP_DMA_SYNC_PACKET,
+};
+
+static inline void omap_dmic_write(struct omap_dmic *dmic, u16 reg, u32 val)
+{
+   __raw_writel(val, dmic-io_base + reg);
+}
+
+static inline int omap_dmic_read(struct omap_dmic *dmic, u16 reg)
+{
+   return __raw_readl(dmic-io_base + reg);
+}
+
+static inline void omap_dmic_start(struct omap_dmic *dmic)
+{
+   u32 ctrl = omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG);
+
+   /* Configure DMA controller */
+   omap_dmic_write(dmic, OMAP_DMIC_DMAENABLE_SET_REG,
+   OMAP_DMIC_DMA_ENABLE);
+
+   omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG, ctrl | dmic-ch_enabled);
+}
+
+static inline void omap_dmic_stop(struct omap_dmic *dmic)
+{
+   u32 ctrl = omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG);
+   omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG,
+   ctrl  ~OMAP_DMIC_UP_ENABLE_MASK);
+
+   /* Disable DMA request generation */
+   omap_dmic_write(dmic, OMAP_DMIC_DMAENABLE_CLR_REG,
+   OMAP_DMIC_DMA_ENABLE);
+
+}
+
+static inline int dmic_is_enabled(struct omap_dmic *dmic)
+{
+   return omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG) 
+   OMAP_DMIC_UP_ENABLE_MASK;
+}
+
+static int omap_dmic_dai_startup(struct snd_pcm_substream *substream,
+ struct snd_soc_dai *dai)
+{
+   

[PATCH 4/5] OMAP4: board-4430sdp: Register platform device for digimic codec

2011-11-22 Thread Peter Ujfalusi
OMAP4 SDP/Blaze boards have onboard digital microphones.
Register the platform device for the dmic-codec to be
able to use the microphones.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 arch/arm/mach-omap2/board-4430sdp.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-4430sdp.c 
b/arch/arm/mach-omap2/board-4430sdp.c
index 5156468..503bf28 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -372,11 +372,17 @@ static struct platform_device sdp4430_vbat = {
},
 };
 
+static struct platform_device sdp4430_dmic_codec = {
+   .name   = dmic-codec,
+   .id = -1,
+};
+
 static struct platform_device *sdp4430_devices[] __initdata = {
sdp4430_gpio_keys_device,
sdp4430_leds_gpio,
sdp4430_leds_pwm,
sdp4430_vbat,
+   sdp4430_dmic_codec,
 };
 
 static struct omap_musb_board_data musb_board_data = {
-- 
1.7.8.rc3

--
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 3/5] OMAP4: devices: Register OMAP4 DMIC platform device

2011-11-22 Thread Peter Ujfalusi
Add platform device registration for OMAP4 DMIC.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 arch/arm/mach-omap2/devices.c |   22 ++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index c15cfad..35d5dff 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -336,6 +336,27 @@ static void omap_init_mcpdm(void)
 static inline void omap_init_mcpdm(void) {}
 #endif
 
+#if defined(CONFIG_SND_OMAP_SOC_DMIC) || \
+   defined(CONFIG_SND_OMAP_SOC_DMIC_MODULE)
+
+static void omap_init_dmic(void)
+{
+   struct omap_hwmod *oh;
+   struct platform_device *pdev;
+
+   oh = omap_hwmod_lookup(dmic);
+   if (!oh) {
+   printk(KERN_ERR Could not look up mcpdm hw_mod\n);
+   return;
+   }
+
+   pdev = omap_device_build(omap-dmic, -1, oh, NULL, 0, NULL, 0, 0);
+   WARN(IS_ERR(pdev), Can't build omap_device for omap-dmic.\n);
+}
+#else
+static inline void omap_init_dmic(void) {}
+#endif
+
 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
 
 #include plat/mcspi.h
@@ -681,6 +702,7 @@ static int __init omap2_init_devices(void)
 */
omap_init_audio();
omap_init_mcpdm();
+   omap_init_dmic();
omap_init_camera();
omap_init_mbox();
omap_init_mcspi();
-- 
1.7.8.rc3

--
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 5/5] ASoC: sdp4430: Add support for digital microphones

2011-11-22 Thread Peter Ujfalusi
OMAP4 SDP/Blaze boards have digital microphones.

Signed-off-by: Peter Ujfalusi peter.ujfal...@ti.com
---
 sound/soc/omap/Kconfig   |2 +
 sound/soc/omap/sdp4430.c |   84 --
 2 files changed, 75 insertions(+), 11 deletions(-)

diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 052254a..fb1bf25 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -100,8 +100,10 @@ config SND_OMAP_SOC_SDP3430
 config SND_OMAP_SOC_SDP4430
tristate SoC Audio support for Texas Instruments SDP4430
depends on TWL4030_CORE  SND_OMAP_SOC  MACH_OMAP_4430SDP
+   select SND_OMAP_SOC_DMIC
select SND_OMAP_SOC_MCPDM
select SND_SOC_TWL6040
+   select SND_SOC_DMIC
help
  Say Y if you want to add support for SoC audio on Texas Instruments
  SDP4430.
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index 03d9fa4..a8c4926 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -33,6 +33,7 @@
 #include plat/hardware.h
 #include plat/mux.h
 
+#include omap-dmic.h
 #include omap-mcpdm.h
 #include omap-pcm.h
 #include ../codecs/twl6040.h
@@ -67,6 +68,31 @@ static struct snd_soc_ops sdp4430_ops = {
.hw_params = sdp4430_hw_params,
 };
 
+static int sdp4430_dmic_hw_params(struct snd_pcm_substream *substream,
+   struct snd_pcm_hw_params *params)
+{
+   struct snd_soc_pcm_runtime *rtd = substream-private_data;
+   struct snd_soc_dai *cpu_dai = rtd-cpu_dai;
+   int ret = 0;
+
+   ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_DMIC_SYSCLK_PAD_CLKS,
+1920, SND_SOC_CLOCK_IN);
+   if (ret  0) {
+   printk(KERN_ERR can't set DMIC cpu system clock\n);
+   return ret;
+   }
+   ret = snd_soc_dai_set_clkdiv(cpu_dai, OMAP_DMIC_CLKDIV, 8);
+   if (ret  0) {
+   printk(KERN_ERR can't set DMIC cpu clock divider\n);
+   return ret;
+   }
+   return 0;
+}
+
+static struct snd_soc_ops sdp4430_dmic_ops = {
+   .hw_params = sdp4430_dmic_hw_params,
+};
+
 /* Headset jack */
 static struct snd_soc_jack hs_jack;
 
@@ -148,23 +174,59 @@ static int sdp4430_twl6040_init(struct 
snd_soc_pcm_runtime *rtd)
return ret;
 }
 
+static const struct snd_soc_dapm_widget sdp4430_dmic_dapm_widgets[] = {
+   SND_SOC_DAPM_MIC(Digital Mic, NULL),
+};
+
+static const struct snd_soc_dapm_route dmic_audio_map[] = {
+   {DMic, NULL, Digital Mic1 Bias},
+   {Digital Mic1 Bias, NULL, Digital Mic},
+};
+
+static int sdp4430_dmic_init(struct snd_soc_pcm_runtime *rtd)
+{
+   struct snd_soc_codec *codec = rtd-codec;
+   struct snd_soc_dapm_context *dapm = codec-dapm;
+   int ret;
+
+   ret = snd_soc_dapm_new_controls(dapm, sdp4430_dmic_dapm_widgets,
+   ARRAY_SIZE(sdp4430_dmic_dapm_widgets));
+   if (ret)
+   return ret;
+
+   return snd_soc_dapm_add_routes(dapm, dmic_audio_map,
+   ARRAY_SIZE(dmic_audio_map));
+}
+
 /* Digital audio interface glue - connects codec -- CPU */
-static struct snd_soc_dai_link sdp4430_dai = {
-   .name = TWL6040,
-   .stream_name = TWL6040,
-   .cpu_dai_name = omap-mcpdm,
-   .codec_dai_name = twl6040-legacy,
-   .platform_name = omap-pcm-audio,
-   .codec_name = twl6040-codec,
-   .init = sdp4430_twl6040_init,
-   .ops = sdp4430_ops,
+static struct snd_soc_dai_link sdp4430_dai[] = {
+   {
+   .name = TWL6040,
+   .stream_name = TWL6040,
+   .cpu_dai_name = omap-mcpdm,
+   .codec_dai_name = twl6040-legacy,
+   .platform_name = omap-pcm-audio,
+   .codec_name = twl6040-codec,
+   .init = sdp4430_twl6040_init,
+   .ops = sdp4430_ops,
+   },
+   {
+   .name = DMIC,
+   .stream_name = DMIC Capture,
+   .cpu_dai_name = omap-dmic,
+   .codec_dai_name = dmic-hifi,
+   .platform_name = omap-pcm-audio,
+   .codec_name = dmic-codec,
+   .init = sdp4430_dmic_init,
+   .ops = sdp4430_dmic_ops,
+   },
 };
 
 /* Audio machine driver */
 static struct snd_soc_card snd_soc_sdp4430 = {
.name = SDP4430,
-   .dai_link = sdp4430_dai,
-   .num_links = 1,
+   .dai_link = sdp4430_dai,
+   .num_links = ARRAY_SIZE(sdp4430_dai),
 
.dapm_widgets = sdp4430_twl6040_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets),
-- 
1.7.8.rc3

--
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: Inclusion of ARM perf tree in linux-next

2011-11-22 Thread Stephen Rothwell
Hi Will,

On Tue, 22 Nov 2011 10:04:35 + Will Deacon will.dea...@arm.com wrote:

 I maintain the ARM perf backend and would be very grateful if you could
 please include this branch in linux-next:
 
 git://git.kernel.org/pub/scm/linux/kernel/git/will/linux.git for-next/perf
 
 This request has arisen specifically from some work with the OMAP guys
 where it would be useful to spot any conflicts for 3.3, however I think it's
 generally a good idea for me to give some of the perf changes an airing
 before they get merged anyway.

I have added that tree now with you as the contact.

Thanks for adding your subsystem tree as a participant of linux-next.  As
you may know, this is not a judgment of your code.  The purpose of
linux-next is for integration testing and to lower the impact of
conflicts between subsystems in the next merge window. 

You will need to ensure that the patches/commits in your tree/series have
been:
 * submitted under GPL v2 (or later) and include the Contributor's
Signed-off-by,
 * posted to the relevant mailing list,
 * reviewed by you (or another maintainer of your subsystem tree),
 * successfully unit tested, and 
 * destined for the current or next Linux merge window.

Basically, this should be just what you would send to Linus (or ask him
to fetch).  It is allowed to be rebased if you deem it necessary.

-- 
Cheers,
Stephen Rothwell 
s...@canb.auug.org.au

Legal Stuff:
By participating in linux-next, your subsystem tree contributions are
public and will be included in the linux-next trees.  You may be sent
e-mail messages indicating errors or other issues when the
patches/commits from your subsystem tree are merged and tested in
linux-next.  These messages may also be cross-posted to the linux-next
mailing list, the linux-kernel mailing list, etc.  The linux-next tree
project and IBM (my employer) make no warranties regarding the linux-next
project, the testing procedures, the results, the e-mails, etc.  If you
don't agree to these ground rules, let me know and I'll remove your tree
from participation in linux-next.


pgpEKkJPDK23a.pgp
Description: PGP signature


Re: [PATCH v3 4/5] clk: basic gateable and fixed-rate clks

2011-11-22 Thread Mark Salter
On Tue, 2011-11-22 at 13:11 +, Arnd Bergmann wrote:
 On Tuesday 22 November 2011, Mike Turquette wrote:
  +static void clk_hw_gate_set_bit(struct clk *clk)
  +{
  +   struct clk_hw_gate *gate = to_clk_hw_gate(clk);
  +   u32 reg;
  +
  +   reg = __raw_readl(gate-reg);
  +   reg |= BIT(gate-bit_idx);
  +   __raw_writel(reg, gate-reg);
  +}
 
 You cannot rely on __raw_readl() to do the right thing, especially
 in architecture independent code. The safe (but slightly inefficient)
 solution would be readl/writel. For ARM-only code, it would be best
 to use readl_relaxed()/writel_relaxed(), but most architectures do
 not implement that. We can probably add a set of helpers in asm-generic/
 to define them to the default functions, like #define readl_relaxed(x)
 readl(x), which I think is a good idea anyway.
 

readl/writel won't work for big endian CPU when the registers are on a
bus that does the endian swabbing in hardware.

--Mark


--
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


omap3isp hangs with 3.2-rc2

2011-11-22 Thread Ohad Ben-Cohen
Hi Laurent,

With 3.2-rc2, omap3isp seems to silently hang in my setup (sensor-less OMAP3).

Turning on lockdep yields the below messages, care to take a quick look ?

Thanks!
Ohad.

root@zoom3:~# media-ctl -r -l 'OMAP3 ISP CCP2 input:0-OMAP3 ISP
CCP2:0[1], OMAP3 ISP CCP
2:1-OMAP3 ISP CCDC:0[1], OMAP3 ISP CCDC:1-OMAP3 ISP CCDC output:0[1]'
media-ctl -f 'OMAP3 ISP CCP2:0[SGRBG10 1280x1024], OMAP3 ISP CCP2:1[SGRBG10
1280x1024], OMAP3 ISP CCDC:1[SGRBG10 1280x1024], OMAP3 ISP CCDC:2[SGRBG10 12
80x1023]'

[   29.014221] Linux video capture interface: v2.00
[   29.423675] omap3isp omap3isp: Revision 15.0 found
[   29.429168] omap-iommu omap-iommu.0: isp: version 1.1
Resetting all links to inactive
Setting up link 2:0 - 1:0 [1]
Setting up link 1:1 - 5:0 [1]
Setting up link 5:1 - 6:0 [1]
Setting up format SGRBG10 1280x1024 on pad OMAP3 ISP CCP2/0
Format set: SGRBG10 1280x1024
Setting up format SGRBG10 1280x1024 on pad OMAP3 ISP CCP2/1
Format set: SGRBG10 1280x1024
Setting up format SGRBG10 1280x1024 on pad OMAP3 ISP CCDC/0
Format set: SGRBG10 1280x1024
Setting up format SGRBG10 1280x1024 on pad OMAP3 ISP CCDC/1
Format set: SGRBG10 1280x1024
Setting up format SGRBG10 1280x1023 on pad OMAP3 ISP CCDC/2
Format set: SGRBG10 1280x1023
Setting up format SGRBG10 1280x1023 on pad OMAP3 ISP AEWB/0
Unable to set format: Invalid argument (-22)
Setting up format SGRBG10 1280x1023 on pad OMAP3 ISP AF/0
Unable to set format: Invalid argument (-22)
Setting up format SGRBG10 1280x1023 on pad OMAP3 ISP histogram/0
Unable to set format: Invalid argument (-22)

At this point, running 'yavta.sh CCP2 input' and 'yavta.sh CCDC
output' in two different terminals yields:

root@zoom2:~# [   55.867156] INFO: trying to register non-static key.
[   55.872161] the code is fine but needs lockdep annotation.
[   55.877624] turning off the locking correctness validator.
[   55.883178] [c001c8f0] (unwind_backtrace+0x0/0x134) from
[c009304c] (__lock_acquire+0x79c/0xb54)
[   55.892333] [c009304c] (__lock_acquire+0x79c/0xb54) from
[c0093a44] (lock_acquire+0x98/0x118)
[   55.901214] [c0093a44] (lock_acquire+0x98/0x118) from
[c0498bb0] (_raw_spin_lock_irqsave+0x5c/0x70)
[   55.910675] [c0498bb0] (_raw_spin_lock_irqsave+0x5c/0x70) from
[bf0393c4] (v4l2_event_queue+0x28/0x6c [videodev])
[   55.921417] [bf0393c4] (v4l2_event_queue+0x28/0x6c [videodev])
from [bf0612b0] (ccdc_hs_vs_isr+0x3c/0x44 [omap3_isp])
[   55.932464] [bf0612b0] (ccdc_hs_vs_isr+0x3c/0x44 [omap3_isp])
from [bf0614a8] (omap3isp_ccdc_isr+0x1f0/0x430 [omap3_isp])
[   55.943847] [bf0614a8] (omap3isp_ccdc_isr+0x1f0/0x430
[omap3_isp]) from [bf057514] (isp_isr+0x174/0x284 [omap3_isp])
[   55.954742] [bf057514] (isp_isr+0x174/0x284 [omap3_isp]) from
[c00a41d4] (handle_irq_event_percpu+0x64/0x268)
[   55.965026] [c00a41d4] (handle_irq_event_percpu+0x64/0x268) from
[c00a4414] (handle_irq_event+0x3c/0x5c)
[   55.974884] [c00a4414] (handle_irq_event+0x3c/0x5c) from
[c00a7264] (handle_level_irq+0xac/0x118)
[   55.984130] [c00a7264] (handle_level_irq+0xac/0x118) from
[c00a3c78] (generic_handle_irq+0x34/0x44)
[   55.993530] [c00a3c78] (generic_handle_irq+0x34/0x44) from
[c0015c38] (handle_IRQ+0x4c/0xac)
[   56.002349] [c0015c38] (handle_IRQ+0x4c/0xac) from [c049961c]
(__irq_svc+0x3c/0xe0)
[   56.010375] [c049961c] (__irq_svc+0x3c/0xe0) from [c005fe80]
(__do_softirq+0x64/0x244)
[   56.018646] [c005fe80] (__do_softirq+0x64/0x244) from
[c00602b8] (irq_exit+0xa0/0xa8)
[   56.026824] [c00602b8] (irq_exit+0xa0/0xa8) from [c0015c3c]
(handle_IRQ+0x50/0xac)
[   56.034759] [c0015c3c] (handle_IRQ+0x50/0xac) from [c049961c]
(__irq_svc+0x3c/0xe0)
[   56.042785] [c049961c] (__irq_svc+0x3c/0xe0) from [c0499340]
(_raw_spin_unlock_irqrestore+0x34/0x5c)
[   56.052307] [c0499340] (_raw_spin_unlock_irqrestore+0x34/0x5c)
from [bf059284] (omap3isp_video_queue_streamon+0x8c/0x9c
[omap3_isp])
[   56.064636] [bf059284] (omap3isp_video_queue_streamon+0x8c/0x9c
[omap3_isp]) from [bf05b2b8] (isp_video_streamon+0x158/0x23c
[omap3_isp])
[   56.077392] [bf05b2b8] (isp_video_streamon+0x158/0x23c
[omap3_isp]) from [bf034f28] (__video_do_ioctl+0x271c/0x5bb8
[videodev])
[   56.089263] [bf034f28] (__video_do_ioctl+0x271c/0x5bb8
[videodev]) from [bf0323c4] (video_usercopy+0x138/0x50c [videodev])
[   56.100708] [bf0323c4] (video_usercopy+0x138/0x50c [videodev])
from [bf031464] (v4l2_ioctl+0x88/0x150 [videodev])
[   56.111358] [bf031464] (v4l2_ioctl+0x88/0x150 [videodev]) from
[c011b3b0] (do_vfs_ioctl+0x7c/0x5b4)
[   56.120758] [c011b3b0] (do_vfs_ioctl+0x7c/0x5b4) from
[c011b95c] (sys_ioctl+0x74/0x7c)
[   56.129028] [c011b95c] (sys_ioctl+0x74/0x7c) from [c0014b80]
(ret_fast_syscall+0x0/0x3c)

[   71.577758] BUG: spinlock lockup on CPU#0, yavta/1302
[   71.582824]  lock: cf345e0c, .magic: , .owner: none/-1,
.owner_cpu: 0
[   71.590148] [c001c8f0] (unwind_backtrace+0x0/0x134) from
[c0265034] (do_raw_spin_lock+0xb8/0x150)
[   71.599395] [c0265034] (do_raw_spin_lock+0xb8/0x150) from
[c0498bb8] (_raw_spin_lock_irqsave+0x64/0x70)
[   

[RFC/PATCH 00/26] PM: Create the AVS class of drivers

2011-11-22 Thread jean . pihet
From: Jean Pihet j-pi...@ti.com

The following patches are in RFC state; the code is still WIP and has been
compile tested only. Feedback on the code organization is welcome!

AVS is a power management technique which controls the operating
voltage of a device in order to optimize (i.e. reduce) its power
consumption. The voltage is adapted depending on static factors
(chip manufacturing process) and dynamic factors (temperature
depending performance).
AVS is also called SmartReflex on OMAP devices.

To that end, create the AVS framework in drivers/power/avs and
move the OMAP SmartReflex code to the new directory.

In preparation to the move of the OMAP code the following changes have been
made:
- split into common code (not semiconductor specific), a v1 IP driver,
  a v2 IP driver and a class driver for SmartReflex Class3,
- initialize the v1 driver for OMAP34xx platform and v2 driver for
   OMAP36xx and OMAP4xxx platforms,
- create CONFIG_AVS* config options accordingly,
- split the include files into generic and platform specific code,
- removal of unused code in SmartReflex: notification machanism, PMIC
  specific code.

The following features are supported:
- read the SmartReflex values from the e-fuses and allow the board file code
  to override the values,
- platform integration data for SmartReflex is passed to the driver using
  pdata.


ToDo:
- integration with the platform code,
- kerneldoc should be added to the new structs and functions,
- use correct device attribute data for OMAP4,
- test on board (OMAP3/4),
- integrate latest SmartReflex fixes [1]

The code is based on Paul's original version of the SmartReflex driver 
conversion
[2].

Compile tested only using omap2plus_defconfig with the CONFIG_POWER_AVS* 
options set.
Based on latest master branch of the l-o git tree (3.2.0-rc2) [3].

[1] http://marc.info/?l=linux-omapm=132134699423547w=2
[2] smartreflex_cleanup_3.1 branch of git://git.pwsan.com/linux-2.6 
[3] git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap.git


Jean Pihet (14):
  OMAP3/4: SmartReflex: class drivers should use struct omap_sr *
  OMAP3/4: SmartReflex: API should use struct omap_sr *, not struct
voltagedomain *
  OMAP: SmartReflex: drop _sr_lookup()
  OMAP3+: Pass SmartReflex instance-specific data via hwmod dev_attr
  OMAP3+: hwmod: get rid of vdd_name field
  OMAP2+: rename struct omap_sr_class_data to smartreflex_class_data
  OMAP2+: Use the names from the SmartReflex data instead of voltage
domains.
  OMAP2+: SmartReflex: make driver generic
  OMAP2+: SmartReflex: get rid of superfluous data that is duplicated
between platform_data and the struct omap_sr
  OMAP2+: SmartReflex: remove OMAP specific code
  OMAP2+: SmartReflex: conversion into generic driver
  OMAP3+: voltage: export functions to plat/voltage.h
  OMAP: PM: convert the SmartReflex code into the AVS driver framework
  PM: Create the AVS class of drivers

Paul Walmsley (12):
  OMAP2+: smartreflex: use sane default values
  OMAP: hwmod/SmartReflex: remove IP block instance-specific data from
the driver code
  OMAP: SmartReflex: make pdata distinct from other data
  OMAP: SmartReflex: Use 'sr' for struct smartreflex
  OMAP3+: SmartReflex: remove unused PMIC code
  OMAP: SmartReflex: remove some SoC-specific implementation details
from driver
  OMAP: SmartReflex driver interface: allow core to override eFuse data
  OMAP2+: SmartReflex: rename nvalue table
  OMAP2+: SmartReflex: cosmetic changes
  OMAP3+: Add SmartReflex clocks
  OMAP2+: Use the TRM formula to calculate the SmartReflex clock rate
  OMAP2+: SmartReflex: Remove the notifier handler

 arch/arm/mach-omap2/Makefile  |4 +-
 arch/arm/mach-omap2/clock3xxx_data.c  |6 +
 arch/arm/mach-omap2/clock44xx_data.c  |3 +
 arch/arm/mach-omap2/omap_hwmod_3xxx_data.c|   37 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c|   40 +-
 arch/arm/mach-omap2/pm.h  |2 +-
 arch/arm/mach-omap2/smartreflex-class3.c  |   59 --
 arch/arm/mach-omap2/smartreflex.c | 1056 -
 arch/arm/mach-omap2/smartreflex.h |  246 --
 arch/arm/mach-omap2/sr_device.c   |  129 ++--
 arch/arm/mach-omap2/voltage.h |3 +-
 arch/arm/mach-omap2/vp.h  |2 -
 arch/arm/plat-omap/Kconfig|   31 -
 arch/arm/plat-omap/include/plat/omap_hwmod.h  |3 -
 arch/arm/plat-omap/include/plat/smartreflex.h |  106 +++
 arch/arm/plat-omap/include/plat/voltage.h |3 +
 drivers/power/Kconfig |2 +
 drivers/power/Makefile|2 +
 drivers/power/avs/Kconfig |   56 ++
 drivers/power/avs/Makefile|4 +
 drivers/power/avs/smartreflex-class3.c|   64 ++
 drivers/power/avs/smartreflex-common.c|  543 +
 drivers/power/avs/smartreflex.h   |  231 ++
 

[PATCH 01/26] OMAP2+: smartreflex: use sane default values

2011-11-22 Thread jean . pihet
From: Paul Walmsley p...@pwsan.com

Use sane values for the smartreflex data from the e-fuses.

Signed-off-by: Paul Walmsley p...@pwsan.com
Signed-off-by: Jean Pihet j-pi...@ti.com
---
 arch/arm/mach-omap2/sr_device.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/sr_device.c b/arch/arm/mach-omap2/sr_device.c
index 9f43fcc..221407a 100644
--- a/arch/arm/mach-omap2/sr_device.c
+++ b/arch/arm/mach-omap2/sr_device.c
@@ -38,11 +38,18 @@ static void __init sr_set_nvalues(struct omap_volt_data 
*volt_data,
struct omap_sr_nvalue_table *nvalue_table;
int i, count = 0;
 
+   sr_data-nvalue_count = 0;
+   sr_data-nvalue_table = NULL;
+
while (volt_data[count].volt_nominal)
count++;
 
nvalue_table = kzalloc(sizeof(struct omap_sr_nvalue_table)*count,
GFP_KERNEL);
+   if (!nvalue_table) {
+   pr_err(OMAP: SmartReflex: cannot allocate memory for n-value 
table\n);
+   return;
+   }
 
for (i = 0; i  count; i++) {
u32 v;
-- 
1.7.5.4

--
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 03/26] OMAP3/4: SmartReflex: API should use struct omap_sr *, not struct voltagedomain *

2011-11-22 Thread jean . pihet
From: Jean Pihet j-pi...@ti.com

The SmartReflex API should take pointers to a SmartReflex instance-specific
structure record, not pointers to a OMAP subarchitecture-specific struct
voltagedomain *.  The SmartReflex drivers should not be tightly coupled
to the SoC subarchitecture; these IP blocks could appear on different
subarchitectures.

Based on Paul's original code for the SmartReflex driver conversion.

Signed-off-by: Jean Pihet j-pi...@ti.com
Cc: Paul Walmsley p...@pwsan.com
Cc: Thara Gopinath th...@ti.com
Cc: Nishanth Menon n...@ti.com
Cc: Kevin Hilman khil...@ti.com
---
 arch/arm/mach-omap2/smartreflex-class3.c |6 +-
 arch/arm/mach-omap2/smartreflex.c|   68 --
 arch/arm/mach-omap2/smartreflex.h|   20 
 3 files changed, 31 insertions(+), 63 deletions(-)

diff --git a/arch/arm/mach-omap2/smartreflex-class3.c 
b/arch/arm/mach-omap2/smartreflex-class3.c
index 97bdb0b..0205f17 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -24,13 +24,13 @@ static int sr_class3_enable(struct omap_sr *sr)
}
 
omap_vp_enable(sr-voltdm);
-   return sr_enable(sr-voltdm, volt);
+   return sr_enable(sr, volt);
 }
 
 static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
 {
omap_vp_disable(sr-voltdm);
-   sr_disable(sr-voltdm);
+   sr_disable(sr);
if (is_volt_reset)
voltdm_reset(sr-voltdm);
 
@@ -39,7 +39,7 @@ static int sr_class3_disable(struct omap_sr *sr, int 
is_volt_reset)
 
 static int sr_class3_configure(struct omap_sr *sr)
 {
-   return sr_configure_errgen(sr-voltdm);
+   return sr_configure_errgen(sr);
 }
 
 /* SR class3 structure */
diff --git a/arch/arm/mach-omap2/smartreflex.c 
b/arch/arm/mach-omap2/smartreflex.c
index 01ff78a..55966bc 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -364,7 +364,7 @@ static u32 sr_retrieve_nvalue(struct omap_sr *sr, u32 
efuse_offs)
 /**
  * sr_configure_errgen() - Configures the smrtreflex to perform AVS using the
  *  error generator module.
- * @voltdm:VDD pointer to which the SR module to be configured belongs to.
+ * @sr: struct omap_sr *
  *
  * This API is to be called from the smartreflex class driver to
  * configure the error generator module inside the smartreflex module.
@@ -373,18 +373,14 @@ static u32 sr_retrieve_nvalue(struct omap_sr *sr, u32 
efuse_offs)
  * SR CLASS 2 can choose between ERROR module and MINMAXAVG
  * module. Returns 0 on success and error value in case of failure.
  */
-int sr_configure_errgen(struct voltagedomain *voltdm)
+int sr_configure_errgen(struct omap_sr *sr)
 {
u32 sr_config, sr_errconfig, errconfig_offs, vpboundint_en;
u32 vpboundint_st, senp_en = 0, senn_en = 0;
u8 senp_shift, senn_shift;
-   struct omap_sr *sr = _sr_lookup(voltdm);
 
-   if (IS_ERR(sr)) {
-   pr_warning(%s: omap_sr struct for sr_%s not found\n,
-   __func__, voltdm-name);
+   if (IS_ERR_OR_NULL(sr))
return -EINVAL;
-   }
 
if (!sr-clk_length)
sr_set_clk_length(sr);
@@ -433,7 +429,7 @@ int sr_configure_errgen(struct voltagedomain *voltdm)
 /**
  * sr_configure_minmax() - Configures the smrtreflex to perform AVS using the
  *  minmaxavg module.
- * @voltdm:VDD pointer to which the SR module to be configured belongs to.
+ * @sr: struct omap_sr *
  *
  * This API is to be called from the smartreflex class driver to
  * configure the minmaxavg module inside the smartreflex module.
@@ -442,18 +438,14 @@ int sr_configure_errgen(struct voltagedomain *voltdm)
  * SR CLASS 2 can choose between ERROR module and MINMAXAVG
  * module. Returns 0 on success and error value in case of failure.
  */
-int sr_configure_minmax(struct voltagedomain *voltdm)
+int sr_configure_minmax(struct omap_sr *sr)
 {
u32 sr_config, sr_avgwt;
u32 senp_en = 0, senn_en = 0;
u8 senp_shift, senn_shift;
-   struct omap_sr *sr = _sr_lookup(voltdm);
 
-   if (IS_ERR(sr)) {
-   pr_warning(%s: omap_sr struct for sr_%s not found\n,
-   __func__, voltdm-name);
+   if (IS_ERR_OR_NULL(sr))
return -EINVAL;
-   }
 
if (!sr-clk_length)
sr_set_clk_length(sr);
@@ -509,7 +501,7 @@ int sr_configure_minmax(struct voltagedomain *voltdm)
 
 /**
  * sr_enable() - Enables the smartreflex module.
- * @voltdm:VDD pointer to which the SR module to be configured belongs to.
+ * @sr: struct omap_sr *
  * @volt:  The voltage at which the Voltage domain associated with
  * the smartreflex module is operating at.
  * This is required only to program the correct Ntarget value.
@@ -518,18 +510,14 @@ int sr_configure_minmax(struct voltagedomain *voltdm)
  * enable a smartreflex module. Returns 0 on 

  1   2   >