Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2484499pxj; Mon, 10 May 2021 04:12:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypdG13D7VL3/Z8LbTZSAiWyvFJXz7gMTASKkB8NtbneOnlw8K4Ehx47ijsoadVIBcWyqIE X-Received: by 2002:a17:906:3ed0:: with SMTP id d16mr1926702ejj.16.1620645074980; Mon, 10 May 2021 04:11:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620645074; cv=none; d=google.com; s=arc-20160816; b=tvYZld9MZE0e8j4sDSR5QeiCSF59jn0pOS6GFxaxCyWnsx1pJj8qEY6SgUgSkTC7SB HVjd9Tc32i3Bt1fRhUXQplEVq+fF/7212cQRlcXGEdJCQXzrXGeJAQF7CvTJOPbXkom2 RUqplZwv/cBi/lKdNyA5MCV2nBby9WFe25ecXCDEJNvCOi7N+CaJ4iYLLpycG9LUvv9q 5DdwJ28Ov9CxCNWsq8m70tZq4aYtrn9nrPdNLoIsG9lFdnnub0rRRORd6bSTz6YG3KOt kciPZSR/atFOrGw/2g8OZ1d4DmJwKknh8tBPCsj1JZANSXvg9YAzj3Thda+9aMOJJ+dg 6cgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2hblJRcaR7fn1pPE4GVe131rSbqLEe0M9cgIEVL4cmo=; b=iK9UibRTvs7I/h+XiG7Dpndzbub+GrXl3c8YNxxrhwWrhc6+vp2o/+/O7klZY0ZAw2 n0Hszp0GP33tp5FcqGtdA22IKlQf3XW0YBBbEN2P6oJhrsL2bAw2QoUJougqIJ0k03tO vVUMYT8qo+ueAi1/4pek6UpFjcqqbvdnedbS8rlyj/o4oRisj7QBPQbKqvPOjIIt0mVL f1le/W/o1nDX2mOiah8FLA4TJmX8bhZR+tUpqxoL8XKtNaGZxJI8SldHU2K9oY6LaDHL yBpmxh2y7x85V5aV0o1QocUpEklo8KBJ03E5u0OBI5e3ylax4UsWfsJ7tK2XKeCQQ4Wr G//Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gBBar4OU; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cw16si13606060ejb.337.2021.05.10.04.10.51; Mon, 10 May 2021 04:11:14 -0700 (PDT) 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=@linuxfoundation.org header.s=korg header.b=gBBar4OU; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235856AbhEJLGZ (ORCPT + 99 others); Mon, 10 May 2021 07:06:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:59364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232633AbhEJKp6 (ORCPT ); Mon, 10 May 2021 06:45:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 15E5261932; Mon, 10 May 2021 10:36:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643008; bh=bgsQ4C6uIetDSOq7p3giD0blDWPX1UU1oDNWpWVUFGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gBBar4OUN4KiCdkv/zKQ5tCc2NBZDzYyGSP0g8n6dorBN5E0Ve8ivBfPijW764/KB JUcwDQ5PIwZF7++ZWMwYT/KD/CY9UWfBaCg2dUozkimSnY7Nz+EBhFIiYUq9FytMpI NLsVjtqhOxgWj/wFMHisKUQRLcIMDNg+45h/Ffrc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kiran Gunda , Daniel Thompson , Lee Jones , Sasha Levin Subject: [PATCH 5.10 140/299] backlight: qcom-wled: Fix FSC update issue for WLED5 Date: Mon, 10 May 2021 12:18:57 +0200 Message-Id: <20210510102009.588409421@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kiran Gunda [ Upstream commit 4d6e9cdff7fbb6bef3e5559596fab3eeffaf95ca ] Currently, for WLED5, the FSC (Full scale current) setting is not updated properly due to driver toggling the wrong register after an FSC update. On WLED5 we should only toggle the MOD_SYNC bit after a brightness update. For an FSC update we need to toggle the SYNC bits instead. Fix it by adopting the common wled3_sync_toggle() for WLED5 and introducing new code to the brightness update path to compensate. Signed-off-by: Kiran Gunda Reviewed-by: Daniel Thompson Signed-off-by: Lee Jones Signed-off-by: Sasha Levin --- drivers/video/backlight/qcom-wled.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/video/backlight/qcom-wled.c b/drivers/video/backlight/qcom-wled.c index 83a187fdaa1d..cd11c5776438 100644 --- a/drivers/video/backlight/qcom-wled.c +++ b/drivers/video/backlight/qcom-wled.c @@ -348,7 +348,7 @@ static int wled3_sync_toggle(struct wled *wled) return rc; } -static int wled5_sync_toggle(struct wled *wled) +static int wled5_mod_sync_toggle(struct wled *wled) { int rc; u8 val; @@ -445,10 +445,23 @@ static int wled_update_status(struct backlight_device *bl) goto unlock_mutex; } - rc = wled->wled_sync_toggle(wled); - if (rc < 0) { - dev_err(wled->dev, "wled sync failed rc:%d\n", rc); - goto unlock_mutex; + if (wled->version < 5) { + rc = wled->wled_sync_toggle(wled); + if (rc < 0) { + dev_err(wled->dev, "wled sync failed rc:%d\n", rc); + goto unlock_mutex; + } + } else { + /* + * For WLED5 toggling the MOD_SYNC_BIT updates the + * brightness + */ + rc = wled5_mod_sync_toggle(wled); + if (rc < 0) { + dev_err(wled->dev, "wled mod sync failed rc:%d\n", + rc); + goto unlock_mutex; + } } } @@ -1459,7 +1472,7 @@ static int wled_configure(struct wled *wled) size = ARRAY_SIZE(wled5_opts); *cfg = wled5_config_defaults; wled->wled_set_brightness = wled5_set_brightness; - wled->wled_sync_toggle = wled5_sync_toggle; + wled->wled_sync_toggle = wled3_sync_toggle; wled->wled_cabc_config = wled5_cabc_config; wled->wled_ovp_delay = wled5_ovp_delay; wled->wled_auto_detection_required = -- 2.30.2