drm/i915/dsi: stop using the drm_panel framework completely
authorJani Nikula <jani.nikula@intel.com>
Mon, 6 Mar 2017 14:31:26 +0000 (16:31 +0200)
committerJani Nikula <jani.nikula@intel.com>
Tue, 7 Mar 2017 13:17:43 +0000 (15:17 +0200)
Now that we've stopped using the drm_panel hooks, there aren't any
benefits left with using the drm_panel framework. Remove the rest of the
drm_panel use. No functional changes.

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Bob Paauwe <bob.j.paauwe@intel.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Madhav Chauhan <madhav.chauhan@intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Bob Paauwe <bob.j.paauwe@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/6602e36641451952065092401bd6e6cfbe93e208.1488810382.git.jani.nikula@intel.com
drivers/gpu/drm/i915/intel_dsi.c
drivers/gpu/drm/i915/intel_dsi.h
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c

index 5a38112c861909100a5a7d0904e39695cbcea6a9..b9ba2d55e4e1e93dd515c7cdd21c43b3e65c6575 100644 (file)
@@ -28,7 +28,6 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
-#include <drm/drm_panel.h>
 #include <drm/drm_mipi_dsi.h>
 #include <linux/slab.h>
 #include <linux/gpio/consumer.h>
@@ -1642,12 +1641,6 @@ static void intel_dsi_encoder_destroy(struct drm_encoder *encoder)
 {
        struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
 
-       if (intel_dsi->panel) {
-               drm_panel_detach(intel_dsi->panel);
-               /* XXX: Logically this call belongs in the panel driver. */
-               drm_panel_remove(intel_dsi->panel);
-       }
-
        /* dispose of the gpios */
        if (intel_dsi->gpio_panel)
                gpiod_put(intel_dsi->gpio_panel);
@@ -1805,8 +1798,7 @@ void intel_dsi_init(struct drm_i915_private *dev_priv)
                intel_dsi->dsi_hosts[port] = host;
        }
 
-       intel_dsi->panel = intel_dsi_vbt_init(intel_dsi, MIPI_DSI_GENERIC_PANEL_ID);
-       if (!intel_dsi->panel) {
+       if (!intel_dsi_vbt_init(intel_dsi, MIPI_DSI_GENERIC_PANEL_ID)) {
                DRM_DEBUG_KMS("no device found\n");
                goto err;
        }
@@ -1840,10 +1832,8 @@ void intel_dsi_init(struct drm_i915_private *dev_priv)
 
        intel_connector_attach_encoder(intel_connector, intel_encoder);
 
-       drm_panel_attach(intel_dsi->panel, connector);
-
        mutex_lock(&dev->mode_config.mutex);
-       intel_dsi_vbt_get_modes(intel_dsi->panel);
+       intel_dsi_vbt_get_modes(intel_dsi);
        list_for_each_entry(scan, &connector->probed_modes, head) {
                if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
                        fixed_mode = drm_mode_duplicate(dev, scan);
index bd3ec02daecb91d5f6958c9e38cb7a63d5f3e134..0a3f133e8888413a765a71f669a7b608884f3582 100644 (file)
@@ -39,7 +39,6 @@ struct intel_dsi_host;
 struct intel_dsi {
        struct intel_encoder base;
 
-       struct drm_panel *panel;
        struct intel_dsi_host *dsi_hosts[I915_MAX_PORTS];
 
        /* GPIO Desc for CRC based Panel control */
@@ -146,8 +145,8 @@ u32 intel_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
 void intel_dsi_reset_clocks(struct intel_encoder *encoder,
                            enum port port);
 
-struct drm_panel *intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id);
-int intel_dsi_vbt_get_modes(struct drm_panel *panel);
+bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id);
+int intel_dsi_vbt_get_modes(struct intel_dsi *intel_dsi);
 enum mipi_dsi_pixel_format pixel_format_from_register_bits(u32 fmt);
 
 #endif /* _INTEL_DSI_H */
index efe4845c56acee856449e05e6e799b36b5a39128..af1783f94d238e3445a7c4acbc85a44238a58bd1 100644 (file)
@@ -28,7 +28,6 @@
 #include <drm/drm_crtc.h>
 #include <drm/drm_edid.h>
 #include <drm/i915_drm.h>
-#include <drm/drm_panel.h>
 #include <linux/gpio/consumer.h>
 #include <linux/slab.h>
 #include <video/mipi_display.h>
 #include "intel_drv.h"
 #include "intel_dsi.h"
 
-struct vbt_panel {
-       struct drm_panel panel;
-       struct intel_dsi *intel_dsi;
-};
-
-static inline struct vbt_panel *to_vbt_panel(struct drm_panel *panel)
-{
-       return container_of(panel, struct vbt_panel, panel);
-}
-
 #define MIPI_TRANSFER_MODE_SHIFT       0
 #define MIPI_VIRTUAL_CHANNEL_SHIFT     1
 #define MIPI_PORT_SHIFT                        3
@@ -492,36 +481,31 @@ void intel_dsi_exec_vbt_sequence(struct intel_dsi *intel_dsi,
        }
 }
 
