drm/msm: Add the eDP connector in msm drm driver (V2)
Modified the hard-coded hdmi connector/encoder implementations in msm drm driver to support both edp and hdmi. V1: Initial change V2: Address Thierry's change Signed-off-by: Hai Li <hali@codeaurora.org> Signed-off-by: Rob Clark <robdclark@gmail.com>
This commit is contained in:
Родитель
ab5b0107cc
Коммит
0045398131
|
@ -1,4 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2014, The Linux Foundation. All rights reserved.
|
||||
* Copyright (C) 2013 Red Hat
|
||||
* Author: Rob Clark <robdclark@gmail.com>
|
||||
*
|
||||
|
@ -123,11 +124,13 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
|
|||
{
|
||||
struct mdp5_encoder *mdp5_encoder = to_mdp5_encoder(encoder);
|
||||
struct mdp5_kms *mdp5_kms = get_kms(encoder);
|
||||
struct drm_device *dev = encoder->dev;
|
||||
struct drm_connector *connector;
|
||||
int intf = mdp5_encoder->intf;
|
||||
uint32_t dtv_hsync_skew, vsync_period, vsync_len, ctrl_pol;
|
||||
uint32_t display_v_start, display_v_end;
|
||||
uint32_t hsync_start_x, hsync_end_x;
|
||||
uint32_t format;
|
||||
uint32_t format = 0x2100;
|
||||
unsigned long flags;
|
||||
|
||||
mode = adjusted_mode;
|
||||
|
@ -149,7 +152,28 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
|
|||
/* probably need to get DATA_EN polarity from panel.. */
|
||||
|
||||
dtv_hsync_skew = 0; /* get this from panel? */
|
||||
format = 0x213f; /* get this from panel? */
|
||||
|
||||
/* Get color format from panel, default is 8bpc */
|
||||
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
|
||||
if (connector->encoder == encoder) {
|
||||
switch (connector->display_info.bpc) {
|
||||
case 4:
|
||||
format |= 0;
|
||||
break;
|
||||
case 5:
|
||||
format |= 0x15;
|
||||
break;
|
||||
case 6:
|
||||
format |= 0x2A;
|
||||
break;
|
||||
case 8:
|
||||
default:
|
||||
format |= 0x3F;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
hsync_start_x = (mode->htotal - mode->hsync_start);
|
||||
hsync_end_x = mode->htotal - (mode->hsync_start - mode->hdisplay) - 1;
|
||||
|
@ -159,6 +183,16 @@ static void mdp5_encoder_mode_set(struct drm_encoder *encoder,
|
|||
display_v_start = (mode->vtotal - mode->vsync_start) * mode->htotal + dtv_hsync_skew;
|
||||
display_v_end = vsync_period - ((mode->vsync_start - mode->vdisplay) * mode->htotal) + dtv_hsync_skew - 1;
|
||||
|
||||
/*
|
||||
* For edp only:
|
||||
* DISPLAY_V_START = (VBP * HCYCLE) + HBP
|
||||
* DISPLAY_V_END = (VBP + VACTIVE) * HCYCLE - 1 - HFP
|
||||
*/
|
||||
if (mdp5_encoder->intf_id == INTF_eDP) {
|
||||
display_v_start += mode->htotal - mode->hsync_start;
|
||||
display_v_end -= mode->hsync_start - mode->hdisplay;
|
||||
}
|
||||
|
||||
spin_lock_irqsave(&mdp5_encoder->intf_lock, flags);
|
||||
|
||||
mdp5_write(mdp5_kms, REG_MDP5_INTF_HSYNC_CTL(intf),
|
||||
|
|
|
@ -222,19 +222,18 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
|
|||
}
|
||||
}
|
||||
|
||||
/* Construct encoder for HDMI: */
|
||||
encoder = mdp5_encoder_init(dev, 3, INTF_HDMI);
|
||||
if (IS_ERR(encoder)) {
|
||||
dev_err(dev->dev, "failed to construct encoder\n");
|
||||
ret = PTR_ERR(encoder);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
encoder->possible_crtcs = (1 << priv->num_crtcs) - 1;;
|
||||
priv->encoders[priv->num_encoders++] = encoder;
|
||||
|
||||
/* Construct bridge/connector for HDMI: */
|
||||
if (priv->hdmi) {
|
||||
/* Construct encoder for HDMI: */
|
||||
encoder = mdp5_encoder_init(dev, 3, INTF_HDMI);
|
||||
if (IS_ERR(encoder)) {
|
||||
dev_err(dev->dev, "failed to construct encoder\n");
|
||||
ret = PTR_ERR(encoder);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
encoder->possible_crtcs = (1 << priv->num_crtcs) - 1;;
|
||||
priv->encoders[priv->num_encoders++] = encoder;
|
||||
|
||||
ret = hdmi_modeset_init(priv->hdmi, dev, encoder);
|
||||
if (ret) {
|
||||
dev_err(dev->dev, "failed to initialize HDMI: %d\n", ret);
|
||||
|
@ -242,6 +241,27 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
|
|||
}
|
||||
}
|
||||
|
||||
if (priv->edp) {
|
||||
/* Construct encoder for eDP: */
|
||||
encoder = mdp5_encoder_init(dev, 0, INTF_eDP);
|
||||
if (IS_ERR(encoder)) {
|
||||
dev_err(dev->dev, "failed to construct eDP encoder\n");
|
||||
ret = PTR_ERR(encoder);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
encoder->possible_crtcs = (1 << priv->num_crtcs) - 1;
|
||||
priv->encoders[priv->num_encoders++] = encoder;
|
||||
|
||||
/* Construct bridge/connector for eDP: */
|
||||
ret = msm_edp_modeset_init(priv->edp, dev, encoder);
|
||||
if (ret) {
|
||||
dev_err(dev->dev, "failed to initialize eDP: %d\n",
|
||||
ret);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
|
|
|
@ -1023,6 +1023,7 @@ static struct platform_driver msm_platform_driver = {
|
|||
static int __init msm_drm_register(void)
|
||||
{
|
||||
DBG("init");
|
||||
msm_edp_register();
|
||||
hdmi_register();
|
||||
adreno_register();
|
||||
return platform_driver_register(&msm_platform_driver);
|
||||
|
@ -1034,6 +1035,7 @@ static void __exit msm_drm_unregister(void)
|
|||
platform_driver_unregister(&msm_platform_driver);
|
||||
hdmi_unregister();
|
||||
adreno_unregister();
|
||||
msm_edp_unregister();
|
||||
}
|
||||
|
||||
module_init(msm_drm_register);
|
||||
|
|
|
@ -230,6 +230,12 @@ int hdmi_modeset_init(struct hdmi *hdmi, struct drm_device *dev,
|
|||
void __init hdmi_register(void);
|
||||
void __exit hdmi_unregister(void);
|
||||
|
||||
struct msm_edp;
|
||||
void __init msm_edp_register(void);
|
||||
void __exit msm_edp_unregister(void);
|
||||
int msm_edp_modeset_init(struct msm_edp *edp, struct drm_device *dev,
|
||||
struct drm_encoder *encoder);
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m);
|
||||
void msm_gem_describe_objects(struct list_head *list, struct seq_file *m);
|
||||
|
|
Загрузка…
Ссылка в новой задаче