Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2707546pxj; Mon, 10 May 2021 09:00:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEB7dpXryP+61ailszDqun/Vs9M1jlswCEvwIW+W9cYTk+AmgN54l6owXB4kYaSVbAaGFg X-Received: by 2002:a05:6402:1109:: with SMTP id u9mr31119285edv.174.1620662405483; Mon, 10 May 2021 09:00:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620662405; cv=none; d=google.com; s=arc-20160816; b=UoVnsXUruEJEKcCYMX/cedlEhHJAcBVkEiksW1wiKSZO18Pxwy2dxHvlkaYPZ5xRUM /7KuqigZvf0WbOPqU5H7LMcX6iKcAIrlyxZ8OCtzH5gisrg+aLJ6c7amsQkddFWRuCas ZqDb9xWq5HnagpTRqPyWJlGZyGGdOrshFMiTH4YVGxaEA2ZHQOD/mzJiEEgUFqJyWebW Hu4eR7JCu4dtl0NwVWtVHqAe3quw9oqV3RgdOluNCJzWgRvpO5p86scm3Fmlt4ZkEUJU kMDo5gmMz9JhRq3CYaVjI+O4+DzqG5bA+fN6jKZwDjfkpWKD81kceSPddeBD45M2nkE4 i25Q== 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=o2/nMRlbgw5G+1vgXAEN13kE9jUMOwb7JXiLM1ItiubGnwjvFZEXwJ1oRXeVtSbgWo 6kSZKGRqjmEloSpc7lKIchV2OwO2lEIVwam5oVm/+NYoYD4gofi3OPXQtvtwlqR4//f/ l5W/XZXC8EZ/OXBMFQ+64EykoWumPBmm9pRTr9diWI6tLigX16fVqXDsUuPYskKKBJfX wNMQiUT6tYOqZBJos0zPARVCkRUt/8w0ZgYQuHz3zh8nt+r4c+D/HeDw+V5Ram7xsQLl C2vqN3VtqR35b1RYn5/LiS24Z0b02RVDVXqMp9rZSsZFfqfguTEYdSdneVjaKIC7NfOC PHMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YbMF2nmo; 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 r5si404936edm.3.2021.05.10.08.59.42; Mon, 10 May 2021 09:00:05 -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=YbMF2nmo; 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 S232768AbhEJLdE (ORCPT + 99 others); Mon, 10 May 2021 07:33:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:52714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234879AbhEJK5N (ORCPT ); Mon, 10 May 2021 06:57:13 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3461361C3B; Mon, 10 May 2021 10:50:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620643808; bh=bgsQ4C6uIetDSOq7p3giD0blDWPX1UU1oDNWpWVUFGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YbMF2nmoga76fNfYy7sL4gJEhnQWNcybfjdXQP/ztvmnK5pQdpW4w5wAUnf0F7ygm pGR8uaSL+wU+h5raJ4OqF9z80iAlxCcRL9pCc5BX3PzfA93CN6jnuS9vEyYiiXOvKO jP6fjr+1snsGl+Wn53+O1c5tSl3iojns55CWt1io= 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.11 166/342] backlight: qcom-wled: Fix FSC update issue for WLED5 Date: Mon, 10 May 2021 12:19:16 +0200 Message-Id: <20210510102015.573824302@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102010.096403571@linuxfoundation.org> References: <20210510102010.096403571@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