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>
This commit is contained in:
parent
7e9804fdcf
commit
759d10c2e1
1 changed files with 34 additions and 18 deletions
|
@ -113,14 +113,18 @@ static inline enum port intel_dsi_seq_port_to_port(u8 port)
|
||||||
static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
|
static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
|
||||||
const u8 *data)
|
const u8 *data)
|
||||||
{
|
{
|
||||||
u8 type, byte, mode, vc, seq_port;
|
struct mipi_dsi_device *dsi_device;
|
||||||
|
u8 type, flags, seq_port;
|
||||||
u16 len;
|
u16 len;
|
||||||
enum port port;
|
enum port port;
|
||||||
|
|
||||||
byte = *data++;
|
flags = *data++;
|
||||||
mode = (byte >> MIPI_TRANSFER_MODE_SHIFT) & 0x1;
|
type = *data++;
|
||||||
vc = (byte >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 0x3;
|
|
||||||
seq_port = (byte >> MIPI_PORT_SHIFT) & 0x3;
|
len = *((u16 *) data);
|
||||||
|
data += 2;
|
||||||
|
|
||||||
|
seq_port = (flags >> MIPI_PORT_SHIFT) & 3;
|
||||||
|
|
||||||
/* For DSI single link on Port A & C, the seq_port value which is
|
/* For DSI single link on Port A & C, the seq_port value which is
|
||||||
* parsed from Sequence Block#53 of VBT has been set to 0
|
* 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,
|
||||||
port = PORT_C;
|
port = PORT_C;
|
||||||
else
|
else
|
||||||
port = intel_dsi_seq_port_to_port(seq_port);
|
port = intel_dsi_seq_port_to_port(seq_port);
|
||||||
/* LP or HS mode */
|
|
||||||
intel_dsi->hs = mode;
|
|
||||||
|
|
||||||
/* get packet type and increment the pointer */
|
dsi_device = intel_dsi->dsi_hosts[port]->device;
|
||||||
type = *data++;
|
if (!dsi_device) {
|
||||||
|
DRM_DEBUG_KMS("no dsi device for port %c\n", port_name(port));
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
len = *((u16 *) data);
|
if ((flags >> MIPI_TRANSFER_MODE_SHIFT) & 1)
|
||||||
data += 2;
|
dsi_device->mode_flags &= ~MIPI_DSI_MODE_LPM;
|
||||||
|
else
|
||||||
|
dsi_device->mode_flags |= MIPI_DSI_MODE_LPM;
|
||||||
|
|
||||||
|
dsi_device->channel = (flags >> MIPI_VIRTUAL_CHANNEL_SHIFT) & 3;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
|
case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
|
||||||
dsi_vc_generic_write_0(intel_dsi, vc, port);
|
mipi_dsi_generic_write(dsi_device, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
|
case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
|
||||||
dsi_vc_generic_write_1(intel_dsi, vc, *data, port);
|
mipi_dsi_generic_write(dsi_device, data, 1);
|
||||||
break;
|
break;
|
||||||
case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
|
case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
|
||||||
dsi_vc_generic_write_2(intel_dsi, vc, *data, *(data + 1), port);
|
mipi_dsi_generic_write(dsi_device, data, 2);
|
||||||
break;
|
break;
|
||||||
case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
|
case MIPI_DSI_GENERIC_READ_REQUEST_0_PARAM:
|
||||||
case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
|
case MIPI_DSI_GENERIC_READ_REQUEST_1_PARAM:
|
||||||
|
@ -156,22 +165,23 @@ static const u8 *mipi_exec_send_packet(struct intel_dsi *intel_dsi,
|
||||||
DRM_DEBUG_DRIVER("Generic Read not yet implemented or used\n");
|
DRM_DEBUG_DRIVER("Generic Read not yet implemented or used\n");
|
||||||
break;
|
break;
|
||||||
case MIPI_DSI_GENERIC_LONG_WRITE:
|
case MIPI_DSI_GENERIC_LONG_WRITE:
|
||||||
dsi_vc_generic_write(intel_dsi, vc, data, len, port);
|
mipi_dsi_generic_write(dsi_device, data, len);
|
||||||
break;
|
break;
|
||||||
case MIPI_DSI_DCS_SHORT_WRITE:
|
case MIPI_DSI_DCS_SHORT_WRITE:
|
||||||
dsi_vc_dcs_write_0(intel_dsi, vc, *data, port);
|
mipi_dsi_dcs_write_buffer(dsi_device, data, 1);
|
||||||
break;
|
break;
|
||||||
case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
|
case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
|
||||||
dsi_vc_dcs_write_1(intel_dsi, vc, *data, *(data + 1), port);
|
mipi_dsi_dcs_write_buffer(dsi_device, data, 2);
|
||||||
break;
|
break;
|
||||||
case MIPI_DSI_DCS_READ:
|
case MIPI_DSI_DCS_READ:
|
||||||
DRM_DEBUG_DRIVER("DCS Read not yet implemented or used\n");
|
DRM_DEBUG_DRIVER("DCS Read not yet implemented or used\n");
|
||||||
break;
|
break;
|
||||||
case MIPI_DSI_DCS_LONG_WRITE:
|
case MIPI_DSI_DCS_LONG_WRITE:
|
||||||
dsi_vc_dcs_write(intel_dsi, vc, data, len, port);
|
mipi_dsi_dcs_write_buffer(dsi_device, data, len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
data += len;
|
data += len;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
@ -389,6 +399,7 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
|
||||||
u32 lp_to_hs_switch, hs_to_lp_switch;
|
u32 lp_to_hs_switch, hs_to_lp_switch;
|
||||||
u32 pclk, computed_ddr;
|
u32 pclk, computed_ddr;
|
||||||
u16 burst_mode_ratio;
|
u16 burst_mode_ratio;
|
||||||
|
enum port port;
|
||||||
|
|
||||||
DRM_DEBUG_KMS("\n");
|
DRM_DEBUG_KMS("\n");
|
||||||
|
|
||||||
|
@ -662,5 +673,10 @@ struct drm_panel *vbt_panel_init(struct intel_dsi *intel_dsi, u16 panel_id)
|
||||||
vbt_panel->panel.funcs = &vbt_panel_funcs;
|
vbt_panel->panel.funcs = &vbt_panel_funcs;
|
||||||
drm_panel_add(&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 &vbt_panel->panel;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue