From nobody Mon Jun 8 05:28:07 2026 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 AA432395AEE for ; Tue, 2 Jun 2026 18:37:49 +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=1780425471; cv=none; b=q6cy2gq8K47m9PPYKO6StoYNJsI2UaUg4BsbuVRdLllqSN+4L8hBjpM5oCy6IXTWU3H6h/dAdKZW5zmsJrwU2bXZwh1yweGORGs9zY8TzVLppkp65TkVbMBWwaeaSH0DU3MHPjBIRhUA2SXKb61IVqkLNvufo9qNpEu04L3lmlg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780425471; c=relaxed/simple; bh=ov52qv09hURyivLgIT73m1vzdLOIqjhLJ2nQEw37YQE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iDyJZZVgFbDBBkTs31fu03RxBMfS8PbS+BwM2Rr223j15/KH/Qb7buWuNXLo9piW9aNBVP8WlouJQlkwEMRa1GpwCu1VqjF597aVRJjy4YTmPnhbOI35D0wG1cpvqnybdMWRavLdXRWOoXBDFO50dJm+K+PLAX1Nf+ZpcQlPq10= 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=Et/OyKEq; 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="Et/OyKEq" 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=1780425466; 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=7FIRnKnjUEgwNKRFP5/LIIC27jGvHXMJS53DGStupNA=; b=Et/OyKEqDlCNwgBBSAxwg24mwBIGKpaAPg/nD9PdjfNMHte6RReHyoaiXE+1s1esIcI1l2 e32gAzaEJl6vsA0U1W2tTgZm6sXrWG4Jhst6gyKh1k9Hlb4wyyum/e0JKP0vwluv/MUVyW cPls8YUocn/uw5F+w4Z04/f7xIg1NMM= From: Henrik Grimler Date: Tue, 02 Jun 2026 20:36:48 +0200 Subject: [PATCH RESEND 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: <20260602-exynos4-sii9234-driver-v4-1-9b2fc38e104a@grimler.se> References: <20260602-exynos4-sii9234-driver-v4-0-9b2fc38e104a@grimler.se> In-Reply-To: <20260602-exynos4-sii9234-driver-v4-0-9b2fc38e104a@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=ov52qv09hURyivLgIT73m1vzdLOIqjhLJ2nQEw37YQE=; b=owEBbQGS/pANAwAKAbAHbkkLcWFrAcsmYgBqHyLokf4gb92s793rV1c2L9bTU6iH6/9jwx0pL 2yifYgO6M2JATMEAAEKAB0WIQQsfymul4kfZBmp4s2wB25JC3FhawUCah8i6AAKCRCwB25JC3Fh axtJB/9/R1jZ8CU5+J0KrHfzmNzGXAi0vkD3kVIRkSrWwXPRfj6gFpsJyNgulaFEHBk404EdS0R RzjfwjzpoS+BolcXKq9xoPMu2pk34tMk6HlAC58RPLB8v/yAHd3+awMUIV3YB/KkeWe3kuAHF/2 xalZfxg3R0Gob0XuVaeL4QVp1MQMEWwBRpzV8/7KWOLzCVPffEOnh/+StGAyMN1EmJHA3WWjoUd pRFXdUXkiafcqNNbU2wGkhTfWJfdtYgrGNdjt20urZZzG5FDVVFRdvpslaQR816iD24yVyJBlBJ qMekqJFEclKY6o+4giXBSU9J0uzGpehLhHYO1LfPpXX/SdPi 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.54.0 From nobody Mon Jun 8 05:28:07 2026 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (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 78709396D1A for ; Tue, 2 Jun 2026 18:37:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780425478; cv=none; b=lI/5qYQdWexIeS4994t8fXe6pe63iFOsingzhoFDRl0EGLyyzB9FfrWUmNk91DhgTfZ0ac2djcgIjFoigCxaUtsG1+iRqreYWbSNemOb6alx9UY9pkCtvLfy5yx6JGpBnXxGkZqQ8SB3INxyR4SsL8ZwxfI6uVqzAdvbxe+o5ZA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780425478; c=relaxed/simple; bh=2JY7jnSV1JB6B0QOWe63/vdQ4r7EM95S5p7Kzp0USdQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pqxLkLBvRFgT8mpA5VAhN3f29QPTE89SfZgNai5ByRBbtiEM/okBD1SbErVP1E9HOZkIBS6mNs0UVZs50VmsLSElEqdrf4/ClUX0EEpihdG+CYBXJOfu0gyqjjk12PHYuKBAzDUDLLGpp7wGY8AgjZ2YGSzLOMNmw+1Op/uJuuA= 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=k8bAAhZ2; arc=none smtp.client-ip=91.218.175.188 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="k8bAAhZ2" 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=1780425472; 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=MQmCjaY8e93JhvqyS05LSFJf7JVZklINckJ9CozzQyY=; b=k8bAAhZ21IGaI8CtYrvGWLNboois7F2pMfESCq3DBVLyFmX0kO1G6AaulM6+9K16azu+J2 abgalwU2WrVzu6NcKEcPB8ViMn92ryfIzKAA4FtXAbFQFx8abd1xsi4ubpH38BS4GZSxVT VX3cUkEznPPd/wbwn26ECjbOEp5NhtQ= From: Henrik Grimler Date: Tue, 02 Jun 2026 20:36:49 +0200 Subject: [PATCH RESEND 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: <20260602-exynos4-sii9234-driver-v4-2-9b2fc38e104a@grimler.se> References: <20260602-exynos4-sii9234-driver-v4-0-9b2fc38e104a@grimler.se> In-Reply-To: <20260602-exynos4-sii9234-driver-v4-0-9b2fc38e104a@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=2JY7jnSV1JB6B0QOWe63/vdQ4r7EM95S5p7Kzp0USdQ=; b=owEBbQGS/pANAwAKAbAHbkkLcWFrAcsmYgBqHyLsxq80QudmYZcs9ETzWXKz24adP5QSwpXbB nGz5A0Sv1+JATMEAAEKAB0WIQQsfymul4kfZBmp4s2wB25JC3FhawUCah8i7AAKCRCwB25JC3Fh a3QiB/wPPWO7lvNZs/EQOLAPjumAPuwc+tXMCZQ21irQYGVDGejM1eegJt/BddMhpZtVYvUo4Hz SxLPIxNxOfa8ZUsJ0Kc5OTE2HDMdg4zPfW7lkDWQ2f1JCkQQXBe0B2GmTWtG9muz3NCxtR4QzOt vZ5GbVy9IcYF0iW8yLvQXulQC7iD/kQfeGx/aIf5xyjapaYZsZwj1izsutoD4mjBWtWz+MbUj9A kVC6O/7KAiFliLYP1Iq5MHFRqX1Jhvi/xuwehwY5Y26Kv69EZJux5SjbdAp/Oc1vHk2E/t+XiPV q4ayuZfU9G3OHNeap+w2dDP31Efkir58YT/xtMVJONjiB9M5 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.54.0 From nobody Mon Jun 8 05:28:07 2026 Received: from out-188.mta0.migadu.com (out-188.mta0.migadu.com [91.218.175.188]) (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 BBCE3395AE1 for ; Tue, 2 Jun 2026 18:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780425479; cv=none; b=blWow3Lx0z1+5nHhd6lSYQbexX+mSijN9c3d0N0qCl7Yeoax2YTmdSU0MkzyVUEFclEr2G0WzOQ8AmdzloITY0deeteKR/9wjAcEXhP5/mPcIZgZgpuKu2bQkPyQ1XD3neMxoAqm7hfw3Ib0LDp3EvPsyIGM8sRupdKbH9pKFSk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780425479; c=relaxed/simple; bh=J2VrdZZdHdrUSvVv2/0hRbTGcr86aySVkMiUCH39Ld4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RxLCmrnWLXWKVu+nPQupOScwToFA5wFFdb91nSyw0wno82Jv6j4fM0KtYwhVbyINHRII9FRjFN7zfes/2LocwVZYlTDxQPd3FUxbDebAAKwtas5XXGkEWlro4WUNP0/sVkicSsH0IfxYdScfFEBqNx1OVDFRE2nSp3eerhYN1QE= 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=Wh7rVw1t; arc=none smtp.client-ip=91.218.175.188 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="Wh7rVw1t" 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=1780425475; 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=WxMYC4T1LGG7DL25LkdKxvkXEaCcM5nAzX/5lfuA2Hc=; b=Wh7rVw1tYHNqYWPTzBP57ZGQzQKY5xTG+zrHYG3pqe+SfeghdLE3Somd74L5h2hsg99yE2 YRx4+4iF59XrFjiSKKnPVgXW81wNMxTrTf3rHXFFLsOxl7k2Covu6eKsmqRBOxDf0dQhsi lTD0UBAFPcsJDhCTfKiUZPI75tp8IXA= From: Henrik Grimler Date: Tue, 02 Jun 2026 20:36:50 +0200 Subject: [PATCH RESEND 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: <20260602-exynos4-sii9234-driver-v4-3-9b2fc38e104a@grimler.se> References: <20260602-exynos4-sii9234-driver-v4-0-9b2fc38e104a@grimler.se> In-Reply-To: <20260602-exynos4-sii9234-driver-v4-0-9b2fc38e104a@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=J2VrdZZdHdrUSvVv2/0hRbTGcr86aySVkMiUCH39Ld4=; b=owEBbQGS/pANAwAKAbAHbkkLcWFrAcsmYgBqHyLv132KVuTm+PwuW9cyhgbWox+p1MI5l8ytv Lc6CdMzpuSJATMEAAEKAB0WIQQsfymul4kfZBmp4s2wB25JC3FhawUCah8i7wAKCRCwB25JC3Fh a85yB/9pljhUB9wE1+ub5xWBjYeuyWheF5e3cs9FG332jfHA7MNhxV3jAy6ph44Dt2NwElbxhZk MJdh6JkGO1EKm/L5euXIEJjZq2LUooo4zQJXIXjEzmEj7LunTbJbwq3l+d1Obyyg/eLxQokugWC a5kojU/pnRDnfLkUvxvbqaKonQWFkDhLd5MNJJQtlG1rC3idlEGwUD/tbgQJLe0ttuLhONv79na Zw9c4hXWAUXPUHFbCJF/N9gSpUh19fm04xTePQFEQqWbNWBzYIwMN7qVsc5ThmvTMlpEX98CAkF YfVyb5whq2UwCMmH6hZErjM6DH7RiP0kAFSshpa8M3LWZ0iT 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.54.0