drm: zte: support hdmi audio through spdif
Subsystems (2)
PATCH v2 1/1 drm: zte: support hdmi audio through spdif
From: Shawn Guo <[email protected]>
It enables HDMI audio support through SPDIF interface based on generic hdmi-audio-codec driver. The HDMI hardware supports more audio interfaces than SPDIF, like I2S, which may be added later.
Signed-off-by Shawn Guo <[email protected]>
---
Changes for v2:
- Distll the function zx_hdmi_audio_get_n() per Sean's suggestion and make it inline.
- Fix the operator typo on N_SVAL2 register write.
drivers/gpu/drm/zte/Kconfig | 1 + drivers/gpu/drm/zte/zx_hdmi.c | 148 +++++++++++++++++++++++++++++++++++++ drivers/gpu/drm/zte/zx_hdmi_regs.h | 14 ++++ drivers/gpu/drm/zte/zx_vou.c | 9 +++ drivers/gpu/drm/zte/zx_vou.h | 10 +++ drivers/gpu/drm/zte/zx_vou_regs.h | 2 + 6 files changed, 184 insertions(+)
drivers/gpu/drm/zte/Kconfig +1 -0
@@ -4,5 +4,6 @@ config DRM_ZTE select DRM_KMS_CMA_HELPER select DRM_KMS_FB_HELPER select DRM_KMS_HELPER + select SND_SOC_HDMI_CODEC if SND_SOC help Choose this option to enable DRM on ZTE ZX SoCs.
drivers/gpu/drm/zte/zx_hdmi.c +148 -0
178 lines not on this page · raw message
drivers/gpu/drm/zte/zx_hdmi_regs.h +14 -0
@@ -52,5 +52,19 @@#define TPI_INFO_TRANS_RPT BIT(6)#define TPI_DDC_MASTER_EN 0x06f8#define HW_DDC_MASTER BIT(7) +#define N_SVAL1 0xa03 +#define N_SVAL2 0xa04 +#define N_SVAL3 0xa05 +#define AUD_EN 0xa13 +#define AUD_IN_EN BIT(0) +#define AUD_MODE 0xa14 +#define SPDIF_EN BIT(1) +#define TPI_AUD_CONFIG 0xa62 +#define SPDIF_SAMPLE_SIZE_SHIFT 6 +#define SPDIF_SAMPLE_SIZE_MASK (0x3 << SPDIF_SAMPLE_SIZE_SHIFT) +#define SPDIF_SAMPLE_SIZE_16BIT (0x1 << SPDIF_SAMPLE_SIZE_SHIFT) +#define SPDIF_SAMPLE_SIZE_20BIT (0x2 << SPDIF_SAMPLE_SIZE_SHIFT) +#define SPDIF_SAMPLE_SIZE_24BIT (0x3 << SPDIF_SAMPLE_SIZE_SHIFT) +#define TPI_AUD_MUTE BIT(4)#endif /* __ZX_HDMI_REGS_H__ */
drivers/gpu/drm/zte/zx_vou.c +9 -0
@@ -119,6 +119,15 @@ static inline struct zx_vou_hw *crtc_to_vou(struct drm_crtc *crtc)return zcrtc->vou; } +void vou_inf_hdmi_audio_sel (struct drm_crtc *crtc, +enum vou_inf_hdmi_audio aud) +{ +struct zx_crtc *zcrtc =to_zx_crtc (crtc); +struct zx_vou_hw *vou = zcrtc->vou; + +zx_writel_mask (vou->vouctl +VOU_INF_HDMI_CTRL ,VOU_HDMI_AUD_MASK , aud); +} +void vou_inf_enable (const struct vou_inf *inf,struct drm_crtc *crtc) {struct zx_crtc *zcrtc =to_zx_crtc (crtc);
drivers/gpu/drm/zte/zx_vou.h +10 -0
@@ -30,6 +30,14 @@ enum vou_inf_data_sel { VOU_RGB_666 = 3, }; +enum vou_inf_hdmi_audio { +VOU_HDMI_AUD_SPDIF =BIT (0 ), +VOU_HDMI_AUD_I2S =BIT (1 ), +VOU_HDMI_AUD_DSD =BIT (2 ), +VOU_HDMI_AUD_HBR =BIT (3 ), +VOU_HDMI_AUD_PARALLEL =BIT (4 ), +}; +struct vou_inf {enum vou_inf_id id;enum vou_inf_data_sel data_sel;
@@ -37,6 +45,8 @@ struct vou_inf {u32 clocks_sel_bits; }; +void vou_inf_hdmi_audio_sel (struct drm_crtc *crtc, +enum vou_inf_hdmi_audio aud);void vou_inf_enable (const struct vou_inf *inf,struct drm_crtc *crtc);void vou_inf_disable (const struct vou_inf *inf,struct drm_crtc *crtc);
drivers/gpu/drm/zte/zx_vou_regs.h +2 -0
@@ -150,6 +150,8 @@#define VOU_CLK_GL0_SEL BIT(4)#define VOU_CLK_REQEN 0x20#define VOU_CLK_EN 0x24 +#define VOU_INF_HDMI_CTRL 0x30 +#define VOU_HDMI_AUD_MASK 0x1f/* OTFPPU_CTRL registers */ #define OTFPPU_RSZ_DATA_SOURCE 0x04
Signature · 1 line
1.9.1