From patchwork Sun Jan 8 16:56:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092607 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 3ED11C54EBD for ; Sun, 8 Jan 2023 16:57:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233127AbjAHQ5D (ORCPT ); Sun, 8 Jan 2023 11:57:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233213AbjAHQ5B (ORCPT ); Sun, 8 Jan 2023 11:57:01 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0228F10BE for ; Sun, 8 Jan 2023 08:57:00 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id d30so4620883lfv.8 for ; Sun, 08 Jan 2023 08:56:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bMcMgMN2h9pQ0++woqWQkTwB0DopoRxUXMW3C3/QKYc=; b=P9dqkZZfHOIrHOTu0QxjNN5J0k/OqwxrnUDvwRdcdF/erP0JK2wzbixjkCGmcn8AmP CxTtz7XvXAHP1NZ2aTtfEhBhTKh4jO/WFzht4gw5vbgTiivyjH5nZYW+XDSykIgoNfC9 1n6uEb7M/WOgAKBqodZb9Y5Ozwy1Dr6hKuaOkf8FdUNhtHW4lg500zrJYeEpMzKiJgPm zyz+vTfWDUIptKZyD9Ps6REXcCzOSau25MqKEBMU8o0saEyA0v5gKpq2dOOVFlUpBdOp r9SmnN0By/RWCTOUFjwhQywtH1zgb9Ha3WEUh38MPzN0a/icfRdSpq7S5xfXCvnRdXxg ZmeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bMcMgMN2h9pQ0++woqWQkTwB0DopoRxUXMW3C3/QKYc=; b=w+JMdGxnr4YbG2ZDoz68tJSXaLU/xssRstWSgNkIJUCGfNiOmx6ykH7iU4H0c91Tuo 43BdwF3WZ6AzOpSGCPFi+Crkm2qgAlbxqxrI+49fUPh2XLMUPjWo6I8hdahpW4P/PS+d l91QsDSmMti5W3tUMlExf8SnmBfijpVctcpsDGqsMcVLI9OkCcCDCpsWQQnkdGfD5UkG ToJFhRm40oG0ki1U16HzyxoDC+2XWBg2BR+RoXIIOrKwEMPdyHRxRVw6btWCUTqiKemh DddalQ1V325eeL1GplAZ3iZTUOBykH1hi54oDE/QezdZ66QbMjo2CUkOloH1ATDr+5Pf v0Yw== X-Gm-Message-State: AFqh2kopTZrgrlAGjFc0SvfxmUqI340Zw0YZjT8dO06IkjUMDic1j4hU YHyIqPJB5GIKnhdTCXd+ANg5hQ== X-Google-Smtp-Source: AMrXdXsSRYg+KJGElLjXPWCsXo8ii+CcZrDyeAXlnwyYhDZJuGqnEvGXDw/1RjhMYPVSdS2EH1jOmQ== X-Received: by 2002:a05:6512:3f0c:b0:4b5:2ef3:fd2b with SMTP id y12-20020a0565123f0c00b004b52ef3fd2bmr20160912lfa.18.1673197018396; Sun, 08 Jan 2023 08:56:58 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.56.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:56:58 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 01/13] drm/bridge: lt9611: fix sleep mode setup Date: Sun, 8 Jan 2023 18:56:44 +0200 Message-Id: <20230108165656.136871-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org On atomic_post_disable the bridge goes to the low power state. However the code disables too much of the chip, so the HPD event is not being detected and delivered to the host. Reduce the power saving in order to get the HPD event. Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge") Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 7c0a99173b39..2714184cc53f 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -448,12 +448,11 @@ static void lt9611_sleep_setup(struct lt9611 *lt9611) { 0x8023, 0x01 }, { 0x8157, 0x03 }, /* set addr pin as output */ { 0x8149, 0x0b }, - { 0x8151, 0x30 }, /* disable IRQ */ + { 0x8102, 0x48 }, /* MIPI Rx power down */ { 0x8123, 0x80 }, { 0x8130, 0x00 }, - { 0x8100, 0x01 }, /* bandgap power down */ - { 0x8101, 0x00 }, /* system clk power down */ + { 0x8011, 0x0a }, }; regmap_multi_reg_write(lt9611->regmap, From patchwork Sun Jan 8 16:56:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092609 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 06696C63797 for ; Sun, 8 Jan 2023 16:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233171AbjAHQ5D (ORCPT ); Sun, 8 Jan 2023 11:57:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233401AbjAHQ5C (ORCPT ); Sun, 8 Jan 2023 11:57:02 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13F6725D1 for ; Sun, 8 Jan 2023 08:57:01 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id y25so9521668lfa.9 for ; Sun, 08 Jan 2023 08:57:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aURTF4UTNK5+9lO/Hwf/8gndFQ6qOIZny88iB+hQmBk=; b=FadltuIVXiXfLKLbIFGk9qMxWJZd0pgdWhDhnMGr7WCcONmtQ0mXvacTSch1FYMboU Kw7aYSYw3CaucKf0i0sK3OEpvgExGpbWDM5jWw9ZG93jxIhuMV3M9EniQmnOSJt6nRgj 0sb7Wx80CAqv1SkZrhRqYC0ed4+9TimMNahppUpsuXdwPTkZaVUBXthTjrQA/1me5WD/ wR7MQWlEQ310OKHGa7JQe9dWRt0WIp5Ygk90v6b/c87H/NYltoGbK9l5JdGedebei++u bTzGof767qoaQEEB5CleBxssgeqrK3ZYfG9UdmCb36jx5cHAmDxCcDLvfQMSzwffzjGr DpBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aURTF4UTNK5+9lO/Hwf/8gndFQ6qOIZny88iB+hQmBk=; b=joeIlE5r8Q5F8F5kr+vrTsJVpv2DmuQEPYdd77jQHwezUZTlkkXMHv3bMDbhQow3Ww /I3UiCOGO49xNTpRmItAAVr55ktw+6EEbuycsxevU/EqBOlsj70KQCBK+tX8KvOgkFqV 9vIM23tmn+2km8W2DovhSpt+tJ7M/DdKt+7vRaWx22yvoPj9Fse+0NqBTjnBiRMQ0WSP wxteTQZ0Wj4C+vTGZ/dzk1sl7x9gryuIMTc5XY75/AcO6KZ8yh+Z9GroKWTuqb5wvmGB eAu5dMimQKKmoko0V647lnMaTzbYfNavzigvAcaR3EJfFiSec/0BvSJ1i9ab70a/OuUJ 03yg== X-Gm-Message-State: AFqh2ko/c6YZNJREqsUwzPkIiNceUlv8aOB/a/R/yvwIx1rGm2lInMub YxdfbbIMD5/VoMQ5MLPqE+VP4g== X-Google-Smtp-Source: AMrXdXu1iHxeu2ExX/A+b5b1uN5KzYXpvD2t4qxsiZYqDufquyjI+BUz/2egXzyca03hmYTvGJ3e+g== X-Received: by 2002:a05:6512:10c3:b0:4b6:e64c:aec6 with SMTP id k3-20020a05651210c300b004b6e64caec6mr21265840lfg.63.1673197019293; Sun, 08 Jan 2023 08:56:59 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.56.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:56:58 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 02/13] drm/bridge: lt9611: fix HPD reenablement Date: Sun, 8 Jan 2023 18:56:45 +0200 Message-Id: <20230108165656.136871-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The driver will reset the bridge in the atomic_pre_enable(). However this will also drop the HPD interrupt state. Instead of resetting the bridge, properly wake it up. This fixes the HPD interrupt delivery after the disable/enable cycle. Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge") Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 2714184cc53f..58f39b279217 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -856,12 +856,18 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge, static void lt9611_bridge_pre_enable(struct drm_bridge *bridge) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); + static const struct reg_sequence reg_cfg[] = { + { 0x8102, 0x12 }, + { 0x8123, 0x40 }, + { 0x8130, 0xea }, + { 0x8011, 0xfa }, + }; if (!lt9611->sleep) return; - lt9611_reset(lt9611); - regmap_write(lt9611->regmap, 0x80ee, 0x01); + regmap_multi_reg_write(lt9611->regmap, + reg_cfg, ARRAY_SIZE(reg_cfg)); lt9611->sleep = false; } From patchwork Sun Jan 8 16:56:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092608 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 AB5FFC677F1 for ; Sun, 8 Jan 2023 16:57:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233401AbjAHQ5E (ORCPT ); Sun, 8 Jan 2023 11:57:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230052AbjAHQ5C (ORCPT ); Sun, 8 Jan 2023 11:57:02 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B28491178 for ; Sun, 8 Jan 2023 08:57:01 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id v25so9496862lfe.12 for ; Sun, 08 Jan 2023 08:57:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mZbpMMJayX1Y27MwQ3eHOLuGX6M4NgpDUpVAQPdHpwg=; b=JwRMK+/DJJm+4Kr83NfHDU4UDfp/HcTiQIs3kBx+7G+CvWdP6us0FNw9fTPb9ReDIg 8awMwlvRZZ1AGLUjxDZMKl/VJpG68NJcOqaLfSJR0kWiEkmLKPbdQv7lyO/DyXFp94+0 CSoJ5oEW8tDY2oyL5Jo1rVsk0l37Uv6jcD9REB4+JEAhQFDBPqfHUpt2QJ1dqJypO3tC t7Cx4ZTHugFWdfQVaXUx7dMhL9crxFuhtTYXmY1qI855oKspqREyUv3WcMT+WKa+ZEAW TWoKubgWS36r+6wgvqc5kxkkwtw/UOXcsDdRHmUVUpQDZj1BgKXU7LUV+B72V5gRq3Ql EUkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mZbpMMJayX1Y27MwQ3eHOLuGX6M4NgpDUpVAQPdHpwg=; b=xGq9TbKW9vhAExLLr5y6aG/3mziGdUHUzIKANZEA+E3leoaMcXgvtbfUWrA4DaaFVV XTLzyI4nlH2Pg+Jy4Tifk52qxCxmLlej8rgUTzXsg6SPEMJHUX4fCS9tQOkWiBbRGOR2 cHQ6uXfY+dzpy9WVYO08iysJG5mnP3+tgNNMvwN8ZFIzwFIsjv/WVNv97+7UztIen5bU KPkpyV8ZcmsJKY0At80jUtTGw5P+QmISR3UDsItozbKO+XD3rZj75vkd4759k2ycWroI 3jinxiC55gBQR0IVObTnTCZU0I7zSyU2/wg6V7f6/Wivt8hraeTLFiH4lha+aI76voIe sXbA== X-Gm-Message-State: AFqh2kpVcnPO9H1+Sp5b1RYImwiuZjBC2n5AV0mA5HQMRiwhQsHyYZKt bqU0sQf5rucwsR9mcYviOCOq+w== X-Google-Smtp-Source: AMrXdXs0EGrOEFr2U+1r7ljGQqrNVBcmIDEWIzTZTSYAS/56AUf8+K6vD6iRgRYzkUiMxRMVaZd8YQ== X-Received: by 2002:a05:6512:3c89:b0:4b6:fddc:1fcd with SMTP id h9-20020a0565123c8900b004b6fddc1fcdmr22972112lfv.23.1673197020000; Sun, 08 Jan 2023 08:57:00 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.56.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:56:59 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 03/13] drm/bridge: lt9611: fix polarity programming Date: Sun, 8 Jan 2023 18:56:46 +0200 Message-Id: <20230108165656.136871-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Fix programming of hsync and vsync polarities Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge") Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 58f39b279217..deb503ca956a 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -207,7 +207,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod /* stage 2 */ { 0x834a, 0x40 }, - { 0x831d, 0x10 }, /* MK limit */ { 0x832d, 0x38 }, @@ -222,11 +221,19 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod { 0x8325, 0x00 }, { 0x832a, 0x01 }, { 0x834a, 0x10 }, - { 0x831d, 0x10 }, - { 0x8326, 0x37 }, }; + u8 pol = 0x10; - regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg)); + if (mode->flags & DRM_MODE_FLAG_NHSYNC) + pol |= 0x2; + if (mode->flags & DRM_MODE_FLAG_NVSYNC) + pol |= 0x1; + regmap_write(lt9611->regmap, 0x831d, pol); + + if (mode->hdisplay == 3840) + regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2)); + else + regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg)); switch (mode->hdisplay) { case 640: @@ -236,7 +243,7 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod regmap_write(lt9611->regmap, 0x8326, 0x37); break; case 3840: - regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2)); + regmap_write(lt9611->regmap, 0x8326, 0x37); break; } From patchwork Sun Jan 8 16:56:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092610 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 AC61FC54EBE for ; Sun, 8 Jan 2023 16:57:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbjAHQ5F (ORCPT ); Sun, 8 Jan 2023 11:57:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233542AbjAHQ5E (ORCPT ); Sun, 8 Jan 2023 11:57:04 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53A9C260D for ; Sun, 8 Jan 2023 08:57:02 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id v25so9496890lfe.12 for ; Sun, 08 Jan 2023 08:57:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=T9VtndEU9TW3RLFSiBZfc8etzz7z8EaiINnNdBxR7Gk=; b=LOaWt0nMZCQMlu/kyhyiFkMmbHnIEYfWIz1Lq09jNRTVo9RvD556KCXF7kHX4y234i 0rDkmmIB0QA6oY/xLhBvWM17IM3Pt7GcoJHb/5CoYsW2JoNAiUiCUgiQPaWeBO/uyB/p 8l+r0OY1ZtPu3xYYYGZN+gJPQcMnoAzbQ0QaQn0S+xSqdI8ZInYY+tn9SVFVitOmRCrY iZdeFZJgYpMmVvMrXOuu608o2DzR3ylTMiD9vxC0PhdJvOJMRoDWzF3HZq4S+8v+i1Xr UO5yrSWKMJaKe7aNESA1UgBPwBiRyMwScg+kZikbtVZdCFzH2LEIa4uhZzQLYOg2/y8v 5QYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=T9VtndEU9TW3RLFSiBZfc8etzz7z8EaiINnNdBxR7Gk=; b=fppDC6LJVy2+/IDE59snIvuqHO20Uin2kiBLtT/okx4uFsqQEcIsoWmyml4Cc7/Tcm G5a5pdyRxVo8SeUK5JBLzvloVwuLJbIuYAX4Fyj2JDP44zCMOCYjJ/zjw6JljXd6xMVA y5gl0K2gkKNN04AAyMFvPpkrElEuDTxlZc6k1ToE6Jvwn7P3xlgBOLZZxg1ZZNdrGSGK 52brv7Hi6pd0azuQhl07OR2uMrJ5ggucdGGEWz9mYP3AmPAzhOj28FdMVjsSNBwy+QDg OldTRlNzdJG6Kb/ua+Lj89T0GnTvXKIJRavwmRLazrRaDSEFy3aoynxPaYTIvkOn4WTj UzBw== X-Gm-Message-State: AFqh2krzaFYtpukTPfdKNZQs1u2tPXWEQPP+WJCgyLxf0K8WQCRRNLUQ uMX5L0+naPNnBgZPvBWpIgRsfA== X-Google-Smtp-Source: AMrXdXtCpM5eXruHKS1u8QD4S2xnCLMW2hGmMU07tlOqcgJWEyfhmZKtxavj5iYb1WxbM18EFmM9Sw== X-Received: by 2002:a05:6512:31ce:b0:4cc:7258:f178 with SMTP id j14-20020a05651231ce00b004cc7258f178mr2109800lfe.59.1673197020705; Sun, 08 Jan 2023 08:57:00 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.57.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:57:00 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 04/13] drm/bridge: lt9611: fix programming of video modes Date: Sun, 8 Jan 2023 18:56:47 +0200 Message-Id: <20230108165656.136871-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Program the upper part of the hfront_porch into the proper register. Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge") Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index deb503ca956a..f377052a45a4 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -187,7 +187,8 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611, regmap_write(lt9611->regmap, 0x8319, (u8)(hfront_porch % 256)); - regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256)); + regmap_write(lt9611->regmap, 0x831a, (u8)(hsync_porch / 256) | + ((hfront_porch / 256) << 4)); regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256)); } From patchwork Sun Jan 8 16:56:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092612 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 9140AC54EBE for ; Sun, 8 Jan 2023 16:57:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233647AbjAHQ5I (ORCPT ); Sun, 8 Jan 2023 11:57:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233508AbjAHQ5F (ORCPT ); Sun, 8 Jan 2023 11:57:05 -0500 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 11C0D10BE for ; Sun, 8 Jan 2023 08:57:03 -0800 (PST) Received: by mail-lf1-x12a.google.com with SMTP id bu8so9541177lfb.4 for ; Sun, 08 Jan 2023 08:57:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MojOF/93S3oRnJzgKxf5e9Ahv/idd5WHTFRxpckdje4=; b=NVoMZ4UsQCrJrNJ7HOzJjuxjLBZIqv0YV6mjO8mPCnwLdIhMPLMGTK53xmunEV2Uzi 6Q4YontEyKBHramQL4VWbOCJDfdqtbE/1yr2XqSrk/W63H+f4OWFwEWlDwbY97+62CC7 Dk3a1TvVlwmYtiPQV6XU1msAMT7CvhAcxg1Xv38EY6iYvOlm7CjKx4lHyuVlwKtKBwnn 2cHn6MP9rmyTJDx4dhgsZdjAMIH+vX3Lzjz5IP35TJqiPcbcpobNPt5FWNpP85FYjCSS IdD1xXAJa5ZcAafeg9mjlXClHWDL7+CbKvWt9K49DkB8Z/YUD0KFOL8EHEtuKgSQW/ia C2cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MojOF/93S3oRnJzgKxf5e9Ahv/idd5WHTFRxpckdje4=; b=6tlpVc/TWx1JXq222qhuBfltnT+vUixwPrhEloWt8GTDI+BoIxF2TabafH3LoCf5oY xnpIuTVg7C1RAwqVYwmC3vhq5N3tTrpDWr+e8XImxqj1QBOru41PxyIxi22SCxZ3KED4 MVkMZug6eyhm8GodEgk9dYEH6YY0DiljKSkzgl8M0Zdq1VDecjQg958vfW6PtUmQGUx/ ZLjoWoDo9CWzfBi8Z2pyJuduo8Z+T61k1ER3tqvVb3i3oxuSBoeGuwB7sR+vj990ZBdU thawvt7ohFMVu84hFbYJHy635VemB8HD3itk8KosUm4OaL1A2C1RbeU79szG7fjvQ5TR YCfw== X-Gm-Message-State: AFqh2kozhoJXEM98MjE+VtE69BtHfbgLHJVQC69CfM7G5jw7wdfmjWaX cRt/lSxUcmyYPbbvB2yyRoFqRg== X-Google-Smtp-Source: AMrXdXunAi3Qs/UsltE/4C3BiyKCtj35mVl/rTsTQ1cm7lLeqYZjG3D7mOMqNozk8oB+vMDfwPSXFQ== X-Received: by 2002:a05:6512:2349:b0:4a4:68b9:66cd with SMTP id p9-20020a056512234900b004a468b966cdmr17233207lfu.24.1673197021375; Sun, 08 Jan 2023 08:57:01 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.57.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:57:01 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 05/13] drm/bridge: lt9611: fix clock calculation Date: Sun, 8 Jan 2023 18:56:48 +0200 Message-Id: <20230108165656.136871-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Instead of having several fixed values for the pcr register, calculate it before programming. This allows the bridge to support most of the display modes. Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge") Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 32 +++++++++++-------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index f377052a45a4..e2799a0df8f8 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -192,8 +192,9 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611, regmap_write(lt9611->regmap, 0x831b, (u8)(hsync_porch % 256)); } -static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode) +static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int postdiv) { + unsigned int pcr_m = mode->clock * 5 * postdiv / 27000; const struct reg_sequence reg_cfg[] = { { 0x830b, 0x01 }, { 0x830c, 0x10 }, @@ -236,24 +237,14 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod else regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg)); - switch (mode->hdisplay) { - case 640: - regmap_write(lt9611->regmap, 0x8326, 0x14); - break; - case 1920: - regmap_write(lt9611->regmap, 0x8326, 0x37); - break; - case 3840: - regmap_write(lt9611->regmap, 0x8326, 0x37); - break; - } + regmap_write(lt9611->regmap, 0x8326, pcr_m); /* pcr rst */ regmap_write(lt9611->regmap, 0x8011, 0x5a); regmap_write(lt9611->regmap, 0x8011, 0xfa); } -static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode) +static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode *mode, unsigned int *postdiv) { unsigned int pclk = mode->clock; const struct reg_sequence reg_cfg[] = { @@ -271,12 +262,16 @@ static int lt9611_pll_setup(struct lt9611 *lt9611, const struct drm_display_mode regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg)); - if (pclk > 150000) + if (pclk > 150000) { regmap_write(lt9611->regmap, 0x812d, 0x88); - else if (pclk > 70000) + *postdiv = 1; + } else if (pclk > 70000) { regmap_write(lt9611->regmap, 0x812d, 0x99); - else + *postdiv = 2; + } else { regmap_write(lt9611->regmap, 0x812d, 0xaa); + *postdiv = 4; + } /* * first divide pclk by 2 first @@ -895,14 +890,15 @@ static void lt9611_bridge_mode_set(struct drm_bridge *bridge, { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); struct hdmi_avi_infoframe avi_frame; + unsigned int postdiv; int ret; lt9611_bridge_pre_enable(bridge); lt9611_mipi_input_digital(lt9611, mode); - lt9611_pll_setup(lt9611, mode); + lt9611_pll_setup(lt9611, mode, &postdiv); lt9611_mipi_video_setup(lt9611, mode); - lt9611_pcr_setup(lt9611, mode); + lt9611_pcr_setup(lt9611, mode, postdiv); ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame, <9611->connector, From patchwork Sun Jan 8 16:56:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092611 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 671E0C53210 for ; Sun, 8 Jan 2023 16:57:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233527AbjAHQ5H (ORCPT ); Sun, 8 Jan 2023 11:57:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233213AbjAHQ5F (ORCPT ); Sun, 8 Jan 2023 11:57:05 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFCC52727 for ; Sun, 8 Jan 2023 08:57:03 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id bt23so9496633lfb.5 for ; Sun, 08 Jan 2023 08:57:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C5ihh3g6iNgJiC7zRiEmt/AFsjwhqCmHhXCZopRf9qg=; b=au5mlBLngo5aQphj6Qo5sCvsVWk3KrTubxzRUEKvMm2OUTgpH26AdjgZemt3YxW8fm VsouXPpNz7Hyyjrp7CFOEqIJzfFvfst8AtVNf8e3PmfI8J/H6zoBM0HQrB4ImO8mtbjf WI7tvyCjRBWohgsNfRkG9jiwcelexz2eugv4vAtQL51of9SR5JChUjoCLiyzOOXdq4T1 9M/pHYgjBSa2e5RrbJ+fZpd+q5aTKLbJqBmGAEvroA/Xko08nZf28p/TBvCfnW3o3iPf yFUHlucVkSezVVgqOoeSluDpK6rSYqm+v3nG2kKCLjQ3Pencj+rYLTV2zF/llVMgCSUm SCgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C5ihh3g6iNgJiC7zRiEmt/AFsjwhqCmHhXCZopRf9qg=; b=vj6ShOZR+Wi/JPLu76aYXCkWFLzDUTDWtcCK6XdiRIzUFhGZ0IjxVknth4zmsW65DK QNSZUSFZmjHm0aJPNExC2fXKIZ6Sso7hE0m0OlqT2+E0eZFMj38VVHoojINnoX4vGpVW dcL6cgwRHf2KEzmEIXndzGaM4HlBxeAP9z5iIprb4isuqdzKnKcYVR2ghlha0oSjhF/4 ggKb4L6sxUbtaTT93irp1wk67qqSsIZJ0h5b7BDXufQk2BmUlM5ya14V/o1BnV6jwvCm /ILxUafRMNkoi9Rkr/wHyha992Dz5HMWmkW7Nf2BwVDUcG/FsXUFDL3C9AVAUDqEGj2x ev9w== X-Gm-Message-State: AFqh2kpZCGxxuD7dacYduJGC7MU9xzvnpAeHEsrOswo2Xo0PyzubLksO hIWQ/h6rD/skzx9Xlcw7ItSg6aSRXhJL4gsi X-Google-Smtp-Source: AMrXdXs9tehp0AeUOGWV0u7MoShAVtbfl2A4h8VIPWPLu41zitPoXPnm0P+YDLpkJ2d9/trIymatIw== X-Received: by 2002:a05:6512:22d3:b0:4b7:66:8231 with SMTP id g19-20020a05651222d300b004b700668231mr20113767lfu.58.1673197022219; Sun, 08 Jan 2023 08:57:02 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.57.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:57:01 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 06/13] drm/bridge: lt9611: pass a pointer to the of node Date: Sun, 8 Jan 2023 18:56:49 +0200 Message-Id: <20230108165656.136871-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Pass a pointer to the OF node while registering lt9611 MIPI device. Fixes: 23278bf54afe ("drm/bridge: Introduce LT9611 DSI to HDMI bridge") Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index e2799a0df8f8..3b77238ca4af 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -769,7 +769,7 @@ static const struct drm_connector_funcs lt9611_bridge_connector_funcs = { static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611, struct device_node *dsi_node) { - const struct mipi_dsi_device_info info = { "lt9611", 0, NULL }; + const struct mipi_dsi_device_info info = { "lt9611", 0, lt9611->dev->of_node}; struct mipi_dsi_device *dsi; struct mipi_dsi_host *host; struct device *dev = lt9611->dev; From patchwork Sun Jan 8 16:56:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092613 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 E49B4C677F1 for ; Sun, 8 Jan 2023 16:57:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234231AbjAHQ5I (ORCPT ); Sun, 8 Jan 2023 11:57:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233542AbjAHQ5H (ORCPT ); Sun, 8 Jan 2023 11:57:07 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A72EE5FDB for ; Sun, 8 Jan 2023 08:57:04 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id bu8so9541242lfb.4 for ; Sun, 08 Jan 2023 08:57:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9RXCRRwOkomayUTWW5R7rnIxD/KiJ4qyyd4b3Mx951U=; b=C45fAdSLNqwsYZX8EmjgYSLGuSOlQg6vODXHr1AQ1Wd0fX6TfFHx8xmHAcIea2qCua tahdwLT+krEqsuyzBgbekojBswZnNCVUkpXq80XHbp7uhty6pSvXkcwUjbykh4hWlfud +tauv9n6EUP794Siby1s6tpVOb0UYZGMz1OMqWnngVZeqEJWSArFYVf1LmorsBTlP41+ vv/1HBpGpFO0TxE6PMgYrP/rxkqtHK4Ikl+Z3QP8usNK9GLzYv9azp42PHxP4LFl0WA8 a9oMu08+1Id7IuqAVwgZht4PVG63T1nhqPodvG+ruSk6m4NWvaxl7x7lNJa5Zsa04abs TFKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9RXCRRwOkomayUTWW5R7rnIxD/KiJ4qyyd4b3Mx951U=; b=ZT7PWwyjzNtngXWAQPNwzQaMc/QlOffyyrvZWuBQtX4/F3/2KP31daSJHCBYY/ybvF qnsOcPULBtUhvIFHm/CPVLpS4aTBgwWb7VRjDGz5HZp19AZjWR2QhPOVPY5h+74Q3hfd iDRIsnylporSEZrrQLQR+0f48O6hzCbtR+Cv8AcZ3vNcWzdutKN6l+lcrs4Gc9ollg5T CEU+E5K5GVDQfZ8mbYvOLHUMB+VZAoRF4s5xpjfMfCouznrfGG9UEbBUmyd3wD0Uuk5q CF2kGBhY157/k8xn63zcBGYUxlyUJNg3c49lriCxobJsMBB/ycT9zP4+KMGODiCP8XJW 9cOw== X-Gm-Message-State: AFqh2krj7aAE98l4SjOR1mqMK9R3tohFhyeQV5rI1wboFs5IQactWtNd KgNuSH/LxcYcf5j1hvFTXOxpOA== X-Google-Smtp-Source: AMrXdXsGHzRbOgFPAjG/634TVSTUGtwJ1klc+iShLchKzs1uQszP0/7sA2z4KzYUimY5S/tiWw+A9A== X-Received: by 2002:a19:7008:0:b0:4b5:7d49:4a05 with SMTP id h8-20020a197008000000b004b57d494a05mr15720943lfc.0.1673197023014; Sun, 08 Jan 2023 08:57:03 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.57.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:57:02 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 07/13] drm/bridge: lt9611: rework the mode_set function Date: Sun, 8 Jan 2023 18:56:50 +0200 Message-Id: <20230108165656.136871-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The mode_set callback is deprectated for drm_bridges in favour of using atomic_enable callback. Move corresponding code into the function lt9611_bridge_atomic_enable() and turn lt9611_bridge_pre_enable() into the proper atomic_pre_enable callback. Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 61 +++++++++++++++---------- 1 file changed, 36 insertions(+), 25 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 3b77238ca4af..1b65a573be27 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -713,6 +713,39 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge, struct drm_bridge_state *old_bridge_state) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); + struct drm_atomic_state *state = old_bridge_state->base.state; + struct drm_connector *connector; + struct drm_connector_state *conn_state; + struct drm_crtc_state *crtc_state; + struct drm_display_mode *mode; + struct hdmi_avi_infoframe avi_frame; + unsigned int postdiv; + int ret; + + connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); + if (WARN_ON(!connector)) + return; + + conn_state = drm_atomic_get_new_connector_state(state, connector); + if (WARN_ON(!conn_state)) + return; + + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); + if (WARN_ON(!crtc_state)) + return; + + mode = &crtc_state->adjusted_mode; + + lt9611_mipi_input_digital(lt9611, mode); + lt9611_pll_setup(lt9611, mode, &postdiv); + lt9611_mipi_video_setup(lt9611, mode); + lt9611_pcr_setup(lt9611, mode, postdiv); + + ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame, + connector, + mode); + if (!ret) + lt9611->vic = avi_frame.video_code; if (lt9611_power_on(lt9611)) { dev_err(lt9611->dev, "power on failed\n"); @@ -856,7 +889,8 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge, return MODE_OK; } -static void lt9611_bridge_pre_enable(struct drm_bridge *bridge) +static void lt9611_bridge_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); static const struct reg_sequence reg_cfg[] = { @@ -884,29 +918,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge, lt9611_sleep_setup(lt9611); } -static void lt9611_bridge_mode_set(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - const struct drm_display_mode *adj_mode) -{ - struct lt9611 *lt9611 = bridge_to_lt9611(bridge); - struct hdmi_avi_infoframe avi_frame; - unsigned int postdiv; - int ret; - - lt9611_bridge_pre_enable(bridge); - - lt9611_mipi_input_digital(lt9611, mode); - lt9611_pll_setup(lt9611, mode, &postdiv); - lt9611_mipi_video_setup(lt9611, mode); - lt9611_pcr_setup(lt9611, mode, postdiv); - - ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame, - <9611->connector, - mode); - if (!ret) - lt9611->vic = avi_frame.video_code; -} - static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge) { return __lt9611_detect(bridge_to_lt9611(bridge)); @@ -957,11 +968,11 @@ lt9611_atomic_get_input_bus_fmts(struct drm_bridge *bridge, static const struct drm_bridge_funcs lt9611_bridge_funcs = { .attach = lt9611_bridge_attach, .mode_valid = lt9611_bridge_mode_valid, - .mode_set = lt9611_bridge_mode_set, .detect = lt9611_bridge_detect, .get_edid = lt9611_bridge_get_edid, .hpd_enable = lt9611_bridge_hpd_enable, + .atomic_pre_enable = lt9611_bridge_atomic_pre_enable, .atomic_enable = lt9611_bridge_atomic_enable, .atomic_disable = lt9611_bridge_atomic_disable, .atomic_post_disable = lt9611_bridge_atomic_post_disable, From patchwork Sun Jan 8 16:56:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092615 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 0AA61C677F1 for ; Sun, 8 Jan 2023 16:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235078AbjAHQ5L (ORCPT ); Sun, 8 Jan 2023 11:57:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233213AbjAHQ5H (ORCPT ); Sun, 8 Jan 2023 11:57:07 -0500 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42E5A5FDD for ; Sun, 8 Jan 2023 08:57:05 -0800 (PST) Received: by mail-lf1-x129.google.com with SMTP id b3so9549851lfv.2 for ; Sun, 08 Jan 2023 08:57:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U/cju9fotz0lov5duz5S4oQdny3N24g+NVMg5SEoeSQ=; b=RKb+kjNwOiCJvONsL81ZqXj94XS9E4HEzXwI/88wV9w1VEa9HQB2ssslUihF/KiZAD rs2xflVqbmyvXc8M6Sb9e6W5jSvGCBCivchlAAwuvbBomMXvUb/pGlcJJSCPAFNWCJg0 I67AaX535YkOn0NG7S4kKDBuIF7FHqZQOVtBPKJxyfgxlAFBVgy8ItukQC3/08HYUTda aRT3xI8WhtNfWQseSwSMKKef2F8+CJVED2oZtUdQfAIUq2XH66lVQ7x0vFjx//Hubw6q 6L3zivk30B40LuxN3XBQW3gUfzeuoBkeZ75A6ABqIF98sI2nWuGudA/hXNSpcliVTTOX Xzog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U/cju9fotz0lov5duz5S4oQdny3N24g+NVMg5SEoeSQ=; b=7bIS3//aBVyg/4vpaRwZF3+t8TuoXEC7Oavlc2T1M6GbjUEuwcEl07Afxm5V4iyoYG r4iaewiXLlq3iAOGn/MDFcWrGjs4pzSkemewCUzlPpVRarIww0X5wTbQLsdR1B++euO2 3MTbKKG5yjL8XUZuKDtjXvVhOEEwBNfboMRKnnlZrawoR/ejekfhJGXXCzGtgWcEnvEh pPrrjLgVAlWRhCgKSN9fJFvFoi1V4lyKtAV4E7JOHsEhw9au6+W76hnq1XGdo1py2yLR eUyNa1GFWhmHp1j/8bXJTHILL0Eyvw0VpTDFFlFcjBK75hbpta5pytb4JJgn6dZewRKs vFuA== X-Gm-Message-State: AFqh2kr0iH8nAZ5x14xFdILfuQdtexmFoN+UssQ6/MRERtEOuP1eo8bj kFiechzvHTpqHbVmXO2o4Fvzag== X-Google-Smtp-Source: AMrXdXtOSdQID4b58q1Qb1/+qU0iFkZFkUaXlF0+sv0upP5V/jnr+RACHrBHcmmcZ5rJVZeu7VOF+Q== X-Received: by 2002:ac2:4f12:0:b0:4b5:b5d0:36e4 with SMTP id k18-20020ac24f12000000b004b5b5d036e4mr20605695lfr.13.1673197023664; Sun, 08 Jan 2023 08:57:03 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:57:03 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 08/13] drm/bridge: lt9611: attach to the next bridge Date: Sun, 8 Jan 2023 18:56:51 +0200 Message-Id: <20230108165656.136871-9-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The bindings require that there is a next bridge after the lt9611. If nothing else it can be the hdmi-connector (as used on the RB3 platform, see sdm845-db845c.dts). Bring in the next bridge into the drm bridges chain and attach to it. Since lt9611 is not anymore the last bridge in the chain, this also allows us to drop all the !DRM_BRIDGE_ATTACH_NO_CONNECTOR functionality. Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 99 ++----------------------- 1 file changed, 7 insertions(+), 92 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 1b65a573be27..773d7a56f86f 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -33,7 +34,7 @@ struct lt9611 { struct device *dev; struct drm_bridge bridge; - struct drm_connector connector; + struct drm_bridge *next_bridge; struct regmap *regmap; @@ -107,11 +108,6 @@ static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge) return container_of(bridge, struct lt9611, bridge); } -static struct lt9611 *connector_to_lt9611(struct drm_connector *connector) -{ - return container_of(connector, struct lt9611, connector); -} - static int lt9611_mipi_input_analog(struct lt9611 *lt9611) { const struct reg_sequence reg_cfg[] = { @@ -581,9 +577,9 @@ static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode) return NULL; } -/* connector funcs */ -static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611) +static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge) { + struct lt9611 *lt9611 = bridge_to_lt9611(bridge); unsigned int reg_val = 0; int connected = 0; @@ -596,12 +592,6 @@ static enum drm_connector_status __lt9611_detect(struct lt9611 *lt9611) return lt9611->status; } -static enum drm_connector_status -lt9611_connector_detect(struct drm_connector *connector, bool force) -{ - return __lt9611_detect(connector_to_lt9611(connector)); -} - static int lt9611_read_edid(struct lt9611 *lt9611) { unsigned int temp; @@ -683,30 +673,6 @@ lt9611_get_edid_block(void *data, u8 *buf, unsigned int block, size_t len) return 0; } -static int lt9611_connector_get_modes(struct drm_connector *connector) -{ - struct lt9611 *lt9611 = connector_to_lt9611(connector); - unsigned int count; - struct edid *edid; - - lt9611_power_on(lt9611); - edid = drm_do_get_edid(connector, lt9611_get_edid_block, lt9611); - drm_connector_update_edid_property(connector, edid); - count = drm_add_edid_modes(connector, edid); - kfree(edid); - - return count; -} - -static enum drm_mode_status -lt9611_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) -{ - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode); - - return lt9611_mode ? MODE_OK : MODE_BAD; -} - /* bridge funcs */ static void lt9611_bridge_atomic_enable(struct drm_bridge *bridge, @@ -784,21 +750,6 @@ lt9611_bridge_atomic_disable(struct drm_bridge *bridge, } } -static struct -drm_connector_helper_funcs lt9611_bridge_connector_helper_funcs = { - .get_modes = lt9611_connector_get_modes, - .mode_valid = lt9611_connector_mode_valid, -}; - -static const struct drm_connector_funcs lt9611_bridge_connector_funcs = { - .fill_modes = drm_helper_probe_single_connector_modes, - .detect = lt9611_connector_detect, - .destroy = drm_connector_cleanup, - .reset = drm_atomic_helper_connector_reset, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611, struct device_node *dsi_node) { @@ -834,44 +785,13 @@ static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611, return dsi; } -static int lt9611_connector_init(struct drm_bridge *bridge, struct lt9611 *lt9611) -{ - int ret; - - ret = drm_connector_init(bridge->dev, <9611->connector, - <9611_bridge_connector_funcs, - DRM_MODE_CONNECTOR_HDMIA); - if (ret) { - DRM_ERROR("Failed to initialize connector with drm\n"); - return ret; - } - - drm_connector_helper_add(<9611->connector, - <9611_bridge_connector_helper_funcs); - - if (!bridge->encoder) { - DRM_ERROR("Parent encoder object not found"); - return -ENODEV; - } - - drm_connector_attach_encoder(<9611->connector, bridge->encoder); - - return 0; -} - static int lt9611_bridge_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); - int ret; - - if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { - ret = lt9611_connector_init(bridge, lt9611); - if (ret < 0) - return ret; - } - return 0; + return drm_bridge_attach(bridge->encoder, lt9611->next_bridge, + bridge, flags); } static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge, @@ -918,11 +838,6 @@ lt9611_bridge_atomic_post_disable(struct drm_bridge *bridge, lt9611_sleep_setup(lt9611); } -static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge) -{ - return __lt9611_detect(bridge_to_lt9611(bridge)); -} - static struct edid *lt9611_bridge_get_edid(struct drm_bridge *bridge, struct drm_connector *connector) { @@ -995,7 +910,7 @@ static int lt9611_parse_dt(struct device *dev, lt9611->ac_mode = of_property_read_bool(dev->of_node, "lt,ac-mode"); - return 0; + return drm_of_find_panel_or_bridge(dev->of_node, 2, -1, NULL, <9611->next_bridge); } static int lt9611_gpio_init(struct lt9611 *lt9611) From patchwork Sun Jan 8 16:56:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092614 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 BB542C63797 for ; Sun, 8 Jan 2023 16:57:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233542AbjAHQ5K (ORCPT ); Sun, 8 Jan 2023 11:57:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233580AbjAHQ5H (ORCPT ); Sun, 8 Jan 2023 11:57:07 -0500 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0422260C5 for ; Sun, 8 Jan 2023 08:57:06 -0800 (PST) Received: by mail-lj1-x22b.google.com with SMTP id g14so6532524ljh.10 for ; Sun, 08 Jan 2023 08:57:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NH1d+1PPDWydMKrpXiB7N/7rHowCambw1HmOt4U8TEY=; b=Mc3S+dGTVyt3txPpj+xX7j2IQEbdfxP887iPwB8+OpSsJetRWSzuWELPuhoc8AJHJE Chz4gJNUCA0DO9/rcAF1QNSr7fg3NKrSRe3VVeL1LKqqcZIWJX1Ier/rtAY68BAAqLT3 WrnBLU1TtpZkOrE3YGD7kNHPKmhbAFzF1AAC6uWZ1Xja5Sy/1DcxlRkZaa3XKlKqC5yZ OeKP4sYO3w8qC7JGmQNEn332SDfM/nf9DrmEvdzbdBZOZAXLx1A4a2ljK9C1LD6exSTx bYTq2XNnMtbTAZZpKByQibYXU5ilPYJl0dQ66bCAbg2AyQ6olSFDF01EoiSwFajuAAG9 +r+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NH1d+1PPDWydMKrpXiB7N/7rHowCambw1HmOt4U8TEY=; b=quAv92eTDqSdaFv7PDpyukntVaTiUe7vaGMXABlQkrqNU1/NGD5SDSaC9L3wJqIHxz LrcyJoXo+/yLWBV4PXjvZKz9XPFEYwUBgkC8sqQakvddh/bXwmzYUHF6kgo1V9e99fMh gxHoAgk1vSr0IqXEbBXF+2KDPGVuYE4a0gOlOxkYlFSR8gI5zxnL8HnosRAwz4TmHeMD t32uq/9WYgiGuTjPuCdjOjCVKd97unmj8MJCimEEfrq1iBzINcRXW0bLUAuN30xxPK8l hWfGaIm8qx6xOs1wJ+iQC2bQWYIv4q9+ii+posQDTBby1YD8aibNs815PwKGbu7ZoiGG L63g== X-Gm-Message-State: AFqh2krNPWnO6NT8usy4Xue6C0MLclfXznkkyH3Pv1Uswb1YjL1WVIfR JiT5xRyH46gXXBdzE1NwZ3JnUw== X-Google-Smtp-Source: AMrXdXssQ9vFGz21nmCaS2uBYJfIJBiPV2tuSTMIYZFfwOKfLE65KNuB3AcOhiEe6S+RBjkOIi7NAw== X-Received: by 2002:a2e:9207:0:b0:27f:ba2d:6d64 with SMTP id k7-20020a2e9207000000b0027fba2d6d64mr13436717ljg.43.1673197024406; Sun, 08 Jan 2023 08:57:04 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:57:03 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 09/13] drm/bridge: lt9611: fix sync polarity for DVI output Date: Sun, 8 Jan 2023 18:56:52 +0200 Message-Id: <20230108165656.136871-10-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Attaching DVI sink to the lt9611 requires different setup. Fix the register write to make the DVI displays sync onto the correct sync pulse. Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 773d7a56f86f..7f9be74acf0d 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -352,13 +352,16 @@ static int lt9611_video_check(struct lt9611 *lt9611) return temp; } -static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611) +static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi) { regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic); regmap_write(lt9611->regmap, 0x8447, lt9611->vic); regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */ - regmap_write(lt9611->regmap, 0x82d6, 0x8c); + if (is_hdmi) + regmap_write(lt9611->regmap, 0x82d6, 0x8c); + else + regmap_write(lt9611->regmap, 0x82d6, 0x0c); regmap_write(lt9611->regmap, 0x82d7, 0x04); } @@ -719,7 +722,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge, } lt9611_mipi_input_analog(lt9611); - lt9611_hdmi_tx_digital(lt9611); + lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi); lt9611_hdmi_tx_phy(lt9611); msleep(500); From patchwork Sun Jan 8 16:56:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092616 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 5B6BFC53210 for ; Sun, 8 Jan 2023 16:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233213AbjAHQ5L (ORCPT ); Sun, 8 Jan 2023 11:57:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234019AbjAHQ5I (ORCPT ); Sun, 8 Jan 2023 11:57:08 -0500 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7BE860D0 for ; Sun, 8 Jan 2023 08:57:06 -0800 (PST) Received: by mail-lf1-x12c.google.com with SMTP id bf43so9535767lfb.6 for ; Sun, 08 Jan 2023 08:57:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=VF5ULjO8Nsom9+kPMKOkmOPhLqLOBqB6rEP7ZLKg/cg=; b=fCuyGkhONFBFCIntZiPzrNU6TIwzenYQIrN2R9WluJ7c5pJmfRL/hGq7p1CfhPwoYS T3gMB0GBRTcfxJNpUap29X/mSZXIx+gpsfsUVZGw/zx83UW6KHr5lffAQ3wQD2ey31Sm uyp+IdZRJNbIZqgEGPBdHYxsjr75Rw3u+MIbKEkJ8wLfU7MFy/HS2fi8epUfGSoHbKy5 cZf8OLn4AUbqyTRZ6SASGaqJUx6BZJw0CAHH0k+5mJSKPaD3jlewnQweY7Pq9hvs/r+X 9cI4NS0bWZQuSXmTPvWItQyi4khjU0NSW3nKokb4r7rkKgCXJGnnln03au5am3UEC+lN 8oXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VF5ULjO8Nsom9+kPMKOkmOPhLqLOBqB6rEP7ZLKg/cg=; b=fOETpXwg/LW4bfb4Z4XA6ifKgb2nG8AbEqnz4XK5/XqwHUqlYySnLf/g3n+qEB66y/ LsADH9SP/vLVcCtIJ/XcYVS32oE0IgELLmpKgBA60gOfmxnW/1osunjKBGl+zgEz+4sr e2irt1x7+qmcxkw9+pkPURI2Zh+eyIfGBPIQS0qo7ViJV/DlbRXxl5jiRyWnxyUIonQy gZNj49qKqZiHPP5vIAZB2SWskj0tGbkVSvNjw+JJMQbUn5AAMZ+1jKl8SNer4VxCv7JP PDyp6or7FoAQdWUCc193Hg3LcT80+dQTkp1SnyOEUbd2lOwSVuwy9T9hVYLPURz/a+6X dozA== X-Gm-Message-State: AFqh2krEHE3AnwLWx/X33WdMGDGRvpfSo3wwPWOTSwTX3LDDXEnpMCUJ bbR8g0fMDrQoO3OF7pGC4DtH4w== X-Google-Smtp-Source: AMrXdXsBGlNd7jK7tTazi2o3aynBgbzQGJUlQBLnfvsAvlKqPQVEbViC06RKS6edaTT+EN8Tr5e30w== X-Received: by 2002:ac2:4adb:0:b0:4cc:83a5:e64e with SMTP id m27-20020ac24adb000000b004cc83a5e64emr75825lfp.60.1673197025158; Sun, 08 Jan 2023 08:57:05 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:57:04 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 10/13] drm/bridge: lt9611: simplify video timings programming Date: Sun, 8 Jan 2023 18:56:53 +0200 Message-Id: <20230108165656.136871-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Inline calculated values to simplify the calculation in lt9611_mipi_video_setup(). Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 7f9be74acf0d..1396ab081f61 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -155,12 +155,12 @@ static void lt9611_mipi_video_setup(struct lt9611 *lt9611, hactive = mode->hdisplay; hsync_len = mode->hsync_end - mode->hsync_start; hfront_porch = mode->hsync_start - mode->hdisplay; - hsync_porch = hsync_len + mode->htotal - mode->hsync_end; + hsync_porch = mode->htotal - mode->hsync_start; vactive = mode->vdisplay; vsync_len = mode->vsync_end - mode->vsync_start; vfront_porch = mode->vsync_start - mode->vdisplay; - vsync_porch = vsync_len + mode->vtotal - mode->vsync_end; + vsync_porch = mode->vtotal - mode->vsync_start; regmap_write(lt9611->regmap, 0x830d, (u8)(v_total / 256)); regmap_write(lt9611->regmap, 0x830e, (u8)(v_total % 256)); From patchwork Sun Jan 8 16:56:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092617 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 8E8FDC678D5 for ; Sun, 8 Jan 2023 16:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235282AbjAHQ5M (ORCPT ); Sun, 8 Jan 2023 11:57:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234377AbjAHQ5I (ORCPT ); Sun, 8 Jan 2023 11:57:08 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A53946140 for ; Sun, 8 Jan 2023 08:57:07 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id bq39so9582163lfb.0 for ; Sun, 08 Jan 2023 08:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NkbWmLh0SyTbaJmj6lwX2gXRB2ciA0Sqr8sImuCDU5U=; b=t/OPt5eqc5RSKisaYoSDzCFgW8txaePdKAsYlpPoSdjRUJ62Z4O3EQ9tQty0KqTP1/ z4fNXZIFVHrTfbf2EoG393nzT5+gQNGyqy+KnmxtulEh4p+7+oQLsTBprXnLYDNRUYCB TkWcA/OTycjxb6dmmlAOsyFJ7gYpgEfCf6wJvp888o3BcQVuif8SCZNe9S7KJ6PFYT8G o2L3DfuNlcPQXvzXilTdLto/v34pGsjcOPf6dV0+SVNydaqjds57tgZ320Z5csaHrtkH 0kL3K3MnkfAZ0/KJE3ofmVAk6WEE2AUcBNO3yR56QgmLjQZ/JNoPaxIUbWFrBNOXfi5g Ba8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NkbWmLh0SyTbaJmj6lwX2gXRB2ciA0Sqr8sImuCDU5U=; b=fCQTfBbdigHsZinijg29/ZFN6Axcu0Q7NXU/BkYw/KPy5DXjfqr21RlIFAdPmAl76E nLHUD5OyVSr8s9j0WPbyBZWuXAz6ySsT19sr2J9Taw31rrN0IKCKHpaKPKCe7BPYWEPZ zvkSgL+ZDntqTh4WyolLPYfbhlRgI2wjx1g9yyagsrMGbfjyqoF3D5DzKYRhT/RrF2SP SVT6ejw02kOMF5S8DCH4lo4DKQ0tainQpU/XlHKDE2JViR7aI2BGjSEqpUEzgvJzGhd5 OwrEWvtrTGdPxDgZEdcaOZwc7crNo01cOPOF4FhcFJ1pQZyeEj+xUhng21BRfdAVKJEK ZafA== X-Gm-Message-State: AFqh2kr0wPM8db6d0ploB7PccHxfkZuGQ+lR3TN649Ui+W3ltT5F2qTv 8vp83YVHxY/1rDxZBvuiZOZphQ== X-Google-Smtp-Source: AMrXdXul4ElWAGTLI45n3QNgcosJtHB69zyQadqjy9RiIsTe16NpflE4ek+tcOTf8Fgv+MpywYe/cQ== X-Received: by 2002:a05:6512:259e:b0:4a4:68b8:c2af with SMTP id bf30-20020a056512259e00b004a468b8c2afmr19374040lfb.6.1673197025968; Sun, 08 Jan 2023 08:57:05 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:57:05 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 11/13] drm/bridge: lt9611: rework infoframes handling Date: Sun, 8 Jan 2023 18:56:54 +0200 Message-Id: <20230108165656.136871-12-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Rework handling infoframes: - Write full HDMI AVI infoframe instead of just fixing the VIC value - Also send the HDMI Vendor Specific infoframe, as recommended by the HDMI spec. Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 57 +++++++++++++++++++------ 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 1396ab081f61..82af1f954cc6 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -59,7 +59,6 @@ struct lt9611 { enum drm_connector_status status; u8 edid_buf[EDID_SEG_SIZE]; - u32 vic; }; #define LT9611_PAGE_CONTROL 0xff @@ -352,12 +351,51 @@ static int lt9611_video_check(struct lt9611 *lt9611) return temp; } -static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi) +static void lt9611_hdmi_set_infoframes(struct lt9611 *lt9611, + struct drm_connector *connector, + struct drm_display_mode *mode) { - regmap_write(lt9611->regmap, 0x8443, 0x46 - lt9611->vic); - regmap_write(lt9611->regmap, 0x8447, lt9611->vic); - regmap_write(lt9611->regmap, 0x843d, 0x0a); /* UD1 infoframe */ + union hdmi_infoframe infoframe; + ssize_t len; + u8 iframes = 0x0a; /* UD1 infoframe */ + u8 buf[32]; + int ret; + int i; + + ret = drm_hdmi_avi_infoframe_from_display_mode(&infoframe.avi, + connector, + mode); + if (ret < 0) + goto out; + + len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf)); + if (len < 0) + goto out; + + for (i = 0; i < len; i++) + regmap_write(lt9611->regmap, 0x8440 + i, buf[i]); + + ret = drm_hdmi_vendor_infoframe_from_display_mode(&infoframe.vendor.hdmi, + connector, + mode); + if (ret < 0) + goto out; + + len = hdmi_infoframe_pack(&infoframe, buf, sizeof(buf)); + if (len < 0) + goto out; + for (i = 0; i < len; i++) + regmap_write(lt9611->regmap, 0x8474 + i, buf[i]); + + iframes |= 0x20; + +out: + regmap_write(lt9611->regmap, 0x843d, iframes); /* UD1 infoframe */ +} + +static void lt9611_hdmi_tx_digital(struct lt9611 *lt9611, bool is_hdmi) +{ if (is_hdmi) regmap_write(lt9611->regmap, 0x82d6, 0x8c); else @@ -687,9 +725,7 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge, struct drm_connector_state *conn_state; struct drm_crtc_state *crtc_state; struct drm_display_mode *mode; - struct hdmi_avi_infoframe avi_frame; unsigned int postdiv; - int ret; connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); if (WARN_ON(!connector)) @@ -710,18 +746,13 @@ lt9611_bridge_atomic_enable(struct drm_bridge *bridge, lt9611_mipi_video_setup(lt9611, mode); lt9611_pcr_setup(lt9611, mode, postdiv); - ret = drm_hdmi_avi_infoframe_from_display_mode(&avi_frame, - connector, - mode); - if (!ret) - lt9611->vic = avi_frame.video_code; - if (lt9611_power_on(lt9611)) { dev_err(lt9611->dev, "power on failed\n"); return; } lt9611_mipi_input_analog(lt9611); + lt9611_hdmi_set_infoframes(lt9611, connector, mode); lt9611_hdmi_tx_digital(lt9611, connector->display_info.is_hdmi); lt9611_hdmi_tx_phy(lt9611); From patchwork Sun Jan 8 16:56:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092618 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 C5033C678D9 for ; Sun, 8 Jan 2023 16:57:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234377AbjAHQ5O (ORCPT ); Sun, 8 Jan 2023 11:57:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234558AbjAHQ5J (ORCPT ); Sun, 8 Jan 2023 11:57:09 -0500 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4D3560FF for ; Sun, 8 Jan 2023 08:57:07 -0800 (PST) Received: by mail-lf1-x133.google.com with SMTP id d30so4621210lfv.8 for ; Sun, 08 Jan 2023 08:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wA5AiX0NaM0jBANyKexsBLsA+hCFuPZNSNXMRY2+crg=; b=LOQ/BphYVdNvhnf/egBtgsBkeBq/iyUPPVmRYm/nO1Z2O/dLMm6P9a10dVL2LYVnhl ZJaYQRLfGZl/djnZfUvvq/IVtjk6wRfCAj1YyhM/95zVXPyEgzEnKUTme9I+SMhOZ9VN tqYXXkxjX/u2nBvR//SmiqFTaryGDHf3YJQTeg9FD4gShpUC1sMDNWs0Z21DtX0mthOm 9TscPQaDvJVIComZkNhN1l6r+58zIS6bs3Lgcr54urTVgsypGbicAoC+XXHkmXKmZPQS 0E/A4XmlBfPj4mMpIWhCrToNJ2cIJ3pOHxidxshz4NcgPlb6yfJkRMkeoBGOk7P/4Ygr h1Cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wA5AiX0NaM0jBANyKexsBLsA+hCFuPZNSNXMRY2+crg=; b=2sPnaQy/NIF/UD0qCuj3orRAi/dQR7yOrMIgkDAPd2e6M6VBG/+8VPeJfWoKswCbD5 Wcuv8oXBRobAIuohuMwwakxhn+/jO5m7YL6VmJD8b0/xLC0BWBIupZgNYHI9+OKtLRn8 OF+Vb0F2AJRDwQ88RxrTB/67t49ebPC++dpsMnTv8deONhs0ufBMEK14K5RBvY7r/0lE M3TlCRcIGYDMNvgJeClzCzTnoe9qbcZlGT5AqxKLykzg1OzIEplF/vhrlGdGLOZQSzsF mrUboFpN02s60tqsOd2ka5eFC4Ly/uvZOzPujlzsqEWvmD99uTWd/haVqFh0YXAR82WD fvuw== X-Gm-Message-State: AFqh2kqx7zMWUIjk6YemVKe5pvhZ8rcMP4+bbqsRW8lUVcEVlX4YVhzj Q3KgvdSFc+H85fJvzXBZ+A0Baw== X-Google-Smtp-Source: AMrXdXsBQvfRM2B1bpbJSaSfpXHViTtgbN+E0OM0dXWVg6QUFNkCB/niTh1efMBo9JZvIOLeeegg2g== X-Received: by 2002:a05:6512:1111:b0:4cc:7e0e:8d5c with SMTP id l17-20020a056512111100b004cc7e0e8d5cmr772906lfg.37.1673197026860; Sun, 08 Jan 2023 08:57:06 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:57:06 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 12/13] drm/bridge: lt9611: stop filtering modes via the table Date: Sun, 8 Jan 2023 18:56:55 +0200 Message-Id: <20230108165656.136871-13-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org The lt9611 bridge can support different modes, it makes no sense to list them in the table. Drop the table and check the number of interfaces using the fixed value. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/lontium-lt9611.c | 41 +++---------------------- 1 file changed, 4 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 82af1f954cc6..df9f015aa3a0 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -84,24 +84,6 @@ static const struct regmap_config lt9611_regmap_config = { .num_ranges = ARRAY_SIZE(lt9611_ranges), }; -struct lt9611_mode { - u16 hdisplay; - u16 vdisplay; - u8 vrefresh; - u8 lanes; - u8 intfs; -}; - -static struct lt9611_mode lt9611_modes[] = { - { 3840, 2160, 30, 4, 2 }, /* 3840x2160 24bit 30Hz 4Lane 2ports */ - { 1920, 1080, 60, 4, 1 }, /* 1080P 24bit 60Hz 4lane 1port */ - { 1920, 1080, 30, 3, 1 }, /* 1080P 24bit 30Hz 3lane 1port */ - { 1920, 1080, 24, 3, 1 }, - { 720, 480, 60, 4, 1 }, - { 720, 576, 50, 2, 1 }, - { 640, 480, 60, 2, 1 }, -}; - static struct lt9611 *bridge_to_lt9611(struct drm_bridge *bridge) { return container_of(bridge, struct lt9611, bridge); @@ -603,21 +585,6 @@ static int lt9611_regulator_enable(struct lt9611 *lt9611) return 0; } -static struct lt9611_mode *lt9611_find_mode(const struct drm_display_mode *mode) -{ - int i; - - for (i = 0; i < ARRAY_SIZE(lt9611_modes); i++) { - if (lt9611_modes[i].hdisplay == mode->hdisplay && - lt9611_modes[i].vdisplay == mode->vdisplay && - lt9611_modes[i].vrefresh == drm_mode_vrefresh(mode)) { - return <9611_modes[i]; - } - } - - return NULL; -} - static enum drm_connector_status lt9611_bridge_detect(struct drm_bridge *bridge) { struct lt9611 *lt9611 = bridge_to_lt9611(bridge); @@ -832,12 +799,12 @@ static enum drm_mode_status lt9611_bridge_mode_valid(struct drm_bridge *bridge, const struct drm_display_info *info, const struct drm_display_mode *mode) { - struct lt9611_mode *lt9611_mode = lt9611_find_mode(mode); struct lt9611 *lt9611 = bridge_to_lt9611(bridge); - if (!lt9611_mode) - return MODE_BAD; - else if (lt9611_mode->intfs > 1 && !lt9611->dsi1) + if (mode->hdisplay >= 3840 && drm_mode_vrefresh(mode) >= 31) + return MODE_CLOCK_HIGH; + + if (mode->hdisplay > 2000 && !lt9611->dsi1_node) return MODE_PANEL; else return MODE_OK; From patchwork Sun Jan 8 16:56:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13092619 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 88150C63797 for ; Sun, 8 Jan 2023 16:57:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235893AbjAHQ51 (ORCPT ); Sun, 8 Jan 2023 11:57:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234683AbjAHQ5J (ORCPT ); Sun, 8 Jan 2023 11:57:09 -0500 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E6F9617B for ; Sun, 8 Jan 2023 08:57:08 -0800 (PST) Received: by mail-lf1-x132.google.com with SMTP id cf42so9556696lfb.1 for ; Sun, 08 Jan 2023 08:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jsw80iE4Bz5Oyb4Yui9qzxM/xJUIMCcqN7Ll6Uw4NDY=; b=alH/lGvw0HcCLjFAslrqET+DjUrHL52unC6JngmkQo3R+u4GToTofXI41ORv5lGv3x V6lJn+39OHyT5/6+l2VRTjDOV8APqJVdBOmtqskna7BCh+31sle2sstwtuPOApV10Vtb 2pTnwOmsuzCPUBnyDh6ZyuOU67os8gdzmNqeVTcZrECtTijODRYtMLJD26M2gH9Tan3H Ko1KerXL7SWgPX5UN0kCSgkvBLQcpE8kHH44fDzM4rILX0Ep/BwtLhkgsDC56+WsYCRg JHSQWRaZvVIE8xk6XoK5VJBrqS0DfVHbrfbmXSdeWSLIVD9Cgi99blLEw+R9W5f+E4HV Ejow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jsw80iE4Bz5Oyb4Yui9qzxM/xJUIMCcqN7Ll6Uw4NDY=; b=i7W4Vo9uE3dXW278a5pm3UhQsDrt903Fb96IIuR5Qnjl7341C5LWDpI2XLeXaQ7s7u FeZZe6IppgL88+c3b9UfrQ+RAU0qsUl0NNN5lfIFmo+kuolYkccAGYtjvng+4xVWa4DN fZknA2o3IDPe9V7aDKPS6WR3n+f0QQM7xXC1eW9qfjwWBBl7XVWuIOyr4Ngraf2F+o1J 04p7im1g0fF0NwGTIalLvwwYx5FPgmuHpkhb9kBhvDMgTXDHdlE1CHmrT27laH3wC1N4 IFuESvWD8wHKA4DmRP2R9oe1ow3kf9QFSj5hPkhygD4KiGOGdPESICqh/0KwOTQZmqzs sZGA== X-Gm-Message-State: AFqh2krQ0ytQ//vEhpDmiTgqFkxJhpCckMqgEWCdWTfo3C84a/OKcuax zNsaKYiHu6cpGtGY3Qyp5UuCFQ== X-Google-Smtp-Source: AMrXdXtFKEVoP2iuRUwM0axgQM+w8vmZcyRa7+dy2pWh64vnZwOeWLem/37rL7Xv8qcFt0EsZpOOQA== X-Received: by 2002:a05:6512:3e1b:b0:4b5:5616:ecd2 with SMTP id i27-20020a0565123e1b00b004b55616ecd2mr21993729lfv.55.1673197027668; Sun, 08 Jan 2023 08:57:07 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id s2-20020a056512202200b004b561b211adsm1138323lfs.254.2023.01.08.08.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Jan 2023 08:57:07 -0800 (PST) From: Dmitry Baryshkov To: Vinod Koul , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [PATCH v2 13/13] drm/bridge: lt9611: properly program the dual host mode Date: Sun, 8 Jan 2023 18:56:56 +0200 Message-Id: <20230108165656.136871-14-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> References: <20230108165656.136871-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org If the bridge is connected using both DSI ports, the driver should use both of them all the time. Correct programming sequence to always use dual-port mode if both dsi0 and dsi1 are connected. Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/bridge/lontium-lt9611.c | 28 ++++++++++++------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index df9f015aa3a0..561da6bd2698 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -118,7 +118,7 @@ static int lt9611_mipi_input_digital(struct lt9611 *lt9611, { 0x8306, 0x0a }, }; - if (mode->hdisplay == 3840) + if (lt9611->dsi1_node) reg_cfg[1].def = 0x03; return regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg)); @@ -191,16 +191,6 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod { 0x832d, 0x38 }, { 0x8331, 0x08 }, }; - const struct reg_sequence reg_cfg2[] = { - { 0x830b, 0x03 }, - { 0x830c, 0xd0 }, - { 0x8348, 0x03 }, - { 0x8349, 0xe0 }, - { 0x8324, 0x72 }, - { 0x8325, 0x00 }, - { 0x832a, 0x01 }, - { 0x834a, 0x10 }, - }; u8 pol = 0x10; if (mode->flags & DRM_MODE_FLAG_NHSYNC) @@ -209,10 +199,18 @@ static void lt9611_pcr_setup(struct lt9611 *lt9611, const struct drm_display_mod pol |= 0x1; regmap_write(lt9611->regmap, 0x831d, pol); - if (mode->hdisplay == 3840) - regmap_multi_reg_write(lt9611->regmap, reg_cfg2, ARRAY_SIZE(reg_cfg2)); - else - regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg)); + regmap_multi_reg_write(lt9611->regmap, reg_cfg, ARRAY_SIZE(reg_cfg)); + if (lt9611->dsi1_node) { + unsigned int hact = mode->hdisplay; + + hact >>= 2; + hact += 0x50; + hact = min(hact, 0x3e0U); + regmap_write(lt9611->regmap, 0x830b, hact / 256); + regmap_write(lt9611->regmap, 0x830c, hact % 256); + regmap_write(lt9611->regmap, 0x8348, hact / 256); + regmap_write(lt9611->regmap, 0x8349, hact % 256); + } regmap_write(lt9611->regmap, 0x8326, pcr_m);