diff options
author | Jani Nikula <jani.nikula@intel.com> | 2015-01-16 07:27:24 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-01-29 10:51:50 -0500 |
commit | 759d10c2e155e5a617af844c51dad9287675ca0f (patch) | |
tree | a4cbf4673953850425f8ce91459c9e497e229d06 /drivers/gpu/drm | |
parent | 7e9804fdcffc650515c60f524b8b2076ee59e710 (diff) |
drm/i915/dsi: make the vbt panel driver use mipi_dsi_device for transfers
Use the drm core interfaces in preparation of removing our homebrew.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-By: Shobhit Kumar <shobhit.kumar@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 52 |
1 files changed, 34 insertions, 18 deletions
diff --git a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c index 576c730664e6..90b2d0021f8f 100644 --- a/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +++ b/drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | |||
@@ -113,14 +113,18 @@ static inline enum port intel_dsi_seq_port_to_port(u8 port) | |||
113 | static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi, | 113 | static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi, |
114 | const u8 *data) | 114 | const u8 *data) |
115 | { | 115 | { |
116 | u8 type, byte, mode, vc, seq_port; | 116 | struct mipi_dsi_device *dsi_device; |
117 | u8 type, flags, seq_port; | ||
117 | u16 len; | 118 | u16 len; |
118 | enum port port; | 119 | enum port port; |
119 | 120 | ||
120 | byte = *data++; | 121 | flags = *data++; |
121 | mode = (byte >> MIPI_TRANSFER_MODE_SHIFT) & 0x1; | 122 | type = *data++; |
122 | vc = (byte >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 0x3; | 123 | |
123 | seq_port = (byte >> MIPI_PORT_SHIFT) & 0x3; | 124 | len = *((u16 *) data); |
125 | data += 2; | ||
126 | |||
127 | seq_port = (flags >> MIPI_PORT_SHIFT) & 3; | ||
124 | 128 | ||
125 | /* For DSI single link on Port A & C, the seq_port value which is | 129 | /* For DSI single link on Port A & C, the seq_port value which is |
126 | * parsed from Sequence Block#53 of VBT has been set to 0 | 130 | * parsed from Sequence Block#53 of VBT has been set to 0 |
@@ -131,24 +135,29 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi, | |||
131 | port = PORT_C; | 135 | port = PORT_C; |
132 | else | 136 | else |
133 | port = intel_dsi_seq_port_to_port(seq_port); | 137 | port = intel_dsi_seq_port_to_port(seq_port); |
134 | /* LP or HS mode */ | ||
135 | intel_dsi->hs = mode; | ||
136 | 138 | ||
137 | /* get packet type and increment the pointer */ | 139 | dsi_device = intel_dsi->dsi_hosts[port]->device; |
138 | type = *data++; | 140 | if (!dsi_device) { |
141 | DRM_DEBUG_KMS("no dsi device for port %c\n", port_name(port)); | ||
142 | goto out; | ||
143 | } | ||
139 | 144 | ||
140 | len = *((u16 *) data); | 145 | if ((flags >> MIPI_TRANSFER_MODE_SHIFT) & 1) |
141 | data += 2; | 146 | dsi_device->mode_flags &= ~MIPI_DSI_MODE_LPM; |
147 | else | ||
148 | dsi_device->mode_flags |= MIPI_DSI_MODE_LPM; | ||
149 | |||
150 | dsi_device->channel = (flags >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 3; | ||
142 | 151 | ||
143 | switch (type) { | 152 | switch (type) { |
144 | case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM: | 153 | case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM: |
145 | dsi_vc_generic_write_0(intel_dsi, vc, port); | 154 | mipi_dsi_generic_write(dsi_device, NULL, 0); |
146 | break; | 155 | break; |
147 | case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM: | 156 | case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM: |
148 | dsi_vc_generic_write_1(intel_dsi, vc, *data, port); | 157 | mipi_dsi_generic_write(dsi_device, data, 1); |
149 | break; | 158 | break; |
150 | case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM: | 159 | case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM: |
151 | dsi_vc_generic_write_2(intel_dsi, vc, *data, *(data + 1), port); | 160 | mipi_dsi_generic_write(dsi_device, data, 2); |
152 | break; | 161 | break; |
153 | case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM: | 162 | case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM: |
154 | case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM: | 163 | case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM: |
@@ -156,22 +165,23 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi, | |||
156 | DRM_DEBUG_DRIVER("Generic Read not yet implemented or used\n"); | 165 | DRM_DEBUG_DRIVER("Generic Read not yet implemented or used\n"); |
157 | break; | 166 | break; |
158 | case MIPI_DSI_GENERIC_LONG_WRITE: | 167 | case MIPI_DSI_GENERIC_LONG_WRITE: |
159 | dsi_vc_generic_write(intel_dsi, vc, data, len, port); | 168 | mipi_dsi_generic_write(dsi_device, data, len); |
160 | break; | 169 | break; |
161 | case MIPI_DSI_DCS_SHORT_WRITE: | 170 | case MIPI_DSI_DCS_SHORT_WRITE: |
162 | dsi_vc_dcs_write_0(intel_dsi, vc, *data, port); | 171 | mipi_dsi_dcs_write_buffer(dsi_device, data, 1); |
163 | break; | 172 | break; |
164 | case MIPI_DSI_DCS_SHORT_WRITE_PARAM: | 173 | case MIPI_DSI_DCS_SHORT_WRITE_PARAM: |
165 | dsi_vc_dcs_write_1(intel_dsi, vc, *data, *(data + 1), port); | 174 | mipi_dsi_dcs_write_buffer(dsi_device, data, 2); |
166 | break; | 175 | break; |
167 | case MIPI_DSI_DCS_READ: | 176 | case MIPI_DSI_DCS_READ: |
168 | DRM_DEBUG_DRIVER("DCS Read not yet implemented or used\n"); | 177 | DRM_DEBUG_DRIVER("DCS Read not yet implemented or used\n"); |
169 | break; | 178 | break; |
170 | case MIPI_DSI_DCS_LONG_WRITE: | 179 | case MIPI_DSI_DCS_LONG_WRITE: |
171 | dsi_vc_dcs_write(intel_dsi, vc, data, len, port); | 180 | mipi_dsi_dcs_write_buffer(dsi_device, data, len); |
172 | break; | 181 | break; |
173 | } | 182 | } |
174 | 183 | ||
184 | out: | ||
175 | data += len; | 185 | data += len; |
176 | 186 | ||
177 | return data; | 187 | return data; |
@@ -389,6 +399,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id) | |||
389 | u32 lp_to_hs_switch, hs_to_lp_switch; | 399 | u32 lp_to_hs_switch, hs_to_lp_switch; |
390 | u32 pclk, computed_ddr; | 400 | u32 pclk, computed_ddr; |
391 | u16 burst_mode_ratio; | 401 | u16 burst_mode_ratio; |
402 | enum port port; | ||
392 | 403 | ||
393 | DRM_DEBUG_KMS("\n"); | 404 | DRM_DEBUG_KMS("\n"); |
394 | 405 | ||
@@ -662,5 +673,10 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id) | |||
662 | vbt_panel->panel.funcs = &vbt_panel_funcs; | 673 | vbt_panel->panel.funcs = &vbt_panel_funcs; |
663 | drm_panel_add(&vbt_panel->panel); | 674 | drm_panel_add(&vbt_panel->panel); |
664 | 675 | ||
676 | /* a regular driver would get the device in probe */ | ||
677 | for_each_dsi_port(port, intel_dsi->ports) { | ||
678 | mipi_dsi_attach(intel_dsi->dsi_hosts[port]->device); | ||
679 | } | ||
680 | |||
665 | return &vbt_panel->panel; | 681 | return &vbt_panel->panel; |
666 | } | 682 | } |