diff mbox series

drm: bridge: adv7511: Add set_jack handler

Message ID 20210119044157.3801598-1-jun.nie@linaro.org
State New
Headers show
Series drm: bridge: adv7511: Add set_jack handler | expand

Commit Message

Jun Nie Jan. 19, 2021, 4:41 a.m. UTC
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(-)

-- 
2.25.1

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

Comments

Jun Nie Feb. 1, 2021, 1:32 p.m. UTC | #1
Jun Nie <jun.nie@linaro.org> 于2021年1月19日周二 下午12:42写道:
>
> 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(-)
>

Does anyone have comments on this patch?

Thanks!
Jun
Andrzej Hajda Feb. 4, 2021, 6:49 p.m. UTC | #2
W dniu 19.01.2021 o 05:41, Jun Nie pisze:
> 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;

Maybe some locking, to protect access to adv7511->connector.status.

> +
> +	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 = {


I think const modifier should be OK here.


Regards

Andrzej


> +		.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,
diff mbox series

Patch

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,