Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2505196ybb; Mon, 30 Mar 2020 07:28:29 -0700 (PDT) X-Google-Smtp-Source: ADFU+vudW3rbLZsqse1y+X00E5I5tj6yZE+tabtcWIuPt4TBaplSiNnVp2/WCG0piEfLjL9pNQP9 X-Received: by 2002:aca:c390:: with SMTP id t138mr7410636oif.117.1585578509494; Mon, 30 Mar 2020 07:28:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585578509; cv=none; d=google.com; s=arc-20160816; b=PfTM7VOrX/NVK9RYmHMLMDwXXBVbEIIUeUzwht/+lJ+pHLHAeCHZ6+iW0/S5Xqdyvc 339YRgCiUOahnCCl9K6EHEISTZEy695NED4VcuVEdKen55mJQb/OhrMsnHieNtihJ2RU Ujc2U3vhRS6TnZGkwDqD0UgXgN2lQRWlHSwW6sWyLCsSoSn5xH7965Nl0z9l5EQl6gBQ oMFW9dOq5kSNd+9EYe0uljn6UsMBsn90r14D7GfonCe8qYugpokUObD51Y7AmUSnPdBf d/CnY7KwUYzDEcwX3CSgBSk5uZsdK95Y8egdRpgyp4Jz/pbTo2/Bs+rju+gSOBO9KFq4 +tlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=gdbB8utVSnB3EAWBa9oIYT1O+f9OUlu6v25pmI075oU=; b=ipn+hdR/vnbLLzT636yn91QBRlFZYE3QlbJA/KYyUokgqrfT7WNG+N3WUXsg75Lpby lISKoQ4aEEMuor/gjzOLw5ny8ZKYQfJAjpeCe84LaZHAJQuD6oINxDSyhJBPwWbWdumK M3cUOfYmt74gHFlHZKmVdCJM6HFH8A5vjN6K0q+GJcc8TCkJzbw9CFxseAZb+7p3pVNp BNlrRiRCHGCqSHsdWUy+G5NMFiakILj/59bdldYOAS4J8G2DzTeZTwY+KnqNvq5HsyP0 8kvQ2nx3fHhSsKyYgCVHMEGIEDowkyBcU7aXuIt+3YVheUosNJ3jjIiYBax1evlywn/+ oKNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=atvZ6Rtt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g7si6813575ots.270.2020.03.30.07.28.16; Mon, 30 Mar 2020 07:28:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=atvZ6Rtt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728569AbgC3OMd (ORCPT + 99 others); Mon, 30 Mar 2020 10:12:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:47630 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725268AbgC3OMc (ORCPT ); Mon, 30 Mar 2020 10:12:32 -0400 Received: from DESKTOP-GFFITBK.localdomain (218-161-90-76.HINET-IP.hinet.net [218.161.90.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7D37C20786; Mon, 30 Mar 2020 14:12:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585577551; bh=Z34pspBhqMJqahd4MffOLhAEomB14DsGzR3OqdRcvaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=atvZ6Rtt/bMPqgEsYtpAPfg88D4jpRYXX/SuBml3WGT3My+5iq7RkSUilWkgkD8ck PiLeYfw+0m4ykvga4NEuNwTJdRR2aRkQpdk9U0rjHu2WTefNXeA3V4Ppm3GNAx3cxR fZ0p4yG6g/NvauzQRW0XhvdyTcrBoCvy4VeqBLv0= From: Chun-Kuang Hu To: Philipp Zabel , David Airlie , Daniel Vetter , Matthias Brugger , Chunfeng Yun , Kishon Vijay Abraham I Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, CK Hu , Chun-Kuang Hu Subject: [PATCH v2 1/4] drm/mediatek: Move tz_disabled from mtk_hdmi_phy to mtk_hdmi driver Date: Mon, 30 Mar 2020 22:12:19 +0800 Message-Id: <20200330141222.17529-2-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200330141222.17529-1-chunkuang.hu@kernel.org> References: <20200330141222.17529-1-chunkuang.hu@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: CK Hu tz_disabled is used to control mtk_hdmi output signal, but this variable is stored in mtk_hdmi_phy and mtk_hdmi_phy does not use it. So move tz_disabled to mtk_hdmi where it's used. Signed-off-by: CK Hu Signed-off-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_hdmi.c | 22 ++++++++++++++++--- drivers/gpu/drm/mediatek/mtk_hdmi_phy.h | 1 - .../gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c | 1 - 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c index 5e4a4dbda443..878433c09c9b 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c @@ -144,11 +144,16 @@ struct hdmi_audio_param { struct hdmi_codec_params codec_params; }; +struct mtk_hdmi_conf { + bool tz_disabled; +}; + struct mtk_hdmi { struct drm_bridge bridge; struct drm_bridge *next_bridge; struct drm_connector conn; struct device *dev; + const struct mtk_hdmi_conf *conf; struct phy *phy; struct device *cec_dev; struct i2c_adapter *ddc_adpt; @@ -230,7 +235,6 @@ static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, bool black) static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable) { struct arm_smccc_res res; - struct mtk_hdmi_phy *hdmi_phy = phy_get_drvdata(hdmi->phy); /* * MT8173 HDMI hardware has an output control bit to enable/disable HDMI @@ -238,7 +242,7 @@ static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable) * The ARM trusted firmware provides an API for the HDMI driver to set * this control bit to enable HDMI output in supervisor mode. */ - if (hdmi_phy->conf && hdmi_phy->conf->tz_disabled) + if (hdmi->conf->tz_disabled) regmap_update_bits(hdmi->sys_regmap, hdmi->sys_offset + HDMI_SYS_CFG20, 0x80008005, enable ? 0x80000005 : 0x8000); @@ -1688,6 +1692,7 @@ static int mtk_drm_hdmi_probe(struct platform_device *pdev) return -ENOMEM; hdmi->dev = dev; + hdmi->conf = of_device_get_match_data(dev); ret = mtk_hdmi_dt_parse_pdata(hdmi, pdev); if (ret) @@ -1765,8 +1770,19 @@ static int mtk_hdmi_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(mtk_hdmi_pm_ops, mtk_hdmi_suspend, mtk_hdmi_resume); +static const struct mtk_hdmi_conf mtk_hdmi_conf_mt2701 = { + .tz_disabled = true, +}; + +static const struct mtk_hdmi_conf mtk_hdmi_conf_mt8173; + static const struct of_device_id mtk_drm_hdmi_of_ids[] = { - { .compatible = "mediatek,mt8173-hdmi", }, + { .compatible = "mediatek,mt2701-hdmi", + .data = &mtk_hdmi_conf_mt2701, + }, + { .compatible = "mediatek,mt8173-hdmi", + .data = &mtk_hdmi_conf_mt8173, + }, {} }; diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h index 2d8b3182470d..fc1c2efd1128 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h @@ -20,7 +20,6 @@ struct mtk_hdmi_phy; struct mtk_hdmi_phy_conf { - bool tz_disabled; unsigned long flags; const struct clk_ops *hdmi_phy_clk_ops; void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy); diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c index d3cc4022e988..99fe05cd3598 100644 --- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c +++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c @@ -237,7 +237,6 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy) } struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = { - .tz_disabled = true, .flags = CLK_SET_RATE_GATE, .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops, .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds, -- 2.17.1