From patchwork Sun Aug 19 19:12:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 1344781 Return-Path: X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id E648B3FC64 for ; Sun, 19 Aug 2012 20:24:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DE248A1048 for ; Sun, 19 Aug 2012 13:24:40 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by gabe.freedesktop.org (Postfix) with ESMTP id E3FACA104A for ; Sun, 19 Aug 2012 13:20:19 -0700 (PDT) Received: by mail-we0-f177.google.com with SMTP id r3so3851112wey.36 for ; Sun, 19 Aug 2012 13:20:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=4vvC4lRFbV06Fhbw3IpASM5qSoKM4zKkYGMzaCxyR8o=; b=hqn5EY2nnpLTOEpKXhi0i5GC3L+I/8foCDdh6wNhuQPI/PDBcoxyJQvo9jj9tiq/3b LGEQXn43AkIcHapxM7Dm+wUN0LJa54xmXhbLGjHhI+IKWwHsbM4QqZXnfUUr39tYuKDl VlLywBwDfKaC1mESEDV3tE5OiRMwBKdZ74vbo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=4vvC4lRFbV06Fhbw3IpASM5qSoKM4zKkYGMzaCxyR8o=; b=HMaVFSZq+Q+HvOFcq2t7TSQb9DljzdDv0p2uDz7j3ZHDifI7f9xWU6l8ZhgpkGhNIV IEuq0uIlyii0CnE6ZTTQ/5aKmr1k8oa12saB6/si0FRYPx+hGhy0qIkHVDFyt3Rz8U/o F/oocTl/o6uHeMlgFPjC+79bw9DDVnQkd7hUdMff9uvT/KPqycTjMPCsXJOLvzqwwdYT xM1O4Wt+qiHEc/rtEDBHYPoow4E7NAcKUjmscdwMZL3tjx9i+5ZiIMdMGiuzr5SlhTQW FAljg+naQ3NsXF8TlDpxMhiKOopyYs9+rjXVc7o5RQZeqPPOVqDFujyW6FsD/1npzJ5l Zx+A== Received: by 10.216.85.149 with SMTP id u21mr5847397wee.147.1345407619544; Sun, 19 Aug 2012 13:20:19 -0700 (PDT) Received: from wespe.ffwll.local (178-83-130-250.dynamic.hispeed.ch. [178.83.130.250]) by mx.google.com with ESMTPS id fu8sm24194367wib.5.2012.08.19.13.20.18 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 19 Aug 2012 13:20:18 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Date: Sun, 19 Aug 2012 21:12:22 +0200 Message-Id: <1345403595-9678-6-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 1.7.11.2 In-Reply-To: <1345403595-9678-1-git-send-email-daniel.vetter@ffwll.ch> References: <1345403595-9678-1-git-send-email-daniel.vetter@ffwll.ch> X-Gm-Message-State: ALoCoQmguLdVBWJCsK2YVgQhw3DfpRHNcLhEKqaZxVFselKxecQzy0EXlLLs4DgAHU06jcb1o1bj Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 05/58] drm/i915/tv: convert to encoder enable/disable X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+patchwork-intel-gfx=patchwork.kernel.org@lists.freedesktop.org Like hdmi tv outputs are simple: They only have 2 states and can't be cloned. Hence give it the same treatment. Signed-Off-by: Daniel Vetter Reviewed-by: Jesse Barnes --- drivers/gpu/drm/i915/intel_tv.c | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c index 95653a5..281e0cf 100644 --- a/drivers/gpu/drm/i915/intel_tv.c +++ b/drivers/gpu/drm/i915/intel_tv.c @@ -837,21 +837,21 @@ static struct intel_tv *intel_attached_tv(struct drm_connector *connector) } static void -intel_tv_dpms(struct drm_encoder *encoder, int mode) +intel_enable_tv(struct intel_encoder *encoder) { - struct drm_device *dev = encoder->dev; + struct drm_device *dev = encoder->base.dev; struct drm_i915_private *dev_priv = dev->dev_private; - switch (mode) { - case DRM_MODE_DPMS_ON: - I915_WRITE(TV_CTL, I915_READ(TV_CTL) | TV_ENC_ENABLE); - break; - case DRM_MODE_DPMS_STANDBY: - case DRM_MODE_DPMS_SUSPEND: - case DRM_MODE_DPMS_OFF: - I915_WRITE(TV_CTL, I915_READ(TV_CTL) & ~TV_ENC_ENABLE); - break; - } + I915_WRITE(TV_CTL, I915_READ(TV_CTL) | TV_ENC_ENABLE); +} + +static void +intel_disable_tv(struct intel_encoder *encoder) +{ + struct drm_device *dev = encoder->base.dev; + struct drm_i915_private *dev_priv = dev->dev_private; + + I915_WRITE(TV_CTL, I915_READ(TV_CTL) & ~TV_ENC_ENABLE); } static const struct tv_mode * @@ -1478,15 +1478,15 @@ out: } static const struct drm_encoder_helper_funcs intel_tv_helper_funcs = { - .dpms = intel_tv_dpms, .mode_fixup = intel_tv_mode_fixup, - .prepare = intel_encoder_prepare, + .prepare = intel_encoder_noop, .mode_set = intel_tv_mode_set, - .commit = intel_encoder_commit, + .commit = intel_encoder_noop, + .disable = intel_encoder_disable, }; static const struct drm_connector_funcs intel_tv_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = intel_connector_dpms, .detect = intel_tv_detect, .destroy = intel_tv_destroy, .set_property = intel_tv_set_property, @@ -1616,6 +1616,9 @@ intel_tv_init(struct drm_device *dev) drm_encoder_init(dev, &intel_encoder->base, &intel_tv_enc_funcs, DRM_MODE_ENCODER_TVDAC); + intel_encoder->enable = intel_enable_tv; + intel_encoder->disable = intel_disable_tv; + intel_connector_attach_encoder(intel_connector, intel_encoder); intel_encoder->type = INTEL_OUTPUT_TVOUT; intel_encoder->crtc_mask = (1 << 0) | (1 << 1);