drm/i915/dsi: convert DSI sub-encoders to drm_bridge
Subsystems (2)
cover drm/i915/dsi: convert DSI sub-encoders to drm_bridge
Hi all, this series converts the homebrew DSI sub-encoder model to use the recently merged drm_bridge model instead. I hear there's fixes coming on top of current -nightly, so we may want to get those in before this one. High level comments still welcome; those will apply regardless of the order in which stuff gets merge.
BR,
Jani.
Jani Nikula (3):
drm/i915/dsi: remove hot plug callback
drm/i915/dsi: call drm_bridge callbacks if available drm/i915/dsi: switch from custom sub-encoder model to drm_bridge
Shobhit Kumar (1):
drm/i915/dsi: add AUO MIPI DSI display driver
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/auo_dsi_display.c | 253 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dsi.c | 149 +++++++------------ drivers/gpu/drm/i915/intel_dsi.h | 50 ++----- 4 files changed, 322 insertions(+), 131 deletions(-) create mode 100644 drivers/gpu/drm/i915/auo_dsi_display.c
Signature · 1 line
1.7.9.5
RFC PATCH 1/4 drm/i915/dsi: remove hot plug callback
Not needed or used.
--- drivers/gpu/drm/i915/intel_dsi.c | 6 ------ 1 file changed, 6 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +0 -6
@@ -98,11 +98,6 @@ static inline bool is_cmd_mode(struct intel_dsi *intel_dsi)return intel_dsi->dev.type ==INTEL_DSI_COMMAND_MODE ; } -static void intel_dsi_hot_plug (struct intel_encoder *encoder) -{ -DRM_DEBUG_KMS ("\n" ); -} -static bool intel_dsi_compute_config (struct intel_encoder *encoder,struct intel_crtc_config *config) {
@@ -558,7 +553,6 @@ bool intel_dsi_init(struct drm_device *dev)drm_encoder_init (dev, encoder, &intel_dsi_funcs,DRM_MODE_ENCODER_DSI );/* XXX: very likely not all of these are needed */ - intel_encoder->hot_plug = intel_dsi_hot_plug; intel_encoder->compute_config = intel_dsi_compute_config; intel_encoder->pre_pll_enable = intel_dsi_pre_pll_enable; intel_encoder->pre_enable = intel_dsi_pre_enable;
Signature · 1 line
1.7.9.5
RFC PATCH 2/4 drm/i915/dsi: call drm_bridge callbacks if available
In reply to Jani NikulaNot used yet, but this is similar to what the crtc helpers do with drm_bridge callbacks. The same functions are mandatory as in crtc helpers.
--- drivers/gpu/drm/i915/intel_dsi.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/gpu/drm/i915/intel_dsi.c +31 -0
@@ -107,12 +107,17 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;struct drm_display_mode *adjusted_mode = &config->adjusted_mode;struct drm_display_mode *mode = &config->requested_mode; +struct drm_bridge *bridge = encoder->base.bridge;DRM_DEBUG_KMS ("\n" );if (fixed_mode)intel_fixed_panel_mode (fixed_mode, adjusted_mode); +if (bridge && bridge->funcs->mode_fixup) +return bridge->funcs->mode_fixup (bridge, mode, adjusted_mode); + +/* transitional, will go away */ if (intel_dsi->dev.dev_ops->mode_fixup)return intel_dsi->dev.dev_ops->mode_fixup (&intel_dsi->dev, mode, adjusted_mode);
@@ -129,7 +134,12 @@ static void intel_dsi_pre_pll_enable(struct intel_encoder *encoder)static void intel_dsi_pre_enable (struct intel_encoder *encoder) { +struct drm_bridge *bridge = encoder->base.bridge; +DRM_DEBUG_KMS ("\n" ); + +if (bridge) + bridge->funcs->pre_enable (bridge); }static void intel_dsi_enable (struct intel_encoder *encoder)
@@ -137,6 +147,7 @@ static void intel_dsi_enable(struct intel_encoder *encoder)struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc);struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base); +struct drm_bridge *bridge = encoder->base.bridge;int pipe = intel_crtc->pipe;u32 temp;
@@ -171,6 +182,10 @@ static void intel_dsi_enable(struct intel_encoder *encoder)POSTING_READ (MIPI_PORT_CTRL (pipe)); } +if (bridge) + bridge->funcs->enable (bridge); + +/* transitional, will go away */ intel_dsi->dev.dev_ops->enable (&intel_dsi->dev); }
@@ -179,11 +194,16 @@ static void intel_dsi_disable(struct intel_encoder *encoder)struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc);struct intel_dsi *intel_dsi =enc_to_intel_dsi (&encoder->base); +struct drm_bridge *bridge = encoder->base.bridge;int pipe = intel_crtc->pipe;u32 temp;DRM_DEBUG_KMS ("\n" ); +if (bridge) + bridge->funcs->disable (bridge); + +/* transitional, will go away */ intel_dsi->dev.dev_ops->disable (&intel_dsi->dev);if (is_vid_mode (intel_dsi)) {
@@ -208,8 +228,13 @@ static void intel_dsi_disable(struct intel_encoder *encoder)static void intel_dsi_post_disable (struct intel_encoder *encoder) { +struct drm_bridge *bridge = encoder->base.bridge; +DRM_DEBUG_KMS ("\n" ); +if (bridge) + bridge->funcs->post_disable (bridge); +vlv_disable_dsi_pll (encoder); }
@@ -339,8 +364,11 @@ static void intel_dsi_mode_set(struct intel_encoder *intel_encoder)struct drm_i915_private *dev_priv = dev->dev_private;struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc);struct intel_dsi *intel_dsi =enc_to_intel_dsi (encoder); +struct drm_bridge *bridge = encoder->bridge;struct drm_display_mode *adjusted_mode = &intel_crtc->config.adjusted_mode; +struct drm_display_mode *requested_mode = + &intel_crtc->config.requested_mode;int pipe = intel_crtc->pipe;unsigned int bpp = intel_crtc->config.pipe_bpp;u32 val, tmp;
@@ -460,6 +488,9 @@ static void intel_dsi_mode_set(struct intel_encoder *intel_encoder)if (is_vid_mode (intel_dsi))I915_WRITE (MIPI_VIDEO_MODE_FORMAT (pipe), intel_dsi->video_mode_format); + +if (bridge && bridge->funcs->mode_set) + bridge->funcs->mode_set (bridge, requested_mode, adjusted_mode); } static enum drm_connector_status
Signature · 1 line
1.7.9.5
RFC PATCH 3/4 drm/i915/dsi: switch from custom sub-encoder model to drm_bridge
In reply to Jani NikulaDrop intel_dsi_device and intel_dsi_dev_ops, and switch to drm_bridge and its own drm_bridge_funcs for sub-encoder (panel driver) callbacks.
Push DSI connector creation and initialization to bridge drivers, which is more natural than the current approach.
Leave the connector callbacks (now prefixed as intel_dsi_connector_*) around as helpers the bridge drivers can choose to use.
This is fairly straightforward as no panel drivers have been merged yet.
--- drivers/gpu/drm/i915/intel_dsi.c | 119 +++++++++----------------------------- drivers/gpu/drm/i915/intel_dsi.h | 50 ++++------------ 2 files changed, 38 insertions(+), 131 deletions(-)
drivers/gpu/drm/i915/intel_dsi.c +27 -92
@@ -34,9 +34,13 @@#include "intel_dsi_cmd.h" /* the sub-encoders aka panel drivers */ -static const struct intel_dsi_device intel_dsi_devices[] = { +struct intel_dsi_device { +uint16_t id; +struct drm_bridge *(*init)(struct intel_dsi *intel_dsi,uint16_t id); }; +static const struct intel_dsi_device intel_dsi_devices[] = { +};static void vlv_cck_modify (struct drm_i915_private *dev_priv,u32 reg,u32 val,u32 mask)
@@ -82,46 +86,28 @@ static void band_gap_wa(struct drm_i915_private *dev_priv)msleep (100 ); } -static struct intel_dsi *intel_attached_dsi (struct drm_connector *connector) -{ -return container_of (intel_attached_encoder (connector), - struct intel_dsi, base); -} -static inline bool is_vid_mode (struct intel_dsi *intel_dsi) { -return intel_dsi->dev.type ==INTEL_DSI_VIDEO_MODE ; +return intel_dsi->type ==INTEL_DSI_VIDEO_MODE ; }static inline bool is_cmd_mode (struct intel_dsi *intel_dsi) { -return intel_dsi->dev.type ==INTEL_DSI_COMMAND_MODE ; +return intel_dsi->type ==INTEL_DSI_COMMAND_MODE ; }static bool intel_dsi_compute_config (struct intel_encoder *encoder,struct intel_crtc_config *config) { - struct intel_dsi *intel_dsi = container_of(encoder, struct intel_dsi, - base); -struct intel_connector *intel_connector = intel_dsi->attached_connector; -struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode;struct drm_display_mode *adjusted_mode = &config->adjusted_mode;struct drm_display_mode *mode = &config->requested_mode;struct drm_bridge *bridge = encoder->base.bridge;DRM_DEBUG_KMS ("\n" ); -if (fixed_mode) -intel_fixed_panel_mode (fixed_mode, adjusted_mode); -if (bridge && bridge->funcs->mode_fixup)return bridge->funcs->mode_fixup (bridge, mode, adjusted_mode); -/* transitional, will go away */ -if (intel_dsi->dev.dev_ops->mode_fixup) -return intel_dsi->dev.dev_ops->mode_fixup (&intel_dsi->dev, - mode, adjusted_mode); -return true; }
@@ -184,9 +170,6 @@ static void intel_dsi_enable(struct intel_encoder *encoder)if (bridge) bridge->funcs->enable (bridge); - -/* transitional, will go away */ - intel_dsi->dev.dev_ops->enable (&intel_dsi->dev); }static void intel_dsi_disable (struct intel_encoder *encoder)
@@ -203,9 +186,6 @@ static void intel_dsi_disable(struct intel_encoder *encoder)if (bridge) bridge->funcs->disable (bridge); -/* transitional, will go away */ - intel_dsi->dev.dev_ops->disable (&intel_dsi->dev); -if (is_vid_mode (intel_dsi)) {dpi_send_cmd (intel_dsi,SHUTDOWN );msleep (10 );
@@ -271,12 +251,11 @@ static void intel_dsi_get_config(struct intel_encoder *encoder,/* XXX: read flags, set to adjusted_mode */ } -static int intel_dsi_mode_valid (struct drm_connector *connector, -struct drm_display_mode *mode) +int intel_dsi_connector_mode_valid (struct drm_connector *connector, +struct drm_display_mode *mode) {struct intel_connector *intel_connector =to_intel_connector (connector);struct drm_display_mode *fixed_mode = intel_connector->panel.fixed_mode; -struct intel_dsi *intel_dsi =intel_attached_dsi (connector);DRM_DEBUG_KMS ("\n" );
@@ -292,7 +271,7 @@ static int intel_dsi_mode_valid(struct drm_connector *connector,return MODE_PANEL ; } -return intel_dsi->dev.dev_ops->mode_valid (&intel_dsi->dev, mode); +return MODE_OK ; }/* return txclkesc cycles in terms of divider and duration in us */
@@ -493,15 +472,14 @@ static void intel_dsi_mode_set(struct intel_encoder *intel_encoder) bridge->funcs->mode_set (bridge, requested_mode, adjusted_mode); } -static enum drm_connector_status -intel_dsi_detect (struct drm_connector *connector,bool force) +enum drm_connector_status +intel_dsi_connector_detect (struct drm_connector *connector,bool force) { -struct intel_dsi *intel_dsi =intel_attached_dsi (connector);DRM_DEBUG_KMS ("\n" ); -return intel_dsi->dev.dev_ops->detect (&intel_dsi->dev); +return connector_status_connected; } -static int intel_dsi_get_modes (struct drm_connector *connector) +int intel_dsi_connector_get_modes (struct drm_connector *connector) {struct intel_connector *intel_connector =to_intel_connector (connector);struct drm_display_mode *mode;
@@ -524,7 +502,7 @@ static int intel_dsi_get_modes(struct drm_connector *connector)return 1 ; } -static void intel_dsi_destroy (struct drm_connector *connector) +void intel_dsi_connector_destroy (struct drm_connector *connector) {struct intel_connector *intel_connector =to_intel_connector (connector);
@@ -539,28 +517,13 @@ static const struct drm_encoder_funcs intel_dsi_funcs = { .destroy = intel_encoder_destroy, }; -static const struct drm_connector_helper_funcs intel_dsi_connector_helper_funcs = { - .get_modes = intel_dsi_get_modes, - .mode_valid = intel_dsi_mode_valid, - .best_encoder = intel_best_encoder, -}; - -static const struct drm_connector_funcs intel_dsi_connector_funcs = { - .dpms = intel_connector_dpms, - .detect = intel_dsi_detect, - .destroy = intel_dsi_destroy, - .fill_modes = drm_helper_probe_single_connector_modes, -}; -bool intel_dsi_init (struct drm_device *dev) { +struct drm_i915_private *dev_priv = dev->dev_private;struct intel_dsi *intel_dsi;struct intel_encoder *intel_encoder;struct drm_encoder *encoder; -struct intel_connector *intel_connector; -struct drm_connector *connector; -struct drm_display_mode *fixed_mode =NULL ; -const struct intel_dsi_device *dsi; +struct drm_bridge *bridge =NULL ;unsigned int i;DRM_DEBUG_KMS ("\n" );
@@ -569,17 +532,8 @@ bool intel_dsi_init(struct drm_device *dev)if (!intel_dsi)return false; - intel_connector =kzalloc (sizeof (*intel_connector),GFP_KERNEL ); -if (!intel_connector) { -kfree (intel_dsi); -return false; - } - intel_encoder = &intel_dsi->base; encoder = &intel_encoder->base; - intel_dsi->attached_connector = intel_connector; - - connector = &intel_connector->base;drm_encoder_init (dev, encoder, &intel_dsi_funcs,DRM_MODE_ENCODER_DSI );
@@ -594,53 +548,34 @@ bool intel_dsi_init(struct drm_device *dev) intel_encoder->get_hw_state = intel_dsi_get_hw_state; intel_encoder->get_config = intel_dsi_get_config; - intel_connector->get_hw_state = intel_connector_get_hw_state; -for (i =0 ; i <ARRAY_SIZE (intel_dsi_devices); i++) { - dsi = &intel_dsi_devices[i]; - intel_dsi->dev = *dsi; +const struct intel_dsi_device *dsi = &intel_dsi_devices[i]; -if (dsi->dev_ops->init (&intel_dsi->dev)) +if (dsi->id && dsi->id != dev_priv->vbt.dsi.panel_id) +continue ; + +/* bridge creates connector and attaches to encoder */ + bridge = dsi->init (intel_dsi, dev_priv->vbt.dsi.panel_id); +if (!IS_ERR_OR_NULL (bridge))break ; } -if (i ==ARRAY_SIZE (intel_dsi_devices)) { +if (IS_ERR_OR_NULL (bridge)) {DRM_DEBUG_KMS ("no device found\n" ); goto err; } + encoder->bridge = bridge; + intel_encoder->type =INTEL_OUTPUT_DSI ; intel_encoder->crtc_mask = (1 <<0 );/* XXX */ - intel_encoder->cloneable = false; -drm_connector_init (dev, connector, &intel_dsi_connector_funcs, -DRM_MODE_CONNECTOR_DSI ); - -drm_connector_helper_add (connector, &intel_dsi_connector_helper_funcs); - - connector->display_info.subpixel_order = SubPixelHorizontalRGB;/*XXX*/ - connector->interlace_allowed = false; - connector->doublescan_allowed = false; - -intel_connector_attach_encoder (intel_connector, intel_encoder); - -drm_sysfs_connector_add (connector); - - fixed_mode = dsi->dev_ops->get_modes (&intel_dsi->dev); -if (!fixed_mode) { -DRM_DEBUG_KMS ("no fixed mode\n" ); - goto err; - } - - fixed_mode->type |=DRM_MODE_TYPE_PREFERRED ; -intel_panel_init (&intel_connector->panel, fixed_mode);return true; err:drm_encoder_cleanup (&intel_encoder->base);kfree (intel_dsi); -kfree (intel_connector);return false; }
drivers/gpu/drm/i915/intel_dsi.h +11 -39
65 lines not on this page · raw message
Signature · 1 line
1.7.9.5
RFC PATCH 4/4 drm/i915/dsi: add AUO MIPI DSI display driver
In reply to Jani NikulaFrom: Shobhit Kumar <[email protected]>
--- drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/auo_dsi_display.c | 253 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dsi.c | 5 + 3 files changed, 259 insertions(+) create mode 100644 drivers/gpu/drm/i915/auo_dsi_display.c
drivers/gpu/drm/i915/Makefile +1 -0
@@ -42,6 +42,7 @@ i915-y := i915_drv.o i915_dma.o i915_irq.o \ intel_opregion.o \ intel_sideband.o \ intel_uncore.o \ + auo_dsi_display.o \ dvo_ch7xxx.o \ dvo_ch7017.o \ dvo_ivch.o \
drivers/gpu/drm/i915/auo_dsi_display.c new file +253 -0
253 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dsi.c +5 -0
@@ -34,12 +34,17 @@#include "intel_dsi_cmd.h" /* the sub-encoders aka panel drivers */ +extern struct drm_bridge *auo_init (struct intel_dsi *intel_dsi,uint16_t panel_id); +struct intel_dsi_device {uint16_t id;struct drm_bridge *(*init)(struct intel_dsi *intel_dsi,uint16_t id); };static const struct intel_dsi_device intel_dsi_devices[] = { + { + .init = auo_init, + }, }; static void vlv_cck_modify(struct drm_i915_private *dev_priv, u32 reg, u32 val,
Signature · 6 lines
1.7.9.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx