Commit e769a350 authored by Maxime Ripard's avatar Maxime Ripard

drm/vc4: hdmi: Support HDMI YUV output

In addition to the RGB444 output, the BCM2711 HDMI controller supports
the YUV444 and YUV422 output formats.

Let's add support for them in the driver, but still use RGB as the
preferred format.
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
Acked-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220222164042.403112-8-maxime@cerno.tech
parent dd39d024
This diff is collapsed.
...@@ -117,6 +117,13 @@ struct vc4_hdmi_audio { ...@@ -117,6 +117,13 @@ struct vc4_hdmi_audio {
bool streaming; bool streaming;
}; };
enum vc4_hdmi_output_format {
VC4_HDMI_OUTPUT_RGB,
VC4_HDMI_OUTPUT_YUV422,
VC4_HDMI_OUTPUT_YUV444,
VC4_HDMI_OUTPUT_YUV420,
};
/* General HDMI hardware state. */ /* General HDMI hardware state. */
struct vc4_hdmi { struct vc4_hdmi {
struct vc4_hdmi_audio audio; struct vc4_hdmi_audio audio;
...@@ -222,6 +229,12 @@ struct vc4_hdmi { ...@@ -222,6 +229,12 @@ struct vc4_hdmi {
* outside of KMS hooks. Protected by @mutex. * outside of KMS hooks. Protected by @mutex.
*/ */
unsigned int output_bpc; unsigned int output_bpc;
/**
* @output_format: Copy of @vc4_connector_state.output_format
* for use outside of KMS hooks. Protected by @mutex.
*/
enum vc4_hdmi_output_format output_format;
}; };
static inline struct vc4_hdmi * static inline struct vc4_hdmi *
...@@ -242,6 +255,7 @@ struct vc4_hdmi_connector_state { ...@@ -242,6 +255,7 @@ struct vc4_hdmi_connector_state {
struct drm_connector_state base; struct drm_connector_state base;
unsigned long long tmds_char_rate; unsigned long long tmds_char_rate;
unsigned int output_bpc; unsigned int output_bpc;
enum vc4_hdmi_output_format output_format;
}; };
static inline struct vc4_hdmi_connector_state * static inline struct vc4_hdmi_connector_state *
......
...@@ -54,6 +54,7 @@ enum vc4_hdmi_field { ...@@ -54,6 +54,7 @@ enum vc4_hdmi_field {
HDMI_CSC_24_23, HDMI_CSC_24_23,
HDMI_CSC_32_31, HDMI_CSC_32_31,
HDMI_CSC_34_33, HDMI_CSC_34_33,
HDMI_CSC_CHANNEL_CTL,
HDMI_CSC_CTL, HDMI_CSC_CTL,
/* /*
...@@ -119,6 +120,7 @@ enum vc4_hdmi_field { ...@@ -119,6 +120,7 @@ enum vc4_hdmi_field {
HDMI_TX_PHY_POWERDOWN_CTL, HDMI_TX_PHY_POWERDOWN_CTL,
HDMI_TX_PHY_RESET_CTL, HDMI_TX_PHY_RESET_CTL,
HDMI_TX_PHY_TMDS_CLK_WORD_SEL, HDMI_TX_PHY_TMDS_CLK_WORD_SEL,
HDMI_VEC_INTERFACE_CFG,
HDMI_VEC_INTERFACE_XBAR, HDMI_VEC_INTERFACE_XBAR,
HDMI_VERTA0, HDMI_VERTA0,
HDMI_VERTA1, HDMI_VERTA1,
...@@ -244,6 +246,7 @@ static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi0_fields[] = { ...@@ -244,6 +246,7 @@ static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi0_fields[] = {
VC4_HDMI_REG(HDMI_SCRAMBLER_CTL, 0x1c4), VC4_HDMI_REG(HDMI_SCRAMBLER_CTL, 0x1c4),
VC5_DVP_REG(HDMI_CLOCK_STOP, 0x0bc), VC5_DVP_REG(HDMI_CLOCK_STOP, 0x0bc),
VC5_DVP_REG(HDMI_VEC_INTERFACE_CFG, 0x0ec),
VC5_DVP_REG(HDMI_VEC_INTERFACE_XBAR, 0x0f0), VC5_DVP_REG(HDMI_VEC_INTERFACE_XBAR, 0x0f0),
VC5_PHY_REG(HDMI_TX_PHY_RESET_CTL, 0x000), VC5_PHY_REG(HDMI_TX_PHY_RESET_CTL, 0x000),
...@@ -289,6 +292,7 @@ static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi0_fields[] = { ...@@ -289,6 +292,7 @@ static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi0_fields[] = {
VC5_CSC_REG(HDMI_CSC_24_23, 0x010), VC5_CSC_REG(HDMI_CSC_24_23, 0x010),
VC5_CSC_REG(HDMI_CSC_32_31, 0x014), VC5_CSC_REG(HDMI_CSC_32_31, 0x014),
VC5_CSC_REG(HDMI_CSC_34_33, 0x018), VC5_CSC_REG(HDMI_CSC_34_33, 0x018),
VC5_CSC_REG(HDMI_CSC_CHANNEL_CTL, 0x02c),
}; };
static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi1_fields[] = { static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi1_fields[] = {
...@@ -324,6 +328,7 @@ static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi1_fields[] = { ...@@ -324,6 +328,7 @@ static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi1_fields[] = {
VC4_HDMI_REG(HDMI_SCRAMBLER_CTL, 0x1c4), VC4_HDMI_REG(HDMI_SCRAMBLER_CTL, 0x1c4),
VC5_DVP_REG(HDMI_CLOCK_STOP, 0x0bc), VC5_DVP_REG(HDMI_CLOCK_STOP, 0x0bc),
VC5_DVP_REG(HDMI_VEC_INTERFACE_CFG, 0x0ec),
VC5_DVP_REG(HDMI_VEC_INTERFACE_XBAR, 0x0f0), VC5_DVP_REG(HDMI_VEC_INTERFACE_XBAR, 0x0f0),
VC5_PHY_REG(HDMI_TX_PHY_RESET_CTL, 0x000), VC5_PHY_REG(HDMI_TX_PHY_RESET_CTL, 0x000),
...@@ -369,6 +374,7 @@ static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi1_fields[] = { ...@@ -369,6 +374,7 @@ static const struct vc4_hdmi_register __maybe_unused vc5_hdmi_hdmi1_fields[] = {
VC5_CSC_REG(HDMI_CSC_24_23, 0x010), VC5_CSC_REG(HDMI_CSC_24_23, 0x010),
VC5_CSC_REG(HDMI_CSC_32_31, 0x014), VC5_CSC_REG(HDMI_CSC_32_31, 0x014),
VC5_CSC_REG(HDMI_CSC_34_33, 0x018), VC5_CSC_REG(HDMI_CSC_34_33, 0x018),
VC5_CSC_REG(HDMI_CSC_CHANNEL_CTL, 0x02c),
}; };
static inline static inline
......
...@@ -774,11 +774,27 @@ enum { ...@@ -774,11 +774,27 @@ enum {
# define VC4_HD_CSC_CTL_RGB2YCC BIT(1) # define VC4_HD_CSC_CTL_RGB2YCC BIT(1)
# define VC4_HD_CSC_CTL_ENABLE BIT(0) # define VC4_HD_CSC_CTL_ENABLE BIT(0)
# define VC5_MT_CP_CSC_CTL_USE_444_TO_422 BIT(6)
# define VC5_MT_CP_CSC_CTL_FILTER_MODE_444_TO_422_MASK \
VC4_MASK(5, 4)
# define VC5_MT_CP_CSC_CTL_FILTER_MODE_444_TO_422_STANDARD \
3
# define VC5_MT_CP_CSC_CTL_USE_RNG_SUPPRESSION BIT(3)
# define VC5_MT_CP_CSC_CTL_ENABLE BIT(2) # define VC5_MT_CP_CSC_CTL_ENABLE BIT(2)
# define VC5_MT_CP_CSC_CTL_MODE_MASK VC4_MASK(1, 0) # define VC5_MT_CP_CSC_CTL_MODE_MASK VC4_MASK(1, 0)
# define VC5_MT_CP_CHANNEL_CTL_OUTPUT_REMAP_MASK \
VC4_MASK(7, 6)
# define VC5_MT_CP_CHANNEL_CTL_OUTPUT_REMAP_LEGACY_STYLE \
2
# define VC4_DVP_HT_CLOCK_STOP_PIXEL BIT(1) # define VC4_DVP_HT_CLOCK_STOP_PIXEL BIT(1)
# define VC5_DVP_HT_VEC_INTERFACE_CFG_SEL_422_MASK \
VC4_MASK(3, 2)
# define VC5_DVP_HT_VEC_INTERFACE_CFG_SEL_422_FORMAT_422_LEGACY \
2
/* HVS display list information. */ /* HVS display list information. */
#define HVS_BOOTLOADER_DLIST_END 32 #define HVS_BOOTLOADER_DLIST_END 32
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment