From patchwork Mon Sep 24 13:58:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomi Valkeinen X-Patchwork-Id: 1497731 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 596043FC71 for ; Mon, 24 Sep 2012 13:58:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755537Ab2IXN64 (ORCPT ); Mon, 24 Sep 2012 09:58:56 -0400 Received: from na3sys009aog126.obsmtp.com ([74.125.149.155]:44557 "EHLO na3sys009aog126.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755497Ab2IXN6z (ORCPT ); Mon, 24 Sep 2012 09:58:55 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]) (using TLSv1) by na3sys009aob126.postini.com ([74.125.148.12]) with SMTP ID DSNKUGBnHpILMmXuynhavVMI19OMey4UhHj2@postini.com; Mon, 24 Sep 2012 06:58:55 PDT Received: by lbbgj3 with SMTP id gj3so6750168lbb.19 for ; Mon, 24 Sep 2012 06:58:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=G64awf1ohLc7rb9jwyjq9QZDunaKKsUvChktIOxGhE4=; b=c5xk5fm77Fv/X+gaGOOlvtV8nTaSeY4vggIRJSfCCc6oXM8jeEr/qsxg7fpgDBo4yY F4FDp/X4FzCZ/sLjlG5gFUreABtdUFqwzDcpwwR6FlAcFnbBhMB4038Kpc0Uro6C0YpR R/8WZpqZWS87zBqXectrAbw0wCh1fag2R9qbdmyZfSXG+S53UEzAVd0IHDQf66S+Bzi4 0Xj2J2HwWtJEIJGim1Ikq3MRwj8ebYx+us/pNzYTafGXNgfKm3oSWTvswZCdpPfhk6J3 utGKlTFMy5GGvkjiNn8hE05Gu56QLfU9/+156wM4aAaVjI8WRooWatxg5i8UO5IL2vDU AX9g== Received: by 10.112.82.130 with SMTP id i2mr4353019lby.126.1348495132808; Mon, 24 Sep 2012 06:58:52 -0700 (PDT) Received: from deskari.tieu.ti.com (a91-156-160-115.elisa-laajakaista.fi. [91.156.160.115]) by mx.google.com with ESMTPS id ly17sm4364922lab.2.2012.09.24.06.58.51 (version=SSLv3 cipher=OTHER); Mon, 24 Sep 2012 06:58:52 -0700 (PDT) From: Tomi Valkeinen To: archit@ti.com, linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org Cc: Tomi Valkeinen , David Anders Subject: [PATCH 4/9] OMAPDSS: Add support for DPI source selection Date: Mon, 24 Sep 2012 16:58:34 +0300 Message-Id: <1348495119-8262-5-git-send-email-tomi.valkeinen@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1348495119-8262-1-git-send-email-tomi.valkeinen@ti.com> References: <1348495119-8262-1-git-send-email-tomi.valkeinen@ti.com> X-Gm-Message-State: ALoCoQl1PcesXqx+Y6K4A4TMiMtgOrMMTPpAYpaOdfh4stEA2copJ2ZY0WeXuk4hDSSZovukTvov Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org We can select the video source for DPI output as follows: OMAP2/3: always LCD1 OMAP4: LCD2 or DIGIT OMAP5: LCD1/LCD2/LCD3/DIGIT This patch adds support to select the source, and makes dpi.c call the function to set the source. Signed-off-by: Tomi Valkeinen Cc: David Anders --- drivers/video/omap2/dss/dpi.c | 5 ++++ drivers/video/omap2/dss/dss.c | 65 +++++++++++++++++++++++++++++++++++++++++ drivers/video/omap2/dss/dss.h | 1 + 3 files changed, 71 insertions(+) diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c index 5ccce9b..b723388 100644 --- a/drivers/video/omap2/dss/dpi.c +++ b/drivers/video/omap2/dss/dpi.c @@ -203,6 +203,10 @@ int omapdss_dpi_display_enable(struct omap_dss_device *dssdev) if (r) goto err_get_dispc; + r = dss_dpi_select_source(dssdev->channel); + if (r) + goto err_src_sel; + if (dpi_use_dsi_pll(dssdev)) { r = dsi_runtime_get(dpi.dsidev); if (r) @@ -237,6 +241,7 @@ err_dsi_pll_init: if (dpi_use_dsi_pll(dssdev)) dsi_runtime_put(dpi.dsidev); err_get_dsi: +err_src_sel: dispc_runtime_put(); err_get_dispc: if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI)) diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c index 660813b..2ab1c3e9 100644 --- a/drivers/video/omap2/dss/dss.c +++ b/drivers/video/omap2/dss/dss.c @@ -69,6 +69,7 @@ struct dss_features { u8 fck_div_max; u8 dss_fck_multiplier; const char *clk_name; + int (*dpi_select_source)(enum omap_channel channel); }; static struct { @@ -623,6 +624,65 @@ enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void) return REG_GET(DSS_CONTROL, 15, 15); } +static int dss_dpi_select_source_omap2_omap3(enum omap_channel channel) +{ + if (channel != OMAP_DSS_CHANNEL_LCD) + return -EINVAL; + + return 0; +} + +static int dss_dpi_select_source_omap4(enum omap_channel channel) +{ + int val; + + switch (channel) { + case OMAP_DSS_CHANNEL_LCD2: + val = 0; + break; + case OMAP_DSS_CHANNEL_DIGIT: + val = 1; + break; + default: + return -EINVAL; + } + + REG_FLD_MOD(DSS_CONTROL, val, 17, 17); + + return 0; +} + +static int dss_dpi_select_source_omap5(enum omap_channel channel) +{ + int val; + + switch (channel) { + case OMAP_DSS_CHANNEL_LCD: + val = 1; + break; + case OMAP_DSS_CHANNEL_LCD2: + val = 2; + break; + case OMAP_DSS_CHANNEL_LCD3: + val = 3; + break; + case OMAP_DSS_CHANNEL_DIGIT: + val = 0; + break; + default: + return -EINVAL; + } + + REG_FLD_MOD(DSS_CONTROL, val, 17, 16); + + return 0; +} + +int dss_dpi_select_source(enum omap_channel channel) +{ + return dss.feat->dpi_select_source(channel); +} + static int dss_get_clocks(void) { struct clk *clk; @@ -701,30 +761,35 @@ static const struct dss_features omap24xx_dss_feats __initconst = { .fck_div_max = 16, .dss_fck_multiplier = 2, .clk_name = NULL, + .dpi_select_source = &dss_dpi_select_source_omap2_omap3, }; static const struct dss_features omap34xx_dss_feats __initconst = { .fck_div_max = 16, .dss_fck_multiplier = 2, .clk_name = "dpll4_m4_ck", + .dpi_select_source = &dss_dpi_select_source_omap2_omap3, }; static const struct dss_features omap3630_dss_feats __initconst = { .fck_div_max = 32, .dss_fck_multiplier = 1, .clk_name = "dpll4_m4_ck", + .dpi_select_source = &dss_dpi_select_source_omap2_omap3, }; static const struct dss_features omap44xx_dss_feats __initconst = { .fck_div_max = 32, .dss_fck_multiplier = 1, .clk_name = "dpll_per_m5x2_ck", + .dpi_select_source = &dss_dpi_select_source_omap4, }; static const struct dss_features omap54xx_dss_feats __initconst = { .fck_div_max = 64, .dss_fck_multiplier = 1, .clk_name = "dpll_per_h12x2_ck", + .dpi_select_source = &dss_dpi_select_source_omap5, }; static int __init dss_init_features(struct device *dev) diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h index 5e9fd769..2a51ae9 100644 --- a/drivers/video/omap2/dss/dss.h +++ b/drivers/video/omap2/dss/dss.h @@ -277,6 +277,7 @@ void dss_overlay_kobj_uninit(struct omap_overlay *ovl); int dss_init_platform_driver(void) __init; void dss_uninit_platform_driver(void); +int dss_dpi_select_source(enum omap_channel channel); void dss_select_hdmi_venc_clk_source(enum dss_hdmi_venc_clk_source_select); enum dss_hdmi_venc_clk_source_select dss_get_hdmi_venc_clk_source(void); const char *dss_get_generic_clk_source_name(enum omap_dss_clk_source clk_src);