Re: [PATCH] drm: bridge: adv7511: Add set_jack handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>   .../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,



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux