diff options
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/omapdrm/omap_crtc.c | 22 | ||||
| -rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.c | 19 | ||||
| -rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.h | 1 |
3 files changed, 29 insertions, 13 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c b/drivers/gpu/drm/omapdrm/omap_crtc.c index f5bdb8de98f4..9742d9f49a7c 100644 --- a/drivers/gpu/drm/omapdrm/omap_crtc.c +++ b/drivers/gpu/drm/omapdrm/omap_crtc.c | |||
| @@ -109,7 +109,6 @@ int omap_crtc_wait_pending(struct drm_crtc *crtc) | |||
| 109 | */ | 109 | */ |
| 110 | 110 | ||
| 111 | /* ovl-mgr-id -> crtc */ | 111 | /* ovl-mgr-id -> crtc */ |
| 112 | static struct omap_crtc *omap_crtcs[8]; | ||
| 113 | static struct omap_dss_device *omap_crtc_output[8]; | 112 | static struct omap_dss_device *omap_crtc_output[8]; |
| 114 | 113 | ||
| 115 | /* we can probably ignore these until we support command-mode panels: */ | 114 | /* we can probably ignore these until we support command-mode panels: */ |
| @@ -215,7 +214,8 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, bool enable) | |||
| 215 | static int omap_crtc_dss_enable(struct omap_drm_private *priv, | 214 | static int omap_crtc_dss_enable(struct omap_drm_private *priv, |
| 216 | enum omap_channel channel) | 215 | enum omap_channel channel) |
| 217 | { | 216 | { |
| 218 | struct omap_crtc *omap_crtc = omap_crtcs[channel]; | 217 | struct drm_crtc *crtc = priv->channels[channel]->crtc; |
| 218 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | ||
| 219 | 219 | ||
| 220 | priv->dispc_ops->mgr_set_timings(priv->dispc, omap_crtc->channel, | 220 | priv->dispc_ops->mgr_set_timings(priv->dispc, omap_crtc->channel, |
| 221 | &omap_crtc->vm); | 221 | &omap_crtc->vm); |
| @@ -227,7 +227,8 @@ static int omap_crtc_dss_enable(struct omap_drm_private *priv, | |||
| 227 | static void omap_crtc_dss_disable(struct omap_drm_private *priv, | 227 | static void omap_crtc_dss_disable(struct omap_drm_private *priv, |
| 228 | enum omap_channel channel) | 228 | enum omap_channel channel) |
| 229 | { | 229 | { |
| 230 | struct omap_crtc *omap_crtc = omap_crtcs[channel]; | 230 | struct drm_crtc *crtc = priv->channels[channel]->crtc; |
| 231 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | ||
| 231 | 232 | ||
| 232 | omap_crtc_set_enabled(&omap_crtc->base, false); | 233 | omap_crtc_set_enabled(&omap_crtc->base, false); |
| 233 | } | 234 | } |
| @@ -236,7 +237,9 @@ static void omap_crtc_dss_set_timings(struct omap_drm_private *priv, | |||
| 236 | enum omap_channel channel, | 237 | enum omap_channel channel, |
| 237 | const struct videomode *vm) | 238 | const struct videomode *vm) |
| 238 | { | 239 | { |
| 239 | struct omap_crtc *omap_crtc = omap_crtcs[channel]; | 240 | struct drm_crtc *crtc = priv->channels[channel]->crtc; |
| 241 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | ||
| 242 | |||
| 240 | DBG("%s", omap_crtc->name); | 243 | DBG("%s", omap_crtc->name); |
| 241 | omap_crtc->vm = *vm; | 244 | omap_crtc->vm = *vm; |
| 242 | } | 245 | } |
| @@ -245,7 +248,8 @@ static void omap_crtc_dss_set_lcd_config(struct omap_drm_private *priv, | |||
| 245 | enum omap_channel channel, | 248 | enum omap_channel channel, |
| 246 | const struct dss_lcd_mgr_config *config) | 249 | const struct dss_lcd_mgr_config *config) |
| 247 | { | 250 | { |
| 248 | struct omap_crtc *omap_crtc = omap_crtcs[channel]; | 251 | struct drm_crtc *crtc = priv->channels[channel]->crtc; |
| 252 | struct omap_crtc *omap_crtc = to_omap_crtc(crtc); | ||
| 249 | 253 | ||
| 250 | DBG("%s", omap_crtc->name); | 254 | DBG("%s", omap_crtc->name); |
| 251 | priv->dispc_ops->mgr_set_lcd_config(priv->dispc, omap_crtc->channel, | 255 | priv->dispc_ops->mgr_set_lcd_config(priv->dispc, omap_crtc->channel, |
| @@ -681,8 +685,6 @@ static const char *channel_names[] = { | |||
| 681 | 685 | ||
| 682 | void omap_crtc_pre_init(struct omap_drm_private *priv) | 686 | void omap_crtc_pre_init(struct omap_drm_private *priv) |
| 683 | { | 687 | { |
| 684 | memset(omap_crtcs, 0, sizeof(omap_crtcs)); | ||
| 685 | |||
| 686 | dss_install_mgr_ops(priv->dss, &mgr_ops, priv); | 688 | dss_install_mgr_ops(priv->dss, &mgr_ops, priv); |
| 687 | } | 689 | } |
| 688 | 690 | ||
| @@ -706,10 +708,6 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, | |||
| 706 | 708 | ||
| 707 | DBG("%s", channel_names[channel]); | 709 | DBG("%s", channel_names[channel]); |
| 708 | 710 | ||
| 709 | /* Multiple displays on same channel is not allowed */ | ||
| 710 | if (WARN_ON(omap_crtcs[channel] != NULL)) | ||
| 711 | return ERR_PTR(-EINVAL); | ||
| 712 | |||
| 713 | omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL); | 711 | omap_crtc = kzalloc(sizeof(*omap_crtc), GFP_KERNEL); |
| 714 | if (!omap_crtc) | 712 | if (!omap_crtc) |
| 715 | return ERR_PTR(-ENOMEM); | 713 | return ERR_PTR(-ENOMEM); |
| @@ -748,7 +746,5 @@ struct drm_crtc *omap_crtc_init(struct drm_device *dev, | |||
| 748 | 746 | ||
| 749 | omap_plane_install_properties(crtc->primary, &crtc->base); | 747 | omap_plane_install_properties(crtc->primary, &crtc->base); |
| 750 | 748 | ||
| 751 | omap_crtcs[channel] = omap_crtc; | ||
| 752 | |||
| 753 | return crtc; | 749 | return crtc; |
| 754 | } | 750 | } |
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index bb9ee2c93eca..f2a69cfb6ebf 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c | |||
| @@ -167,6 +167,8 @@ static void omap_disconnect_pipelines(struct drm_device *ddev) | |||
| 167 | pipe->display = NULL; | 167 | pipe->display = NULL; |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | memset(&priv->channels, 0, sizeof(priv->channels)); | ||
| 171 | |||
| 170 | priv->num_pipes = 0; | 172 | priv->num_pipes = 0; |
| 171 | } | 173 | } |
| 172 | 174 | ||
| @@ -186,6 +188,7 @@ static int omap_connect_pipelines(struct drm_device *ddev) | |||
| 186 | { | 188 | { |
| 187 | struct omap_drm_private *priv = ddev->dev_private; | 189 | struct omap_drm_private *priv = ddev->dev_private; |
| 188 | struct omap_dss_device *output = NULL; | 190 | struct omap_dss_device *output = NULL; |
| 191 | unsigned int i; | ||
| 189 | int r; | 192 | int r; |
| 190 | 193 | ||
| 191 | if (!omapdss_stack_is_ready()) | 194 | if (!omapdss_stack_is_ready()) |
| @@ -218,6 +221,22 @@ static int omap_connect_pipelines(struct drm_device *ddev) | |||
| 218 | sort(priv->pipes, priv->num_pipes, sizeof(priv->pipes[0]), | 221 | sort(priv->pipes, priv->num_pipes, sizeof(priv->pipes[0]), |
| 219 | omap_compare_pipes, NULL); | 222 | omap_compare_pipes, NULL); |
| 220 | 223 | ||
| 224 | /* | ||
| 225 | * Populate the pipeline lookup table by DISPC channel. Only one display | ||
| 226 | * is allowed per channel. | ||
| 227 | */ | ||
| 228 | for (i = 0; i < priv->num_pipes; ++i) { | ||
| 229 | struct omap_drm_pipeline *pipe = &priv->pipes[i]; | ||
| 230 | enum omap_channel channel = pipe->output->dispc_channel; | ||
| 231 | |||
| 232 | if (WARN_ON(priv->channels[channel] != NULL)) { | ||
| 233 | r = -EINVAL; | ||
| 234 | goto cleanup; | ||
| 235 | } | ||
| 236 | |||
| 237 | priv->channels[channel] = pipe; | ||
| 238 | } | ||
| 239 | |||
| 221 | return 0; | 240 | return 0; |
| 222 | 241 | ||
| 223 | cleanup: | 242 | cleanup: |
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.h b/drivers/gpu/drm/omapdrm/omap_drv.h index a38d07d4d6ea..bd7f2c227a25 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.h +++ b/drivers/gpu/drm/omapdrm/omap_drv.h | |||
| @@ -64,6 +64,7 @@ struct omap_drm_private { | |||
| 64 | 64 | ||
| 65 | unsigned int num_pipes; | 65 | unsigned int num_pipes; |
| 66 | struct omap_drm_pipeline pipes[8]; | 66 | struct omap_drm_pipeline pipes[8]; |
| 67 | struct omap_drm_pipeline *channels[8]; | ||
| 67 | 68 | ||
| 68 | unsigned int num_planes; | 69 | unsigned int num_planes; |
| 69 | struct drm_plane *planes[8]; | 70 | struct drm_plane *planes[8]; |
