drm/vc4: hdmi: Remove vc4_hdmi_encoder
authorJosé Expósito <jose.exposito89@gmail.com>
Wed, 20 Apr 2022 11:45:00 +0000 (13:45 +0200)
committerPhil Elwell <8911409+pelwell@users.noreply.github.com>
Mon, 19 Sep 2022 19:33:09 +0000 (20:33 +0100)
The vc4_hdmi_encoder struct was used exclusively to cache the value
returned by drm_detect_hdmi_monitor() in order to avoid calling it
multiple times.

Now that drm_detect_hdmi_monitor() has been replaced with
drm_display_info.is_hdmi, there is no need to have an extra struct.

Remove vc4_hdmi_encoder.

Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Signed-off-by: Maxime Ripard <maxime@cerno.tech>
Link: https://patchwork.freedesktop.org/patch/msgid/20220420114500.187664-3-jose.exposito89@gmail.com
drivers/gpu/drm/vc4/vc4_hdmi.c
drivers/gpu/drm/vc4/vc4_hdmi.h

index d9c125e..8494910 100644 (file)
@@ -302,7 +302,7 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
 
        WARN_ON(pm_runtime_resume_and_get(&vc4_hdmi->pdev->dev));
 
-       if (force_hotplug & BIT(vc4_hdmi->encoder.base.type - VC4_ENCODER_TYPE_HDMI0))
+       if (force_hotplug & BIT(vc4_hdmi->encoder.type - VC4_ENCODER_TYPE_HDMI0))
                connected = true;
        else if (vc4_hdmi->hpd_gpio) {
                if (gpiod_get_value_cansleep(vc4_hdmi->hpd_gpio))
@@ -323,7 +323,7 @@ vc4_hdmi_connector_detect(struct drm_connector *connector, bool force)
                        }
                }
 
-               vc4_hdmi_enable_scrambling(&vc4_hdmi->encoder.base.base);
+               vc4_hdmi_enable_scrambling(&vc4_hdmi->encoder.base);
                pm_runtime_put(&vc4_hdmi->pdev->dev);
                mutex_unlock(&vc4_hdmi->mutex);
                return connector_status_connected;
@@ -548,7 +548,7 @@ static int vc4_hdmi_connector_init(struct drm_device *dev,
                                   struct vc4_hdmi *vc4_hdmi)
 {
        struct drm_connector *connector = &vc4_hdmi->connector;
-       struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
+       struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
        int ret;
 
        ret = drmm_connector_init(dev, connector,
@@ -2242,7 +2242,7 @@ out:
 
 static void vc4_hdmi_audio_reset(struct vc4_hdmi *vc4_hdmi)
 {
-       struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
+       struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
        struct device *dev = &vc4_hdmi->pdev->dev;
        unsigned long flags;
        int ret;
@@ -2341,7 +2341,7 @@ static int vc4_hdmi_audio_prepare(struct device *dev, void *data,
 {
        struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
        struct drm_device *drm = vc4_hdmi->connector.dev;
-       struct drm_encoder *encoder = &vc4_hdmi->encoder.base.base;
+       struct drm_encoder *encoder = &vc4_hdmi->encoder.base;
        unsigned int sample_rate = params->sample_rate;
        unsigned int channels = params->channels;
        unsigned long flags;
@@ -3517,13 +3517,13 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
        INIT_DELAYED_WORK(&vc4_hdmi->scrambling_work, vc4_hdmi_scrambling_wq);
 
        dev_set_drvdata(dev, vc4_hdmi);
-       encoder = &vc4_hdmi->encoder.base.base;
-       vc4_hdmi->encoder.base.type = variant->encoder_type;
-       vc4_hdmi->encoder.base.pre_crtc_configure = vc4_hdmi_encoder_pre_crtc_configure;
-       vc4_hdmi->encoder.base.pre_crtc_enable = vc4_hdmi_encoder_pre_crtc_enable;
-       vc4_hdmi->encoder.base.post_crtc_enable = vc4_hdmi_encoder_post_crtc_enable;
-       vc4_hdmi->encoder.base.post_crtc_disable = vc4_hdmi_encoder_post_crtc_disable;
-       vc4_hdmi->encoder.base.post_crtc_powerdown = vc4_hdmi_encoder_post_crtc_powerdown;
+       encoder = &vc4_hdmi->encoder.base;
+       vc4_hdmi->encoder.type = variant->encoder_type;
+       vc4_hdmi->encoder.pre_crtc_configure = vc4_hdmi_encoder_pre_crtc_configure;
+       vc4_hdmi->encoder.pre_crtc_enable = vc4_hdmi_encoder_pre_crtc_enable;
+       vc4_hdmi->encoder.post_crtc_enable = vc4_hdmi_encoder_post_crtc_enable;
+       vc4_hdmi->encoder.post_crtc_disable = vc4_hdmi_encoder_post_crtc_disable;
+       vc4_hdmi->encoder.post_crtc_powerdown = vc4_hdmi_encoder_post_crtc_powerdown;
        vc4_hdmi->pdev = pdev;
        vc4_hdmi->variant = variant;
 
index 2d6a0e2..9a5c540 100644 (file)
@@ -8,17 +8,6 @@
 
 #include "vc4_drv.h"
 
-/* VC4 HDMI encoder KMS struct */
-struct vc4_hdmi_encoder {
-       struct vc4_encoder base;
-};
-
-static inline struct vc4_hdmi_encoder *
-to_vc4_hdmi_encoder(struct drm_encoder *encoder)
-{
-       return container_of(encoder, struct vc4_hdmi_encoder, base.base);
-}
-
 struct vc4_hdmi;
 struct vc4_hdmi_register;
 struct vc4_hdmi_connector_state;
@@ -135,7 +124,7 @@ struct vc4_hdmi {
        struct platform_device *pdev;
        const struct vc4_hdmi_variant *variant;
 
-       struct vc4_hdmi_encoder encoder;
+       struct vc4_encoder encoder;
        struct drm_connector connector;
 
        struct delayed_work scrambling_work;
@@ -258,8 +247,7 @@ connector_to_vc4_hdmi(struct drm_connector *connector)
 static inline struct vc4_hdmi *
 encoder_to_vc4_hdmi(struct drm_encoder *encoder)
 {
-       struct vc4_hdmi_encoder *_encoder = to_vc4_hdmi_encoder(encoder);
-
+       struct vc4_encoder *_encoder = to_vc4_encoder(encoder);
        return container_of(_encoder, struct vc4_hdmi, encoder);
 }