From nobody Fri Oct 3 21:55:35 2025 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 520F12853E0 for ; Sun, 24 Aug 2025 11:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756034261; cv=none; b=SgBy9Y0/gii5Rx55UPPwDLeKXfpmfyx2ipKlh5HC9LIh+GWW11AJvZASJG+VoHWXG+vYxTtKuCNvXMnMamIGtTpEK5a1VrHrcmHNicN2/MXDSbZizE6Owwvxsgv8SXpmDSaXlCpF2uAu1Do4ToQBjICqE/g4zfTuBnYvB0ChamA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756034261; c=relaxed/simple; bh=tF1XdNPzABc4GXXTUniUTBAc53Z0OMRaK2671uJFP44=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mrBBGYQ1Cp/xfuz54QOLPz+1OjL3b/tWUcdg0VruDaqxgCeyiH9l46ZTS2Bg0PDO5oVrcUDX+EK7MASLV07O0Cl7pWiB6X9bRzhAPFpANwuC8Cz2oFpUoHkZYoWe+3lkDwZgdDPxlQ/+vN/pgn2jlwZOEWYc1eKEqpZtALYygZk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=grimler.se; spf=pass smtp.mailfrom=grimler.se; dkim=pass (1024-bit key) header.d=grimler.se header.i=@grimler.se header.b=a5DnYZL6; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=grimler.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=grimler.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=grimler.se header.i=@grimler.se header.b="a5DnYZL6" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=grimler.se; s=key1; t=1756034255; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3aK39K6kznEgVQk3rj38IpsyJh21pnGECoEjeWkg6Cs=; b=a5DnYZL6PeRnOA0UtnTHAZHMQGwrtbXEQ1KsWH7L1gsdGpnLA4L8u63F/SOnCVu6enHvj4 VGXdYA4aLLdfAHlCuQGbtZQXuQzJryhhwBOrmpiMNTVaKSYR37a8pfFlYMvNsHEdCXh04W gZ3nRL5PS0WMXFCnbnD+r5tZ0oIJqgQ= From: Henrik Grimler Date: Sun, 24 Aug 2025 13:16:54 +0200 Subject: [PATCH v3 1/3] drm/bridge: sii9234: fix some typos in comments and messages Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250824-exynos4-sii9234-driver-v3-1-80849e716a37@grimler.se> References: <20250824-exynos4-sii9234-driver-v3-0-80849e716a37@grimler.se> In-Reply-To: <20250824-exynos4-sii9234-driver-v3-0-80849e716a37@grimler.se> To: Dmitry Baryshkov , Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, replicant@osuosl.org, linux-kernel@vger.kernel.org, Henrik Grimler X-Developer-Signature: v=1; a=openpgp-sha256; l=2422; i=henrik@grimler.se; h=from:subject:message-id; bh=tF1XdNPzABc4GXXTUniUTBAc53Z0OMRaK2671uJFP44=; b=owEBbQGS/pANAwAKAbAHbkkLcWFrAcsmYgBoqvS7ZCLaLjj4NfoYTX2lHUV+kE+xhb6YeNCQb VHbS6J8IEKJATMEAAEKAB0WIQQsfymul4kfZBmp4s2wB25JC3FhawUCaKr0uwAKCRCwB25JC3Fh a5F6B/9R1XlFsu5BkbBgjE7QCcJpWKMlTv3PJBu78ynkTLtQVgqfsQK2V+w+Lk1AnvKO/H2NcKy kEFtaAuFT2R3dZpEc4YUsD4rxJ/4NnkzHUSyA6swvCN1WT8UVPh41NvrOsT5HVTa6dNhf1gjQe2 xFG1G5F6T6BTM5AoHCgJqcNFeKyEOUetHyjH0bYnJgeT4IfysPWzebonqMSWpkSmCe4uWE6bQxz Wa5sEdp4Ml7QauCklcrz1rD4xTdLkATvKHO0UndaqNttEQf/lLZyMos51y9cL+K4+3HM7Z+8JJk iVSMuqXsD7k57rXJ5us6Zdmh+T4YiG4r5fPHSybagPuI3Msc X-Developer-Key: i=henrik@grimler.se; a=openpgp; fpr=2C7F29AE97891F6419A9E2CDB0076E490B71616B X-Migadu-Flow: FLOW_OUT Fix spelling and formatting so that the code is easier to follow, and so that it is more searchable. Reviewed-by: Dmitry Baryshkov Signed-off-by: Henrik Grimler --- v3: collect tags v2: no changes --- drivers/gpu/drm/bridge/sii9234.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9= 234.c index bb1bed03eb5b7ae67f752c0d593dc54131e9e370..930117bbba87285e62107389606= 897740516eb0a 100644 --- a/drivers/gpu/drm/bridge/sii9234.c +++ b/drivers/gpu/drm/bridge/sii9234.c @@ -339,7 +339,7 @@ static int sii9234_cbus_reset(struct sii9234 *ctx) return sii9234_clear_error(ctx); } =20 -/* Require to chek mhl imformation of samsung in cbus_init_register */ +/* Require to check mhl information of samsung in cbus_init_register */ static int sii9234_cbus_init(struct sii9234 *ctx) { cbus_writeb(ctx, 0x07, 0xF2); @@ -614,7 +614,7 @@ static void sii9234_cable_out(struct sii9234 *ctx) =20 disable_irq(to_i2c_client(ctx->dev)->irq); tpi_writeb(ctx, TPI_DPD_REG, 0); - /* Turn on&off hpd festure for only QCT HDMI */ + /* Turn on&off hpd feature for only QCT HDMI */ sii9234_hw_off(ctx); =20 ctx->state =3D ST_OFF; @@ -708,7 +708,7 @@ static enum sii9234_state sii9234_rsen_change(struct si= i9234 *ctx) { int value; =20 - /* Work_around code to handle wrong interrupt */ + /* Workaround code to handle wrong interrupt */ if (ctx->state !=3D ST_RGND_1K) { dev_err(ctx->dev, "RSEN_HIGH without RGND_1K\n"); return ST_FAILURE; @@ -723,9 +723,9 @@ static enum sii9234_state sii9234_rsen_change(struct si= i9234 *ctx) } dev_dbg(ctx->dev, "RSEN lost\n"); /* - * Once RSEN loss is confirmed,we need to check - * based on cable status and chip power status,whether - * it is SINK Loss(HDMI cable not connected, TV Off) + * Once RSEN loss is confirmed, we need to check + * based on cable status and chip power status, whether + * it is SINK Loss (HDMI cable not connected, TV Off) * or MHL cable disconnection * TODO: Define the below mhl_disconnection() */ @@ -820,7 +820,7 @@ static int sii9234_init_resources(struct sii9234 *ctx, int ret; =20 if (!ctx->dev->of_node) { - dev_err(ctx->dev, "not DT device\n"); + dev_err(ctx->dev, "no DT device\n"); return -ENODEV; } =20 --=20 2.50.1 From nobody Fri Oct 3 21:55:35 2025 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF4FB2D4B6F for ; Sun, 24 Aug 2025 11:17:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756034262; cv=none; b=Ee3Pek1xqPnUhrQmjCbG7gC/5q64StY6dgIOQXrxZBe8LQkdnYuiOOIZJjl5mIezH5zviKvcC6rmqTQ1exZuWGF8AHaoJpG6oU+ordqoHz02sJq9l/7wLTkwDseOmj9gywREwNX5pbFlgto//8iK2GRe9fIWfU54BRlFLEnM9Ug= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756034262; c=relaxed/simple; bh=2hbU/JPpq+X+b93KBMazUAOoDOg6/IpPSJiqUcoJRj4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lOQ17QBHWsMF2v6zo6TvQFiuva1eP4O952xOMDk9dT+MwAQejlGA+DObwMzCok4GPNpnNd9ADGaleQ5dN3A10SGz8XCJ3FrtFVPZ4onHmTJcSny3Vl3vQRcWX+iWapmzaDDbcSW3FlOho/F3Pq2LyQU0r1m+eIHsexQKLt8KSC8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=grimler.se; spf=pass smtp.mailfrom=grimler.se; dkim=pass (1024-bit key) header.d=grimler.se header.i=@grimler.se header.b=H2i8/Z/D; arc=none smtp.client-ip=91.218.175.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=grimler.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=grimler.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=grimler.se header.i=@grimler.se header.b="H2i8/Z/D" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=grimler.se; s=key1; t=1756034258; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3LQfg9PNf1t19zyYrXBmiGz0nsA2Dze/kpHpdB04NEk=; b=H2i8/Z/Dd1ccwRMT9pJ1dDvczogVNknNpVKIPH+yIOaCXJ0RXTH7CxZSpOIgHE4TTUCWwW HAYJ2hLpn3fv//7tvFdJPxtc+r8loU3c81eH+foi3ugmnfB0obszMw6+sRK4WTuMLdtYiU Vd1LPVyrlSJAmqmqs3iCKg6rIilBQk8= From: Henrik Grimler Date: Sun, 24 Aug 2025 13:16:55 +0200 Subject: [PATCH v3 2/3] drm/bridge: sii9234: use dev_err_probe where applicable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250824-exynos4-sii9234-driver-v3-2-80849e716a37@grimler.se> References: <20250824-exynos4-sii9234-driver-v3-0-80849e716a37@grimler.se> In-Reply-To: <20250824-exynos4-sii9234-driver-v3-0-80849e716a37@grimler.se> To: Dmitry Baryshkov , Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, replicant@osuosl.org, linux-kernel@vger.kernel.org, Henrik Grimler X-Developer-Signature: v=1; a=openpgp-sha256; l=2063; i=henrik@grimler.se; h=from:subject:message-id; bh=2hbU/JPpq+X+b93KBMazUAOoDOg6/IpPSJiqUcoJRj4=; b=owEBbQGS/pANAwAKAbAHbkkLcWFrAcsmYgBoqvS+8R0f1PRorqdnd9Bp/G8CpitQqnizIhgBO 6TJxHtFKCaJATMEAAEKAB0WIQQsfymul4kfZBmp4s2wB25JC3FhawUCaKr0vgAKCRCwB25JC3Fh a/uUCADJbaz5IGQA8slIHDswHP0HZIyepT57uXh/hoeTc8qmBEJkit1tipXPSocIiEs2ZPugLD9 YEMpGZ4bjcGwiHZ3OJX1+yqxFJefu9LL80PnhGqKQTcXAYjKHnIAlcJ+PE37NyNh5VjtuBWiHY7 dOCn4GdxWKpg/n3u16sGHtoPfl1V1G05WnJrGjjPckGYOlqqlZXow18hTaWVIGH+voXRl1xwbkU ZnFzUwzEqwyTi3xfeprymY3TAjyHzTN7iuUVp6Q61SpcVmDZKtnNyft2pQkNG+rjO6uo69mFAJq oICte8FFQsQtDJaJ1iOJcufc+c1R8jRmyrQ+hoW1UdavFLpW X-Developer-Key: i=henrik@grimler.se; a=openpgp; fpr=2C7F29AE97891F6419A9E2CDB0076E490B71616B X-Migadu-Flow: FLOW_OUT In case of error during resource acquisition the driver should print an error message only if it is not deferred probe. Use dev_err_probe helper to handle this, which will also record defer probe reason for debugging. Signed-off-by: Henrik Grimler Reviewed-by: Dmitry Baryshkov --- v3: add missing return in error path, spotted by Dmitry v2: no changes --- drivers/gpu/drm/bridge/sii9234.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9= 234.c index 930117bbba87285e62107389606897740516eb0a..e43248e515b3dcdde043997288d= 61f738417b8f0 100644 --- a/drivers/gpu/drm/bridge/sii9234.c +++ b/drivers/gpu/drm/bridge/sii9234.c @@ -825,21 +825,17 @@ static int sii9234_init_resources(struct sii9234 *ctx, } =20 ctx->gpio_reset =3D devm_gpiod_get(ctx->dev, "reset", GPIOD_OUT_LOW); - if (IS_ERR(ctx->gpio_reset)) { - dev_err(ctx->dev, "failed to get reset gpio from DT\n"); - return PTR_ERR(ctx->gpio_reset); - } + if (IS_ERR(ctx->gpio_reset)) + return dev_err_probe(ctx->dev, PTR_ERR(ctx->gpio_reset), + "failed to get reset gpio from DT\n"); =20 ctx->supplies[0].supply =3D "avcc12"; ctx->supplies[1].supply =3D "avcc33"; ctx->supplies[2].supply =3D "iovcc18"; ctx->supplies[3].supply =3D "cvcc12"; ret =3D devm_regulator_bulk_get(ctx->dev, 4, ctx->supplies); - if (ret) { - if (ret !=3D -EPROBE_DEFER) - dev_err(ctx->dev, "regulator_bulk failed\n"); - return ret; - } + if (ret) + return dev_err_probe(ctx->dev, ret, "regulator_bulk failed\n"); =20 ctx->client[I2C_MHL] =3D client; =20 @@ -911,10 +907,9 @@ static int sii9234_probe(struct i2c_client *client) sii9234_irq_thread, IRQF_TRIGGER_HIGH | IRQF_ONESHOT, "sii9234", ctx); - if (ret < 0) { - dev_err(dev, "failed to install IRQ handler\n"); - return ret; - } + if (ret < 0) + return dev_err_probe(dev, ret, + "failed to install IRQ handler\n"); =20 ret =3D sii9234_init_resources(ctx, client); if (ret < 0) --=20 2.50.1 From nobody Fri Oct 3 21:55:35 2025 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34E302D5C64 for ; Sun, 24 Aug 2025 11:17:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756034265; cv=none; b=qSvg6edBRSauDaGepi6fszyoOPE8yjfKthuo2OvMwrTEfSFhWnllzdNZJ7Yepq3J/K8oHxIjlThQADB4eFVzhnsnmM2ocs1ZPFTZgsV/2Al5qmMLirzRsM7XD5G6FCot+DxsPsc5TZ9YXrAhdz6sqoLUqQ4kYrsAu+rYN3K1Tr4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756034265; c=relaxed/simple; bh=tXujzRgrrBGUn2v030aF3lID+YnDxsftptuhhBvWKg4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GgmD9k8KNQ2/kED3PMxJ6CZ5nZiTFZ+1GRIV8G4mDhlnPGrMvC6WbeFK9TGrKJpoMj5zrpfiqIZVn+5Rw2z52/5/EVhoiq2xM3L/Xz6VZZeykykKVcUg1Tv3UvBa4c6eYtf1KLPqmzj4XoMuX7Qsix2+9cYs0B19pYitYDN25RE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=grimler.se; spf=pass smtp.mailfrom=grimler.se; dkim=pass (1024-bit key) header.d=grimler.se header.i=@grimler.se header.b=PffkWfbx; arc=none smtp.client-ip=91.218.175.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=grimler.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=grimler.se Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=grimler.se header.i=@grimler.se header.b="PffkWfbx" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=grimler.se; s=key1; t=1756034260; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=37+dl7EpiJ+GXGLYXXe1onZHgckG1U2hI48/KV0d1I0=; b=PffkWfbxzXBAdOh6czW5cQrlRuQsFnWWrDGzH11GAZCfvecRlDqtv3lMN8b5oKcrvDOYiH 0xnwivO8jQPgNxPk8NFeEIiPOA/VHcNw6QOhlz/O1IogfqlOMvzWVRBJzwWxqgP54+ekKk UmmasPAmFjDmxV6i+1qZZKjujXvz+K8= From: Henrik Grimler Date: Sun, 24 Aug 2025 13:16:56 +0200 Subject: [PATCH v3 3/3] drm/bridge: sii9234: use extcon cable detection logic to detect MHL Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250824-exynos4-sii9234-driver-v3-3-80849e716a37@grimler.se> References: <20250824-exynos4-sii9234-driver-v3-0-80849e716a37@grimler.se> In-Reply-To: <20250824-exynos4-sii9234-driver-v3-0-80849e716a37@grimler.se> To: Dmitry Baryshkov , Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter Cc: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, replicant@osuosl.org, linux-kernel@vger.kernel.org, Henrik Grimler X-Developer-Signature: v=1; a=openpgp-sha256; l=4972; i=henrik@grimler.se; h=from:subject:message-id; bh=tXujzRgrrBGUn2v030aF3lID+YnDxsftptuhhBvWKg4=; b=kA0DAAoBsAduSQtxYWsByyZiAGiq9MGgu7d0a5IvpXE27Z/Vihx4bBp4EscBPD4qgCydQJkHr 4kBMwQAAQoAHRYhBCx/Ka6XiR9kGanizbAHbkkLcWFrBQJoqvTBAAoJELAHbkkLcWFrLCcIAIm1 nM3abFAj8mHjSAHke+KtItJOiyo8GtEdvaJzrlL/t0bAMxUDDWG7tW71BiFBCtbeW4pjD0RE6Vo lidu4/+xACv/LTWQ6038x4LHfOoczXxyIVxIZqJvYIBR0jQu2f69QVGUfDR9/o1GCMLLBObYyqP 9gzyCSYiB1t2LfbSQnpaM5q1zF30Z6fJ9O1aslK6TV3Ot86RpSnwyMkLf3jziqOCkV2+QoEJPIU UAESmv8MKGrzOYJFwGpTrknV314YnoSG+ODiP1wypPakj/VBTbiAjJJf8VeVmV0CDkBOqL+ZTP/ qV0EOSlEwhGj0lvLkAVIWaaEy8qm0zgkDnfIGWA= X-Developer-Key: i=henrik@grimler.se; a=openpgp; fpr=2C7F29AE97891F6419A9E2CDB0076E490B71616B X-Migadu-Flow: FLOW_OUT To use MHL we currently need the MHL chip to be permanently on, which consumes unnecessary power. Let's use extcon attached to MUIC to enable the MHL chip only if it detects an MHL cable. Signed-off-by: Henrik Grimler Tested-by: Marek Szyprowski --- v3: add missing return in error path, spotted by Marek Use depends on EXTCON || !EXTCON instead of select v2: add dependency on extcon. Issue reported by kernel test robot --- drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/sii9234.c | 89 ++++++++++++++++++++++++++++++++++++= ++-- 2 files changed, 87 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 6945029b35929a8e30054ac1a699bd88ab0487f2..bf73f8d900ebd8da9fa3444c0b2= d9bfc901ea773 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -304,6 +304,7 @@ config DRM_SII902X config DRM_SII9234 tristate "Silicon Image SII9234 HDMI/MHL bridge" depends on OF + depends on EXTCON || !EXTCON help Say Y here if you want support for the MHL interface. It is an I2C driver, that detects connection of MHL bridge diff --git a/drivers/gpu/drm/bridge/sii9234.c b/drivers/gpu/drm/bridge/sii9= 234.c index e43248e515b3dcdde043997288d61f738417b8f0..72c6aeed6e12e43df3b052dadc0= 990f1609253f0 100644 --- a/drivers/gpu/drm/bridge/sii9234.c +++ b/drivers/gpu/drm/bridge/sii9234.c @@ -19,6 +19,7 @@ =20 #include #include +#include #include #include #include @@ -26,6 +27,7 @@ #include #include #include +#include #include #include =20 @@ -170,8 +172,12 @@ struct sii9234 { struct drm_bridge bridge; struct device *dev; struct gpio_desc *gpio_reset; - int i2c_error; struct regulator_bulk_data supplies[4]; + struct extcon_dev *extcon; + struct notifier_block extcon_nb; + struct work_struct extcon_wq; + int cable_state; + int i2c_error; =20 struct mutex lock; /* Protects fields below and device registers */ enum sii9234_state state; @@ -863,6 +869,70 @@ static int sii9234_init_resources(struct sii9234 *ctx, return 0; } =20 +static void sii9234_extcon_work(struct work_struct *work) +{ + struct sii9234 *ctx =3D + container_of(work, struct sii9234, extcon_wq); + int state =3D extcon_get_state(ctx->extcon, EXTCON_DISP_MHL); + + if (state =3D=3D ctx->cable_state) + return; + + ctx->cable_state =3D state; + + if (state > 0) + sii9234_cable_in(ctx); + else + sii9234_cable_out(ctx); +} + +static int sii9234_extcon_notifier(struct notifier_block *self, + unsigned long event, void *ptr) +{ + struct sii9234 *ctx =3D + container_of(self, struct sii9234, extcon_nb); + + schedule_work(&ctx->extcon_wq); + + return NOTIFY_DONE; +} + +static int sii9234_extcon_init(struct sii9234 *ctx) +{ + struct extcon_dev *edev; + struct device_node *musb, *muic; + int ret; + + /* Get micro-USB connector node */ + musb =3D of_graph_get_remote_node(ctx->dev->of_node, 1, -1); + /* Then get micro-USB Interface Controller node */ + muic =3D of_get_next_parent(musb); + + if (!muic) { + dev_info(ctx->dev, + "no extcon found, switching to 'always on' mode\n"); + return 0; + } + + edev =3D extcon_find_edev_by_node(muic); + of_node_put(muic); + if (IS_ERR(edev)) { + return dev_err_probe(ctx->dev, PTR_ERR(edev), + "invalid or missing extcon\n"); + } + + ctx->extcon =3D edev; + ctx->extcon_nb.notifier_call =3D sii9234_extcon_notifier; + INIT_WORK(&ctx->extcon_wq, sii9234_extcon_work); + ret =3D extcon_register_notifier(edev, EXTCON_DISP_MHL, &ctx->extcon_nb); + if (ret) { + dev_err(ctx->dev, "failed to register notifier for MHL\n"); + return ret; + } + + return 0; +} + static enum drm_mode_status sii9234_mode_valid(struct drm_bridge *bridge, const struct drm_display_info *info, const struct drm_display_mode *mode) @@ -915,12 +985,17 @@ static int sii9234_probe(struct i2c_client *client) if (ret < 0) return ret; =20 + ret =3D sii9234_extcon_init(ctx); + if (ret < 0) + return ret; + i2c_set_clientdata(client, ctx); =20 ctx->bridge.of_node =3D dev->of_node; drm_bridge_add(&ctx->bridge); =20 - sii9234_cable_in(ctx); + if (!ctx->extcon) + sii9234_cable_in(ctx); =20 return 0; } @@ -929,7 +1004,15 @@ static void sii9234_remove(struct i2c_client *client) { struct sii9234 *ctx =3D i2c_get_clientdata(client); =20 - sii9234_cable_out(ctx); + if (ctx->extcon) { + extcon_unregister_notifier(ctx->extcon, EXTCON_DISP_MHL, + &ctx->extcon_nb); + flush_work(&ctx->extcon_wq); + if (ctx->cable_state > 0) + sii9234_cable_out(ctx); + } else { + sii9234_cable_out(ctx); + } drm_bridge_remove(&ctx->bridge); } =20 --=20 2.50.1