From nobody Mon Feb 9 16:03:40 2026 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 4C8BE38F25C for ; Tue, 13 Jan 2026 12:50:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768308606; cv=none; b=pVXCTF6EVopEyGeMmRlOKItkkySj2tWFKUU8HR5OB82yKNYkp9uH2iGtuwCZkWk0lMKKkOT8fhKsgiYCU3PmnR0MCSwS8Bfqr/XH80GY2pxUVgiDuJ3k2oeIGrDbt7a3pJxPJ5NLen4kTlfcPOI62FDSWZkuDVT6oNXRYARK36Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768308606; c=relaxed/simple; bh=/PifViMuWvo7zfvjCOh/M1snfV5AQVf1KCAH+/d0SlY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A0BAPdpQ8M8pxOhxNd3/HMYiz4WfoTp+jsVsO8WpUpfc8MwxiDAgAU683tUsQ7Jn8a3BeuauNDgGXHW2sCfNoYQzvwSfm5C9oXAcY1PBYe6RDx5yak5yqs/xdFV3+8e1EQN5Y8aLo9joqBsqxLNxiRlvUbMLZkTCuAfu+8WDo78= 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=lFGPpoL5; arc=none smtp.client-ip=91.218.175.183 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="lFGPpoL5" 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=1768308601; 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=Dn8TkGnFX648Df0G4MRNqXtbtucg/2Mdh004DLq7F5A=; b=lFGPpoL5RH56iNDF0944tz84HBfsj7AecmBciHPe4lHyeNPt1fPN9GB6enWYs4DmxfjKqE LY42pQEar5Fua79NAYgGUh/TVdjuMi5jgGD3HVPNSWS3kMWT2j8yjDNJ4iw5+Md+L5pI8u NmrQzDe0lpGtqMB7cvia14ZPoUvcUtU= From: Henrik Grimler Date: Tue, 13 Jan 2026 13:49:29 +0100 Subject: [PATCH v4 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: <20260113-exynos4-sii9234-driver-v4-1-6e8c0ac14f84@grimler.se> References: <20260113-exynos4-sii9234-driver-v4-0-6e8c0ac14f84@grimler.se> In-Reply-To: <20260113-exynos4-sii9234-driver-v4-0-6e8c0ac14f84@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=2382; i=henrik@grimler.se; h=from:subject:message-id; bh=/PifViMuWvo7zfvjCOh/M1snfV5AQVf1KCAH+/d0SlY=; b=owEBbQGS/pANAwAKAbAHbkkLcWFrAcsmYgBpZj9quqwxtYky6Pb2N1L+xfnn+4F1GGht+DnEp Y+cDCs1Q5mJATMEAAEKAB0WIQQsfymul4kfZBmp4s2wB25JC3FhawUCaWY/agAKCRCwB25JC3Fh a9D4CAC8Aha7YF6GuWMJFjL1se6o5RvLnLwnKEkp89MYLRUuI21shrdwTEgg2vkyUH+Shh5W2C8 U7G8chGQCmfYJ7oIT+tT1NqtxriC+ERUvDuETdD9+du787/8cqNz2RGN1pOdsF1EPdOdkPJk6v+ dRt7lKwizgKhnEfswYQ+hWDNb9Ct1u2Fq9Ds7aZZVa6QKRirxQ64MorcTc+xaRbi2mvkan5Aznf T4X90vUiOzftpaZ3a4siIPsBbkBaNR5Gce3WWabANtRrJ8O1mJ8gy7XyI/UBJ8Gcrsl0iJXHwMs FYsUZxXJhg22Tj2NKJlw+e/qGA5gbJq9jqQLAAbWu1rJsT7b 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 --- v4: no changes 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 bb1bed03eb5b..930117bbba87 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.52.0 From nobody Mon Feb 9 16:03:40 2026 Received: from out-186.mta0.migadu.com (out-186.mta0.migadu.com [91.218.175.186]) (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 967DE38F928 for ; Tue, 13 Jan 2026 12:50:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.186 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768308607; cv=none; b=Mqd5Uzawlluoq+YEJS9sfm1DOhQSHbt4qTMfJ0Ph3bf88+P26ghNmG3Tc7M+uTZmzx/eljKhsCjlHhU8KY8K7cZsZHaOQ4vWfDwhcEOnXSi5RPuRFnVyzHe08ZfSs5Jo/tcEv2PHuVx/w59VrKXzv5WMkpxTNLnMy5JJATRxMO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768308607; c=relaxed/simple; bh=1pnn12wlQLRLVuJOXumFkPogBBkxIJewCc4pUkwMdhE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JPR0x4QW6jRQ268SG43BtBBocEmpmGUNSJsfFs1vMBd8r/pfP6uYxg+zw/aPY1ht7YaOX5W4KDp7/XOPbd/SfxxC/Eg/v94TvThC73dfZLDGQRLDwKhYvxr/VCmTAOYPpAeIrvsaqtWbvXjg+LQGPNLoOkXIg6O7ChwtDVo86pQ= 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=DHnTJFhP; arc=none smtp.client-ip=91.218.175.186 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="DHnTJFhP" 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=1768308604; 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=7Y/Fgs7A0AOIZAlZ6XnKfgoin/CzNGqX+748paLlw/s=; b=DHnTJFhPz4t7cJ2WousNEHKFhAMbtmFE9w1+ikiAw5Zg9n0G4sQAmpFFHy0UMqA4ocYnYT hkxj+DSmYRbxtDEwuooYEW7wtoO/gDB3Ig7eTrZk9mlPxt2WqZuwKw7qkzisI/DQS5mOOP x2z3NCusUlz59qNl9M7P4Rm19wcS6QI= From: Henrik Grimler Date: Tue, 13 Jan 2026 13:49:30 +0100 Subject: [PATCH v4 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: <20260113-exynos4-sii9234-driver-v4-2-6e8c0ac14f84@grimler.se> References: <20260113-exynos4-sii9234-driver-v4-0-6e8c0ac14f84@grimler.se> In-Reply-To: <20260113-exynos4-sii9234-driver-v4-0-6e8c0ac14f84@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=2092; i=henrik@grimler.se; h=from:subject:message-id; bh=1pnn12wlQLRLVuJOXumFkPogBBkxIJewCc4pUkwMdhE=; b=owEBbQGS/pANAwAKAbAHbkkLcWFrAcsmYgBpZj9twnqIjL/fuNNSK5NMiJcFaYib7Nr8YXwZw 9nlua7NLC+JATMEAAEKAB0WIQQsfymul4kfZBmp4s2wB25JC3FhawUCaWY/bQAKCRCwB25JC3Fh a82yB/9gAoSqGSTjVXu/btz9oyxWZnGFD7saihV02JJhSTENQRjLfDs7ef9SrX/G9e9bYL2F/E0 exDqehceTUHD9nVbOZ+fPXI8cTUU2tNRIZhEm/MkG2lSi2Gub+jYgv+DcdfEugahHXhvZbRXpMR 8wGQOE60fc0gOxsRHCfmRE6Kmn/yaXxZsQiGtMLylr5FmQqudFAIWGLiEGEKqaN1GreCaxCxX+i scFUdNc24v2aeDt/rmzuRwL/uczGaZz5/1/WwYuTE6sT9JO9lfJtdlBt+7BWp3FTbLN3g4Yt4T1 DL1m6Kh9s6H+/DuQ+pHinWFQZEx4oAMy806AGMTcv1/PuMfU 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. Reviewed-by: Dmitry Baryshkov Signed-off-by: Henrik Grimler --- v4: collect tags 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 930117bbba87..e43248e515b3 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.52.0 From nobody Mon Feb 9 16:03:40 2026 Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) (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 C0FEF38F941 for ; Tue, 13 Jan 2026 12:50:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768308618; cv=none; b=OPfPzWyiUC4MaG8b1i+sZvAh6f4FNw0ZcNwwH8axtYsBQBlIOQHFUHFmvJqrW9IFOrQVh2gxqDLCeDv61tYsOHourbSXGvZkASzvCgGqkWzPyoTagV2/pHvCOjFBi9fFMVe8k2Yd/CRswmzNphlAb1QpFPs2PdaknomlIyECYH0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768308618; c=relaxed/simple; bh=pldzOsbv7vqhDc1HP8HwsXxb+ROaOBWObRlyCIAfto0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cGprP7pMvb8O23i7gyrs0Q0Bqu1zyZ2wo24cH7pNz/ZkfikMU6MvxEb7tJiXVK18O6epAQ/c1XpeZ8xoGPz/NqYBv2yHDsEhnlAUE2y8oF46vbMjkd27SJcMOQ+aXpKn2IOmpb8IIC1CzxFEmo/6nRyn4Vf9bQgBPU8EIdUpaGM= 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=eOtdakCj; arc=none smtp.client-ip=91.218.175.180 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="eOtdakCj" 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=1768308606; 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=b5HYdsqnn7iZNMGRXG9w9QT0yjmplZ77lGq34gX7Onw=; b=eOtdakCjzzdNvMvJRBjAwgYBYrJaLOoETJO/bBpZMWfdEZImS4wR9IAOPAU0iivX3bfLn9 YULvRA+NsbsEnJVR01Pig4gZ7kcMeg6Jmu0Isuz9dZTtRiKTLDlaWSfbIIY7t61yfNl9DV J0bYPilkb+G55ZAPXKMhi6Tsc+Ix/58= From: Henrik Grimler Date: Tue, 13 Jan 2026 13:49:31 +0100 Subject: [PATCH v4 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: <20260113-exynos4-sii9234-driver-v4-3-6e8c0ac14f84@grimler.se> References: <20260113-exynos4-sii9234-driver-v4-0-6e8c0ac14f84@grimler.se> In-Reply-To: <20260113-exynos4-sii9234-driver-v4-0-6e8c0ac14f84@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=4934; i=henrik@grimler.se; h=from:subject:message-id; bh=pldzOsbv7vqhDc1HP8HwsXxb+ROaOBWObRlyCIAfto0=; b=owEBbQGS/pANAwAKAbAHbkkLcWFrAcsmYgBpZj9wNYYO4aHtNT011nHB2qQoDPj/pSBnWbTZu Z5WMbPfmQ2JATMEAAEKAB0WIQQsfymul4kfZBmp4s2wB25JC3FhawUCaWY/cAAKCRCwB25JC3Fh a1uUCADHNLW62WImxg6gvZXfbWFpbv6ZGxgwXO3dpOSUpmzEGUl06pv3irk+zD+6By5HGHh9+Jt fTpR0J9gv5bY8vOKxWQo5Pi3uYmskWlAOBE0UWDLoAb+f0ZN2nUNe8+j28z4c/9nYMAbvHm8m4Q xgzclQPhfWixVXBkQgzCxxeibGfucYFP3DE+XaEpcs3bLjxuHAGLeKPT+RC0hNhj1bFyz/EwjsX GZmDv2LO4orIpF9MQhWn/AZNV+DvZUl37BLQepQFMY+ATNS+B8ot0dpA06fRiRa47ozGW368kpB fJjLVdymtvrm7NC8pHsD508TBgcxTzglzmOWNtjU+m9H9QqO 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. Tested-by: Marek Szyprowski Signed-off-by: Henrik Grimler --- v4: collect tags 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 39385deafc68..a8343df2d424 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -310,6 +310,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 e43248e515b3..72c6aeed6e12 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.52.0