Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp1136072rdg; Fri, 11 Aug 2023 10:49:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFWtU50fsuPG0Dkfi74upFjCcQnIA2PvVNxvvVhjsp4iX6C3e0LzQbQrVF+lQNo6EKvuj1i X-Received: by 2002:a17:906:2102:b0:99c:e037:e4b8 with SMTP id 2-20020a170906210200b0099ce037e4b8mr2171758ejt.72.1691776189743; Fri, 11 Aug 2023 10:49:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691776189; cv=none; d=google.com; s=arc-20160816; b=wBQYbWsWdOzrn4JR3UHUTzWnJFN7UxHDAUGJ73FRi42oEy83+ZMJL/elbm4cttcC1/ toIsGZdZG8ZhMfot948DPz+Or8mLtE7ddqHFRojE3mk0NfCU0UFmtp8R6u2jtdRm3KjU jQFobENuGL0dF7xrpxyygut+wRq2BIYifVcQjkxcjwi0tKj5T3j1PNqn+XC/CiqWnSgA YWIJamVpX7/m60Fdl8JbHl9pzhx//EptaGYEl5UouC16WvMTObdgBs0/Q07T1y530+xy dLdfUC4kSeC4TleOQpfa2sMGnjK/PbuKrlwGo6MMofo5h+3tPZd+ziCWCX5oW9ym7QvY Wulg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=rrIm5djmxalhJ8fGCRO7XC0aNr/6sFYyMTAIVgKt0/g=; fh=RCCKe594xFPZHhttKxAvsFO+Y6hBYHfmXPRHi7qps4s=; b=YU0WaUmrVxdfuTmBPCwlFIf5fZN2lbd1JYL4bn6nbQZderRQdSW8+hRwOOzKrTXZEK xr3vdS+mTWx1It3VCC+5wy5BxMcsMA71fjQd0QOCRiSTf+xfVza/5H2lmSTLmjXmq63V j0onR9tJVDbi2OqcVB6r6TPVLo1QcvGHx5rG01klq2hiCrAH2qsllOO8aC8Lo7cOA4m5 iNXQA6+690y+nCi+i/XIXR0l05+yzGmKTdVzwAx6Vw4aWv1YfZUVo51hc3ugmRhjL8th FwdZI5iTSQeb/xyf3CVDlSG0ofcd2ScY8ZLrkJx1CCeIlGUTb8oQc6gcmLv4zomg4IIt 6HPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=WQAg12iA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n24-20020a1709065e1800b0099cbf068b6bsi3603556eju.588.2023.08.11.10.49.24; Fri, 11 Aug 2023 10:49:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=WQAg12iA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235321AbjHKRDJ (ORCPT + 99 others); Fri, 11 Aug 2023 13:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236535AbjHKRC4 (ORCPT ); Fri, 11 Aug 2023 13:02:56 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E9C4420C for ; Fri, 11 Aug 2023 10:02:39 -0700 (PDT) Received: from [192.168.88.20] (91-154-35-171.elisa-laajakaista.fi [91.154.35.171]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 54800FA6; Fri, 11 Aug 2023 19:01:16 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1691773277; bh=uDSexvpr2PnoMuFUNNtlPr7ZBmberNLh6mS6tWooTd4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=WQAg12iAPxQQOS+xEojC9HcTfyWdQzilDz7msKKHvDvCVJ4hYmUrIe7MtsZqtwA8I 5pioe+TemfMcJD0faPUlKxSqRuEW89AH8LD7i61i1o8WhI8w7v3JnElBvrULGFcbcD cT6TwOr9La+d3oKnXQtZMIWajn1zSwFVsSGCz0mE= Message-ID: <241937b4-1ef8-abad-7c4a-b26bfab86a3a@ideasonboard.com> Date: Fri, 11 Aug 2023 20:02:23 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH 02/11] drm/bridge: tc358768: Fix bit updates Content-Language: en-US To: =?UTF-8?Q?P=c3=a9ter_Ujfalusi?= , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Francesco Dolcini Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Aradhya Bhatia References: <20230804-tc358768-v1-0-1afd44b7826b@ideasonboard.com> <20230804-tc358768-v1-2-1afd44b7826b@ideasonboard.com> From: Tomi Valkeinen In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/08/2023 19:23, Péter Ujfalusi wrote: > > > On 04/08/2023 13:44, Tomi Valkeinen wrote: >> The driver has a few places where it does: >> >> if (thing_is_enabled_in_config) >> update_thing_bit_in_hw() >> >> This means that if the thing is _not_ enabled, the bit never gets >> cleared. This affects the h/vsyncs and continuous DSI clock bits. > > I guess the idea was to keep the reset value unless it needs to be flipped. > >> >> Fix the driver to always update the bit. >> >> Fixes: ff1ca6397b1d ("drm/bridge: Add tc358768 driver") >> Signed-off-by: Tomi Valkeinen >> --- >> drivers/gpu/drm/bridge/tc358768.c | 13 +++++++------ >> 1 file changed, 7 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/gpu/drm/bridge/tc358768.c b/drivers/gpu/drm/bridge/tc358768.c >> index bc97a837955b..b668f77673c3 100644 >> --- a/drivers/gpu/drm/bridge/tc358768.c >> +++ b/drivers/gpu/drm/bridge/tc358768.c >> @@ -794,8 +794,8 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) >> val |= BIT(i + 1); >> tc358768_write(priv, TC358768_HSTXVREGEN, val); >> >> - if (!(mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS)) >> - tc358768_write(priv, TC358768_TXOPTIONCNTRL, 0x1); >> + tc358768_write(priv, TC358768_TXOPTIONCNTRL, >> + (mode_flags & MIPI_DSI_CLOCK_NON_CONTINUOUS) ? 0 : BIT(0)); >> >> /* TXTAGOCNT[26:16] RXTASURECNT[10:0] */ >> val = tc358768_to_ns((lptxcnt + 1) * dsibclk_nsk * 4); >> @@ -861,11 +861,12 @@ static void tc358768_bridge_pre_enable(struct drm_bridge *bridge) >> tc358768_write(priv, TC358768_DSI_HACT, hact); >> >> /* VSYNC polarity */ >> - if (!(mode->flags & DRM_MODE_FLAG_NVSYNC)) >> - tc358768_update_bits(priv, TC358768_CONFCTL, BIT(5), BIT(5)); >> + tc358768_update_bits(priv, TC358768_CONFCTL, BIT(5), >> + (mode->flags & DRM_MODE_FLAG_PVSYNC) ? BIT(5) : 0); > > Was this the reverse before and should be: > (mode->flags & DRM_MODE_FLAG_PVSYNC) ? 0 : BIT(5) Bit 5 is 1 for active high vsync polarity. The test was previously !nvsync, i.e. the same as pvsync. Tomi