-int intel_dsi_vbt_get_modes(struct drm_panel *panel)
+int intel_dsi_vbt_get_modes(struct intel_dsi *intel_dsi)
 {
-       struct vbt_panel *vbt_panel = to_vbt_panel(panel);
-       struct intel_dsi *intel_dsi = vbt_panel->intel_dsi;
+       struct intel_connector *connector = intel_dsi->attached_connector;
        struct drm_device *dev = intel_dsi->base.base.dev;
        struct drm_i915_private *dev_priv = to_i915(dev);
        struct drm_display_mode *mode;
 
-       if (!panel->connector)
-               return 0;
-
        mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
        if (!mode)
                return 0;
 
        mode->type |= DRM_MODE_TYPE_PREFERRED;
 
-       drm_mode_probed_add(panel->connector, mode);
+       drm_mode_probed_add(&connector->base, mode);
 
        return 1;
 }
 
-struct drm_panel *intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
+bool intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
 {
        struct drm_device *dev = intel_dsi->base.base.dev;
        struct drm_i915_private *dev_priv = to_i915(dev);
        struct mipi_config *mipi_config = dev_priv->vbt.dsi.config;
        struct mipi_pps_data *pps = dev_priv->vbt.dsi.pps;
        struct drm_display_mode *mode = dev_priv->vbt.lfp_lvds_vbt_mode;
-       struct vbt_panel *vbt_panel;
        u32 bpp;
        u32 tlpx_ns, extra_byte_count, bitrate, tlpx_ui;
        u32 ui_num, ui_den;
@@ -584,7 +568,7 @@ struct drm_panel *intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
                        if (mipi_config->target_burst_mode_freq <
                                                                computed_ddr) {
                                DRM_ERROR("Burst mode freq is less than computed\n");
-                               return NULL;
+                               return false;
                        }
 
                        burst_mode_ratio = DIV_ROUND_UP(
@@ -594,7 +578,7 @@ struct drm_panel *intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
                        pclk = DIV_ROUND_UP(pclk * burst_mode_ratio, 100);
                } else {
                        DRM_ERROR("Burst mode target is not set\n");
-                       return NULL;
+                       return false;
                }
        } else
                burst_mode_ratio = 100;
@@ -805,19 +789,10 @@ struct drm_panel *intel_dsi_vbt_init(struct intel_dsi *intel_dsi, u16 panel_id)
        intel_dsi->panel_off_delay = pps->panel_off_delay / 10;
        intel_dsi->panel_pwr_cycle_delay = pps->panel_power_cycle_delay / 10;
 
-       /* This is cheating a bit with the cleanup. */
-       vbt_panel = devm_kzalloc(dev->dev, sizeof(*vbt_panel), GFP_KERNEL);
-       if (!vbt_panel)
-               return NULL;
-
-       vbt_panel->intel_dsi = intel_dsi;
-       drm_panel_init(&vbt_panel->panel);
-       drm_panel_add(&vbt_panel->panel);
-
        /* a regular driver would get the device in probe */
        for_each_dsi_port(port, intel_dsi->ports) {
                mipi_dsi_attach(intel_dsi->dsi_hosts[port]->device);
        }
 
-       return &vbt_panel->panel;
+       return true;
 }