From patchwork Mon Apr 14 17:26:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Egbert Eich X-Patchwork-Id: 3984831 Return-Path: X-Original-To: patchwork-intel-gfx@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 7F803BFF02 for ; Mon, 14 Apr 2014 17:26:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E56A22015A for ; Mon, 14 Apr 2014 17:26:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 08098201B9 for ; Mon, 14 Apr 2014 17:26:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 63AD07202E; Mon, 14 Apr 2014 10:26:53 -0700 (PDT) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) by gabe.freedesktop.org (Postfix) with ESMTP id 6226A7202E for ; Mon, 14 Apr 2014 10:26:50 -0700 (PDT) Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1F4D6AD03 for ; Mon, 14 Apr 2014 17:26:49 +0000 (UTC) Received: from sles12.fritz.box (sles12.fritz.box [192.168.178.35]) by debian (Postfix) with ESMTP id B793F47ED; Mon, 14 Apr 2014 19:26:47 +0200 (CEST) From: Egbert Eich To: intel-gfx@lists.freedesktop.org Date: Mon, 14 Apr 2014 19:26:09 +0200 Message-Id: <1397496369-2746-3-git-send-email-eich@suse.de> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1397496369-2746-1-git-send-email-eich@suse.de> References: <1397496369-2746-1-git-send-email-eich@suse.de> Cc: Egbert Eich Subject: [Intel-gfx] [PATCH 2/2] drm/i915: Set up SDVO encoder type only at detect X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Spam-Status: No, score=-5.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, 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 Depending on the SDVO output_flags SDVO may have multiple connectors. These are all initialized in intel_sdvo_output_setup(). The connector that is initialized later will override the encoder_type that has been set up by an earlier connector type initialization. Eventually the one that comes last wins. Eventually when intel_sdvo_detect() is called the active connector is determined. Delay encoder type initialization until the active connector is known and set it to the type that corresponds to this connector. Signed-off-by: Egbert Eich --- drivers/gpu/drm/i915/intel_sdvo.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index d27155a..5043f16 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c @@ -154,6 +154,9 @@ struct intel_sdvo_connector { /* Mark the type of connector */ uint16_t output_flag; + /* store encoder type for convenience */ + int encoder_type; + enum hdmi_force_audio force_audio; /* This contains all current supported TV format */ @@ -1746,6 +1749,7 @@ intel_sdvo_detect(struct drm_connector *connector, bool force) if (response == 0) return connector_status_disconnected; + intel_sdvo->base.base.encoder_type = intel_sdvo_connector->encoder_type; intel_sdvo->attached_output = response; intel_sdvo->has_hdmi_monitor = false; @@ -2489,7 +2493,9 @@ intel_sdvo_dvi_init(struct intel_sdvo *intel_sdvo, int device) } else { intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT | DRM_CONNECTOR_POLL_DISCONNECT; } - encoder->encoder_type = DRM_MODE_ENCODER_TMDS; + /* delay encoder_type setting until detection */ + intel_sdvo_connector->encoder_type = DRM_MODE_ENCODER_TMDS; + encoder->encoder_type = DRM_MODE_ENCODER_NONE; connector->connector_type = DRM_MODE_CONNECTOR_DVID; if (intel_sdvo_is_hdmi_connector(intel_sdvo, device)) { @@ -2524,7 +2530,9 @@ intel_sdvo_tv_init(struct intel_sdvo *intel_sdvo, int type) intel_connector = &intel_sdvo_connector->base; connector = &intel_connector->base; - encoder->encoder_type = DRM_MODE_ENCODER_TVDAC; + /* delay encoder_type setting until detection */ + intel_sdvo_connector->encoder_type = DRM_MODE_ENCODER_TVDAC; + encoder->encoder_type = DRM_MODE_ENCODER_NONE; connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO; intel_sdvo->controlled_output |= type; @@ -2568,7 +2576,9 @@ intel_sdvo_analog_init(struct intel_sdvo *intel_sdvo, int device) intel_connector = &intel_sdvo_connector->base; connector = &intel_connector->base; intel_connector->polled = DRM_CONNECTOR_POLL_CONNECT; - encoder->encoder_type = DRM_MODE_ENCODER_DAC; + /* delay encoder_type setting until detection */ + intel_sdvo_connector->encoder_type = DRM_MODE_ENCODER_DAC; + encoder->encoder_type = DRM_MODE_ENCODER_NONE; connector->connector_type = DRM_MODE_CONNECTOR_VGA; if (device == 0) { @@ -2603,7 +2613,9 @@ intel_sdvo_lvds_init(struct intel_sdvo *intel_sdvo, int device) intel_connector = &intel_sdvo_connector->base; connector = &intel_connector->base; - encoder->encoder_type = DRM_MODE_ENCODER_LVDS; + /* delay encoder_type setting until detection */ + intel_sdvo_connector->encoder_type = DRM_MODE_ENCODER_LVDS; + encoder->encoder_type = DRM_MODE_ENCODER_NONE; connector->connector_type = DRM_MODE_CONNECTOR_LVDS; if (device == 0) { @@ -2984,7 +2996,8 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) /* encoder type will be decided later */ intel_encoder = &intel_sdvo->base; intel_encoder->type = INTEL_OUTPUT_SDVO; - drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, 0); + drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, + DRM_MODE_ENCODER_NONE); /* Read the regs to test if we can talk to the device */ for (i = 0; i < 0x40; i++) {