From patchwork Thu Aug 16 07:36:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: archit taneja X-Patchwork-Id: 1330081 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 70B5840210 for ; Thu, 16 Aug 2012 07:38:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752316Ab2HPHi0 (ORCPT ); Thu, 16 Aug 2012 03:38:26 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:42141 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751606Ab2HPHiZ (ORCPT ); Thu, 16 Aug 2012 03:38:25 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id q7G7cO3e007308; Thu, 16 Aug 2012 02:38:24 -0500 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7G7cOdU028801; Thu, 16 Aug 2012 02:38:24 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Thu, 16 Aug 2012 02:38:24 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7G7cOVU018570; Thu, 16 Aug 2012 02:38:24 -0500 Received: from localhost (a0393947pc.apr.dhcp.ti.com [172.24.137.248]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id q7G7cMr13376; Thu, 16 Aug 2012 02:38:22 -0500 (CDT) From: Archit Taneja To: CC: , , Archit Taneja Subject: [PATCH 5/6] OMAPDSS: VENC: Maintain copy of venc type in driver data Date: Thu, 16 Aug 2012 13:06:33 +0530 Message-ID: <1345102594-6222-6-git-send-email-archit@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1345102594-6222-1-git-send-email-archit@ti.com> References: <343817088-29645-1-git-send-email-archit@ti.com> <1345102594-6222-1-git-send-email-archit@ti.com> MIME-Version: 1.0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The VENC driver currently relies on the omap_dss_device struct to configure the venc type. This makes the VENC interface driver dependent on the omap_dss_device struct. Make the VENC driver data maintain it's own 'venc type' field. A panel driver is expected to call omapdss_venc_set_type() before enabling the interface or changing the type via display sysfs attributes. Signed-off-by: Archit Taneja --- drivers/video/omap2/dss/dss.h | 2 ++ drivers/video/omap2/dss/venc.c | 15 +++++++++++++-- drivers/video/omap2/dss/venc_panel.c | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index f919dc8..c17d298 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -477,6 +477,8 @@ int omapdss_venc_check_timings(struct omap_dss_device *dssdev, struct omap_video_timings *timings); u32 omapdss_venc_get_wss(struct omap_dss_device *dssdev); int omapdss_venc_set_wss(struct omap_dss_device *dssdev, u32 wss); +void omapdss_venc_set_type(struct omap_dss_device *dssdev, + enum omap_dss_venc_type type); int venc_panel_init(void); void venc_panel_exit(void); diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index d96025e..2d90fcf 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -302,6 +302,7 @@ static struct { struct clk *tv_dac_clk; struct omap_video_timings timings; + enum omap_dss_venc_type type; } venc; static inline void venc_write_reg(int idx, u32 val) @@ -436,12 +437,12 @@ static int venc_power_on(struct omap_dss_device *dssdev) venc_reset(); venc_write_config(venc_timings_to_config(&venc.timings)); - dss_set_venc_output(dssdev->phy.venc.type); + dss_set_venc_output(venc.type); dss_set_dac_pwrdn_bgz(1); l = 0; - if (dssdev->phy.venc.type == OMAP_DSS_VENC_TYPE_COMPOSITE) + if (venc.type == OMAP_DSS_VENC_TYPE_COMPOSITE) l |= 1 << 1; else /* S-Video */ l |= (1 << 0) | (1 << 2); @@ -628,6 +629,16 @@ err: return r; } +void omapdss_venc_set_type(struct omap_dss_device *dssdev, + enum omap_dss_venc_type type) +{ + mutex_lock(&venc.venc_lock); + + venc.type = type; + + mutex_unlock(&venc.venc_lock); +} + static int __init venc_init_display(struct omap_dss_device *dssdev) { DSSDBG("init_display\n"); diff --git a/drivers/video/omap2/dss/venc_panel.c b/drivers/video/omap2/dss/venc_panel.c index 8096369..ef21361 100644 --- a/drivers/video/omap2/dss/venc_panel.c +++ b/drivers/video/omap2/dss/venc_panel.c @@ -68,6 +68,7 @@ static ssize_t display_output_type_store(struct device *dev, if (dssdev->phy.venc.type != new_type) { dssdev->phy.venc.type = new_type; + omapdss_venc_set_type(dssdev, new_type); if (dssdev->state == OMAP_DSS_DISPLAY_ACTIVE) { omapdss_venc_display_disable(dssdev); omapdss_venc_display_enable(dssdev); @@ -128,6 +129,7 @@ static int venc_panel_enable(struct omap_dss_device *dssdev) } omapdss_venc_set_timings(dssdev, &dssdev->panel.timings); + omapdss_venc_set_type(dssdev, dssdev->phy.venc.type); r = omapdss_venc_display_enable(dssdev); if (r)