summaryrefslogtreecommitdiff
path: root/drivers/video
diff options
context:
space:
mode:
authorMarcus Lorentzon <marcus.xm.lorentzon@stericsson.com>2011-11-15 18:17:08 +0100
committerPhilippe Langlais <philippe.langlais@stericsson.com>2012-05-22 11:04:24 +0200
commit11f7b4afa5d8ede8bbf762dc5c7dfb221e42aa1f (patch)
tree83ec496d60f0c55031e5ded778b2daf78870d668 /drivers/video
parent527c0f7b29feec34d498291999ea4ee7ebfa91f0 (diff)
video: mcde: Hide display physical orientation
User space should not have to compensate fbdev rotation for different physical mounting orientations of panels. This patch hide the mounting orientation from user space. ST-Ericsson ID: 368097 ST-Ericsson FOSS-OUT ID: Trivial ST-Ericsson Linux next: NA Change-Id: Ia6088066af04477cf9643e3151f72e4350531ccc Signed-off-by: Marcus Lorentzon <marcus.xm.lorentzon@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/34137 Reviewed-by: QATOOLS Reviewed-by: QABUILD Reviewed-by: QATEST Reviewed-by: Jimmy RUBIN <jimmy.rubin@stericsson.com> Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Diffstat (limited to 'drivers/video')
-rw-r--r--drivers/video/mcde/mcde_display.c26
-rw-r--r--drivers/video/mcde/mcde_dss.c15
-rw-r--r--drivers/video/mcde/mcde_hw.c4
3 files changed, 27 insertions, 18 deletions
diff --git a/drivers/video/mcde/mcde_display.c b/drivers/video/mcde/mcde_display.c
index a461b36c9b6..1e71514ab34 100644
--- a/drivers/video/mcde/mcde_display.c
+++ b/drivers/video/mcde/mcde_display.c
@@ -210,25 +210,19 @@ static int mcde_display_set_rotation_default(struct mcde_display_device *ddev,
enum mcde_display_rotation rotation)
{
int ret;
+ u8 param = 0;
+ enum mcde_display_rotation final;
- ret = mcde_chnl_set_rotation(ddev->chnl_state, rotation,
- ddev->rotbuf1, ddev->rotbuf2);
- if (ret < 0) {
- dev_warn(&ddev->dev, "%s:Failed to set rotation = %d\n",
- __func__, rotation);
+ final = (360 + rotation - ddev->orientation) % 360;
+ ret = mcde_chnl_set_rotation(ddev->chnl_state, final,
+ ddev->rotbuf1, ddev->rotbuf2);
+ if (WARN_ON(ret))
return ret;
- }
- if (rotation == MCDE_DISPLAY_ROT_180_CCW) {
- u8 param = 0x40;
- (void) mcde_dsi_dcs_write(ddev->chnl_state,
- DCS_CMD_SET_ADDRESS_MODE, &param, 1);
- } else if (ddev->rotation == MCDE_DISPLAY_ROT_180_CCW &&
- rotation != MCDE_DISPLAY_ROT_180_CCW) {
- u8 param = 0;
- (void) mcde_dsi_dcs_write(ddev->chnl_state,
- DCS_CMD_SET_ADDRESS_MODE, &param, 1);
- }
+ if (final == MCDE_DISPLAY_ROT_180_CW)
+ param = 0x40; /* Horizontal flip */
+ (void)mcde_dsi_dcs_write(ddev->chnl_state, DCS_CMD_SET_ADDRESS_MODE,
+ &param, 1);
ddev->rotation = rotation;
ddev->update_flags |= UPDATE_FLAG_ROTATION;
diff --git a/drivers/video/mcde/mcde_dss.c b/drivers/video/mcde/mcde_dss.c
index 044e39ad285..a2ef0b652d7 100644
--- a/drivers/video/mcde/mcde_dss.c
+++ b/drivers/video/mcde/mcde_dss.c
@@ -121,6 +121,10 @@ int mcde_dss_enable_display(struct mcde_display_device *ddev)
if (ret < 0)
dev_warn(&ddev->dev, "Failed to set sync\n");
+ ret = ddev->set_rotation(ddev, ddev->get_rotation(ddev));
+ if (ret < 0)
+ dev_warn(&ddev->dev, "Failed to set rotation\n");
+
ret = mcde_chnl_enable_synchronized_update(ddev->chnl_state,
ddev->synchronized_update);
if (ret < 0) {
@@ -301,8 +305,17 @@ EXPORT_SYMBOL(mcde_dss_get_overlay_info);
void mcde_dss_get_native_resolution(struct mcde_display_device *ddev,
u16 *x_res, u16 *y_res)
{
+ u16 x_tmp, y_tmp;
mutex_lock(&ddev->display_lock);
- ddev->get_native_resolution(ddev, x_res, y_res);
+ ddev->get_native_resolution(ddev, &x_tmp, &y_tmp);
+ if (ddev->orientation == MCDE_DISPLAY_ROT_90_CW ||
+ ddev->orientation == MCDE_DISPLAY_ROT_90_CCW) {
+ *x_res = y_tmp;
+ *y_res = x_tmp;
+ } else {
+ *x_res = x_tmp;
+ *y_res = y_tmp;
+ }
mutex_unlock(&ddev->display_lock);
}
EXPORT_SYMBOL(mcde_dss_get_native_resolution);
diff --git a/drivers/video/mcde/mcde_hw.c b/drivers/video/mcde/mcde_hw.c
index 6e846e60f47..dfda6490ae2 100644
--- a/drivers/video/mcde/mcde_hw.c
+++ b/drivers/video/mcde/mcde_hw.c
@@ -2944,7 +2944,9 @@ int mcde_chnl_set_rotation(struct mcde_chnl_state *chnl,
if (!chnl->reserved)
return -EINVAL;
- if (chnl->id != MCDE_CHNL_A && chnl->id != MCDE_CHNL_B)
+ if ((rotation == MCDE_DISPLAY_ROT_90_CW ||
+ rotation == MCDE_DISPLAY_ROT_90_CCW) &&
+ (chnl->id != MCDE_CHNL_A && chnl->id != MCDE_CHNL_B))
return -EINVAL;
chnl->rotation = rotation;