[RESEND] drm: bridge: adv7511: Support I2S IEC958 encoded PCM format
diff mbox series

Message ID 20210422064015.15285-1-jee.heng.sia@intel.com
State In Next
Commit ae053fa234f42b4abc582372af7410ad0e3e1dad
Headers show
Series
  • [RESEND] drm: bridge: adv7511: Support I2S IEC958 encoded PCM format
Related show

Commit Message

Sia Jee Heng April 22, 2021, 6:40 a.m. UTC
Support IEC958 encoded PCM format for ADV7511 so that ADV7511 HDMI
audio driver can accept the IEC958 data from the I2S input.

Signed-off-by: Sia Jee Heng <jee.heng.sia@intel.com>
Reviewed-by: Robert Foss <robert.foss@linaro.org>
---
 drivers/gpu/drm/bridge/adv7511/adv7511.h       | 1 +
 drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 6 ++++++
 2 files changed, 7 insertions(+)


base-commit: e488b1023a4a4eab15b905871cf8e81f00336ed7

Comments

Robert Foss April 23, 2021, 8:33 a.m. UTC | #1
Hey Sia,

Thanks for the reminder!

I've merged this patch to drm-misc-next.

https://cgit.freedesktop.org/drm/drm-misc/log/

On Thu, 22 Apr 2021 at 08:57, Sia Jee Heng <jee.heng.sia@intel.com> wrote:
>
> Support IEC958 encoded PCM format for ADV7511 so that ADV7511 HDMI
> audio driver can accept the IEC958 data from the I2S input.
>
> Signed-off-by: Sia Jee Heng <jee.heng.sia@intel.com>
> Reviewed-by: Robert Foss <robert.foss@linaro.org>
> ---
>  drivers/gpu/drm/bridge/adv7511/adv7511.h       | 1 +
>  drivers/gpu/drm/bridge/adv7511/adv7511_audio.c | 6 ++++++
>  2 files changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h
> index a9bb734366ae..05e3abb5a0c9 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h
> @@ -191,6 +191,7 @@
>  #define ADV7511_I2S_FORMAT_I2S                 0
>  #define ADV7511_I2S_FORMAT_RIGHT_J             1
>  #define ADV7511_I2S_FORMAT_LEFT_J              2
> +#define ADV7511_I2S_IEC958_DIRECT              3
>
>  #define ADV7511_PACKET(p, x)       ((p) * 0x20 + (x))
>  #define ADV7511_PACKET_SDP(x)      ADV7511_PACKET(0, x)
> diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
> index 45838bd08d37..61f4a38e7d2b 100644
> --- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
> +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
> @@ -101,6 +101,10 @@ static int adv7511_hdmi_hw_params(struct device *dev, void *data,
>         case 20:
>                 len = ADV7511_I2S_SAMPLE_LEN_20;
>                 break;
> +       case 32:
> +               if (fmt->bit_fmt != SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE)
> +                       return -EINVAL;
> +               fallthrough;
>         case 24:
>                 len = ADV7511_I2S_SAMPLE_LEN_24;
>                 break;
> @@ -112,6 +116,8 @@ static int adv7511_hdmi_hw_params(struct device *dev, void *data,
>         case HDMI_I2S:
>                 audio_source = ADV7511_AUDIO_SOURCE_I2S;
>                 i2s_format = ADV7511_I2S_FORMAT_I2S;
> +               if (fmt->bit_fmt == SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE)
> +                       i2s_format = ADV7511_I2S_IEC958_DIRECT;
>                 break;
>         case HDMI_RIGHT_J:
>                 audio_source = ADV7511_AUDIO_SOURCE_I2S;
>
> base-commit: e488b1023a4a4eab15b905871cf8e81f00336ed7
> --
> 2.18.0
>

Patch
diff mbox series

diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h
index a9bb734366ae..05e3abb5a0c9 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511.h
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h
@@ -191,6 +191,7 @@ 
 #define ADV7511_I2S_FORMAT_I2S			0
 #define ADV7511_I2S_FORMAT_RIGHT_J		1
 #define ADV7511_I2S_FORMAT_LEFT_J		2
+#define ADV7511_I2S_IEC958_DIRECT		3
 
 #define ADV7511_PACKET(p, x)	    ((p) * 0x20 + (x))
 #define ADV7511_PACKET_SDP(x)	    ADV7511_PACKET(0, x)
diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
index 45838bd08d37..61f4a38e7d2b 100644
--- a/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
+++ b/drivers/gpu/drm/bridge/adv7511/adv7511_audio.c
@@ -101,6 +101,10 @@  static int adv7511_hdmi_hw_params(struct device *dev, void *data,
 	case 20:
 		len = ADV7511_I2S_SAMPLE_LEN_20;
 		break;
+	case 32:
+		if (fmt->bit_fmt != SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE)
+			return -EINVAL;
+		fallthrough;
 	case 24:
 		len = ADV7511_I2S_SAMPLE_LEN_24;
 		break;
@@ -112,6 +116,8 @@  static int adv7511_hdmi_hw_params(struct device *dev, void *data,
 	case HDMI_I2S:
 		audio_source = ADV7511_AUDIO_SOURCE_I2S;
 		i2s_format = ADV7511_I2S_FORMAT_I2S;
+		if (fmt->bit_fmt == SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE)
+			i2s_format = ADV7511_I2S_IEC958_DIRECT;
 		break;
 	case HDMI_RIGHT_J:
 		audio_source = ADV7511_AUDIO_SOURCE_I2S;