From patchwork Fri Feb 3 10:00:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Abriou X-Patchwork-Id: 9553759 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F803604A7 for ; Fri, 3 Feb 2017 10:00:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1109E27F95 for ; Fri, 3 Feb 2017 10:00:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05D62284F1; Fri, 3 Feb 2017 10:00:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8889027F95 for ; Fri, 3 Feb 2017 10:00:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EFE966EB41; Fri, 3 Feb 2017 10:00:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mx07-00178001.pphosted.com (mx07-00178001.pphosted.com [62.209.51.94]) by gabe.freedesktop.org (Postfix) with ESMTPS id C5C966EB41 for ; Fri, 3 Feb 2017 10:00:36 +0000 (UTC) Received: from pps.filterd (m0046037.ppops.net [127.0.0.1]) by m0046037.ppops.net (8.16.0.11/8.16.0.11) with SMTP id v139xc4g003519; Fri, 3 Feb 2017 11:00:34 +0100 Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-.pphosted.com with ESMTP id 288hxwnpk1-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT); Fri, 03 Feb 2017 11:00:34 +0100 Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 3CD7A3D; Fri, 3 Feb 2017 10:00:29 +0000 (GMT) Received: from Webmail-eu.st.com (Safex1hubcas23.st.com [10.75.90.46]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 21E3D27C7; Fri, 3 Feb 2017 10:00:29 +0000 (GMT) Received: from localhost (10.201.23.35) by webmail-ga.st.com (10.75.90.48) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 3 Feb 2017 11:00:28 +0100 From: Vincent Abriou To: Subject: [PATCH] drm/sti: hdmi: automatically check DVI/HDMI mode Date: Fri, 3 Feb 2017 11:00:13 +0100 Message-ID: <1486116013-14419-1-git-send-email-vincent.abriou@st.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [10.201.23.35] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-03_08:, , signatures=0 Cc: Yannick Fertre , Vincent Abriou , Fabien Dessenne X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Remove the hdmi_mode_property and use drm_detect_hdmi_monitor function to check whether the connected monitor is HDMI capable or DVI only. Signed-off-by: Vincent Abriou --- drivers/gpu/drm/sti/sti_hdmi.c | 31 ++++++------------------------- drivers/gpu/drm/sti/sti_hdmi.h | 17 ++--------------- 2 files changed, 8 insertions(+), 40 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 6862d59..ce2dcba 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -158,7 +158,6 @@ struct sti_hdmi_connector { struct drm_encoder *encoder; struct sti_hdmi *hdmi; struct drm_property *colorspace_property; - struct drm_property *hdmi_mode_property; }; #define to_sti_hdmi_connector(x) \ @@ -265,7 +264,7 @@ static void hdmi_config(struct sti_hdmi *hdmi) /* Select encryption type and the framing mode */ conf |= HDMI_CFG_ESS_NOT_OESS; - if (hdmi->hdmi_mode == HDMI_MODE_HDMI) + if (hdmi->hdmi_monitor) conf |= HDMI_CFG_HDMI_NOT_DVI; /* Set Hsync polarity */ @@ -970,6 +969,11 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector) if (!edid) goto fail; + hdmi->hdmi_monitor = drm_detect_hdmi_monitor(edid); + DRM_DEBUG_KMS("%s : %dx%d cm\n", + (hdmi->hdmi_monitor ? "hdmi monitor" : "dvi monitor"), + edid->width_cm, edid->height_cm); + count = drm_add_edid_modes(connector, edid); drm_mode_connector_update_edid_property(connector, edid); drm_edid_to_eld(connector, edid); @@ -1053,19 +1057,6 @@ static void sti_hdmi_connector_init_property(struct drm_device *drm_dev, } hdmi_connector->colorspace_property = prop; drm_object_attach_property(&connector->base, prop, hdmi->colorspace); - - /* hdmi_mode property */ - hdmi->hdmi_mode = DEFAULT_HDMI_MODE; - prop = drm_property_create_enum(drm_dev, 0, "hdmi_mode", - hdmi_mode_names, - ARRAY_SIZE(hdmi_mode_names)); - if (!prop) { - DRM_ERROR("fails to create colorspace property\n"); - return; - } - hdmi_connector->hdmi_mode_property = prop; - drm_object_attach_property(&connector->base, prop, hdmi->hdmi_mode); - } static int @@ -1083,11 +1074,6 @@ sti_hdmi_connector_set_property(struct drm_connector *connector, return 0; } - if (property == hdmi_connector->hdmi_mode_property) { - hdmi->hdmi_mode = val; - return 0; - } - DRM_ERROR("failed to set hdmi connector property\n"); return -EINVAL; } @@ -1107,11 +1093,6 @@ sti_hdmi_connector_get_property(struct drm_connector *connector, return 0; } - if (property == hdmi_connector->hdmi_mode_property) { - *val = hdmi->hdmi_mode; - return 0; - } - DRM_ERROR("failed to get hdmi connector property\n"); return -EINVAL; } diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h index 119bc35..4070123 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.h +++ b/drivers/gpu/drm/sti/sti_hdmi.h @@ -30,19 +30,6 @@ struct hdmi_audio_params { struct hdmi_audio_infoframe cea; }; -/* values for the framing mode property */ -enum sti_hdmi_modes { - HDMI_MODE_HDMI, - HDMI_MODE_DVI, -}; - -static const struct drm_prop_enum_list hdmi_mode_names[] = { - { HDMI_MODE_HDMI, "hdmi" }, - { HDMI_MODE_DVI, "dvi" }, -}; - -#define DEFAULT_HDMI_MODE HDMI_MODE_HDMI - static const struct drm_prop_enum_list colorspace_mode_names[] = { { HDMI_COLORSPACE_RGB, "rgb" }, { HDMI_COLORSPACE_YUV422, "yuv422" }, @@ -73,7 +60,7 @@ static const struct drm_prop_enum_list colorspace_mode_names[] = { * @reset: reset control of the hdmi phy * @ddc_adapt: i2c ddc adapter * @colorspace: current colorspace selected - * @hdmi_mode: select framing for HDMI or DVI + * @hdmi_monitor: true if HDMI monitor detected else DVI monitor assumed * @audio_pdev: ASoC hdmi-codec platform device * @audio: hdmi audio parameters. * @drm_connector: hdmi connector @@ -98,7 +85,7 @@ struct sti_hdmi { struct reset_control *reset; struct i2c_adapter *ddc_adapt; enum hdmi_colorspace colorspace; - enum sti_hdmi_modes hdmi_mode; + bool hdmi_monitor; struct platform_device *audio_pdev; struct hdmi_audio_params audio; struct drm_connector *drm_connector;