From patchwork Wed Nov 7 14:44:24 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: archit taneja X-Patchwork-Id: 1710781 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 7570CE003B for ; Wed, 7 Nov 2012 14:45:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753922Ab2KGOpM (ORCPT ); Wed, 7 Nov 2012 09:45:12 -0500 Received: from bear.ext.ti.com ([192.94.94.41]:42431 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753794Ab2KGOpK (ORCPT ); Wed, 7 Nov 2012 09:45:10 -0500 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id qA7Ej9LQ023858; Wed, 7 Nov 2012 08:45:09 -0600 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 qA7Ej9NC010785; Wed, 7 Nov 2012 08:45:09 -0600 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; Wed, 7 Nov 2012 08:45:09 -0600 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 qA7Ej97X011076; Wed, 7 Nov 2012 08:45:09 -0600 Received: from localhost (a0393947pc.apr.dhcp.ti.com [172.24.136.151]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id qA7Ej8w12891; Wed, 7 Nov 2012 08:45:08 -0600 (CST) From: Archit Taneja To: CC: , , Archit Taneja Subject: [RFC 06/11] OMAPDSS: APPLY: configure channel_in for writeback Date: Wed, 7 Nov 2012 20:14:24 +0530 Message-ID: <1352299469-17609-7-git-send-email-archit@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1352299469-17609-1-git-send-email-archit@ti.com> References: <1352299469-17609-1-git-send-email-archit@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org writeback's input is configured by the CHANNELIN field in DISPC_WB_ATTRIBUTES. It's an immediate write register field. We need to change writeback's channel in whenever the manager to which it is connected changes. When changing managers for overlays, we needed to be certain that the overlay was disabled. We added some extra waits for that. However, such a thing isn't required for writeback as it's disabled for sure after we call dss_wb_disable. Signed-off-by: Archit Taneja --- drivers/video/omap2/dss/apply.c | 31 +++++++++++++++++++++++++++++++ drivers/video/omap2/dss/dss.h | 9 +++++++++ drivers/video/omap2/dss/writeback.c | 23 +++++++++++++++++++++++ 3 files changed, 63 insertions(+) diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index 1ab1755..a205ed4 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c @@ -1175,6 +1175,22 @@ int dss_mgr_set_output(struct omap_overlay_manager *mgr, goto err; } + if (output_is_wb(output)) { + enum dss_writeback_channel channel; + + r = dss_writeback_calc_channel_in(mgr, &channel); + if (r) + goto err; + + r = dispc_runtime_get(); + if (r) + goto err; + + dispc_wb_set_channel_in(channel); + + dispc_runtime_put(); + } + output->manager = mgr; mgr->output = output; @@ -1210,6 +1226,21 @@ int dss_mgr_unset_output(struct omap_overlay_manager *mgr) spin_unlock_irqrestore(&data_lock, flags); + if (output_is_wb(mgr->output)) { + struct omap_dss_output *wb = mgr->output; + struct wb_priv_data *wp = get_wb_priv(wb); + + spin_lock_irqsave(&data_lock, flags); + + if (wp->enabled) { + DSSERR("WB output can't be unset when enabled\n"); + r = -EINVAL; + goto err1; + } + + spin_unlock_irqrestore(&data_lock, flags); + } + mgr->output->manager = NULL; mgr->output = NULL; diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 6238895..f9e7074 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -540,6 +540,15 @@ int hdmi_audio_config(struct omap_dss_audio *audio); #ifdef CONFIG_OMAP4_DSS_WRITEBACK int writeback_init_platform_driver(void) __init; void writeback_uninit_platform_driver(void) __exit; +int dss_writeback_calc_channel_in(struct omap_overlay_manager *mgr, + enum dss_writeback_channel *channel); +#else +static inline int dss_writeback_calc_channel_in(struct omap_overlay_manager *mgr, + enum dss_writeback_channel *channel) +{ + WARN("%s: WB not compiled in, returning 0\n", __func__); + return 0; +} #endif /* RFBI */ diff --git a/drivers/video/omap2/dss/writeback.c b/drivers/video/omap2/dss/writeback.c index 598defd..09394fb 100644 --- a/drivers/video/omap2/dss/writeback.c +++ b/drivers/video/omap2/dss/writeback.c @@ -48,6 +48,29 @@ static inline struct platform_device *writeback_get_wbdev_from_output(struct oma return out->pdev; } +int dss_writeback_calc_channel_in(struct omap_overlay_manager *mgr, + enum dss_writeback_channel *channel) +{ + /* + * Add a case for dummy writeback manager once we support connecting + * writeback directly to an overlay. + */ + switch (mgr->id) { + case OMAP_DSS_CHANNEL_DIGIT: + *channel = DSS_WB_TV_MGR; + break; + case OMAP_DSS_CHANNEL_LCD2: + *channel = DSS_WB_LCD2_MGR; + break; + case OMAP_DSS_CHANNEL_LCD: + default: + *channel = DSS_WB_LCD1_MGR; + break; + } + + return 0; +} + void omapdss_writeback_set_input_size(struct omap_dss_output *wb, u16 w, u16 h) { struct platform_device *wbdev = writeback_get_wbdev_from_output(wb);