Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1390726pxb; Fri, 26 Feb 2021 09:30:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJzESd3nbVaHXXk+u3pe/z44tV/L7AUEDU1iZITJ47Y9CRI+3WarYXooc4kg7Xep5TnMYn1N X-Received: by 2002:a17:907:d0b:: with SMTP id gn11mr4579021ejc.144.1614360656917; Fri, 26 Feb 2021 09:30:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614360656; cv=none; d=google.com; s=arc-20160816; b=DX1P9X2+FcyidYMRDclMg9goCddKP+N8km9+IxhwtXZnkQLtRpzP6jx7Ar+LkyPCAH Ak6kEViAwPrp+ktz0vbK0FVyMP/9l+MIopq7vyHSEYZxaYHwI2FNocJV7MyjgRH16SaP Ywo+dVSl/GCGbQLGqO2ROFDokurtx3No3T8GU3ZsfC4uY7Eya6/jy0CtMx8Pjcz5RvJ/ 0CaTw1PC2tp9ElZv9BTt2G+toNQPNoqRZYcqdAftckK9kEopCdoI0lQdZ70TvNisjF7Q Kzs6j5BkJYjP0S0+wJys9YLuVD/P7Cv+quPHnmqe8FFIhEDER/ZC10/uglzI9KqFqgql 4Kcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Bqhbgu1Yp7BWdaUz/Li+kTuQBD64JpudY4kka6cuYOU=; b=WtyvJrdRcvZSFUy2Vw1t3IvDZNy6udW8ha36BUOaNVtnbYlU45VM+6qwmabvKpSYL4 2rwojKRKp2eNkVQ03ks33j1Z2+eFRkNVmQZytLlzJA+zJKdPSnPWG90dumqWUcB7N8RL pwRv2v9eOwlkhq4XI0Uz/NItFtEXAdPCz4/g/k3b5+1iCgAWL9h8iPCCyeREs4a9wX8D jC5MXAlfcM11wKCy2wjQjqJVwngE0bjwMDimEFfZZV7WkevQffongfZE+IbS9RHYRtGk yJx4UCW8AnQKsF5MPRn2l0/LEKaCp5ns0Y1oJdxVgbg11wQv2+ozJwuame8d4Ff8Emwe fUwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="de/+gQcX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f17si6024034edw.291.2021.02.26.09.30.30; Fri, 26 Feb 2021 09:30:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="de/+gQcX"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230049AbhBZR10 (ORCPT + 99 others); Fri, 26 Feb 2021 12:27:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbhBZR1Z (ORCPT ); Fri, 26 Feb 2021 12:27:25 -0500 Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D30B6C06178A for ; Fri, 26 Feb 2021 09:26:04 -0800 (PST) Received: by mail-wr1-x433.google.com with SMTP id l12so9316228wry.2 for ; Fri, 26 Feb 2021 09:26:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Bqhbgu1Yp7BWdaUz/Li+kTuQBD64JpudY4kka6cuYOU=; b=de/+gQcXIlBR8jVkGwRajly9Ur7JLImRwKdA+cqTXTZs2N9AXIZdKdqD63bPpunD4X skq0DwsLCISevZLfmV9iOR6B/XV8PPTB0urSK1KY3HiY0yFlCuOSPH1MXrt8FHbRz5dq qm9yXsuQ9A/7hySFuR9vYhZQXbjIhgI0PgCuHk+GmglnrOlbRmcijDueB9SRpR8saq8X Si6LEabKe9dqZqHszSD2dChA8chYp7GnBZgSNV1yPlWZYAX+1UB7xHqJLcqjV4ESJ+mW XmgfxsxOViwwKJgHzfnSA+RUuMgpP09C2JcsYvCwhZoLeuwu+l1MLZTugYxD1FPiG2gG YggA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Bqhbgu1Yp7BWdaUz/Li+kTuQBD64JpudY4kka6cuYOU=; b=ehLEUaqAhR2xfkAH5dm0s+VANbLM/coFM+T7DBNqn+GyyNHxokhzGR3Xg+KDcix3rQ ECJu3QQQrvasE1v6UcY3SMIQ7eL4zQBsXqqcyHOEADenw6u8fUN0NgKR41ypsUw3zEhP Zk5vkDzTRZcBodroAjZgOHSWYoQhn0bKH4UMLjg2nTWUd8Bw+fGnzpDl/s1Nw7IDCihE HG3slNqHuhfOU4Ikius+Q5qXwjmIgnYaRTjjNe8o5t9QIUCGvmZbrIJxKONuo9V+U9Fh P9WuCt6FNoHpJYeFOKSn7dN3F3D4M0rusbklo9Vn1suf8RuT/PzK/QWz5amjISwONUT5 i+KA== X-Gm-Message-State: AOAM531lfxseJ3CRxcFkGobOBbpEb1ARAo1mJLzOyAcTIlzvnMkumOQ1 R+ZAuZD+pw7t3Aep0wDza3yYSQ== X-Received: by 2002:adf:e409:: with SMTP id g9mr4219176wrm.423.1614360363351; Fri, 26 Feb 2021 09:26:03 -0800 (PST) Received: from maple.lan (cpc141216-aztw34-2-0-cust174.18-1.cable.virginm.net. [80.7.220.175]) by smtp.gmail.com with ESMTPSA id m9sm57861wro.52.2021.02.26.09.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Feb 2021 09:26:02 -0800 (PST) Date: Fri, 26 Feb 2021 17:26:01 +0000 From: Daniel Thompson To: Kiran Gunda Cc: bjorn.andersson@linaro.org, jingoohan1@gmail.com, lee.jones@linaro.org, b.zolnierkie@samsung.com, dri-devel@lists.freedesktop.org, jacek.anaszewski@gmail.com, pavel@ucw.cz, robh+dt@kernel.org, mark.rutland@arm.com, linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Gross , linux-arm-msm@vger.kernel.org, linux-fbdev@vger.kernel.org, phone-devel@vger.kernel.org Subject: Re: [PATCH V2 2/2] backlight: qcom-wled: Correct the sync_toggle sequence Message-ID: <20210226172601.aknj2d4hghkkqjol@maple.lan> References: <1614341544-5306-1-git-send-email-kgunda@codeaurora.org> <1614341544-5306-3-git-send-email-kgunda@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1614341544-5306-3-git-send-email-kgunda@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 26, 2021 at 05:42:24PM +0530, Kiran Gunda wrote: > As per the current implementation, after FSC (Full Scale Current) > and brightness update the sync bits are transitioned from 1 to 0. This still seems to incorrectly describe the current behaviour. Surely in most cases (i.e. every time except the first) the value of the sync bit is 0 when the function is called and we get both a 0 to 1 and then a 1 to 0 transition. That is why I recommended set-then-clear terminology to describe the current behaviour. It is concise and correct. Daniel. > But, the FSC and brightness sync takes place during a 0 to 1 > transition of the sync bits. So the hardware team recommends a > clear-then-set approach in order to guarantee such a transition > regardless of the previous register state. > > Signed-off-by: Kiran Gunda > --- > drivers/video/backlight/qcom-wled.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c > index aef52b9..19f83ac 100644 > --- a/drivers/video/backlight/qcom-wled.c > +++ b/drivers/video/backlight/qcom-wled.c > @@ -337,13 +337,13 @@ static int wled3_sync_toggle(struct wled *wled) > > rc = regmap_update_bits(wled->regmap, > wled->ctrl_addr + WLED3_SINK_REG_SYNC, > - mask, mask); > + mask, WLED3_SINK_REG_SYNC_CLEAR); > if (rc < 0) > return rc; > > rc = regmap_update_bits(wled->regmap, > wled->ctrl_addr + WLED3_SINK_REG_SYNC, > - mask, WLED3_SINK_REG_SYNC_CLEAR); > + mask, mask); > > return rc; > } > @@ -353,17 +353,17 @@ static int wled5_mod_sync_toggle(struct wled *wled) > int rc; > u8 val; > > - val = (wled->cfg.mod_sel == MOD_A) ? WLED5_SINK_REG_SYNC_MOD_A_BIT : > - WLED5_SINK_REG_SYNC_MOD_B_BIT; > rc = regmap_update_bits(wled->regmap, > wled->sink_addr + WLED5_SINK_REG_MOD_SYNC_BIT, > - WLED5_SINK_REG_SYNC_MASK, val); > + WLED5_SINK_REG_SYNC_MASK, 0); > if (rc < 0) > return rc; > > + val = (wled->cfg.mod_sel == MOD_A) ? WLED5_SINK_REG_SYNC_MOD_A_BIT : > + WLED5_SINK_REG_SYNC_MOD_B_BIT; > return regmap_update_bits(wled->regmap, > wled->sink_addr + WLED5_SINK_REG_MOD_SYNC_BIT, > - WLED5_SINK_REG_SYNC_MASK, 0); > + WLED5_SINK_REG_SYNC_MASK, val); > } > > static int wled_ovp_fault_status(struct wled *wled, bool *fault_set) > -- > The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > a Linux Foundation Collaborative Project >