From patchwork Thu Aug 30 11:40:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: archit taneja X-Patchwork-Id: 1387801 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 E75B63FDF5 for ; Thu, 30 Aug 2012 11:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754769Ab2H3LnT (ORCPT ); Thu, 30 Aug 2012 07:43:19 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:57664 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754708Ab2H3LnS (ORCPT ); Thu, 30 Aug 2012 07:43:18 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id q7UBhHNv019522; Thu, 30 Aug 2012 06:43:17 -0500 Received: from DLEE74.ent.ti.com (dlee74.ent.ti.com [157.170.170.8]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7UBhHRd001407; Thu, 30 Aug 2012 06:43:17 -0500 Received: from dlelxv24.itg.ti.com (172.17.1.199) by DLEE74.ent.ti.com (157.170.170.8) with Microsoft SMTP Server id 14.1.323.3; Thu, 30 Aug 2012 06:43:16 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv24.itg.ti.com (8.13.8/8.13.8) with ESMTP id q7UBhG3u005669; Thu, 30 Aug 2012 06:43:16 -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 q7UBhEr25267; Thu, 30 Aug 2012 06:43:15 -0500 (CDT) From: Archit Taneja To: CC: , , , Archit Taneja Subject: [PATCH v2 16/23] OMAPDSS: VENC: Pass omap_dss_output within the driver Date: Thu, 30 Aug 2012 17:10:38 +0530 Message-ID: <1346326845-16583-17-git-send-email-archit@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1346326845-16583-1-git-send-email-archit@ti.com> References: <1345528711-27801-1-git-send-email-archit@ti.com> <1346326845-16583-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 When a panel driver calls a VENC function, it passes the omap_dss_device pointer, this pointer currently propagates within the VENC driver to configure the interface. Extract the omap_dss_output pointer from omap_dss_device received from the panel driver, pass the output pointer to VENC functions local to the driver to configure the interface, these functions no longer need omap_dss_device since the driver now maintains a copy of output parameters. Replace dssdev->manager references with out->manager references as only these will be valid later. With the addition of outputs. There is a possibility that an omap_dss_device isn't connected to an output, or a manager isn't connected to an output yet. Ensure that the VENC interface functions proceed only if the output is non NULL. Signed-off-by: Archit Taneja --- drivers/video/omap2/dss/venc.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c index 942a378..3fe974f 100644 --- a/drivers/video/omap2/dss/venc.c +++ b/drivers/video/omap2/dss/venc.c @@ -428,7 +428,7 @@ static const struct venc_config *venc_timings_to_config( return NULL; } -static int venc_power_on(struct omap_dss_device *dssdev) +static int venc_power_on(struct omap_dss_output *out) { u32 l; int r; @@ -455,13 +455,13 @@ static int venc_power_on(struct omap_dss_device *dssdev) venc_write_reg(VENC_OUTPUT_CONTROL, l); - dss_mgr_set_timings(dssdev->manager, &venc.timings); + dss_mgr_set_timings(out->manager, &venc.timings); r = regulator_enable(venc.vdda_dac_reg); if (r) goto err1; - r = dss_mgr_enable(dssdev->manager); + r = dss_mgr_enable(out->manager); if (r) goto err2; @@ -478,12 +478,12 @@ err0: return r; } -static void venc_power_off(struct omap_dss_device *dssdev) +static void venc_power_off(struct omap_dss_output *out) { venc_write_reg(VENC_OUTPUT_CONTROL, 0); dss_set_dac_pwrdn_bgz(0); - dss_mgr_disable(dssdev->manager); + dss_mgr_disable(out->manager); regulator_disable(venc.vdda_dac_reg); @@ -498,14 +498,15 @@ unsigned long venc_get_pixel_clock(void) int omapdss_venc_display_enable(struct omap_dss_device *dssdev) { + struct omap_dss_output *out = dssdev->output; int r; DSSDBG("venc_display_enable\n"); mutex_lock(&venc.venc_lock); - if (dssdev->manager == NULL) { - DSSERR("Failed to enable display: no manager\n"); + if (out == NULL || out->manager == NULL) { + DSSERR("Failed to enable display: no output/manager\n"); r = -ENODEV; goto err0; } @@ -520,7 +521,7 @@ int omapdss_venc_display_enable(struct omap_dss_device *dssdev) dssdev->platform_enable(dssdev); - r = venc_power_on(dssdev); + r = venc_power_on(out); if (r) goto err1; @@ -540,11 +541,13 @@ err0: void omapdss_venc_display_disable(struct omap_dss_device *dssdev) { + struct omap_dss_output *out = dssdev->output; + DSSDBG("venc_display_disable\n"); mutex_lock(&venc.venc_lock); - venc_power_off(dssdev); + venc_power_off(out); omap_dss_stop_device(dssdev); @@ -557,8 +560,13 @@ void omapdss_venc_display_disable(struct omap_dss_device *dssdev) void omapdss_venc_set_timings(struct omap_dss_device *dssdev, struct omap_video_timings *timings) { + struct omap_dss_output *out = dssdev->output; + DSSDBG("venc_set_timings\n"); + if (out == NULL) + return; + mutex_lock(&venc.venc_lock); /* Reset WSS data when the TV standard changes. */ @@ -571,13 +579,13 @@ void omapdss_venc_set_timings(struct omap_dss_device *dssdev, int r; /* turn the venc off and on to get new timings to use */ - venc_power_off(dssdev); + venc_power_off(out); - r = venc_power_on(dssdev); + r = venc_power_on(out); if (r) DSSERR("failed to power on VENC\n"); } else { - dss_mgr_set_timings(dssdev->manager, timings); + dss_mgr_set_timings(out->manager, timings); } mutex_unlock(&venc.venc_lock);