From patchwork Fri Aug 4 22:44:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 9882255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3F8CD60375 for ; Fri, 4 Aug 2017 22:46:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32ABF289EF for ; Fri, 4 Aug 2017 22:46:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 278AA289F1; Fri, 4 Aug 2017 22:46:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C149D289EF for ; Fri, 4 Aug 2017 22:46:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB2E16E607; Fri, 4 Aug 2017 22:44:35 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from galahad.ideasonboard.com (galahad.ideasonboard.com [IPv6:2001:4b98:dc2:45:216:3eff:febb:480d]) by gabe.freedesktop.org (Postfix) with ESMTPS id F23FD6E5F0 for ; Fri, 4 Aug 2017 22:44:30 +0000 (UTC) Received: from avalon.bb.dnainternet.fi (dfj612ybrt5fhg77mgycy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:2e86:4862:ef6a:2804]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id E956020F9E; Sat, 5 Aug 2017 00:43:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1501886595; bh=/88wtHl/D6caa5sdLpBzHrfdmzq22c4FaYH4TpzaSOM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oK4HPbJB8fIe+ZJu7vxQmhAJWFK6uJji2YAqfR/Mtt0+clHSKOGcGH7NsqskQvgYL Jen+NBd8P31G6jwKEMuaNeGvBEWr52TdFLhfWbT5ZYG19R708Pg5rbYzY/Mk1FK2Co XnmoUMmSYYhI3aivy6g19PQ12SH2DA7qAJVaYPDw= From: Laurent Pinchart To: dri-devel@lists.freedesktop.org Subject: [PATCH v3 27/35] drm: omapdrm: Move FEAT_HDMI_* features to hdmi4 driver Date: Sat, 5 Aug 2017 01:44:11 +0300 Message-Id: <20170804224419.30758-28-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170804224419.30758-1-laurent.pinchart@ideasonboard.com> References: <20170804224419.30758-1-laurent.pinchart@ideasonboard.com> Cc: Tomi Valkeinen X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The FEAT_HDMI_* features are specific to the HDMI4, move them from the omap_dss_features structure to the hdmi4 driver. Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/omapdrm/dss/dss_features.c | 5 ---- drivers/gpu/drm/omapdrm/dss/dss_features.h | 2 -- drivers/gpu/drm/omapdrm/dss/hdmi.h | 2 ++ drivers/gpu/drm/omapdrm/dss/hdmi4_core.c | 37 ++++++++++++++++++++++++++++-- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/omapdrm/dss/dss_features.c b/drivers/gpu/drm/omapdrm/dss/dss_features.c index f2c61bcb617a..3d0bee95fb46 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss_features.c +++ b/drivers/gpu/drm/omapdrm/dss/dss_features.c @@ -240,7 +240,6 @@ static const enum dss_feat_id omap4430_es2_0_1_2_dss_feat_list[] = { FEAT_MGR_LCD2, FEAT_CORE_CLK_DIV, FEAT_LCD_CLK_SRC, - FEAT_HDMI_CTS_SWMODE, FEAT_HANDLE_UV_SEPARATE, FEAT_ATTR2, FEAT_CPR, @@ -255,8 +254,6 @@ static const enum dss_feat_id omap4_dss_feat_list[] = { FEAT_MGR_LCD2, FEAT_CORE_CLK_DIV, FEAT_LCD_CLK_SRC, - FEAT_HDMI_CTS_SWMODE, - FEAT_HDMI_AUDIO_USE_MCLK, FEAT_HANDLE_UV_SEPARATE, FEAT_ATTR2, FEAT_CPR, @@ -272,8 +269,6 @@ static const enum dss_feat_id omap5_dss_feat_list[] = { FEAT_MGR_LCD3, FEAT_CORE_CLK_DIV, FEAT_LCD_CLK_SRC, - FEAT_HDMI_CTS_SWMODE, - FEAT_HDMI_AUDIO_USE_MCLK, FEAT_HANDLE_UV_SEPARATE, FEAT_ATTR2, FEAT_CPR, diff --git a/drivers/gpu/drm/omapdrm/dss/dss_features.h b/drivers/gpu/drm/omapdrm/dss/dss_features.h index 61c419ac0517..f5320c392077 100644 --- a/drivers/gpu/drm/omapdrm/dss/dss_features.h +++ b/drivers/gpu/drm/omapdrm/dss/dss_features.h @@ -40,8 +40,6 @@ enum dss_feat_id { FEAT_CORE_CLK_DIV, FEAT_LCD_CLK_SRC, FEAT_DPI_USES_VDDS_DSI, - FEAT_HDMI_CTS_SWMODE, - FEAT_HDMI_AUDIO_USE_MCLK, FEAT_HANDLE_UV_SEPARATE, FEAT_ATTR2, FEAT_CPR, diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi.h b/drivers/gpu/drm/omapdrm/dss/hdmi.h index 851e5e6f6820..3738a5b397d9 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi.h +++ b/drivers/gpu/drm/omapdrm/dss/hdmi.h @@ -261,6 +261,8 @@ struct hdmi_phy_data { struct hdmi_core_data { void __iomem *base; + bool cts_swmode; + bool audio_use_mclk; }; static inline void hdmi_write_reg(void __iomem *base_addr, const u32 idx, diff --git a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c index ed6001613405..5aef83c270da 100644 --- a/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c +++ b/drivers/gpu/drm/omapdrm/dss/hdmi4_core.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -757,10 +758,10 @@ int hdmi4_audio_config(struct hdmi_core_data *core, struct hdmi_wp_data *wp, /* Audio clock regeneration settings */ acore.n = n; acore.cts = cts; - if (dss_has_feature(FEAT_HDMI_CTS_SWMODE)) { + if (core->cts_swmode) { acore.aud_par_busclk = 0; acore.cts_mode = HDMI_AUDIO_CTS_MODE_SW; - acore.use_mclk = dss_has_feature(FEAT_HDMI_AUDIO_USE_MCLK); + acore.use_mclk = core->audio_use_mclk; } else { acore.aud_par_busclk = (((128 * 31) - 1) << 8); acore.cts_mode = HDMI_AUDIO_CTS_MODE_HW; @@ -884,10 +885,42 @@ void hdmi4_audio_stop(struct hdmi_core_data *core, struct hdmi_wp_data *wp) hdmi_wp_audio_core_req_enable(wp, false); } +struct hdmi4_features { + bool cts_swmode; + bool audio_use_mclk; +}; + +static const struct hdmi4_features hdmi4_es1_features = { + .cts_swmode = false, + .audio_use_mclk = false, +}; + +static const struct hdmi4_features hdmi4_es2_features = { + .cts_swmode = true, + .audio_use_mclk = false, +}; + +static const struct hdmi4_features hdmi4_es3_features = { + .cts_swmode = true, + .audio_use_mclk = true, +}; + +static const struct soc_device_attribute hdmi4_soc_devices[] = { + { .family = "OMAP4", .revision = "ES1.?", .data = &hdmi4_es1_features }, + { .family = "OMAP4", .revision = "ES2.?", .data = &hdmi4_es2_features }, + { .family = "OMAP4", .data = &hdmi4_es3_features }, + { /* sentinel */ } +}; + int hdmi4_core_init(struct platform_device *pdev, struct hdmi_core_data *core) { + const struct hdmi4_features *features; struct resource *res; + features = soc_device_match(hdmi4_soc_devices)->data; + core->cts_swmode = features->cts_swmode; + core->audio_use_mclk = features->audio_use_mclk; + res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "core"); core->base = devm_ioremap_resource(&pdev->dev, res); if (IS_ERR(core->base))