From patchwork Wed Jan 18 08:16: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: 644264 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 C86A1C38159 for ; Wed, 18 Jan 2023 09:00:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229561AbjARJA0 (ORCPT ); Wed, 18 Jan 2023 04:00:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbjARI6p (ORCPT ); Wed, 18 Jan 2023 03:58:45 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14C3555A3 for ; Wed, 18 Jan 2023 00:17:02 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id ss4so73993339ejb.11 for ; Wed, 18 Jan 2023 00:17: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=WANyF2F/RgYw3X0PQ15siC75t9y7XEggYSa5zgiK7xs=; b=w3pX+rZVu0y1aN6UOW2+7y7W1c+5KInTOYxSZxwn2lUGSfYO2mwRBmvY+TYeewqApi 7gegKNXqiw2VaMBNA/sk7o51jRBlsKNcvT4v4fVuJPWY4SPGjXLg542X3EFLLwti6cfg pGd6EXIo88vo8+CpX00YmmycF1XElScAntM1hC0XaPnWLFcMhsMz4jcaoOvABts1AR+R fCn0Aum+sP5Z0iC4udsaSa59hPjfhwSUu35aodORV7Lony7NENfU/7yMALdCV6NSZnik +D8gpJkgvc6LuWtoabq16xUaSf1sZ6yETGGzifgxxC5ka6ZHtpQBy5c6sm09CmCcdsGX t/nQ== 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=WANyF2F/RgYw3X0PQ15siC75t9y7XEggYSa5zgiK7xs=; b=PNywUcSroTd4u1zVNTaJSAjdry1HA7bJO7Gzc32KmVZCQEtjy8SCkcOr43TQxiYADi eefNnjYKZsyfn4zlsIwAP9ZUD2Hsg1VBRvlcVB6M23G8gSL2b3fnOOmU6OxmiymxfDcP a/nK2OOxAqmh5ZaNRbNoEoD5tUM84667iicRpdJbArSENPq0cWm2xqCHDmlK6iAZ4wU8 9QU5dZVLZoBuPQ1NVu83tEvMfNV31HysLm2YpvoBa9epQU87y76ymNFULK9MnajNFjzM mg8V0QYPAbivmRFfMUPliB5oSemaeZdNvboqcts71Cadw9WMNc+EM/lh2vFNwsr+pvo3 Uopg== X-Gm-Message-State: AFqh2koVuDepH90uJI+ETUgs76WxU2T39vmgwuTrh2zkXUWUkgKoVzyC I32QpLC11o9YnMHO/ISr087iTQ== X-Google-Smtp-Source: AMrXdXt+Wg6xcTrkPiQyiXb8RxciTGBL7rIrHsRt08RnF1gyMk5qwxdnlQb1dkR86ClSBBpvc8FVQA== X-Received: by 2002:a17:907:d007:b0:829:59d5:e661 with SMTP id va7-20020a170907d00700b0082959d5e661mr6164457ejc.29.1674029821376; Wed, 18 Jan 2023 00:17:01 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17: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 01/13] drm/bridge: lt9611: fix sleep mode setup Date: Wed, 18 Jan 2023 10:16:46 +0200 Message-Id: <20230118081658.2198520-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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") Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16: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: 643773 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 6B0A2C38159 for ; Wed, 18 Jan 2023 09:00:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230122AbjARJAU (ORCPT ); Wed, 18 Jan 2023 04:00:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjARI6s (ORCPT ); Wed, 18 Jan 2023 03:58:48 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E38CA55A4 for ; Wed, 18 Jan 2023 00:17:03 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id ss4so73993437ejb.11 for ; Wed, 18 Jan 2023 00:17: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=ffQ9QQ9cEmbatl2Z6drUHQqKYZ2qTHMnm6bqB742ivs=; b=F3zx+o8HIciBkmGlZ+KOd0AIVFAcURL/lkf64wkVSAwBgPm3cGlgJuWYDZEsGvLfwp +QGc9hsDxeCVjOCjyOnA9rkbu6uOwNyDpR0rbhT0JvKt9uAMSwbIDKctKCinSov1wv45 1/D51glaQZp2RT7nlyZpdvV+IMtdRc6FpGTFoynyDdyAjumO4sLqHHjtdTaWs6TQ1Ugv yp80S+jU/l5mPKBX5nJbeuhrafJCw73QYYpDbnkpHosQ2VYdPdB/OqZYoR+JKbMasVHT LoMOD1MgGrZnG/0YPZFjSQhDeNXOfAljeuKez4cCNXJSDBW7jfMTnuxubSz791yQMiEp sbDw== 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=ffQ9QQ9cEmbatl2Z6drUHQqKYZ2qTHMnm6bqB742ivs=; b=Jl8pvlV5B0QPABdgsDGCW0y5z7AsgUmx5z1O39UVfeXqEGLyM4AuFu63CqNyHTtRbx mF1rHiRlahZiJqQAJSqJehwLunYMw5mTpYV5gSTvxeTm9DBIXJOq1qiqwxyt1e5Ra4A2 dD21Ew1/dsxxIiHTe6Y57ME1ij/nJClxNs14Nd7znwkcU57i39OJbKylqH/o/qfzj3OG sEytJ+jdKyJN3Lc7znlPMjvj5clHbBfdkscBiMjHSr+LVhDe/QRLa0oCBJBd4bKFkow2 RhcFcT1iuPNWR0gtKfpATcOq0i/aDj8RbqLyKEpBGC4nlWP01O7/fJA8w7j6PW3H9dVj Ly2w== X-Gm-Message-State: AFqh2koXXCjcNRgtIBi9q59ehyDsX6WXT36nX7QDyiJtctkv7P3yKhRH Evt1psq1pAUFO+v1SdclK9bzExZWKRw/FgAS X-Google-Smtp-Source: AMrXdXtiaZSjxKJh/ME5gKEx7BWuOcQQ8+DqDHHvx22LGspB9fRkBIkiA8kRle0Io+wJBIym3/d0hQ== X-Received: by 2002:a17:906:230a:b0:86f:5375:9f63 with SMTP id l10-20020a170906230a00b0086f53759f63mr5192973eja.39.1674029822451; Wed, 18 Jan 2023 00:17:02 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17: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 02/13] drm/bridge: lt9611: fix HPD reenablement Date: Wed, 18 Jan 2023 10:16:47 +0200 Message-Id: <20230118081658.2198520-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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") Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16: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: 643770 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 1285DC32793 for ; Wed, 18 Jan 2023 09:01:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbjARJAp (ORCPT ); Wed, 18 Jan 2023 04:00:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229637AbjARI6s (ORCPT ); Wed, 18 Jan 2023 03:58:48 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF59355B5 for ; Wed, 18 Jan 2023 00:17:04 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id u19so81225087ejm.8 for ; Wed, 18 Jan 2023 00:17: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=jBfCqrDR4MpJFEnebR6McOavUtbCVSzMNuhuevH6nB0=; b=CIGRp+wi2KsKMXXI/Fr+WhpcoI96+VtHe0oNYw438BSi2i9PPSRrZpzg4pztss+1PS KLtjg7S4NJzirTkchGwnCVwN/eSaZU+aP5h4kIfNufZ1fLCgXjIOb35hwkjyHIcFZiMr t4Qh3dD4vxUusLQbjyqEf2p7udMf1ZgSwHuqjngaTuy/BMRGuPK2kEvTfr4NOZ4vJvte V8uOU9KArSDi0tK9cvyIkP45ZqlCZeOlRVLUrEo9ShaDDKB5m3BxSuK08jkTqHzkRu8H 85s7AOzJ8Y9fuINuBgThauZJw5rcGG/99DB/44OAJOGChkxVLm0AjPcHmwrccKqRHg7c Sprg== 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=jBfCqrDR4MpJFEnebR6McOavUtbCVSzMNuhuevH6nB0=; b=q6wI7I5o8TeQu4HFEoUS18/AhJKoxo97Z2GT6Q4EKBE3b/31xkzVUh5Q8LDYc58+Zl qB6hFjvJ0h/G6gZrombl4QI465Cpuvj6RLlzAJ8neee6ZD5YCk+2pXq5J92GNjVGyDPl TuGHWnPu90MoXcF1QMYgZIonFRs6OL+liYkXa1Ae3th2RJZiZDEaYsAz6FOx1oLPXFSw ml6fbyqPRdtqs0afyp+2ILosRyXKjpkf9hp0Evzon7YTpNojE9xa4Q9IQmDTpo+nDe5I mV2G+al15gjZ9FcUQMBnBOED4nnJS5YtsWAi6FtGVOxXqgM6l0eblxC/DN5Ve5YTEIr9 41Xw== X-Gm-Message-State: AFqh2kqALVEtPkr+c1XmQzKlFuUEK/GBsuw9mhtSwK1GvDVRg+owz/ep PY7ddNJUlgNX7YDNfZW6Z26RHQ== X-Google-Smtp-Source: AMrXdXujXPrQ+U3YPkv1Up45oc0vaV+q3Os8LYgZ1Fvx09I8JVuo7j5nIjHce/ZSu1JaB5xDm0OR6Q== X-Received: by 2002:a17:906:d8a8:b0:84b:b481:6188 with SMTP id qc8-20020a170906d8a800b0084bb4816188mr2050170ejb.64.1674029823456; Wed, 18 Jan 2023 00:17:03 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17: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 03/13] drm/bridge: lt9611: fix polarity programming Date: Wed, 18 Jan 2023 10:16:48 +0200 Message-Id: <20230118081658.2198520-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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") Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16: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: 644261 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 58001C32793 for ; Wed, 18 Jan 2023 09:01:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229811AbjARJAv (ORCPT ); Wed, 18 Jan 2023 04:00:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbjARI6z (ORCPT ); Wed, 18 Jan 2023 03:58:55 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 818EC6E98 for ; Wed, 18 Jan 2023 00:17:06 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id kt14so22384985ejc.3 for ; Wed, 18 Jan 2023 00:17: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=2+GwFGuHURa9u3Ijog1S5HZ1MuVt0LKqtxKhtevrnGE=; b=XXKEc0cdVABrKza8PldX1r7edCiQA5WbeuLkA/B9c9m7BaR/OZz1cu9SPRU0kHnKzv p9mh5rgYKh00QfVDDJVp37PjmoqxJYk5C5F71fF5sxwn5BduxoZ4cN9+WWcoC0rwkU/m Hmoy9VJ8sssmoME99WxmKtsi6aEQlBW3HvbjAPqW9JSbROOafu3ObpZ5stIY3n92t+ff PZ/2c/8aPJjxhdUBLyBY5gf0j2FzaNCz3YnTo+v8rYk6TrFb36hMkpPmSxB1riTpQjxL Kwo4pqvwN1UD4Dcm18t6ixonWr3gekmfHHOnWQBlPI4zAq+y7oKoC34WH/1jQyzXsv3m BxpQ== 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=2+GwFGuHURa9u3Ijog1S5HZ1MuVt0LKqtxKhtevrnGE=; b=VWno7VNgmYhBiK9JmzhK6GjoKKNmFw7Q8Y/fAGns4oDQVqN/1R4LC/w0Qx7hZjciVm fxgAqo+ENr23AO/nwqFjN6ytD9n8JPQs895sxN6/GL1WDaB5V+sQxA2lrzF5s+9xjy+c i+GdmoriIdlUZHrv7FoI56DdGVSXADFFPby6bMyoK6nqvspgGjmSymP5OTegS8FE0O4X uGCr2Ke0D0RytFs6dm5Pm6lPQMzKrKMzpt456ygwhi8STB5WvKmPljGi1bnZkTMt6+gd 9S3ccTIDXJ83wNmhp86aAo4mscn+S4ho96JQEdsyJ8O7YnZbugV55tBrSECEJQqIETBT BI5g== X-Gm-Message-State: AFqh2kpOShJHLWeKYZC+9UpW7e90EWFnAzIIMZFnqNQXSO0mqStnbD5T FaMHLx6Gg0V4b8fP3tVSFNjKHA== X-Google-Smtp-Source: AMrXdXtm2Fvr9sRQuv4VdZo5ULfq0W+0uB2MTEzG3Xm1YqV68IOxq+pDjWfJw5N/BIqqVuJMNXsLlw== X-Received: by 2002:a17:906:e0c5:b0:86d:67ee:d607 with SMTP id gl5-20020a170906e0c500b0086d67eed607mr16081680ejb.64.1674029824691; Wed, 18 Jan 2023 00:17:04 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17: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 04/13] drm/bridge: lt9611: fix programming of video modes Date: Wed, 18 Jan 2023 10:16:49 +0200 Message-Id: <20230118081658.2198520-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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") Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16: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: 644263 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 1440BC38159 for ; Wed, 18 Jan 2023 09:00:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229677AbjARJAd (ORCPT ); Wed, 18 Jan 2023 04:00:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbjARI6s (ORCPT ); Wed, 18 Jan 2023 03:58:48 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB12D72A4 for ; Wed, 18 Jan 2023 00:17:07 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id az20so62188580ejc.1 for ; Wed, 18 Jan 2023 00:17: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=3EPo30eXxIqiDes4Q3ryePcQbuaNGcUHr9bzE1lqhMk=; b=V+M888y0DsTbf8ukmahbdvJjbXld+C3mtg7f28nunecY+1HHOZUPuCcguw6Agwen/e zawTVdDGcU+pKKLfpMuuAF8e5dNOtWOFP70kyVbBUQtVxAs1JHDH01KorSMqPKGXMrIO iaa5qgvd4GVRUztRgtytC9XKntAMZ9DUi+rH1NSJfeQAO3gpdpFnVHOXAt+akz1JgByT 2OaqCnTgA2Ut7tzhstjpi3xYGmXcNcJ+CFVSDiFp63YL5WJHmIFcU9nvFpObgYRTDErs W9+hUuZ/2uvgPiVZ8TCRak50p6aFoYx652fpuR4goECvO8v2sSDgDG1Pa9nWHOBwO968 OluA== 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=3EPo30eXxIqiDes4Q3ryePcQbuaNGcUHr9bzE1lqhMk=; b=1FTp9SYrdShNbrlCsgZLmI62tKp36X8RHI5L8UP84WwZBPzEGzLgScY8uhr522pMY9 jzZCgdO+2gIcn1BqGZeRG+ZfKBIG8zXv2O4jsYxzPGUuADMIELw7mIdWqJ0SeONEH+oj 8VDpzL5+7g5sejlQX1v5o38B94bJUElgRq9wpwE4OUwn293Uw0y2OCSXyKfetVYuUkWv LVImGs9zRJJNTLpNS/tLvEdsOQFl5DB3NMxWdmcB/4mxCm8K31RzPH/Qnb/OvY4M32nF AoFemyVzutsHOBSvGzhelPgBfXaRHItrZJfKhcI+uTNXDgdUT01BQqXtAk1ee+6HOCdb WKlg== X-Gm-Message-State: AFqh2kpOSMmWZVgznyo3AJ0djUMm9orCCoszykA6NfnNgZNiv+K/RwQe P7YtXFJy3qysxU5RRgh4PriIgA== X-Google-Smtp-Source: AMrXdXueaqKIjBvQTVPvF1em064T6cm/Li8AuOULGgIZVnUfkC+UD9debypBCj2bvQ0OtCqs5E66Yg== X-Received: by 2002:a17:906:a24f:b0:873:4ebb:94cd with SMTP id bi15-20020a170906a24f00b008734ebb94cdmr4651244ejb.10.1674029825760; Wed, 18 Jan 2023 00:17:05 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17: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 05/13] drm/bridge: lt9611: fix clock calculation Date: Wed, 18 Jan 2023 10:16:50 +0200 Message-Id: <20230118081658.2198520-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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") Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16: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: 644262 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 0B10FC32793 for ; Wed, 18 Jan 2023 09:00:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229769AbjARJAm (ORCPT ); Wed, 18 Jan 2023 04:00:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229620AbjARI6s (ORCPT ); Wed, 18 Jan 2023 03:58:48 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D34577ABB for ; Wed, 18 Jan 2023 00:17:08 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id ss4so73993888ejb.11 for ; Wed, 18 Jan 2023 00:17: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=Z21qabX0zA0LOCrjyd5BOA9oMNili5LM3YkrVmBV2Eo=; b=miHFnkPBaZGBZf/Q+RwZ03zBxicSB0GC4It/AoIceWlaEUI3cB/wA8NvOSz78BmNR5 R/BFzSoHyY7rSq5HDWmm8qXH7rSOihIbgusOus+AQSFdokZMIOM8fauF5pjGcXscgyCG yFf9eXa2FimHCNRBjYhLJ33HwHi0scOQcuWSKa5/Sc2I9JPEY2FxeFIAwABOL28SNWBP KvXK7ewf13f2QlTzY3kLLb3VywOZWmrOK2axqdSu5RnJ0J0K9HGVhG2pvAJpEXXNMCnc FlK/xF0bLFZLBzeatC5lsPaGfWZKOP+M9kUmDxbGHat+33jcnLX3pjwEDDhxk3xN7X9y ogFA== 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=Z21qabX0zA0LOCrjyd5BOA9oMNili5LM3YkrVmBV2Eo=; b=oODB3fwPxXBXhL9Wg+WxJ5uRUP9EtrcL33FVQSczS/vtS8F1N+uLtF9CmXkObFVOwo /6DqGphjZqOQxhQEWDRUR9OJIYar7z9F+Kr+FfDw3SH/ybwu/GGPpDbMhRaIJ682g/+i WYnSiFZUs/rF3NpsX0yQY2gXDXjzbzTB4G6lfTyaeY3kKouZnRKIpFdQgwWSqhE7S4T1 G6LlZploKnL8zkQgGKYMpmt5dRv54wILH3ojM0QgQlfIcM53QJPvJxPV5m8F7VVR/KAC uWqimQCWWhnCgbibnMzDDYfc2Ezaq6XI+53GQNGXfCDuUyWtCTpf189/GE6Z4VBmUzv8 bovw== X-Gm-Message-State: AFqh2kpvLMYQX1nNgaVX7VmZO+omjdlaVRvypsvAKmic6KWpKIOTAKrU evR3cGeDrau+Zdcg/gBuZHgYvA== X-Google-Smtp-Source: AMrXdXv54Cd9vgBkUt9dwbHyzGs5tvEicxpFcmTNq4XN69Jnw66LcHPusI+mYcTMN6hVRR35tkYctA== X-Received: by 2002:a17:907:8d16:b0:84d:43a0:7090 with SMTP id tc22-20020a1709078d1600b0084d43a07090mr6629133ejc.77.1674029826804; Wed, 18 Jan 2023 00:17:06 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17: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 06/13] drm/bridge: lt9611: pass a pointer to the of node Date: Wed, 18 Jan 2023 10:16:51 +0200 Message-Id: <20230118081658.2198520-7-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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") Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16: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: 643771 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 23838C004D4 for ; Wed, 18 Jan 2023 09:00:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229738AbjARJAi (ORCPT ); Wed, 18 Jan 2023 04:00:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbjARI6x (ORCPT ); Wed, 18 Jan 2023 03:58:53 -0500 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D34EC7EC2 for ; Wed, 18 Jan 2023 00:17:09 -0800 (PST) Received: by mail-ej1-x633.google.com with SMTP id az20so62188819ejc.1 for ; Wed, 18 Jan 2023 00:17:09 -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=CQXRJpIEx1m5W9dKJ1KEjOKQXiphyajnal/aAWcW0NQ=; b=P1lS85P6uArn1vTeO/PQFLeL+/8ELt6sfNZlB9RDTP6xSdQiQaM3r9D+UrPmDshJz0 Yso1R/mOZ1gRi7vWvEZLU85rOKPtKuHY55DKfY5SN4LE3a1yz0YpTlObcx64NXxmp7Gg OJC6dtzegFKeUD8fXiwgmIEt2dOK/I5W3kGXiOHPXnziKkIKDJxHTEj8WlczzYUbdyTm 8hZgb7iCApyRpn7OSCjdjfuc7ICWvp/jECz8HPmvA9tw8K23Ovi4sgfiEwgjZUYjZ+W0 zY9/iAfRIbJNVIjUFDMcBE8eQ/CB6Y7PbdPjZk4wnGjAvu/n/gCA4u76Kwltlwf9b7SM eo5w== 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=CQXRJpIEx1m5W9dKJ1KEjOKQXiphyajnal/aAWcW0NQ=; b=T1Jky3DjKUUGezbSXAoOarU5WSbwtAMDRPs+E70jP89wvkCFXZMpUe4SJm+Lnv9AwZ awZJ2pV24Y2HvCHyI9D90NH8b1qC5Rfy5PuNY07xcj6U9lAK3nYMKqVaxq1mIVPWOKnt Boae+rs8LyfNExo/xz3lzzfWkfjaJEEo127iRBFyNjsfIqudaq7tCMkyWs+yigl7JPBQ xo2Fos3wqRDVS8rWJHhmiiXZ6tJGVAcgCnw6Z9jWQKpuNP2yDCVx15Zy4EUV6rMXokxD v4CiUntVwduweW0EliHIxbL0pOyBmbpVr8nucmm6eKxqesBgoFy5nNaaz9uj/hBkjrLa WmPA== X-Gm-Message-State: AFqh2kqJ+Vv+GaaheERoGL7r2MuM73L021fYAfrz+qWdZAlQyCXNyAyW JgOGUs0KU1Gfhp7baIT6uUkbCg== X-Google-Smtp-Source: AMrXdXtHyizRqiSU0MbwJfy1jHviM3YzZgYYKcOteerItybZSiMaqVgTXDPskslOHsB/hYQR++SP+g== X-Received: by 2002:a17:907:2a53:b0:86f:8ccb:5d1e with SMTP id fe19-20020a1709072a5300b0086f8ccb5d1emr5395021ejc.17.1674029827946; Wed, 18 Jan 2023 00:17:07 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17: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 07/13] drm/bridge: lt9611: rework the mode_set function Date: Wed, 18 Jan 2023 10:16:52 +0200 Message-Id: <20230118081658.2198520-8-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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. Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16: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: 643768 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 3B669C004D4 for ; Wed, 18 Jan 2023 09:01:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229845AbjARJBQ (ORCPT ); Wed, 18 Jan 2023 04:01:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229775AbjARI7N (ORCPT ); Wed, 18 Jan 2023 03:59:13 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F0395EC57 for ; Wed, 18 Jan 2023 00:17:10 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id az20so62188927ejc.1 for ; Wed, 18 Jan 2023 00:17:10 -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=HQ2aAg4fbCsXcPNHxikuTzFNlTQ8Wf2P2yvZM2CoT7I=; b=wbGN9XesHSuigRGRQmxOV6IC6S2rfEmd3K8Pu67HwaRq6Of/RxmaBDbbkKRyFKSit1 bo2Mpcljk8GIv4J1hBFvpIYAwl3n5AR4hBAXKyGQ66Y7MsYccCejsyvR6dBmVGzLCQFV ejwKG67HxjEwNB+vy+DAotb8mn0L8BLG6pgt7RObQhfK8LTg1TCiwgMAYvJKqrAX6JDb JdqB5l6bbkVip8mLd0ptpc4N9NFH+pU7E5/gtJORB0AI9rxDol3Tye7s6bjqUKpAyFI2 AGxRk14LGbeMlwBHBx97UKSoSYXmF1aS1A/TUXp/R2AdmrgxkE1r4EAQwzIac7Tncz+O Ygng== 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=HQ2aAg4fbCsXcPNHxikuTzFNlTQ8Wf2P2yvZM2CoT7I=; b=nwU7qOon8So1V22hnliPAEX41lubUcH56scudMf5vbgaK2nX+tOOyE5ji8Cq6HSUX9 7lk6bABLRVdYcPZmj1D0M/ySqkLU0gOt3JqtVmX6/fg7gx8PeZqryoEXIrRol+NJAZwF moN+ntBKYwtt6e4Ymkkg24wjFqNMPmttTB7N+HeZDtm0sa8hc8f6yVO9PIY0Wqe3vku2 wDRxsybNdgbCTxlLnxY0T++VQsbo+604G5vwGxSnvPYXVt026/bU7LH9RAp5pjDwfgNG FfaMUbzpKM1ng6QCq1MV1SpsbU+JsbK/rc7RV7nH6NOoB7Xkcsf973gpmjUzQiHSmWBx 1Jng== X-Gm-Message-State: AFqh2koxxR72II7M2xUmIHZsofVNGO+/yh3gBjHcbzqA3Ew2hyO0pXvu dQdQGZxn+ziTHaABNt/ttoBDzQ== X-Google-Smtp-Source: AMrXdXvlIQa2fwdeIWpM1XFHJpcDn7zmmy2dO1EqDu7cJoWOhFI2KjODo72o3vkZeYcg+KFo5GLRtA== X-Received: by 2002:a17:907:62a3:b0:86c:df3:4bbc with SMTP id nd35-20020a17090762a300b0086c0df34bbcmr9681549ejc.4.1674029828977; Wed, 18 Jan 2023 00:17:08 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17:08 -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 08/13] drm/bridge: lt9611: attach to the next bridge Date: Wed, 18 Jan 2023 10:16:53 +0200 Message-Id: <20230118081658.2198520-9-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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. Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16: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: 644259 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 CFA88C38159 for ; Wed, 18 Jan 2023 09:01:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229616AbjARJBU (ORCPT ); Wed, 18 Jan 2023 04:01:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbjARI7N (ORCPT ); Wed, 18 Jan 2023 03:59:13 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F064EEC72 for ; Wed, 18 Jan 2023 00:17:11 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id hw16so69429502ejc.10 for ; Wed, 18 Jan 2023 00:17:11 -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=qsYZ9kXBxRXYjdXYi3EuO6RFywLtz/JTmCkAqTyPm7Y=; b=pp94AYLoiIe3LR89Xf3QFr/6KwLzz8Tvs9MfgPUhO/l7EO6698cyrC14LjA0NP4ZVN NoNF6lsapl69djMz4p0mQ8vNt1RS9vgJwwYdh/WXqKbyFCWjrL/caBaDn94ygON779bW jDGvW7JkSiXh2HOUcvyyuPy5D3RpVBws5uCxohwwZx6C3EXfUdYkb/NpAbtPsCuW2FxP od267J+kfKsydgGttf1Ye/uU635s7Jgn7NQvcR4rEnDFjJcpBdy6zMhcIUlBJd13/aBg KjFfBYW+MFgCdD6cTgObqvIrc4tv5thcXtbYd9hNiQbvBHA4pkU47SV+u8gZdMNn2g0G JAQw== 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=qsYZ9kXBxRXYjdXYi3EuO6RFywLtz/JTmCkAqTyPm7Y=; b=i/wh1tcq0uXER0VsnE3fjbb3ieid1/i6R89uWuHR8XVBxb/zzFZ7SRKO54ovyCwjA5 ZQrb50HZAdaJLIr0PD02wEjf9GsHP0xcNR4MvIwdhQAMEBaFMV0ZfY2rX/T0lbGcwV50 yXUIfeSLyFJYDPOgOjAMlLZ5juwaVC7PdWXlTuERtlhdsS3/nRwMnJJSe74QMdOiH7BM 7ZkMuPn5e6RCa89dVljTyQqQGCP+oLHyWtHB24s2CdJTFZzDkYL3DZZyrQvaqFSkzyN6 nllkXPA3IIgRVifeWmWyVaUFITZplkO0B/RKy/jDiR2LoR9r30CDTrKDd6WHFjnWSsG1 SwFg== X-Gm-Message-State: AFqh2kpFMvHVmyPWxmb7V8KQviEJs5owzKY7B6m2G0KWs9Yn5RTFBfaz PbDeYWdSsB4ef4CmnkASCypRTw== X-Google-Smtp-Source: AMrXdXvO0vgpkZfSv7xRXpy2KH+wUnsYErZHHrJugp/D35qPYzZLO1n2OVSH7ETmfP9hWN7ehqSOJg== X-Received: by 2002:a17:906:8e0a:b0:7c1:1444:da41 with SMTP id rx10-20020a1709068e0a00b007c11444da41mr21736585ejc.40.1674029830067; Wed, 18 Jan 2023 00:17:10 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17:09 -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 09/13] drm/bridge: lt9611: fix sync polarity for DVI output Date: Wed, 18 Jan 2023 10:16:54 +0200 Message-Id: <20230118081658.2198520-10-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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. Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16: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: 644260 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 8A5E3C38159 for ; Wed, 18 Jan 2023 09:01:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229798AbjARJBL (ORCPT ); Wed, 18 Jan 2023 04:01:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229616AbjARI7M (ORCPT ); Wed, 18 Jan 2023 03:59:12 -0500 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EB5C10F4 for ; Wed, 18 Jan 2023 00:17:12 -0800 (PST) Received: by mail-ed1-x52e.google.com with SMTP id v6so48471226edd.6 for ; Wed, 18 Jan 2023 00:17:12 -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=xKWMWBkiBRp89l37RQ64rpz1WLSSDShciYdrNMM6e18=; b=sVIqtz7UvlrtqEpDU+pmxvqmwI1/B0wi02UzxO3FJlR8+mQsX9ZLJ7uUjj5KerlDjG osQy343Nal1u8S/ISOWrUjsf2Rwz7V1nzhgH0fHmEcotEPZ4CBgmetRVr8Y6V+Hj18Oz NpFUX4hx47xkBaE/SPLRiEwkJ4qEnRN0VH+OzNzwJBugSaGHP+XMmS+Rf80HNI1KKGIG bcNukvAsM8RVeHUy8ujxFI1KmE24bkXyBVpFkJn05YF+bISIIBajHKoW7yk13gjlG9pH wEfR3FT9wSeGL76QpKdJ6407sICTWYDcP0oWVHyiOXpyGMPSLxV7oKUI0ac1Erk+Klrq nPOg== 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=xKWMWBkiBRp89l37RQ64rpz1WLSSDShciYdrNMM6e18=; b=k2lSCGDPizFERwt3Nrlb5RC8ETy7OylM1sXMLqb6ZdLN1IpVftny6brF/GL9sanmnq G7DcSAt8Br5J0idbjvKAFcLY0bKS7H6sCXpePkdb1ln9NJvn8r2il/Wax+wQ5xniTMR+ z3SsEX8H65++5T1jUd+xIzHnSsZeSgGH5ayzQ985xXT3uR/JEzG4nTrtmUtcLjFlR5sV 9ja8fti9ETRbuUhu21xMHP+9hNX6N7Sl7BGuS2U7TifRliMrzfNCgHk9eNJ2AK66tbgO gB3OQixXiLLMM5caaoMv4TcxyP/IgXFLKwFDEPnGROE4ZZwb0xA49lh7Wb5iHhLaPeCW xAfQ== X-Gm-Message-State: AFqh2kqo6YHyed9ysyO36uWqzg18FcJruCdVZqK+k4NMFoT9Io64WO3H dBUlx/L5l8SIlQnQ9Cf7NL2F7Q== X-Google-Smtp-Source: AMrXdXvLHdymmreFDJFQdXc4WZTlX5SHLKz8w75pA9lqpebRUNjm+Gfu1+LHBnrg+EUkwF3JkvPZ5Q== X-Received: by 2002:a05:6402:2289:b0:498:f82c:7068 with SMTP id cw9-20020a056402228900b00498f82c7068mr5001316edb.35.1674029831043; Wed, 18 Jan 2023 00:17:11 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17:10 -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 10/13] drm/bridge: lt9611: simplify video timings programming Date: Wed, 18 Jan 2023 10:16:55 +0200 Message-Id: <20230118081658.2198520-11-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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(). Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16: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: 643769 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 D5232C54EBE for ; Wed, 18 Jan 2023 09:01:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbjARJBI (ORCPT ); Wed, 18 Jan 2023 04:01:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbjARI7M (ORCPT ); Wed, 18 Jan 2023 03:59:12 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8EC5B3A9D for ; Wed, 18 Jan 2023 00:17:13 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id vw16so18136818ejc.12 for ; Wed, 18 Jan 2023 00:17:13 -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=jN4n/APO0j+iHU4GexQwYo+e5BBUf2euvHCYZprN54c=; b=GQuQHpw7BBP6IlwMv3KHt9QknNYChhIskWdxfWTc/BjlG7eUgyItrA2C3XYgns3fnC BuTNaPrGb1gSOU+NAvQJSiS1fg/M7nEpXcFIMp4bzF1pHOc7ve4i+PwnulRFhmiNFYU9 0VDj9kbsoOxA2b9Z2fzm88tMASAGnah8igGs8y0qJCBY+5NRbrSF/bhJd00K5Sn845cp av38f4mIV/EK2X4eNVCAuhzgNmEKXmyt2qHqVbOGa1GPKmK1UvG7APpVhZEWfppD4Vwv tWXMTphOA3/iyvAaxqlLabW2xeOL3yytEtP2xKqvzc5pC7XYUiQQ187bIFIpnMKE7gWW +sXQ== 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=jN4n/APO0j+iHU4GexQwYo+e5BBUf2euvHCYZprN54c=; b=b7/+weBVy2ytuXL2HHdEED+dxM7EMhhLtg4uVHYqvsqh9r9fBTHBNKWpeMZXdiPNxF KegxU8K7Ito4aJWn5BX6TrMqRqRh8yUckvonQJw8ep5v6LT8Ll0Lok8YviRkclEkjVf5 Z4XpExNZfSqKTx/LuCAJDUrnzZPGd/x5uKo2YoGgrKy22nD2CQihCIEW5HXemi0reXxj SqPY5ZHLxPSVmaQ21zHXL4v/NeMpmn9xDgONZAkCLjqVZFMk83d/mqh3BW8keiTePKa3 RazMWK5NybtvA9I+zRe1XpykXLKL6UYq3Ap+AvuQvfOaN+NWGe/rLxvXZxq02Q8QQDuR +Xdg== X-Gm-Message-State: AFqh2kqzuwOB9+Qnzy5/S7apEiISNzbaetpwi4NK9DopGaLY5I7zB/tU ymt4FN2JVcLJs/89aJRGInit2nr/Aeq1I2mu X-Google-Smtp-Source: AMrXdXtO3joQkNhyuNPKzneSneODhkC5eZgZS9CASCcCHKpNlDFdikws+nKOKpsPU/B19sxhsNI/sw== X-Received: by 2002:a17:906:38c3:b0:872:82d3:4162 with SMTP id r3-20020a17090638c300b0087282d34162mr5844316ejd.44.1674029832178; Wed, 18 Jan 2023 00:17:12 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17:11 -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 11/13] drm/bridge: lt9611: rework infoframes handling Date: Wed, 18 Jan 2023 10:16:56 +0200 Message-Id: <20230118081658.2198520-12-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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. Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 Wed Jan 18 08:16:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 644258 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 81A21C004D4 for ; Wed, 18 Jan 2023 09:01:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229790AbjARJBd (ORCPT ); Wed, 18 Jan 2023 04:01:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229832AbjARI7N (ORCPT ); Wed, 18 Jan 2023 03:59:13 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F117DEC7E for ; Wed, 18 Jan 2023 00:17:14 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id u19so81226046ejm.8 for ; Wed, 18 Jan 2023 00:17:14 -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=7iRO5zobwnMAf5ot44I6NAriyBvIWuLFOAUC1y5raCw=; b=HZ0zSZ3Z3w4RqLmp+bGcbuFXjMe+ULnoxR1lS71MHJONksERVhgeDH1V424TBBQWJF sQrGFe0DLBnnYuhLmPxAo+GROVgb0S9tFhLcTXOouTg3njsGzcf2mWRuRPreIPLy/8Nj hWr09acxJ9mTKpapcibGa6z4zblnnRuKg98zCLAKKIfCJriHQg2oYSUW/R3vD9XY5VKE RfaI3bDMRWkSI6JJ98y+mW8fooeVdRIKWJajxqG0tPBpeBSB7roANvEEqCcBuFwmx2Ho lEI8qEMRNEVdw9E9pggGWKt04Pa0pbu+QJysjebW62sKM/cEcbuxIwHcjbvHJRs8pXNP FI6w== 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=7iRO5zobwnMAf5ot44I6NAriyBvIWuLFOAUC1y5raCw=; b=F7DLQKpt/LM5DAVzOKUoK+Ci8p7X+zNcaM4VX0v0UOLlhQ4r5wtNwzb6HUSpgSD61R YGoe89Ebfp+y+7Hw7mV8SpCg8VD0RIxI5uf8GanAhKpjX7ecTkRSBT19Ws3quEL0eHrh +Sy8m+Mn7/BVNMnKl0aiudszi9BQ/dNK+5jwhuDEF+zEeRW5U9LeAE9L3vTZeA4Ml7nI oBtZX7zH1tz+BLKtLvZqRY7753eB182dFT2x8ONOMI8jWBnu87vVL0Kx+IQxVndHY9eX MDGTrWl03yoQJ3sFzBonbz4wEpKZ6sajtl+euYffLECwWZanSKrcDUHxSkyFJFjXbmRZ gELQ== X-Gm-Message-State: AFqh2kqdh4LKija+xA3Lyy5Mw1oNmFV9gh5s5kYQHI2BB+/T4y/RPDgC Gyxtoa9pVtbRld8XKDP0aPgJgw== X-Google-Smtp-Source: AMrXdXscwnGp+t9+zLyWaTX06jajtPcXPCxyKDwib+i96HA+T/G9V6Wzq4cxmFXTV7bNN/guIvW9iQ== X-Received: by 2002:a17:907:2c66:b0:7c4:f752:e959 with SMTP id ib6-20020a1709072c6600b007c4f752e959mr6847828ejc.33.1674029833247; Wed, 18 Jan 2023 00:17:13 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17:12 -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 12/13] drm/bridge: lt9611: stop filtering modes via the table Date: Wed, 18 Jan 2023 10:16:57 +0200 Message-Id: <20230118081658.2198520-13-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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 | 49 ++++++------------------- 1 file changed, 12 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/bridge/lontium-lt9611.c index 82af1f954cc6..c2cd36d926a0 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,20 @@ 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) + return MODE_BAD_HVALUE; + + if (mode->vdisplay > 2160) + return MODE_BAD_VVALUE; + + if (mode->hdisplay == 3840 && + mode->vdisplay == 2160 && + drm_mode_vrefresh(mode) > 30) + return MODE_CLOCK_HIGH; + + if (mode->hdisplay > 2000 && !lt9611->dsi1_node) return MODE_PANEL; else return MODE_OK; From patchwork Wed Jan 18 08:16:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 643767 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 C0F39C004D4 for ; Wed, 18 Jan 2023 09:01:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229674AbjARJB2 (ORCPT ); Wed, 18 Jan 2023 04:01:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbjARI7N (ORCPT ); Wed, 18 Jan 2023 03:59:13 -0500 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F32FB10A8F for ; Wed, 18 Jan 2023 00:17:15 -0800 (PST) Received: by mail-ej1-x62a.google.com with SMTP id ud5so81325187ejc.4 for ; Wed, 18 Jan 2023 00:17:15 -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=FpdbxTL1TsJx6ZvxMXDuiLUdcmbkfcCseR/ToR83G3E=; b=tp+GZPa1zP8xw8T5zoc1Y19d3dl6rRGGwlW4xjrPET+Yf/26aiJlvcQkApXKAYjq/e NG6qItEAedVaaFugJsi7o8QXvOR5GtBq8QOSKb//s/OVBWrfcAmIzhFS5Om38k6bRLaJ 5SG+jT6LlpQMsVnX0eIg/iIhrTYN0zLp3PngErW8dg2yE7mm8PE2HkGL9Hd9x71HaSHP 3wKT7FXy7t7zbM84wJ59dkuge1ObHIjnW5vp5+bGaRqayF0SsVJmZC4YjlPCUexAj1G6 DAe/wJaIKUBEbPNNKJrXWJk61qaXZ+OfhY3vNEp5CX1uHpAlJbrnFfrc7N7lRdeVf7/G g2nw== 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=FpdbxTL1TsJx6ZvxMXDuiLUdcmbkfcCseR/ToR83G3E=; b=Ndvdlvxb6na0rlEMA0TnViFYKb8Seqn45OG74hekL0BpuSnMnGf2vP1fzgQj3SUdL2 PwT6+eBt7SgiLcrehnddZcxjzVHPwfZsnIdvX54N4RymbP8BvMnCrAa+gZ6L8cNqh5Ua 0aAee1CV9aGPhe+poEzgESlDnvHhtJOkJYqbM/N+wwEdPu6BnEqC2qwRkC8lByoyBfRx /RWSKp+Dkel8b3KkHkJ5few419/TDEdt2qUE0fPdvNsQZQpVJX0g4aIqg+2ar6FUxF0g tuX6npPB5qI6P9et6WLBSnGfytK701T8+0g+H8XZHLi/zi3g9kSPdcspQmi4QIs8GQsm TOLA== X-Gm-Message-State: AFqh2krHTuD1ZO3EWZ5t9m/JseVic0X+3CohnkyCXC93e4vn0d7pEWmK brj2kCy+KJGqMG0eaZ/fVEqB/w== X-Google-Smtp-Source: AMrXdXuucVAB6Mc41A9WbCBTnWWwywaSwMlrRjlBFANbvbNf9GRNLrYFFfdEncxeiQanLo3iYNpyww== X-Received: by 2002:a17:907:a80b:b0:86f:220e:94af with SMTP id vo11-20020a170907a80b00b0086f220e94afmr15367395ejc.56.1674029834449; Wed, 18 Jan 2023 00:17:14 -0800 (PST) Received: from eriador.lan (dzccz6yyyyyyyyyyybcwt-3.rev.dnainternet.fi. [2001:14ba:a085:4d00::8a5]) by smtp.gmail.com with ESMTPSA id f22-20020a17090631d600b00779cde476e4sm14199080ejf.62.2023.01.18.00.17.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jan 2023 00:17:14 -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 13/13] drm/bridge: lt9611: properly program the dual host mode Date: Wed, 18 Jan 2023 10:16:58 +0200 Message-Id: <20230118081658.2198520-14-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230118081658.2198520-1-dmitry.baryshkov@linaro.org> References: <20230118081658.2198520-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. Reviewed-by: Neil Armstrong Signed-off-by: Dmitry Baryshkov --- 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 c2cd36d926a0..276c77b273cd 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);