From patchwork Wed Nov 7 14:44:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: archit taneja X-Patchwork-Id: 1710721 Return-Path: X-Original-To: patchwork-linux-omap@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 DC5473FD2B for ; Wed, 7 Nov 2012 14:45:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753749Ab2KGOpD (ORCPT ); Wed, 7 Nov 2012 09:45:03 -0500 Received: from arroyo.ext.ti.com ([192.94.94.40]:50622 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753700Ab2KGOpA (ORCPT ); Wed, 7 Nov 2012 09:45:00 -0500 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by arroyo.ext.ti.com (8.13.7/8.13.7) with ESMTP id qA7Ej0lL003331; Wed, 7 Nov 2012 08:45:00 -0600 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 qA7Ej0dZ010240; Wed, 7 Nov 2012 08:45:00 -0600 Received: from dlelxv24.itg.ti.com (172.17.1.199) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Wed, 7 Nov 2012 08:45:00 -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 qA7Ej0kc010710; Wed, 7 Nov 2012 08:45:00 -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 qA7Eiww12834; Wed, 7 Nov 2012 08:44:59 -0600 (CST) From: Archit Taneja To: CC: , , Archit Taneja Subject: [RFC 03/11] OMAPDSS: APPLY: Apply writeback configurations Date: Wed, 7 Nov 2012 20:14:21 +0530 Message-ID: <1352299469-17609-4-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 Add changes in apply to let a user apply writeback configurations. This basically involves a writeback user to commit the writeback_info it has set previously. Only memory to memory mode is supported for now in APPLY. Actual register writes would only happen when a mem to mem update is initiated. Therefore, there isn't a need to support the cases of shadow registers being dirty. Add the following: - info and info_dirty fields in private data to represent the lower cache of writeback info in APPLY. - Function omap_dss_wb_apply which propagates user_info to info, and an equivalent function in writeback output driver exposed to writeback users. - Function dss_wb_write_regs to be used by APPLY to configure writeback DISPC registers. - Helper function which tells the mode of writeback. Signed-off-by: Archit Taneja --- drivers/video/omap2/dss/apply.c | 68 +++++++++++++++++++++++++++++++++++ drivers/video/omap2/dss/dss.h | 1 + drivers/video/omap2/dss/writeback.c | 6 ++++ include/video/omapdss.h | 1 + 4 files changed, 76 insertions(+) diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c index b2e4f6a..76886da 100644 --- a/drivers/video/omap2/dss/apply.c +++ b/drivers/video/omap2/dss/apply.c @@ -110,6 +110,15 @@ struct wb_priv_data { bool user_info_dirty; struct omap_dss_writeback_info user_info; + + bool info_dirty; + struct omap_dss_writeback_info info; + + /* + * If true in memory to memory mode, a manager is connected to it. + * However, it may not be active. + */ + bool enabled; }; static struct { @@ -209,6 +218,11 @@ static bool mgr_manual_update(struct omap_overlay_manager *mgr) return mp->lcd_config.stallmode; } +static bool wb_manual_update(struct omap_dss_output *wb) +{ + return true; +} + static int dss_check_settings_low(struct omap_overlay_manager *mgr, bool applying) { @@ -684,6 +698,36 @@ static void dss_mgr_write_regs_extra(struct omap_overlay_manager *mgr) mp->shadow_extra_info_dirty = true; } +static void dss_wb_write_regs(struct omap_dss_output *wb) +{ + struct wb_priv_data *wp = get_wb_priv(wb); + struct omap_dss_writeback_info *wi; + struct mgr_priv_data *mp; + u32 fifo_low, fifo_high; + bool use_fifo_merge = false; + int r; + + if (!wp->enabled || !wp->info_dirty) + return; + + wi = &wp->info; + + mp = get_mgr_priv(wb->manager); + + dispc_ovl_compute_fifo_thresholds(OMAP_DSS_WB, &fifo_low, &fifo_high, + use_fifo_merge, wb_manual_update(wb)); + + dispc_ovl_set_fifo_threshold(OMAP_DSS_WB, fifo_low, fifo_high); + + r = dispc_wb_setup(wi, wb_manual_update(wb), &mp->timings); + if (r) { + DSSERR("dispc_wb_setup failed %d\n", r); + return; + } + + wp->info_dirty = false; +} + static void dss_write_regs(void) { const int num_mgrs = omap_dss_get_num_overlay_managers(); @@ -1507,3 +1551,27 @@ void dss_wb_get_info(struct omap_dss_output *wb, spin_unlock_irqrestore(&data_lock, flags); } + +int omap_dss_wb_apply(struct omap_dss_output *wb) +{ + struct wb_priv_data *wp = get_wb_priv(wb); + unsigned long flags; + + DSSDBG("omap_dss_wb_apply\n"); + + spin_lock_irqsave(&data_lock, flags); + + /* check for settings here */ + + if (!wp->user_info_dirty) + goto end; + + wp->user_info_dirty = false; + wp->info_dirty = true; + wp->info = wp->user_info; + +end: + spin_unlock_irqrestore(&data_lock, flags); + + return 0; +} diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index f738c1e..1b9c936 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -214,6 +214,7 @@ int dss_wb_set_info(struct omap_dss_output *wb, struct omap_dss_writeback_info *info); void dss_wb_get_info(struct omap_dss_output *wb, struct omap_dss_writeback_info *info); +int omap_dss_wb_apply(struct omap_dss_output *wb); /* output */ void dss_register_output(struct omap_dss_output *out); diff --git a/drivers/video/omap2/dss/writeback.c b/drivers/video/omap2/dss/writeback.c index be7027b..c05dd54 100644 --- a/drivers/video/omap2/dss/writeback.c +++ b/drivers/video/omap2/dss/writeback.c @@ -42,6 +42,12 @@ static inline struct platform_device *writeback_get_wbdev_from_output(struct oma return out->pdev; } +int omapdss_writeback_apply(struct omap_dss_output *wb) +{ + return omap_dss_wb_apply(wb); +} +EXPORT_SYMBOL(omapdss_writeback_apply); + int omapdss_writeback_set_info(struct omap_dss_output *wb, struct omap_dss_writeback_info *info) { diff --git a/include/video/omapdss.h b/include/video/omapdss.h index 2a3a878..2bc10cb 100644 --- a/include/video/omapdss.h +++ b/include/video/omapdss.h @@ -837,6 +837,7 @@ void omapdss_rfbi_set_data_lines(struct omap_dss_device *dssdev, void omapdss_rfbi_set_interface_timings(struct omap_dss_device *dssdev, struct rfbi_timings *timings); +int omapdss_writeback_apply(struct omap_dss_output *wb); int omapdss_writeback_set_info(struct omap_dss_output *wb, struct omap_dss_writeback_info *info); void omapdss_writeback_get_info(struct omap_dss_output *wb,