From patchwork Thu Jul 11 11:26:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Pietrasiewicz X-Patchwork-Id: 11039775 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 969C01395 for ; Thu, 11 Jul 2019 11:29:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 75BE328A8F for ; Thu, 11 Jul 2019 11:29:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 725FC28A7D; Thu, 11 Jul 2019 11:29:48 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1169728A91 for ; Thu, 11 Jul 2019 11:29:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3RCMAlWZBW5EgsPalpSgWgO4/VmJGbwkJaecUHOuC88=; b=lFrITHg0QDfc1hTB3vY/YBotGh 1u1nEKlw/Ie5q1xw6LsRn9IKi0BswIvEB3tSZ0a21SA3IavV3SkcgZegV4y2uavo18aMFnjiwzCOR e4/uwbQ73g9GDe052DoNDl1a3uHvf5eIcME5bqWsgpv69w1jYb25j9INiMh/tIWhoGEKxaqLz+0Ac 8QPJ/KMV/hBth0gvBMly6ChmwpHB7VjTpWtclu728hdLkJmjL+aSRDG1Q506T5Jb9y2yNzR5OFvQA xa4nUBwer71aaulQKQaTxLstNe2Ip+V3PANEP+YcI2iJuH04JQn+3lTE69gu7qY3dZ9ZNIJpFgWaE wp9cL9iA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hlXGk-0006Ja-EB; Thu, 11 Jul 2019 11:29:46 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hlXGg-0006HL-8t; Thu, 11 Jul 2019 11:29:43 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id E9C8128B681 From: Andrzej Pietrasiewicz To: dri-devel@lists.freedesktop.org Subject: [PATCH v4 11/23] drm/vc4: Provide ddc symlink in connector sysfs directory Date: Thu, 11 Jul 2019 13:26:38 +0200 Message-Id: <5066b656e50cbdb3b0721778ced761c4a96bf720.1562843413.git.andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190711_042942_587125_FE54C07B X-CRM114-Status: GOOD ( 13.66 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Y.C. Chen" , =?utf-8?q?Heiko_St=C3=BCbner?= , Sam Ravnborg , Neil Armstrong , Maxime Ripard , Ramalingam C , Joonas Lahtinen , Douglas Anderson , Andrzej Hajda , Thierry Reding , Laurent Pinchart , Benjamin Gaignard , kernel@collabora.com, Fabio Estevam , =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= , "David \(ChunMing\) Zhou" , linux-samsung-soc@vger.kernel.org, Joonyoung Shim , linux-rockchip@lists.infradead.org, Vincent Abriou , Rob Clark , Krzysztof Kozlowski , Jonathan Hunter , David Airlie , Chen-Yu Tsai , Kukjin Kim , NXP Linux Team , CK Hu , Dave Airlie , intel-gfx@lists.freedesktop.org, Shashank Sharma , freedreno@lists.freedesktop.org, linux-tegra@vger.kernel.org, Daniel Vetter , Jonas Karlman , linux-arm-msm@vger.kernel.org, Sascha Hauer , Maarten Lankhorst , Jani Nikula , Inki Dae , Mamta Shukla , linux-mediatek@lists.infradead.org, Jyri Sarha , Rodrigo Vivi , Matthias Brugger , Thomas Gleixner , Chris Wilson , Sean Paul , Pengutronix Kernel Team , Allison Randal , linux-arm-kernel@lists.infradead.org, amd-gfx@lists.freedesktop.org, Tomi Valkeinen , Eric Anholt , Thomas Zimmermann , Seung-Woo Kim , Sandy Huang , linux-kernel@vger.kernel.org, Todor Tomov , Kyungmin Park , Huang Rui , Philipp Zabel , Alex Deucher , Shawn Guo , =?utf-8?q?Christian_K=C3=B6nig?= , Gerd Hoffmann MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Use the ddc pointer provided by the generic connector. Signed-off-by: Andrzej Pietrasiewicz --- drivers/gpu/drm/vc4/vc4_hdmi.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index ee7d4e7b0ee3..abacd48a1462 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -76,7 +76,6 @@ struct vc4_hdmi { struct vc4_hdmi_audio audio; - struct i2c_adapter *ddc; void __iomem *hdmicore_regs; void __iomem *hd_regs; int hpd_gpio; @@ -207,7 +206,7 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force) return connector_status_disconnected; } - if (drm_probe_ddc(vc4->hdmi->ddc)) + if (drm_probe_ddc(connector->ddc)) return connector_status_connected; if (HDMI_READ(VC4_HDMI_HOTPLUG) & VC4_HDMI_HOTPLUG_CONNECTED) @@ -233,7 +232,7 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector) int ret = 0; struct edid *edid; - edid = drm_get_edid(connector, vc4->hdmi->ddc); + edid = drm_get_edid(connector, connector->ddc); cec_s_phys_addr_from_edid(vc4->hdmi->cec_adap, edid); if (!edid) return -ENODEV; @@ -267,7 +266,8 @@ static const struct drm_connector_helper_funcs vc4_hdmi_connector_helper_funcs = }; static struct drm_connector *vc4_hdmi_connector_init(struct drm_device *dev, - struct drm_encoder *encoder) + struct drm_encoder *encoder, + struct i2c_adapter *ddc) { struct drm_connector *connector; struct vc4_hdmi_connector *hdmi_connector; @@ -280,6 +280,7 @@ static struct drm_connector *vc4_hdmi_connector_init(struct drm_device *dev, connector = &hdmi_connector->base; hdmi_connector->encoder = encoder; + connector->ddc = ddc; drm_connector_init(dev, connector, &vc4_hdmi_connector_funcs, DRM_MODE_CONNECTOR_HDMIA); @@ -1291,6 +1292,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) struct vc4_hdmi *hdmi; struct vc4_hdmi_encoder *vc4_hdmi_encoder; struct device_node *ddc_node; + struct i2c_adapter *ddc; u32 value; int ret; @@ -1338,9 +1340,9 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) return -ENODEV; } - hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node); + ddc = of_find_i2c_adapter_by_node(ddc_node); of_node_put(ddc_node); - if (!hdmi->ddc) { + if (ddc) { DRM_DEBUG("Failed to get ddc i2c adapter by node\n"); return -EPROBE_DEFER; } @@ -1395,7 +1397,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) DRM_MODE_ENCODER_TMDS, NULL); drm_encoder_helper_add(hdmi->encoder, &vc4_hdmi_encoder_helper_funcs); - hdmi->connector = vc4_hdmi_connector_init(drm, hdmi->encoder); + hdmi->connector = vc4_hdmi_connector_init(drm, hdmi->encoder, ddc); if (IS_ERR(hdmi->connector)) { ret = PTR_ERR(hdmi->connector); goto err_destroy_encoder; @@ -1452,7 +1454,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data) clk_disable_unprepare(hdmi->hsm_clock); pm_runtime_disable(dev); err_put_i2c: - put_device(&hdmi->ddc->dev); + put_device(&ddc->dev); return ret; } @@ -1463,6 +1465,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, struct drm_device *drm = dev_get_drvdata(master); struct vc4_dev *vc4 = drm->dev_private; struct vc4_hdmi *hdmi = vc4->hdmi; + struct i2c_adapter *ddc = hdmi->connector->ddc; cec_unregister_adapter(hdmi->cec_adap); vc4_hdmi_connector_destroy(hdmi->connector); @@ -1471,7 +1474,7 @@ static void vc4_hdmi_unbind(struct device *dev, struct device *master, clk_disable_unprepare(hdmi->hsm_clock); pm_runtime_disable(dev); - put_device(&hdmi->ddc->dev); + put_device(&ddc->dev); vc4->hdmi = NULL; }