Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp5265018ybg; Tue, 22 Oct 2019 00:22:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqxCCA5Jwh1vvv5ZyRdpHmdrplzB92/NnqcwOmVmWSTlim9QAo1OG2fbWtbQLxO+EkujS7h3 X-Received: by 2002:a17:906:3009:: with SMTP id 9mr26179774ejz.124.1571728975103; Tue, 22 Oct 2019 00:22:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571728975; cv=none; d=google.com; s=arc-20160816; b=jszNch/K2fS8UQrrk4E3fBwc+wQjKW0F9HsEDkK3g8n/MKvsx2Ra8RttAOw/Kbo0Fp q1omN8TWIaGB1RZP+EVoaHlhiUeZW3CFsqtCDEpt2SY6NIyLns/BlpK9tnPQzeOqKUc2 yT0LMOnUU2SAqYF8yAcbSU2U8U3cdPZyZCShYd2wi/OCAbtWCgBEcTmFmR8tX4PwyjV8 CmbVAdbDJkoqKElQ8n5+C3hUI2agWoCT09KtIiAICeH5Pr0jfeE4rQKO0nNj4D+co2Nf XrobZPVpjwFprnKURijbxYCylt7JKlZZsZYRGMvgHaeuZcG2H56D8S0/0o1ubNHIGCfc fm0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature:dkim-signature; bh=EV8yXXjM7CACZ51y9Srtpr+tjDOkQOzIzTsNX2QMiFU=; b=M4/pAv3xBiSJIUxEhB+yGgPh12gNAaB4xqBtMdnc3HRWb9C9QfQw/wOZ9XZblM7iHc gghNHbWroATnmzjA1bVBT/IYyLtKgXCVDdQx/VkHjo9lHBzHgxSgzMP69ZIMc/Q2FFyH 1RfTE8gpvM/klqDvUdYFTafzE3uGffew568TiZGf4DtQHJXthENbDxlPD4xRHVdN716V c7LWkJxrCcpnj8xzpNDdFc3EzydHxW8UX1cVeR21pNgPmdZ+Q3CT4GstnTlvkJqLBeuv 2ZL/6iqeNi9fm50VrO7V0Vf9OwAAikgKus+mtUW7+h2yAN+C6XjESOaydADjnjmFu1rK JH/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=dWFWIuvf; dkim=pass header.i=@codeaurora.org header.s=default header.b=L182tLUn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x22si3169756ejv.335.2019.10.22.00.22.29; Tue, 22 Oct 2019 00:22:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=dWFWIuvf; dkim=pass header.i=@codeaurora.org header.s=default header.b=L182tLUn; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731050AbfJVHU3 (ORCPT + 99 others); Tue, 22 Oct 2019 03:20:29 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:39994 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728346AbfJVHU3 (ORCPT ); Tue, 22 Oct 2019 03:20:29 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 62804607DE; Tue, 22 Oct 2019 07:20:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1571728827; bh=EVwj46UeE2wGGDTOX5OHTVhOFwofSd5fYovKQxbRLQg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dWFWIuvfhkYhzhxaCFrwEsjwAD6OHiNShNaNIzxk8XoTN1KGvmppbfSYjkQoOGTkT kaBx5EoMwX0C8/4ivSYMZfuArOjpTYa6/N25SyUi9j7zJYi/iLnxtxTWWHB5KP7Gyp L1ERtz9LOVC3CFeW+MJ2FxquzrnpUbV013oRX/UE= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.codeaurora.org (Postfix) with ESMTP id 1BFE9602D8; Tue, 22 Oct 2019 07:20:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1571728826; bh=EVwj46UeE2wGGDTOX5OHTVhOFwofSd5fYovKQxbRLQg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=L182tLUn5lO3IAJmkyDsbs67sIsNniqSSrUcM/4htc7AHSW6qY8UzUT2JztXMGK0f eYdL11L+La2yCVX3QAQ5tVN+DH34lPoZGTunK3dzImJAB6zIq1mxy+NAiZGiooY7Vo yKwNxmgTYuTPfNtvox+bMnBltKkQCsVS23TY9sOs= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 22 Oct 2019 12:50:16 +0530 From: kgunda@codeaurora.org To: Daniel Thompson 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 Subject: Re: [PATCH V8 6/6] backlight: qcom-wled: Add auto string detection logic In-Reply-To: <20191021103150.ta7qalltldofouh4@holly.lan> References: <1571402009-8706-1-git-send-email-kgunda@codeaurora.org> <1571402009-8706-7-git-send-email-kgunda@codeaurora.org> <20191021103150.ta7qalltldofouh4@holly.lan> Message-ID: <0d41f3eb83bbae9eaab0723a84bfcb1b@codeaurora.org> X-Sender: kgunda@codeaurora.org User-Agent: Roundcube Webmail/1.2.5 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2019-10-21 16:01, Daniel Thompson wrote: > On Fri, Oct 18, 2019 at 06:03:29PM +0530, Kiran Gunda wrote: >> The auto string detection algorithm checks if the current WLED >> sink configuration is valid. It tries enabling every sink and >> checks if the OVP fault is observed. Based on this information >> it detects and enables the valid sink configuration. >> Auto calibration will be triggered when the OVP fault interrupts >> are seen frequently thereby it tries to fix the sink configuration. >> >> The auto-detection also kicks in when the connected LED string >> of the display-backlight malfunctions (because of damage) and >> requires the damaged string to be turned off to prevent the >> complete panel and/or board from being damaged. >> >> Signed-off-by: Kiran Gunda >> --- >> drivers/video/backlight/qcom-wled.c | 398 >> +++++++++++++++++++++++++++++++++++- >> 1 file changed, 392 insertions(+), 6 deletions(-) >> >> diff --git a/drivers/video/backlight/qcom-wled.c >> b/drivers/video/backlight/qcom-wled.c >> index 658b1e0..b2e6754 100644 >> --- a/drivers/video/backlight/qcom-wled.c >> +++ b/drivers/video/backlight/qcom-wled.c >> @@ -193,7 +216,23 @@ static int wled_module_enable(struct wled *wled, >> int val) >> WLED3_CTRL_REG_MOD_EN, >> WLED3_CTRL_REG_MOD_EN_MASK, >> val << WLED3_CTRL_REG_MOD_EN_SHIFT); >> - return rc; >> + if (rc < 0) >> + return rc; >> + >> + if (wled->ovp_irq > 0) { >> + if (val) { >> + /* >> + * Wait for at least 10ms before enabling OVP interrupt >> + * after module enable so that soft start is completed. >> + */ > > Comments should not say what is does (we can read that). It should be > saying what is weird about the hardware the results in us enabling the > interrupt in an unusual way. > > More like: > > "The hardware generates a storm of spurious OVP interrupts during soft > start operations so defer enabling the IRQ for 10ms to ensure that > the soft start is complete." > > Note that I am only guessing that is an spurious interrupt storm that > caused you to defer the interrupt enable... I don't want to have to > guess which is why I am asking for a good quality comment! > > > Daniel. Yes. Your guess is correct. The hardware document explains the same. The WLED boost voltage can hit OVP limit in normal operating conditions such as during the soft start timing. Hence, waiting for the soft start to complete before enabling the OVP interrupt to avoid the spurious interrupts. I will update the comment as you suggested in the next series.