Revert "drm/vc4: hdmi: Rework hdmi_enable_4kp60 detection"
authorMaxime Ripard <maxime@cerno.tech>
Fri, 4 Nov 2022 14:46:13 +0000 (15:46 +0100)
committerPhil Elwell <8911409+pelwell@users.noreply.github.com>
Sat, 5 Nov 2022 12:31:07 +0000 (12:31 +0000)
This reverts commit 15acfbaf70d7f4b371f2a3fe85e47d5988264217.

drivers/gpu/drm/vc4/vc4_drv.h
drivers/gpu/drm/vc4/vc4_hdmi.c
drivers/gpu/drm/vc4/vc4_hdmi.h
drivers/gpu/drm/vc4/vc4_hvs.c

index b6d4d51..73ff32e 100644 (file)
@@ -341,14 +341,6 @@ struct vc4_hvs {
        struct drm_mm_node mitchell_netravali_filter;
 
        struct debugfs_regset32 regset;
-
-       /*
-        * Even if HDMI0 on the RPi4 can output modes requiring a pixel
-        * rate higher than 297MHz, it needs some adjustments in the
-        * config.txt file to be able to do so and thus won't always be
-        * available.
-        */
-       bool vc5_hdmi_enable_scrambling;
 };
 
 struct vc4_plane {
index f663f04..35e0dba 100644 (file)
@@ -507,7 +507,7 @@ static int vc4_hdmi_connector_get_modes(struct drm_connector *connector)
        ret = drm_add_edid_modes(connector, edid);
        kfree(edid);
 
-       if (!vc4->hvs->vc5_hdmi_enable_scrambling) {
+       if (vc4_hdmi->disable_4kp60) {
                struct drm_device *drm = connector->dev;
                const struct drm_display_mode *mode;
 
@@ -1963,12 +1963,11 @@ vc4_hdmi_encoder_clock_valid(const struct vc4_hdmi *vc4_hdmi,
 {
        const struct drm_connector *connector = &vc4_hdmi->connector;
        const struct drm_display_info *info = &connector->display_info;
-       struct vc4_dev *vc4 = to_vc4_dev(connector->dev);
 
        if (clock > vc4_hdmi->variant->max_pixel_clock)
                return MODE_CLOCK_HIGH;
 
-       if (!vc4->hvs->vc5_hdmi_enable_scrambling && clock > HDMI_14_MAX_TMDS_CLK)
+       if (vc4_hdmi->disable_4kp60 && clock > HDMI_14_MAX_TMDS_CLK)
                return MODE_CLOCK_HIGH;
 
        if (info->max_tmds_clock && clock > (info->max_tmds_clock * 1000))
@@ -3652,6 +3651,14 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
        vc4_hdmi->disable_wifi_frequencies =
                of_property_read_bool(dev->of_node, "wifi-2.4ghz-coexistence");
 
+       if (variant->max_pixel_clock == 600000000) {
+               struct vc4_dev *vc4 = to_vc4_dev(drm);
+               long max_rate = clk_round_rate(vc4->hvs->core_clk, 550000000);
+
+               if (max_rate < 550000000)
+                       vc4_hdmi->disable_4kp60 = true;
+       }
+
        /*
         * If we boot without any cable connected to the HDMI connector,
         * the firmware will skip the HSM initialization and leave it
index ecebcca..dab7839 100644 (file)
@@ -158,6 +158,14 @@ struct vc4_hdmi {
         */
        bool disable_wifi_frequencies;
 
+       /*
+        * Even if HDMI0 on the RPi4 can output modes requiring a pixel
+        * rate higher than 297MHz, it needs some adjustments in the
+        * config.txt file to be able to do so and thus won't always be
+        * available.
+        */
+       bool disable_4kp60;
+
        struct cec_adapter *cec_adap;
        struct cec_msg cec_rx_msg;
        bool cec_tx_ok;
index e045e7a..8958deb 100644 (file)
@@ -1033,18 +1033,12 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data)
        hvs->regset.nregs = ARRAY_SIZE(hvs_regs);
 
        if (vc4->is_vc5) {
-               unsigned long max_rate;
-
                hvs->core_clk = devm_clk_get(&pdev->dev, NULL);
                if (IS_ERR(hvs->core_clk)) {
                        dev_err(&pdev->dev, "Couldn't get core clock\n");
                        return PTR_ERR(hvs->core_clk);
                }
 
-               max_rate = clk_get_max_rate(hvs->core_clk);
-               if (max_rate >= 550000000)
-                       hvs->vc5_hdmi_enable_scrambling = true;
-
                ret = clk_prepare_enable(hvs->core_clk);
                if (ret) {
                        dev_err(&pdev->dev, "Couldn't enable the core clock\n");