From patchwork Wed Jul 24 13:59:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Pietrasiewicz X-Patchwork-Id: 11056967 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 A26C9746 for ; Wed, 24 Jul 2019 14:05:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 900CA2858A for ; Wed, 24 Jul 2019 14:05:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 835DA286AD; Wed, 24 Jul 2019 14:05:41 +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,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY 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 1AF392858A for ; Wed, 24 Jul 2019 14:05:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 225366E58A; Wed, 24 Jul 2019 14:05:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by gabe.freedesktop.org (Postfix) with ESMTPS id 61A426E58A; Wed, 24 Jul 2019 14:05:39 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: andrzej.p) with ESMTPSA id 85226283CC1 From: Andrzej Pietrasiewicz To: dri-devel@lists.freedesktop.org Subject: [PATCH v5 21/24] drm/bridge: ti-tfp410: Provide ddc symlink in connector sysfs directory Date: Wed, 24 Jul 2019 15:59:43 +0200 Message-Id: <87b9340ea88713b8b715fcf8234dd07d77f8bc9a.1563960855.git.andrzej.p@collabora.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Sam Ravnborg , Neil Armstrong , David Airlie , Douglas Anderson , Thierry Reding , Laurent Pinchart , kernel@collabora.com, linux-samsung-soc@vger.kernel.org, linux-rockchip@lists.infradead.org, Oleksandr Andrushchenko , Vincent Abriou , Krzysztof Kozlowski , Jonathan Hunter , Maxime Ripard , Chen-Yu Tsai , Kukjin Kim , NXP Linux Team , Dave Airlie , intel-gfx@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-tegra@vger.kernel.org, Jonas Karlman , linux-arm-msm@vger.kernel.org, Alexios Zavras , Mamta Shukla , linux-mediatek@lists.infradead.org, Jyri Sarha , Rodrigo Vivi , Matthias Brugger , Thomas Gleixner , Sean Paul , Pengutronix Kernel Team , Allison Randal , linux-arm-kernel@lists.infradead.org, Enrico Weigelt , Jernej Skrabec , amd-gfx@lists.freedesktop.org, Tomi Valkeinen , Thomas Zimmermann , Seung-Woo Kim , linux-kernel@vger.kernel.org, Todor Tomov , Kyungmin Park , Huang Rui , Greg Kroah-Hartman , Alex Deucher , Shawn Guo , =?utf-8?q?Christian_K=C3=B6nig?= , Gerd Hoffmann MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Use the ddc pointer provided by the generic connector. Signed-off-by: Andrzej Pietrasiewicz --- drivers/gpu/drm/bridge/ti-tfp410.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-tfp410.c b/drivers/gpu/drm/bridge/ti-tfp410.c index dbf35c7bc85e..ca8e2f382851 100644 --- a/drivers/gpu/drm/bridge/ti-tfp410.c +++ b/drivers/gpu/drm/bridge/ti-tfp410.c @@ -26,7 +26,6 @@ struct tfp410 { unsigned int connector_type; u32 bus_format; - struct i2c_adapter *ddc; struct gpio_desc *hpd; int hpd_irq; struct delayed_work hpd_work; @@ -55,10 +54,10 @@ static int tfp410_get_modes(struct drm_connector *connector) struct edid *edid; int ret; - if (!dvi->ddc) + if (!dvi->connector.ddc) goto fallback; - edid = drm_get_edid(connector, dvi->ddc); + edid = drm_get_edid(connector, dvi->connector.ddc); if (!edid) { DRM_INFO("EDID read failed. Fallback to standard modes\n"); goto fallback; @@ -98,8 +97,8 @@ tfp410_connector_detect(struct drm_connector *connector, bool force) return connector_status_disconnected; } - if (dvi->ddc) { - if (drm_probe_ddc(dvi->ddc)) + if (dvi->connector.ddc) { + if (drm_probe_ddc(dvi->connector.ddc)) return connector_status_connected; else return connector_status_disconnected; @@ -134,8 +133,10 @@ static int tfp410_attach(struct drm_bridge *bridge) drm_connector_helper_add(&dvi->connector, &tfp410_con_helper_funcs); - ret = drm_connector_init(bridge->dev, &dvi->connector, - &tfp410_con_funcs, dvi->connector_type); + ret = drm_connector_init_with_ddc(bridge->dev, &dvi->connector, + &tfp410_con_funcs, + dvi->connector_type, + dvi->connector.ddc); if (ret) { dev_err(dvi->dev, "drm_connector_init() failed: %d\n", ret); return ret; @@ -297,8 +298,8 @@ static int tfp410_get_connector_properties(struct tfp410 *dvi) if (!ddc_phandle) goto fail; - dvi->ddc = of_get_i2c_adapter_by_node(ddc_phandle); - if (dvi->ddc) + dvi->connector.ddc = of_get_i2c_adapter_by_node(ddc_phandle); + if (dvi->connector.ddc) dev_info(dvi->dev, "Connector's ddc i2c bus found\n"); else ret = -EPROBE_DEFER; @@ -367,7 +368,7 @@ static int tfp410_init(struct device *dev, bool i2c) return 0; fail: - i2c_put_adapter(dvi->ddc); + i2c_put_adapter(dvi->connector.ddc); if (dvi->hpd) gpiod_put(dvi->hpd); return ret; @@ -382,8 +383,8 @@ static int tfp410_fini(struct device *dev) drm_bridge_remove(&dvi->bridge); - if (dvi->ddc) - i2c_put_adapter(dvi->ddc); + if (dvi->connector.ddc) + i2c_put_adapter(dvi->connector.ddc); if (dvi->hpd) gpiod_put(dvi->hpd);