}
static void vc4_hdmi_encoder_disable(struct drm_encoder *encoder)
-@@ -995,6 +1024,8 @@ static void vc4_hdmi_encoder_pre_crtc_co
+@@ -996,6 +1025,8 @@ static void vc4_hdmi_encoder_pre_crtc_co
unsigned long flags;
int ret;
/*
* As stated in RPi's vc4 firmware "HDMI state machine (HSM) clock must
* be faster than pixel clock, infinitesimally faster, tested in
-@@ -1015,13 +1046,13 @@ static void vc4_hdmi_encoder_pre_crtc_co
+@@ -1016,13 +1047,13 @@ static void vc4_hdmi_encoder_pre_crtc_co
ret = clk_set_min_rate(vc4_hdmi->hsm_clock, hsm_rate);
if (ret) {
DRM_ERROR("Failed to set HSM clock rate: %d\n", ret);
}
ret = clk_set_rate(vc4_hdmi->pixel_clock, pixel_rate);
-@@ -1073,13 +1104,16 @@ static void vc4_hdmi_encoder_pre_crtc_co
+@@ -1074,13 +1105,16 @@ static void vc4_hdmi_encoder_pre_crtc_co
if (vc4_hdmi->variant->set_timings)
vc4_hdmi->variant->set_timings(vc4_hdmi, conn_state, mode);
return;
}
-@@ -1091,6 +1125,8 @@ static void vc4_hdmi_encoder_pre_crtc_en
+@@ -1092,6 +1126,8 @@ static void vc4_hdmi_encoder_pre_crtc_en
struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
unsigned long flags;
if (vc4_encoder->hdmi_monitor &&
drm_default_rgb_quant_range(mode) == HDMI_QUANTIZATION_RANGE_LIMITED) {
if (vc4_hdmi->variant->csc_setup)
-@@ -1107,6 +1143,8 @@ static void vc4_hdmi_encoder_pre_crtc_en
+@@ -1108,6 +1144,8 @@ static void vc4_hdmi_encoder_pre_crtc_en
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
HDMI_WRITE(HDMI_FIFO_CTL, VC4_HDMI_FIFO_CTL_MASTER_SLAVE_N);
spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
}
static void vc4_hdmi_encoder_post_crtc_enable(struct drm_encoder *encoder,
-@@ -1120,6 +1158,8 @@ static void vc4_hdmi_encoder_post_crtc_e
+@@ -1121,6 +1159,8 @@ static void vc4_hdmi_encoder_post_crtc_e
unsigned long flags;
int ret;
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
HDMI_WRITE(HDMI_VID_CTL,
-@@ -1179,6 +1219,8 @@ static void vc4_hdmi_encoder_post_crtc_e
+@@ -1180,6 +1220,8 @@ static void vc4_hdmi_encoder_post_crtc_e
vc4_hdmi_recenter_fifo(vc4_hdmi);
vc4_hdmi_enable_scrambling(encoder);
}
static void vc4_hdmi_encoder_enable(struct drm_encoder *encoder)
-@@ -1322,6 +1364,7 @@ static void vc4_hdmi_set_n_cts(struct vc
+@@ -1323,6 +1365,7 @@ static void vc4_hdmi_set_n_cts(struct vc
u32 n, cts;
u64 tmp;
lockdep_assert_held(&vc4_hdmi->hw_lock);
n = 128 * samplerate / 1000;
-@@ -1355,13 +1398,17 @@ static int vc4_hdmi_audio_startup(struct
+@@ -1356,13 +1399,17 @@ static int vc4_hdmi_audio_startup(struct
struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
unsigned long flags;
vc4_hdmi->audio.streaming = true;
-@@ -1377,6 +1424,8 @@ static int vc4_hdmi_audio_startup(struct
+@@ -1378,6 +1425,8 @@ static int vc4_hdmi_audio_startup(struct
if (vc4_hdmi->variant->phy_rng_enable)
vc4_hdmi->variant->phy_rng_enable(vc4_hdmi);
return 0;
}
-@@ -1387,6 +1436,8 @@ static void vc4_hdmi_audio_reset(struct
+@@ -1388,6 +1437,8 @@ static void vc4_hdmi_audio_reset(struct
unsigned long flags;
int ret;
vc4_hdmi->audio.streaming = false;
ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO, false);
if (ret)
-@@ -1406,6 +1457,8 @@ static void vc4_hdmi_audio_shutdown(stru
+@@ -1407,6 +1458,8 @@ static void vc4_hdmi_audio_shutdown(stru
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
unsigned long flags;
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
HDMI_WRITE(HDMI_MAI_CTL,
-@@ -1420,6 +1473,8 @@ static void vc4_hdmi_audio_shutdown(stru
+@@ -1421,6 +1474,8 @@ static void vc4_hdmi_audio_shutdown(stru
vc4_hdmi->audio.streaming = false;
vc4_hdmi_audio_reset(vc4_hdmi);
}
static int sample_rate_to_mai_fmt(int samplerate)
-@@ -1478,6 +1533,8 @@ static int vc4_hdmi_audio_prepare(struct
+@@ -1479,6 +1534,8 @@ static int vc4_hdmi_audio_prepare(struct
dev_dbg(dev, "%s: %u Hz, %d bit, %d channels\n", __func__,
sample_rate, params->sample_width, channels);
vc4_hdmi_audio_set_mai_clock(vc4_hdmi, sample_rate);
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
-@@ -1532,6 +1589,8 @@ static int vc4_hdmi_audio_prepare(struct
+@@ -1533,6 +1590,8 @@ static int vc4_hdmi_audio_prepare(struct
memcpy(&vc4_hdmi->audio.infoframe, ¶ms->cea, sizeof(params->cea));
vc4_hdmi_set_audio_infoframe(encoder);
return 0;
}
-@@ -1574,7 +1633,9 @@ static int vc4_hdmi_audio_get_eld(struct
+@@ -1575,7 +1634,9 @@ static int vc4_hdmi_audio_get_eld(struct
struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
struct drm_connector *connector = &vc4_hdmi->connector;
return 0;
}
-@@ -1911,6 +1972,17 @@ static int vc4_hdmi_cec_enable(struct ce
+@@ -1912,6 +1973,17 @@ static int vc4_hdmi_cec_enable(struct ce
u32 val;
int ret;
ret = pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev);
if (ret)
return ret;
-@@ -1957,6 +2029,17 @@ static int vc4_hdmi_cec_disable(struct c
+@@ -1958,6 +2030,17 @@ static int vc4_hdmi_cec_disable(struct c
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
unsigned long flags;
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
if (!vc4_hdmi->variant->external_irq_controller)
-@@ -1985,6 +2068,17 @@ static int vc4_hdmi_cec_adap_log_addr(st
+@@ -1986,6 +2069,17 @@ static int vc4_hdmi_cec_adap_log_addr(st
struct vc4_hdmi *vc4_hdmi = cec_get_drvdata(adap);
unsigned long flags;
spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
HDMI_WRITE(HDMI_CEC_CNTRL_1,
(HDMI_READ(HDMI_CEC_CNTRL_1) & ~VC4_HDMI_CEC_ADDR_MASK) |
-@@ -2003,6 +2097,17 @@ static int vc4_hdmi_cec_adap_transmit(st
+@@ -2004,6 +2098,17 @@ static int vc4_hdmi_cec_adap_transmit(st
u32 val;
unsigned int i;
if (msg->len > 16) {
drm_err(dev, "Attempting to transmit too much data (%d)\n", msg->len);
return -ENOMEM;
-@@ -2359,6 +2464,7 @@ static int vc4_hdmi_bind(struct device *
+@@ -2360,6 +2465,7 @@ static int vc4_hdmi_bind(struct device *
vc4_hdmi = devm_kzalloc(dev, sizeof(*vc4_hdmi), GFP_KERNEL);
if (!vc4_hdmi)
return -ENOMEM;