All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jun Nie <jun.nie@linaro.org>
To: a.hajda@samsung.com, john.stultz@linaro.org
Cc: architt@codeaurora.org, lars@metafoo.de,
	kuninori.morimoto.gx@renesas.com, airlied@linux.ie,
	broonie@kernel.org, alsa-devel@alsa-project.org,
	dri-devel@lists.freedesktop.org, robh+dt@kernel.org,
	bogdan.togorean@analog.com
Subject: [PATCH] drm: bridge: adv7511: Add set_jack handler
Date: Tue, 19 Jan 2021 12:41:57 +0800	[thread overview]
Message-ID: <20210119044157.3801598-1-jun.nie@linaro.org> (raw)

With commit 55c5cc63ab, the hdmi_codec_set_jack() will report unsupport
failure if set_jack handler is missing. Add set_jack handler to resolve
this failure.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
---
 .../gpu/drm/bridge/adv7511/adv7511_audio.c    | 27 ++++++++++++++-----
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
index f101dd2819b5..16de1a8ca7a0 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
@@ -217,22 +217,35 @@ static int adv7511_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
 	return -EINVAL;
 }
 
+static int adv7511_hdmi_i2s_hook_plugged_cb(struct device *dev, void *data,
+					    hdmi_codec_plugged_cb fn,
+					    struct device *codec_dev)
+{
+	struct adv7511 *adv7511 = data;
+	bool plugged = adv7511->connector.status == connector_status_connected;
+
+	fn(codec_dev, plugged);
+	return 0;
+}
+
 static const struct hdmi_codec_ops adv7511_codec_ops = {
 	.hw_params	= adv7511_hdmi_hw_params,
 	.audio_shutdown = audio_shutdown,
 	.audio_startup	= audio_startup,
 	.get_dai_id	= adv7511_hdmi_i2s_get_dai_id,
-};
-
-static const struct hdmi_codec_pdata codec_data = {
-	.ops = &adv7511_codec_ops,
-	.max_i2s_channels = 2,
-	.i2s = 1,
-	.spdif = 1,
+	.hook_plugged_cb = adv7511_hdmi_i2s_hook_plugged_cb,
 };
 
 int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511)
 {
+	struct hdmi_codec_pdata codec_data = {
+		.ops = &adv7511_codec_ops,
+		.max_i2s_channels = 2,
+		.i2s = 1,
+		.spdif = 1,
+		.data = adv7511,
+	};
+
 	adv7511->audio_pdev = platform_device_register_data(dev,
 					HDMI_CODEC_DRV_NAME,
 					PLATFORM_DEVID_AUTO,
-- 
2.25.1


WARNING: multiple messages have this Message-ID (diff)
From: Jun Nie <jun.nie@linaro.org>
To: a.hajda@samsung.com, john.stultz@linaro.org
Cc: architt@codeaurora.org, kuninori.morimoto.gx@renesas.com,
	airlied@linux.ie, broonie@kernel.org,
	alsa-devel@alsa-project.org, dri-devel@lists.freedesktop.org,
	robh+dt@kernel.org, bogdan.togorean@analog.com
Subject: [PATCH] drm: bridge: adv7511: Add set_jack handler
Date: Tue, 19 Jan 2021 12:41:57 +0800	[thread overview]
Message-ID: <20210119044157.3801598-1-jun.nie@linaro.org> (raw)

With commit 55c5cc63ab, the hdmi_codec_set_jack() will report unsupport
failure if set_jack handler is missing. Add set_jack handler to resolve
this failure.

Signed-off-by: Jun Nie <jun.nie@linaro.org>
---
 .../gpu/drm/bridge/adv7511/adv7511_audio.c    | 27 ++++++++++++++-----
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
index f101dd2819b5..16de1a8ca7a0 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
@@ -217,22 +217,35 @@ static int adv7511_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
 	return -EINVAL;
 }
 
+static int adv7511_hdmi_i2s_hook_plugged_cb(struct device *dev, void *data,
+					    hdmi_codec_plugged_cb fn,
+					    struct device *codec_dev)
+{
+	struct adv7511 *adv7511 = data;
+	bool plugged = adv7511->connector.status == connector_status_connected;
+
+	fn(codec_dev, plugged);
+	return 0;
+}
+
 static const struct hdmi_codec_ops adv7511_codec_ops = {
 	.hw_params	= adv7511_hdmi_hw_params,
 	.audio_shutdown = audio_shutdown,
 	.audio_startup	= audio_startup,
 	.get_dai_id	= adv7511_hdmi_i2s_get_dai_id,
-};
-
-static const struct hdmi_codec_pdata codec_data = {
-	.ops = &adv7511_codec_ops,
-	.max_i2s_channels = 2,
-	.i2s = 1,
-	.spdif = 1,
+	.hook_plugged_cb = adv7511_hdmi_i2s_hook_plugged_cb,
 };
 
 int adv7511_audio_init(struct device *dev, struct adv7511 *adv7511)
 {
+	struct hdmi_codec_pdata codec_data = {
+		.ops = &adv7511_codec_ops,
+		.max_i2s_channels = 2,
+		.i2s = 1,
+		.spdif = 1,
+		.data = adv7511,
+	};
+
 	adv7511->audio_pdev = platform_device_register_data(dev,
 					HDMI_CODEC_DRV_NAME,
 					PLATFORM_DEVID_AUTO,
-- 
2.25.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2021-01-19  4:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210119083817eucas1p2076a221a3d70372fb1a7dc55ed9b2ac3@eucas1p2.samsung.com>
2021-01-19  4:41 ` Jun Nie [this message]
2021-01-19  4:41   ` [PATCH] drm: bridge: adv7511: Add set_jack handler Jun Nie
2021-02-01 13:32   ` Jun Nie
2021-02-01 13:32     ` Jun Nie
2021-02-04 18:49   ` Andrzej Hajda
2021-02-04 18:49     ` Andrzej Hajda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210119044157.3801598-1-jun.nie@linaro.org \
    --to=jun.nie@linaro.org \
    --cc=a.hajda@samsung.com \
    --cc=airlied@linux.ie \
    --cc=alsa-devel@alsa-project.org \
    --cc=architt@codeaurora.org \
    --cc=bogdan.togorean@analog.com \
    --cc=broonie@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=john.stultz@linaro.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lars@metafoo.de \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.