From patchwork Sun Dec 11 21:13:17 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 5579 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 2029723E19 for ; Sun, 11 Dec 2011 21:13:25 +0000 (UTC) Received: from mail-bw0-f52.google.com (mail-bw0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 01370A1856F for ; Sun, 11 Dec 2011 21:13:24 +0000 (UTC) Received: by bke17 with SMTP id 17so6411885bke.11 for ; Sun, 11 Dec 2011 13:13:24 -0800 (PST) Received: by 10.204.157.12 with SMTP id z12mr5607959bkw.18.1323638004326; Sun, 11 Dec 2011 13:13:24 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.129.2 with SMTP id hg2cs30199bkc; Sun, 11 Dec 2011 13:13:23 -0800 (PST) Received: by 10.236.161.197 with SMTP id w45mr22296935yhk.96.1323638001293; Sun, 11 Dec 2011 13:13:21 -0800 (PST) Received: from mail-gy0-f178.google.com (mail-gy0-f178.google.com [209.85.160.178]) by mx.google.com with ESMTPS id l8si3037411yba.5.2011.12.11.13.13.20 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 11 Dec 2011 13:13:21 -0800 (PST) Received-SPF: pass (google.com: domain of robdclark@gmail.com designates 209.85.160.178 as permitted sender) client-ip=209.85.160.178; Authentication-Results: mx.google.com; spf=pass (google.com: domain of robdclark@gmail.com designates 209.85.160.178 as permitted sender) smtp.mail=robdclark@gmail.com; dkim=pass (test mode) header.i=@gmail.com Received: by ghrr1 with SMTP id r1so3688887ghr.37 for ; Sun, 11 Dec 2011 13:13:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; bh=i7ecjgS/lcI1CUo0U51qaxdehFjhY8VLZ8iesM+x3oA=; b=h2T20E5bzNIOVUfYTP0oEyFPp/KyXLRuHPjjX3cbCfDXmAT8H9Jh+gEHFFNDyeXlQW rF3iIhsIqVH82XNnVIimJdSXfapqiKSMG8pfjgGrZUOT6yG1/iRIoUeTBhgHolfSfvFz WYkobIAX71W8VN3IVvKH0s01Im86mZz75IL00= Received: by 10.236.135.77 with SMTP id t53mr22271102yhi.49.1323638000531; Sun, 11 Dec 2011 13:13:20 -0800 (PST) Received: from localhost (ppp-70-253-156-7.dsl.rcsntx.swbell.net. [70.253.156.7]) by mx.google.com with ESMTPS id c44sm26921358yhm.5.2011.12.11.13.13.19 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 11 Dec 2011 13:13:19 -0800 (PST) Sender: Rob Clark From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: patches@linaro.org, Greg KH , Tomi Valkeinen , Rob Clark Subject: [PATCH] drm/omap: fix for connectors not enabled at bootup Date: Sun, 11 Dec 2011 15:13:17 -0600 Message-Id: <1323637997-18045-1-git-send-email-rob.clark@linaro.org> X-Mailer: git-send-email 1.7.5.4 From: Rob Clark The connector's dpms fxn is only triggered by userspace. When the driver is loaded and detected displays configured, drm core only calls the crtc and encoder's dpms functions. Signed-off-by: Rob Clark --- Arguably, this could be called a work-around, and instead drm core should call connector's dpms functions and rely on drm_helper_connector_dpms to call encoder and crtc dpms functions. If people think it is better to fix this in drm core, and don't mind me making that change, then I will do that instead. drivers/staging/omapdrm/omap_connector.c | 15 ++------------- drivers/staging/omapdrm/omap_drv.h | 1 + drivers/staging/omapdrm/omap_encoder.c | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/drivers/staging/omapdrm/omap_connector.c b/drivers/staging/omapdrm/omap_connector.c index 6177f30..1c1db90 100644 --- a/drivers/staging/omapdrm/omap_connector.c +++ b/drivers/staging/omapdrm/omap_connector.c @@ -74,20 +74,13 @@ static inline void copy_timings_drm_to_omap(struct omap_video_timings *timings, timings->vbp = mode->vtotal - mode->vsync_end; } -static void omap_connector_dpms(struct drm_connector *connector, int mode) +void omap_connector_dpms(struct drm_connector *connector, int mode) { struct omap_connector *omap_connector = to_omap_connector(connector); struct omap_dss_device *dssdev = omap_connector->dssdev; - int old_dpms; DBG("%s: %d", dssdev->name, mode); - old_dpms = connector->dpms; - - /* from off to on, do from crtc to connector */ - if (mode < old_dpms) - drm_helper_connector_dpms(connector, mode); - if (mode == DRM_MODE_DPMS_ON) { /* store resume info for suspended displays */ switch (dssdev->state) { @@ -109,10 +102,6 @@ static void omap_connector_dpms(struct drm_connector *connector, int mode) } else { /* TODO */ } - - /* from on to off, do from connector to crtc */ - if (mode > old_dpms) - drm_helper_connector_dpms(connector, mode); } enum drm_connector_status omap_connector_detect( @@ -378,7 +367,7 @@ struct drm_encoder *omap_connector_attached_encoder( } static const struct drm_connector_funcs omap_connector_funcs = { - .dpms = omap_connector_dpms, + .dpms = drm_helper_connector_dpms, .detect = omap_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = omap_connector_destroy, diff --git a/drivers/staging/omapdrm/omap_drv.h b/drivers/staging/omapdrm/omap_drv.h index 263057a..8dd7d74 100644 --- a/drivers/staging/omapdrm/omap_drv.h +++ b/drivers/staging/omapdrm/omap_drv.h @@ -73,6 +73,7 @@ void omap_connector_mode_set(struct drm_connector *connector, struct drm_display_mode *mode); void omap_connector_flush(struct drm_connector *connector, int x, int y, int w, int h); +void omap_connector_dpms(struct drm_connector *connector, int mode); struct drm_framebuffer *omap_framebuffer_create(struct drm_device *dev, struct drm_file *file, struct drm_mode_fb_cmd *mode_cmd); diff --git a/drivers/staging/omapdrm/omap_encoder.c b/drivers/staging/omapdrm/omap_encoder.c index 06c52cb..af39dc3 100644 --- a/drivers/staging/omapdrm/omap_encoder.c +++ b/drivers/staging/omapdrm/omap_encoder.c @@ -44,7 +44,23 @@ static void omap_encoder_destroy(struct drm_encoder *encoder) static void omap_encoder_dpms(struct drm_encoder *encoder, int mode) { struct omap_encoder *omap_encoder = to_omap_encoder(encoder); + struct drm_device *dev = encoder->dev; + struct omap_drm_private *priv = dev->dev_private; + int i; + DBG("%s: %d", omap_encoder->mgr->name, mode); + + /* Note: the connector DPMS fxn is only called from userspace + * ioctl, and not at bootup. But the encoder dpms function is. + * Ensure that our connector gets notified of the DPMS state + * change: + */ + for (i = 0; i < priv->num_connectors; i++) { + struct drm_connector *connector = priv->connectors[i]; + if (connector->encoder == encoder) { + omap_connector_dpms(connector, mode); + } + } } static bool omap_encoder_mode_fixup(struct drm_encoder *encoder,