From patchwork Thu Apr 21 17:07:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 12822067 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 15BEBC433EF for ; Thu, 21 Apr 2022 17:07:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239963AbiDURKb (ORCPT ); Thu, 21 Apr 2022 13:10:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390545AbiDURKa (ORCPT ); Thu, 21 Apr 2022 13:10:30 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BA284927B; Thu, 21 Apr 2022 10:07:40 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id n126-20020a1c2784000000b0038e8af3e788so3848761wmn.1; Thu, 21 Apr 2022 10:07:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+Fvcbf2Jm5l/vRCSGsuIt2faeX/qaz6+Vl1oafOAcKQ=; b=NMfSYNOPYP5wVJpdUDLQMLA9kSTWWoJS6DdQqc6sbuqGuz75ibsvUdGuuvwEplCgPM iFS7sQm+KrsRrQ38IV7thWl9D7GoM/s45vg7Zs8NMR9NQuZrj5peb1saZeX5NghZ2mJH /WU5rs+mq9WiOHP5cA8jNkFqzKfub6miD+dB9JoFLMW8yHVc/ISmwCJH6wJXAIvYYaTm Q+amkXrv5Xr7c4mq4s/2BELAdO73Dc5Wovph1WiFw7x/92IPLZfRmPh0U44iJLQr4YZZ JSJs+Urv3gKaQY6SgTcepc4t9aUZ430cSQwlRjfBW1dx6rHKeJ8DjUvRgZfbT6cGEx1F yWtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+Fvcbf2Jm5l/vRCSGsuIt2faeX/qaz6+Vl1oafOAcKQ=; b=huhRgisThaft/uzM+QxeV7sV08wJs7Q5+ZvzQrfm66OwNnt1IJXLpprk5q4PQFZ07O m88jsTOv3DIa3ZvWfI4QmzgO0neP8pogNl0X+he9RTsFQaB9sXVeHJH+k10IE2NiKHG/ HB1iqjj3ZJix8KUgzUOd3BtKyT3dxaIA1m7wQWOObmD5NQ58UO/ftcYIzBLYnoy1W+LS Nq19GEJZ8EBH4J8+h0nA2KyGGlKTBGIgojqeYvuTtQrAIWiUGfEVGLXifAlz6q+KoAMQ EqR2LOu8znrbni+VBmA59OyQcx32LhBI8L2UYOx3/LLQKRgxUv9CT+jC5Mry6WXImTss n4ZA== X-Gm-Message-State: AOAM5314eQFJNtZp/Wf7M4WisZwPtQ24Sk9Pt6bTpqb0wIf/3TMAlvBX +HNIQHgRgguHTjPfUuDYjyw= X-Google-Smtp-Source: ABdhPJwR0kknMZpvf1LjdEueL/t7nBEI/Q5b0+MyD3XtVoquZJFTZctKAaW4elf7wJkbs+MyuxguFQ== X-Received: by 2002:a1c:35c1:0:b0:38e:c4f6:1931 with SMTP id c184-20020a1c35c1000000b0038ec4f61931mr280617wma.161.1650560859146; Thu, 21 Apr 2022 10:07:39 -0700 (PDT) Received: from localhost.localdomain ([94.73.37.128]) by smtp.gmail.com with ESMTPSA id i11-20020a5d584b000000b0020a8d859e5fsm2963849wrf.10.2022.04.21.10.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 10:07:38 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: inki.dae@samsung.com Cc: jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie, daniel@ffwll.ch, krzk@kernel.org, alim.akhtar@samsung.com, lgirdwood@gmail.com, broonie@kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, hjc@rock-chips.com, heiko@sntech.de, linux-rockchip@lists.infradead.org, alain.volmat@foss.st.com, p.zabel@pengutronix.de, mripard@kernel.org, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-sunxi@lists.linux.dev, laurent.pinchart@ideasonboard.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH 1/5] drm/exynos: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi Date: Thu, 21 Apr 2022 19:07:21 +0200 Message-Id: <20220421170725.903361-2-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421170725.903361-1-jose.exposito89@gmail.com> References: <20220421170725.903361-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Once EDID is parsed, the monitor HDMI support information is available through drm_display_info.is_hdmi. This driver calls drm_detect_hdmi_monitor() to receive the same information and stores its own cached value, which is less efficient. Avoid calling drm_detect_hdmi_monitor() and use drm_display_info.is_hdmi instead and also remove hdmi_context.dvi_mode as it is no longer necessary. Signed-off-by: José Expósito --- drivers/gpu/drm/exynos/exynos_hdmi.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 7655142a4651..a6743ae87728 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -119,7 +119,6 @@ struct hdmi_context { struct device *dev; struct drm_device *drm_dev; struct drm_connector connector; - bool dvi_mode; struct delayed_work hotplug_work; struct cec_notifier *notifier; const struct hdmi_driver_data *drv_data; @@ -811,11 +810,12 @@ static int hdmi_audio_infoframe_apply(struct hdmi_context *hdata) static void hdmi_reg_infoframes(struct hdmi_context *hdata) { struct drm_display_mode *m = &hdata->encoder.crtc->state->mode; + struct drm_display_info *display = &hdata->connector.display_info; union hdmi_infoframe frm; u8 buf[25]; int ret; - if (hdata->dvi_mode) { + if (!display->is_hdmi) { hdmi_reg_writeb(hdata, HDMI_AVI_CON, HDMI_AVI_CON_DO_NOT_TRANSMIT); hdmi_reg_writeb(hdata, HDMI_VSI_CON, @@ -893,9 +893,9 @@ static int hdmi_get_modes(struct drm_connector *connector) if (!edid) return -ENODEV; - hdata->dvi_mode = !drm_detect_hdmi_monitor(edid); DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n", - (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"), + (connector->display_info.is_hdmi ? "hdmi monitor" : + "dvi monitor"), edid->width_cm, edid->height_cm); drm_connector_update_edid_property(connector, edid); @@ -1118,9 +1118,10 @@ static void hdmi_audio_config(struct hdmi_context *hdata) static void hdmi_audio_control(struct hdmi_context *hdata) { + struct drm_display_info *display = &hdata->connector.display_info; bool enable = !hdata->audio.mute; - if (hdata->dvi_mode) + if (!display->is_hdmi) return; hdmi_reg_writeb(hdata, HDMI_AUI_CON, enable ? @@ -1143,6 +1144,8 @@ static void hdmi_start(struct hdmi_context *hdata, bool start) static void hdmi_conf_init(struct hdmi_context *hdata) { + struct drm_display_info *display = &hdata->connector.display_info; + /* disable HPD interrupts from HDMI IP block, use GPIO instead */ hdmi_reg_writemask(hdata, HDMI_INTC_CON, 0, HDMI_INTC_EN_GLOBAL | HDMI_INTC_EN_HPD_PLUG | HDMI_INTC_EN_HPD_UNPLUG); @@ -1155,7 +1158,7 @@ static void hdmi_conf_init(struct hdmi_context *hdata) /* disable bluescreen */ hdmi_reg_writemask(hdata, HDMI_CON_0, 0, HDMI_BLUE_SCR_EN); - if (hdata->dvi_mode) { + if (!display->is_hdmi) { hdmi_reg_writemask(hdata, HDMI_MODE_SEL, HDMI_MODE_DVI_EN, HDMI_MODE_MASK); hdmi_reg_writeb(hdata, HDMI_CON_2, From patchwork Thu Apr 21 17:07:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 12822068 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2E6FC433EF for ; Thu, 21 Apr 2022 17:07:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390557AbiDURKi (ORCPT ); Thu, 21 Apr 2022 13:10:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390545AbiDURKd (ORCPT ); Thu, 21 Apr 2022 13:10:33 -0400 Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4481540905; Thu, 21 Apr 2022 10:07:43 -0700 (PDT) Received: by mail-wr1-x42a.google.com with SMTP id u3so7609160wrg.3; Thu, 21 Apr 2022 10:07:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eKm3qfCfRTvpAFA5EAH6ryNQ7rOqn4mcVqOVEQ3yBg4=; b=Ni5qBNH54L+lErFbripcTI35F+F8JtthLEbq0Z0UUJSc163DjScfnStCqt9bEBOvOK hctqtlIoahTUOylzbbJ4kWGEMRVfn6zntL6xxtDiWk2uQSpwhsYwuLELDawTzVgiexkD rGi8mJrxMu88sIQgnK5khi5vuZkh+co9PLdJmPTb1WLaKrmWDuy2Se2gR8Mh1Oc+j5YU 2ym+G7p8V5ZgmMzGmPxeE1CDk6apDaEHSgrOf0duRZ+Q2MLICnFa+O9qvASKeWIuwbvR Hj7i3iyl0pnsPjjSMttEQyMlkMbmJA8JJmPHcQ2Ut12rtDOq9U/mhylL8DmhUnwPy5VL YWCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eKm3qfCfRTvpAFA5EAH6ryNQ7rOqn4mcVqOVEQ3yBg4=; b=pgEQd0tIPOixNsJ3/K9sYnyQjdFCZcaMhE+bLPG9pSGpP7PlgGxqNhfEH23AgLp6qs V9UCnt0a0kERVkZG0+W4wEC71zLzOl0rJA231BMy4kXo/fpjYZIooVa3plqswiS0M7W0 W/SmPXOctQ4qmR+shrD3W136eeKHheStLczSCHJyC2Qm+9Om0k/mcVie9VOXFNlAgu11 zuDf+vfsXxitnhTAeqi9eY9sWBizvV9ngw9lYbl2Mnc45YJaTkOYvDQHwFFXfccAQ/A6 uVeDD/T4Vtr1z+8YhNYCgUU/N69zF2FYGzAt3qpKIFmIhDLPMY4BDuU3ggS7umRscTnK SZuw== X-Gm-Message-State: AOAM533NQerp7MCArAl9OcPKyD4dCieK74o+57JkYOGa43OztcFEfTEi MhDzP1FzqElX29D9TEMGvng= X-Google-Smtp-Source: ABdhPJxlCcy8zYc1BDrHUPlz44VMsFdU0skH0FV3nalzzrkpovFXfzLqOTI6phAIdGGYdymHKVzVjw== X-Received: by 2002:a5d:5953:0:b0:206:b5c:dfe8 with SMTP id e19-20020a5d5953000000b002060b5cdfe8mr527391wri.35.1650560861569; Thu, 21 Apr 2022 10:07:41 -0700 (PDT) Received: from localhost.localdomain ([94.73.37.128]) by smtp.gmail.com with ESMTPSA id i11-20020a5d584b000000b0020a8d859e5fsm2963849wrf.10.2022.04.21.10.07.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 10:07:41 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: inki.dae@samsung.com Cc: jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie, daniel@ffwll.ch, krzk@kernel.org, alim.akhtar@samsung.com, lgirdwood@gmail.com, broonie@kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, hjc@rock-chips.com, heiko@sntech.de, linux-rockchip@lists.infradead.org, alain.volmat@foss.st.com, p.zabel@pengutronix.de, mripard@kernel.org, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-sunxi@lists.linux.dev, laurent.pinchart@ideasonboard.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH 2/5] drm/rockchip: inno_hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi Date: Thu, 21 Apr 2022 19:07:22 +0200 Message-Id: <20220421170725.903361-3-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421170725.903361-1-jose.exposito89@gmail.com> References: <20220421170725.903361-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Once EDID is parsed, the monitor HDMI support information is available through drm_display_info.is_hdmi. This driver calls drm_detect_hdmi_monitor() to receive the same information and stores its own cached value, which is less efficient. Avoid calling drm_detect_hdmi_monitor() and use drm_display_info.is_hdmi instead and also remove hdmi_data_info.sink_is_hdmi as it is no longer necessary. Signed-off-by: José Expósito --- drivers/gpu/drm/rockchip/inno_hdmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/inno_hdmi.c b/drivers/gpu/drm/rockchip/inno_hdmi.c index 046e8ec2a71c..aa8b704d44a2 100644 --- a/drivers/gpu/drm/rockchip/inno_hdmi.c +++ b/drivers/gpu/drm/rockchip/inno_hdmi.c @@ -30,7 +30,6 @@ struct hdmi_data_info { int vic; - bool sink_is_hdmi; bool sink_has_audio; unsigned int enc_in_format; unsigned int enc_out_format; @@ -433,6 +432,8 @@ static int inno_hdmi_config_video_timing(struct inno_hdmi *hdmi, static int inno_hdmi_setup(struct inno_hdmi *hdmi, struct drm_display_mode *mode) { + struct drm_display_info *display = &hdmi->connector.display_info; + hdmi->hdmi_data.vic = drm_match_cea_mode(mode); hdmi->hdmi_data.enc_in_format = HDMI_COLORSPACE_RGB; @@ -452,13 +453,13 @@ static int inno_hdmi_setup(struct inno_hdmi *hdmi, /* Set HDMI Mode */ hdmi_writeb(hdmi, HDMI_HDCP_CTRL, - v_HDMI_DVI(hdmi->hdmi_data.sink_is_hdmi)); + v_HDMI_DVI(display->is_hdmi)); inno_hdmi_config_video_timing(hdmi, mode); inno_hdmi_config_video_csc(hdmi); - if (hdmi->hdmi_data.sink_is_hdmi) { + if (display->is_hdmi) { inno_hdmi_config_video_avi(hdmi, mode); inno_hdmi_config_video_vsi(hdmi, mode); } @@ -553,7 +554,6 @@ static int inno_hdmi_connector_get_modes(struct drm_connector *connector) edid = drm_get_edid(connector, hdmi->ddc); if (edid) { - hdmi->hdmi_data.sink_is_hdmi = drm_detect_hdmi_monitor(edid); hdmi->hdmi_data.sink_has_audio = drm_detect_monitor_audio(edid); drm_connector_update_edid_property(connector, edid); ret = drm_add_edid_modes(connector, edid); From patchwork Thu Apr 21 17:07:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 12822069 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16916C433FE for ; Thu, 21 Apr 2022 17:07:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390561AbiDURKi (ORCPT ); Thu, 21 Apr 2022 13:10:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48740 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390554AbiDURKg (ORCPT ); Thu, 21 Apr 2022 13:10:36 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AB1149274; Thu, 21 Apr 2022 10:07:46 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id bv16so7559827wrb.9; Thu, 21 Apr 2022 10:07:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dLb9n6Vqs4Ih6Tde/WV0zahdLSPBAQf9NPHM6Jy9hzo=; b=LAevyX/ERqtxF65hYRvst71jOVYt9rxNi2LfjZ3L4IvPvF3WP6C6foYJwdUqmgc9Uz 3DIsXUyUOQFeHRz3NsIo4oChjNW1OCy6txnH8L4BbdXswQosN4TMfCACw1LMm3EUoGcW w/YN9U3gZRYMLrDoUzse9t2+NaarYg2H3R4Qb5AEHrQDoBbfX/Umx/8r2KqHv4WnSlDg xGZ0YsuUYnS5tu4PO/M9Ff3iq+eFrJ/BfqjRx59gzmbdDqIj8mpYMkD+euQeJa7DJuOO RGO2VuwabF3TTZDyScm1NSbxJEaTFG8bAbkFTFv3WpVPXJFWGINMOtgCQ5/U2SuQXeLp 4d4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dLb9n6Vqs4Ih6Tde/WV0zahdLSPBAQf9NPHM6Jy9hzo=; b=imYi3OwSljssiYRN7Kbqrg8KEdf0uLHR0xbDYwPoFekN63J8Iuy+oMvOsLcd7iCf/7 0w5mjpv7C1qZ8o+WFhxjXAstpVPaGc62oVwFE4U7hQZmMrrfHmuTgJDGsc/cRu03r+jE T7eJ8M53ADvz3mj4BL26pWEjcTpeB4g2vEQ9+dcD9+oxXhCC9dvjcmzXrbNRpYDNZkKD wXNzBaG+GDX/oEAFtPzAmeZ6L2ubwYBc5/m7/yZ0Yss7RgWtja+nJFlVhMIGU1Zxa6/Y BTRsu2KIQm6+H0Cxd0PR/4XOHBI9qIPBVRHH3sAZUnpO6dgWtae3Zrm7C+BBCQFWLN9X GFpQ== X-Gm-Message-State: AOAM532K1jenXl2jRlqixieYM0OfjsFqvq6KlHCbNYIMp/vvSSLFjhQX xDX/LIRg0t7pcj10Rneoaqs= X-Google-Smtp-Source: ABdhPJx/kFGrmr6cOw1E9qfYzW98wPDX3Gw0oBcObPlkQWqdzFcmeXcXxIP+Db0E7MqTjK84xMOdHQ== X-Received: by 2002:a5d:6488:0:b0:203:b628:70d2 with SMTP id o8-20020a5d6488000000b00203b62870d2mr522020wri.83.1650560864504; Thu, 21 Apr 2022 10:07:44 -0700 (PDT) Received: from localhost.localdomain ([94.73.37.128]) by smtp.gmail.com with ESMTPSA id i11-20020a5d584b000000b0020a8d859e5fsm2963849wrf.10.2022.04.21.10.07.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 10:07:44 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: inki.dae@samsung.com Cc: jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie, daniel@ffwll.ch, krzk@kernel.org, alim.akhtar@samsung.com, lgirdwood@gmail.com, broonie@kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, hjc@rock-chips.com, heiko@sntech.de, linux-rockchip@lists.infradead.org, alain.volmat@foss.st.com, p.zabel@pengutronix.de, mripard@kernel.org, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-sunxi@lists.linux.dev, laurent.pinchart@ideasonboard.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH 3/5] drm/rockchip: rk3066_hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi Date: Thu, 21 Apr 2022 19:07:23 +0200 Message-Id: <20220421170725.903361-4-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421170725.903361-1-jose.exposito89@gmail.com> References: <20220421170725.903361-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Once EDID is parsed, the monitor HDMI support information is available through drm_display_info.is_hdmi. This driver calls drm_detect_hdmi_monitor() to receive the same information and stores its own cached value, which is less efficient. Avoid calling drm_detect_hdmi_monitor() and use drm_display_info.is_hdmi instead and also remove hdmi_data_info.sink_is_hdmi as it is no longer necessary. Signed-off-by: José Expósito --- drivers/gpu/drm/rockchip/rk3066_hdmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rk3066_hdmi.c b/drivers/gpu/drm/rockchip/rk3066_hdmi.c index 1c546c3a8998..a09dbb7d446a 100644 --- a/drivers/gpu/drm/rockchip/rk3066_hdmi.c +++ b/drivers/gpu/drm/rockchip/rk3066_hdmi.c @@ -22,7 +22,6 @@ struct hdmi_data_info { int vic; /* The CEA Video ID (VIC) of the current drm display mode. */ - bool sink_is_hdmi; unsigned int enc_out_format; unsigned int colorimetry; }; @@ -317,6 +316,8 @@ static void rk3066_hdmi_config_phy(struct rk3066_hdmi *hdmi) static int rk3066_hdmi_setup(struct rk3066_hdmi *hdmi, struct drm_display_mode *mode) { + struct drm_display_info *display = &hdmi->connector.display_info; + hdmi->hdmi_data.vic = drm_match_cea_mode(mode); hdmi->hdmi_data.enc_out_format = HDMI_COLORSPACE_RGB; @@ -349,7 +350,7 @@ static int rk3066_hdmi_setup(struct rk3066_hdmi *hdmi, rk3066_hdmi_config_video_timing(hdmi, mode); - if (hdmi->hdmi_data.sink_is_hdmi) { + if (display->is_hdmi) { hdmi_modb(hdmi, HDMI_HDCP_CTRL, HDMI_VIDEO_MODE_MASK, HDMI_VIDEO_MODE_HDMI); rk3066_hdmi_config_avi(hdmi, mode); @@ -472,7 +473,6 @@ static int rk3066_hdmi_connector_get_modes(struct drm_connector *connector) edid = drm_get_edid(connector, hdmi->ddc); if (edid) { - hdmi->hdmi_data.sink_is_hdmi = drm_detect_hdmi_monitor(edid); drm_connector_update_edid_property(connector, edid); ret = drm_add_edid_modes(connector, edid); kfree(edid); From patchwork Thu Apr 21 17:07:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 12822070 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8345C433FE for ; Thu, 21 Apr 2022 17:07:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390545AbiDURKj (ORCPT ); Thu, 21 Apr 2022 13:10:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390563AbiDURKj (ORCPT ); Thu, 21 Apr 2022 13:10:39 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7426549682; Thu, 21 Apr 2022 10:07:47 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id x18so7624894wrc.0; Thu, 21 Apr 2022 10:07:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qu4miKRfTQ5edYvqjwCdNnoZhdelBzzQxfVquTwJYcU=; b=lxA+j4hsGR37CsR5Pcl2akYbQ+9eiuuBp4pFH2LGebfC+LqkKZfG7H6fzk2IvrFcJt XsLiYjdR69D9iGA6qPpMFTk86JChOo/AomlJ2VbMPmsm4kOgP3oXEXft47RFsMJQ57AD Vxq5gk2rZ+BCIbH7Q7mRAYDHCjfpsiXoGDowdX916/ea67KHw9NM4wkxsAh0+bigZfiB BLicaU7MNZmEtp1JQOHY8LTMwHeUEozRWMOg98gmeDh7p47EJ++knKYdojZlFOTASofN bcv+MxJLsTyn75mUnleqvvO4gvsuyQ8jk5VbOFAUlkrj0CqoZJT6BH8WnvYBiYa9HRXU bo6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qu4miKRfTQ5edYvqjwCdNnoZhdelBzzQxfVquTwJYcU=; b=FpTEbvjt+dehKm4/EFW51wqB2OFRd6DwYN2yYYcWeKSfX484e1V4UFzNAi9dWxFvdm 4wdot279iVJfQLONLxZFfEyRi1d0SMaOeWVNer+6Zs+BFnYP/Xv3dpv3cES01t3clNSP tyAEX7Gm349moLrpDRnxF6a8C2V6e28FqH822jL0CswF1rVQcThOJZtol6witDsPHZR2 0lhyof6kbhoo+vRxJcXNu+kC6SdH/J86PYd6UgpBbV/uH9lQQpTyYD3Su2ghQ/WM9HRn eixeqvJ54kSw8HFk/5Gxh27958V1wCtPVh+SimHIGgNQqt/ugoCaSBqWLnEEHDKFT6WN SSfw== X-Gm-Message-State: AOAM531i3yfjZPmre3/GOytXuJ5jGgKe9wbxI2liCIidZjvaDepqHu3W EwrKcxmzJU8uxjxdd5+YA/w= X-Google-Smtp-Source: ABdhPJztCBlTtH8qv1VRhJlR2SzX0FcTLm+9xXk+65FTP+M5MyZVogXt4diKZu3QDquG6Bgk4X0BGQ== X-Received: by 2002:a5d:6d0f:0:b0:20a:897d:ad95 with SMTP id e15-20020a5d6d0f000000b0020a897dad95mr552084wrq.113.1650560866018; Thu, 21 Apr 2022 10:07:46 -0700 (PDT) Received: from localhost.localdomain ([94.73.37.128]) by smtp.gmail.com with ESMTPSA id i11-20020a5d584b000000b0020a8d859e5fsm2963849wrf.10.2022.04.21.10.07.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 10:07:45 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: inki.dae@samsung.com Cc: jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie, daniel@ffwll.ch, krzk@kernel.org, alim.akhtar@samsung.com, lgirdwood@gmail.com, broonie@kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, hjc@rock-chips.com, heiko@sntech.de, linux-rockchip@lists.infradead.org, alain.volmat@foss.st.com, p.zabel@pengutronix.de, mripard@kernel.org, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-sunxi@lists.linux.dev, laurent.pinchart@ideasonboard.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH 4/5] drm/sti/sti_hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi Date: Thu, 21 Apr 2022 19:07:24 +0200 Message-Id: <20220421170725.903361-5-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421170725.903361-1-jose.exposito89@gmail.com> References: <20220421170725.903361-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Once EDID is parsed, the monitor HDMI support information is available through drm_display_info.is_hdmi. This driver calls drm_detect_hdmi_monitor() to receive the same information and stores its own cached value, which is less efficient. Avoid calling drm_detect_hdmi_monitor() and use drm_display_info.is_hdmi instead and also remove sti_hdmi.hdmi_monitor as it is no longer necessary. Signed-off-by: José Expósito --- drivers/gpu/drm/sti/sti_hdmi.c | 7 ++++--- drivers/gpu/drm/sti/sti_hdmi.h | 2 -- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index f3ace11209dd..93841ba907a8 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c @@ -266,6 +266,7 @@ static void hdmi_active_area(struct sti_hdmi *hdmi) static void hdmi_config(struct sti_hdmi *hdmi) { u32 conf; + struct drm_display_info *display = &hdmi->drm_connector->display_info; DRM_DEBUG_DRIVER("\n"); @@ -274,7 +275,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_monitor) + if (display->is_hdmi) conf |= HDMI_CFG_HDMI_NOT_DVI; /* Set Hsync polarity */ @@ -984,9 +985,9 @@ 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"), + (connector->display_info.is_hdmi ? "hdmi monitor" : + "dvi monitor"), edid->width_cm, edid->height_cm); cec_notifier_set_phys_addr_from_edid(hdmi->notifier, edid); diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h index 05b2f3d0d48d..6d4c3f57bc46 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.h +++ b/drivers/gpu/drm/sti/sti_hdmi.h @@ -57,7 +57,6 @@ struct hdmi_audio_params { * @reset: reset control of the hdmi phy * @ddc_adapt: i2c ddc adapter * @colorspace: current colorspace selected - * @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 @@ -83,7 +82,6 @@ struct sti_hdmi { struct reset_control *reset; struct i2c_adapter *ddc_adapt; enum hdmi_colorspace colorspace; - bool hdmi_monitor; struct platform_device *audio_pdev; struct hdmi_audio_params audio; struct drm_connector *drm_connector; From patchwork Thu Apr 21 17:07:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= X-Patchwork-Id: 12822071 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8E73DC433F5 for ; Thu, 21 Apr 2022 17:07:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390579AbiDURKn (ORCPT ); Thu, 21 Apr 2022 13:10:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1390571AbiDURKk (ORCPT ); Thu, 21 Apr 2022 13:10:40 -0400 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32B2349274; Thu, 21 Apr 2022 10:07:50 -0700 (PDT) Received: by mail-wr1-x42c.google.com with SMTP id w4so7555337wrg.12; Thu, 21 Apr 2022 10:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1DHr0UfeFKvgTc9CqETxWAhcnj8bwvB27mi7L/RJMLI=; b=P3YAtF35V53kyVqjeoLe6NLR6GC/doMtIALc3tdmXTpE4LrW2S2r1iOO54iREtCJxH dOTTK9hlGJ+9eEh532NzO318GRvv72+BePjdQztXTWKNZ5KBRVg3kEehRTC2u6l9OuDA WyN/gR2kdohSojmSfR71eW5heZTUm1swjm1FhpBiAt5P1j8iGudP1VksYTrWIyc/TPJZ zO6eIlGiJrE5j/OszmcVXjcgemR/u2dxwYFQlRq1UkFGUtPu5oKguyC0r+8QcnOAuC87 BsRWuNatkxU/1mf9mOfrzEK7X+Wmg1Auq3cC4wSMaYC6wrC8x5aajWQ4/9ElGwsP/Rat 1Puw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1DHr0UfeFKvgTc9CqETxWAhcnj8bwvB27mi7L/RJMLI=; b=nMtPkxI0CR0F72UylNvaY6lxQcWz7yVn1Cg3NDCATlUvm9qNiolBjssuQbMj8ND00u QGmLt/QxjCVo/nai4wEOYPOgyMORRkpeQBKlD9bo4wnOHl5vaiGoG1m57GqE7JRkTmZw yQ+X3a7aUwWCpa01UM7HgKNJiZe4AdDbUqCd9ELGis3QUr41MDAAlXWl6v5VVlEXrzgY 7tzzS1ZKj8oWGBvozvq5HwBBsKVMIdVf4JP1Rb8DsGcbGdysZCeqL0ku/bExMkjQ469e gCq+Q20G+cR6fUuCQtq9FSBTFQYR3c4qrVECHFcoYdKtuSmQ1+xBy9oJ/oscIu2BOkdW kHOQ== X-Gm-Message-State: AOAM531BSz8BmoycTT+pWv83IlPwUISVfFYXeFJoiFtowkybWT0FsqOF l3DN3AO5yfFBvsXIQRcJTAQ= X-Google-Smtp-Source: ABdhPJyF9I+tOdug2GInrB3O1KIZXBnyfjirt1kYYZ6Dne73ApfJWTQEjsu+D+I0t5Nf5JVuBfCwqA== X-Received: by 2002:adf:e908:0:b0:207:a28e:b904 with SMTP id f8-20020adfe908000000b00207a28eb904mr562456wrm.542.1650560868785; Thu, 21 Apr 2022 10:07:48 -0700 (PDT) Received: from localhost.localdomain ([94.73.37.128]) by smtp.gmail.com with ESMTPSA id i11-20020a5d584b000000b0020a8d859e5fsm2963849wrf.10.2022.04.21.10.07.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Apr 2022 10:07:48 -0700 (PDT) From: =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= To: inki.dae@samsung.com Cc: jy0922.shim@samsung.com, sw0312.kim@samsung.com, kyungmin.park@samsung.com, airlied@linux.ie, daniel@ffwll.ch, krzk@kernel.org, alim.akhtar@samsung.com, lgirdwood@gmail.com, broonie@kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org, hjc@rock-chips.com, heiko@sntech.de, linux-rockchip@lists.infradead.org, alain.volmat@foss.st.com, p.zabel@pengutronix.de, mripard@kernel.org, wens@csie.org, jernej.skrabec@gmail.com, samuel@sholland.org, linux-sunxi@lists.linux.dev, laurent.pinchart@ideasonboard.com, =?utf-8?b?Sm9zw6kgRXhww7NzaXRv?= Subject: [PATCH 5/5] drm/sun4i: hdmi: Replace drm_detect_hdmi_monitor() with is_hdmi Date: Thu, 21 Apr 2022 19:07:25 +0200 Message-Id: <20220421170725.903361-6-jose.exposito89@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220421170725.903361-1-jose.exposito89@gmail.com> References: <20220421170725.903361-1-jose.exposito89@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Once EDID is parsed, the monitor HDMI support information is available through drm_display_info.is_hdmi. This driver calls drm_detect_hdmi_monitor() to receive the same information and stores its own cached value, which is less efficient. Avoid calling drm_detect_hdmi_monitor() and use drm_display_info.is_hdmi instead and also remove sun4i_hdmi.hdmi_monitor as it is no longer necessary. Signed-off-by: José Expósito --- drivers/gpu/drm/sun4i/sun4i_hdmi.h | 1 - drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi.h b/drivers/gpu/drm/sun4i/sun4i_hdmi.h index 00ca35f07ba5..65c801cd6f35 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi.h +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi.h @@ -285,7 +285,6 @@ struct sun4i_hdmi { struct sun4i_drv *drv; - bool hdmi_monitor; struct cec_adapter *cec_adap; const struct sun4i_hdmi_variant *variant; diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c index 3799a745b7dd..d8b71710e8f6 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -99,6 +99,7 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder) { struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; struct sun4i_hdmi *hdmi = drm_encoder_to_sun4i_hdmi(encoder); + struct drm_display_info *display = &hdmi->connector.display_info; u32 val = 0; DRM_DEBUG_DRIVER("Enabling the HDMI Output\n"); @@ -111,7 +112,7 @@ static void sun4i_hdmi_enable(struct drm_encoder *encoder) writel(val, hdmi->base + SUN4I_HDMI_PKT_CTRL_REG(0)); val = SUN4I_HDMI_VID_CTRL_ENABLE; - if (hdmi->hdmi_monitor) + if (display->is_hdmi) val |= SUN4I_HDMI_VID_CTRL_HDMI_MODE; writel(val, hdmi->base + SUN4I_HDMI_VID_CTRL_REG); @@ -215,9 +216,8 @@ static int sun4i_hdmi_get_modes(struct drm_connector *connector) if (!edid) return 0; - hdmi->hdmi_monitor = drm_detect_hdmi_monitor(edid); DRM_DEBUG_DRIVER("Monitor is %s monitor\n", - hdmi->hdmi_monitor ? "an HDMI" : "a DVI"); + connector->display_info.is_hdmi ? "an HDMI" : "a DVI"); drm_connector_update_edid_property(connector, edid); cec_s_phys_addr_from_edid(hdmi->cec_adap, edid);