From patchwork Tue Jul 16 19:33:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrik Jakobsson X-Patchwork-Id: 2828294 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 430A4C0AB2 for ; Tue, 16 Jul 2013 19:58:18 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F0B7B2023F for ; Tue, 16 Jul 2013 19:58:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B179F20265 for ; Tue, 16 Jul 2013 19:58:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 86CB5E6D2F for ; Tue, 16 Jul 2013 12:58:15 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-la0-f48.google.com (mail-la0-f48.google.com [209.85.215.48]) by gabe.freedesktop.org (Postfix) with ESMTP id B9479E662D for ; Tue, 16 Jul 2013 12:34:30 -0700 (PDT) Received: by mail-la0-f48.google.com with SMTP id lx15so843431lab.7 for ; Tue, 16 Jul 2013 12:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer; bh=R+6RJyqzSPqSIKzk3Y6UoHFMbTkc5Y6DxnkfxT8szMY=; b=wRsuTNk9MeBXMm0VLeMF6Jhtt+8Q+NGLDztpu0vuxduZkXdPRRhDVS7YP6XkqaByic 09bcp2wSIklL8upYMutRuII7remPYaDOV3bctrnNKfEIGTpO5Ho9owmDgIfVhU5gbdgD +Cc+RK66s0yypUTb9tnt+DwYIQS3n9/uv2DrZLc2ROYIeSI5/8fVYwNdJCF8jE+RLgtj pifKNIIx0eJ9EQyaC4bMK1058UHdGFfvzMEehQsSlxUwImcYZK8SRP7t01V1w5NEP0fK w9EJqWgSr504Qw3V7XVXDCMtGXWjdNSTqfya45SvDTldYpGN9yK9HMTRPCR+T/L1iS1X U/FQ== X-Received: by 10.112.144.97 with SMTP id sl1mr1747844lbb.56.1374003269784; Tue, 16 Jul 2013 12:34:29 -0700 (PDT) Received: from patrik-cedarview.lan (h138n8-oer-a32.ias.bredband.telia.com. [2.248.103.138]) by mx.google.com with ESMTPSA id 8sm1581822lbq.4.2013.07.16.12.34.28 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Jul 2013 12:34:29 -0700 (PDT) From: Patrik Jakobsson To: dri-devel@lists.freedesktop.org Subject: [PATCH 23/30] drm/gma500: Add generic encoder functions Date: Tue, 16 Jul 2013 21:33:56 +0200 Message-Id: <1374003243-15888-24-git-send-email-patrik.r.jakobsson@gmail.com> X-Mailer: git-send-email 1.8.1.2 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Patrik Jakobsson --- drivers/gpu/drm/gma500/gma_display.c | 41 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/gma500/gma_display.h | 4 ++++ drivers/gpu/drm/gma500/psb_intel_drv.h | 10 +++++++++ 3 files changed, 55 insertions(+) diff --git a/drivers/gpu/drm/gma500/gma_display.c b/drivers/gpu/drm/gma500/gma_display.c index 40894c2..98a0eec 100644 --- a/drivers/gpu/drm/gma500/gma_display.c +++ b/drivers/gpu/drm/gma500/gma_display.c @@ -519,6 +519,47 @@ void gma_crtc_destroy(struct drm_crtc *crtc) kfree(psb_intel_crtc); } +void gma_encoder_prepare(struct drm_encoder *encoder) +{ + struct drm_encoder_helper_funcs *encoder_funcs = + encoder->helper_private; + /* lvds has its own version of prepare see psb_intel_lvds_prepare */ + encoder_funcs->dpms(encoder, DRM_MODE_DPMS_OFF); +} + +void gma_encoder_commit(struct drm_encoder *encoder) +{ + struct drm_encoder_helper_funcs *encoder_funcs = + encoder->helper_private; + /* lvds has its own version of commit see psb_intel_lvds_commit */ + encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON); +} + +void gma_encoder_destroy(struct drm_encoder *encoder) +{ + struct psb_intel_encoder *intel_encoder = to_psb_intel_encoder(encoder); + + drm_encoder_cleanup(encoder); + kfree(intel_encoder); +} + +/* Currently there is only a 1:1 mapping of encoders and connectors */ +struct drm_encoder *gma_best_encoder(struct drm_connector *connector) +{ + struct psb_intel_encoder *psb_intel_encoder = + psb_intel_attached_encoder(connector); + + return &psb_intel_encoder->base; +} + +void gma_connector_attach_encoder(struct psb_intel_connector *connector, + struct psb_intel_encoder *encoder) +{ + connector->encoder = encoder; + drm_mode_connector_attach_encoder(&connector->base, + &encoder->base); +} + #define GMA_PLL_INVALID(s) { /* DRM_ERROR(s); */ return false; } bool gma_pll_is_valid(struct drm_crtc *crtc, diff --git a/drivers/gpu/drm/gma500/gma_display.h b/drivers/gpu/drm/gma500/gma_display.h index 0d3b607..1e70165 100644 --- a/drivers/gpu/drm/gma500/gma_display.h +++ b/drivers/gpu/drm/gma500/gma_display.h @@ -81,6 +81,10 @@ extern void gma_crtc_commit(struct drm_crtc *crtc); extern void gma_crtc_disable(struct drm_crtc *crtc); extern void gma_crtc_destroy(struct drm_crtc *crtc); +extern void gma_encoder_prepare(struct drm_encoder *encoder); +extern void gma_encoder_commit(struct drm_encoder *encoder); +extern void gma_encoder_destroy(struct drm_encoder *encoder); + /* Common clock related functions */ extern const struct gma_limit_t *gma_limit(struct drm_crtc *crtc, int refclk); extern void gma_clock(int refclk, struct gma_clock_t *clock); diff --git a/drivers/gpu/drm/gma500/psb_intel_drv.h b/drivers/gpu/drm/gma500/psb_intel_drv.h index c8cd9be..39f09e0 100644 --- a/drivers/gpu/drm/gma500/psb_intel_drv.h +++ b/drivers/gpu/drm/gma500/psb_intel_drv.h @@ -230,12 +230,22 @@ extern void psb_intel_encoder_prepare(struct drm_encoder *encoder); extern void psb_intel_encoder_commit(struct drm_encoder *encoder); extern void psb_intel_encoder_destroy(struct drm_encoder *encoder); +extern struct drm_encoder *gma_best_encoder(struct drm_connector *connector); +extern void gma_connector_attach_encoder(struct psb_intel_connector *connector, + struct psb_intel_encoder *encoder); + static inline struct psb_intel_encoder *psb_intel_attached_encoder( struct drm_connector *connector) { return to_psb_intel_connector(connector)->encoder; } +static inline struct psb_intel_encoder *gma_attached_encoder( + struct drm_connector *connector) +{ + return to_psb_intel_connector(connector)->encoder; +} + extern void psb_intel_connector_attach_encoder( struct psb_intel_connector *connector, struct psb_intel_encoder *encoder);