Commit b47a72f3 authored by Maxime Ripard's avatar Maxime Ripard

drm/vc4: hdmi: Switch to HDMI connector

The new HDMI connector infrastructure allows us to remove a lot of
boilerplate, so let's switch to it.
Acked-by: default avatarSui Jingfeng <sui.jingfeng@linux.dev>
Link: https://patchwork.freedesktop.org/patch/msgid/20240527-kms-hdmi-connector-state-v15-25-c5af16c3aae2@kernel.orgSigned-off-by: default avatarMaxime Ripard <mripard@kernel.org>
parent c602e495
...@@ -10,6 +10,7 @@ config DRM_VC4 ...@@ -10,6 +10,7 @@ config DRM_VC4
depends on COMMON_CLK depends on COMMON_CLK
depends on PM depends on PM
select DRM_DISPLAY_HDMI_HELPER select DRM_DISPLAY_HDMI_HELPER
select DRM_DISPLAY_HDMI_STATE_HELPER
select DRM_DISPLAY_HELPER select DRM_DISPLAY_HELPER
select DRM_KMS_HELPER select DRM_KMS_HELPER
select DRM_GEM_DMA_HELPER select DRM_GEM_DMA_HELPER
......
This diff is collapsed.
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
struct vc4_hdmi; struct vc4_hdmi;
struct vc4_hdmi_register; struct vc4_hdmi_register;
struct vc4_hdmi_connector_state;
enum vc4_hdmi_phy_channel { enum vc4_hdmi_phy_channel {
PHY_LANE_0 = 0, PHY_LANE_0 = 0,
...@@ -76,7 +75,7 @@ struct vc4_hdmi_variant { ...@@ -76,7 +75,7 @@ struct vc4_hdmi_variant {
/* Callback to initialize the PHY according to the connector state */ /* Callback to initialize the PHY according to the connector state */
void (*phy_init)(struct vc4_hdmi *vc4_hdmi, void (*phy_init)(struct vc4_hdmi *vc4_hdmi,
struct vc4_hdmi_connector_state *vc4_conn_state); struct drm_connector_state *conn_state);
/* Callback to disable the PHY */ /* Callback to disable the PHY */
void (*phy_disable)(struct vc4_hdmi *vc4_hdmi); void (*phy_disable)(struct vc4_hdmi *vc4_hdmi);
...@@ -110,19 +109,6 @@ struct vc4_hdmi_audio { ...@@ -110,19 +109,6 @@ 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,
};
enum vc4_hdmi_broadcast_rgb {
VC4_HDMI_BROADCAST_RGB_AUTO,
VC4_HDMI_BROADCAST_RGB_FULL,
VC4_HDMI_BROADCAST_RGB_LIMITED,
};
/* General HDMI hardware state. */ /* General HDMI hardware state. */
struct vc4_hdmi { struct vc4_hdmi {
struct vc4_hdmi_audio audio; struct vc4_hdmi_audio audio;
...@@ -135,8 +121,6 @@ struct vc4_hdmi { ...@@ -135,8 +121,6 @@ struct vc4_hdmi {
struct delayed_work scrambling_work; struct delayed_work scrambling_work;
struct drm_property *broadcast_rgb_property;
struct i2c_adapter *ddc; struct i2c_adapter *ddc;
void __iomem *hdmicore_regs; void __iomem *hdmicore_regs;
void __iomem *hd_regs; void __iomem *hd_regs;
...@@ -218,16 +202,17 @@ struct vc4_hdmi { ...@@ -218,16 +202,17 @@ struct vc4_hdmi {
bool scdc_enabled; bool scdc_enabled;
/** /**
* @output_bpc: Copy of @vc4_connector_state.output_bpc for use * @output_bpc: Copy of @drm_connector_state.hdmi.output_bpc for
* outside of KMS hooks. Protected by @mutex. * use outside of KMS hooks. Protected by @mutex.
*/ */
unsigned int output_bpc; unsigned int output_bpc;
/** /**
* @output_format: Copy of @vc4_connector_state.output_format * @output_format: Copy of
* for use outside of KMS hooks. Protected by @mutex. * @drm_connector_state.hdmi.output_format for use outside of
* KMS hooks. Protected by @mutex.
*/ */
enum vc4_hdmi_output_format output_format; enum hdmi_colorspace output_format;
}; };
#define connector_to_vc4_hdmi(_connector) \ #define connector_to_vc4_hdmi(_connector) \
...@@ -240,25 +225,14 @@ encoder_to_vc4_hdmi(struct drm_encoder *encoder) ...@@ -240,25 +225,14 @@ encoder_to_vc4_hdmi(struct drm_encoder *encoder)
return container_of_const(_encoder, struct vc4_hdmi, encoder); return container_of_const(_encoder, struct vc4_hdmi, encoder);
} }
struct vc4_hdmi_connector_state {
struct drm_connector_state base;
unsigned long long tmds_char_rate;
unsigned int output_bpc;
enum vc4_hdmi_output_format output_format;
enum vc4_hdmi_broadcast_rgb broadcast_rgb;
};
#define conn_state_to_vc4_hdmi_conn_state(_state) \
container_of_const(_state, struct vc4_hdmi_connector_state, base)
void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi,
struct vc4_hdmi_connector_state *vc4_conn_state); struct drm_connector_state *conn_state);
void vc4_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi); void vc4_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi);
void vc4_hdmi_phy_rng_enable(struct vc4_hdmi *vc4_hdmi); void vc4_hdmi_phy_rng_enable(struct vc4_hdmi *vc4_hdmi);
void vc4_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi); void vc4_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi);
void vc5_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, void vc5_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi,
struct vc4_hdmi_connector_state *vc4_conn_state); struct drm_connector_state *conn_state);
void vc5_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi); void vc5_hdmi_phy_disable(struct vc4_hdmi *vc4_hdmi);
void vc5_hdmi_phy_rng_enable(struct vc4_hdmi *vc4_hdmi); void vc5_hdmi_phy_rng_enable(struct vc4_hdmi *vc4_hdmi);
void vc5_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi); void vc5_hdmi_phy_rng_disable(struct vc4_hdmi *vc4_hdmi);
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
#define OSCILLATOR_FREQUENCY 54000000 #define OSCILLATOR_FREQUENCY 54000000
void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, void vc4_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi,
struct vc4_hdmi_connector_state *conn_state) struct drm_connector_state *conn_state)
{ {
unsigned long flags; unsigned long flags;
...@@ -361,11 +361,11 @@ static void vc5_hdmi_reset_phy(struct vc4_hdmi *vc4_hdmi) ...@@ -361,11 +361,11 @@ static void vc5_hdmi_reset_phy(struct vc4_hdmi *vc4_hdmi)
} }
void vc5_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi, void vc5_hdmi_phy_init(struct vc4_hdmi *vc4_hdmi,
struct vc4_hdmi_connector_state *conn_state) struct drm_connector_state *conn_state)
{ {
const struct phy_lane_settings *chan0_settings, *chan1_settings, *chan2_settings, *clock_settings; const struct phy_lane_settings *chan0_settings, *chan1_settings, *chan2_settings, *clock_settings;
const struct vc4_hdmi_variant *variant = vc4_hdmi->variant; const struct vc4_hdmi_variant *variant = vc4_hdmi->variant;
unsigned long long pixel_freq = conn_state->tmds_char_rate; unsigned long long pixel_freq = conn_state->hdmi.tmds_char_rate;
unsigned long long vco_freq; unsigned long long vco_freq;
unsigned char word_sel; unsigned char word_sel;
unsigned long flags; unsigned long flags;
......
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