Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2543085pxj; Mon, 10 May 2021 05:34:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1FcdMGnvFhwt0SSP5VUSzxL+x3VOvMARUyBdNf7x6fbPTh1X7cmrLehulwviVymytp/rE X-Received: by 2002:a05:6402:3546:: with SMTP id f6mr29324925edd.267.1620650049252; Mon, 10 May 2021 05:34:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620650049; cv=none; d=google.com; s=arc-20160816; b=DjDTmFc36t9y2WTANwk2qVloX+hRBWgjvvOHX68o7Sie7c+wY+MzFllz0JOG0dx0Fy aZEhudPX40nyL3UmAkZT6SgObaTQguuicpVm8lRTHjob6QZgUI+sa5syvJtPQ8nYfEpd 3+LcCBplu9vR/ipvNbudf9uwZlJ9hHz7jKkIu8ZY+5rfOjK58UUDaVpUd+lZR8PZG4yC hZIOc649m4R6h3yWvrHys4et1ILEg+dfPze1HnDtmsZVvIpVjc2JRkOCyq28CPbggDUY IZnPxUaRgNnflJIPP/3XmMLywtvX7NhzOgjafBT9pZmVVAt8kH5ph3JPolxj8X0yK3O4 Pbqw== 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=OHpWEBqF7ZdtwGWpshyxxMeeSQ3+kLlPU7ZvtB8gLoQ=; b=xlNJ4iMZ3lcNROx1A1jphxvV49KmjcpQQeVUdWb4iWi3VovnOfrZsleX7D5ZbrXzLm +4pvl5usq85nO7CFY4rtAwQ7qi6VvFYGLbax0mijR2+xOljYiSVRXWb+BB1g3GH1BJCU RyLDlaXOzUk1uQLWkMyOFg0t7VzWJc7BFd+pkGjLuDRsC1t/bnRpqRjyNynGoVvUNSbc Hzqrjh11AJUuHNZ8+evZpwiMAz8WrW0oM0UL9ja0tuIvJIJDgaAL1lPIA7pvHaRjt4c9 nBu/DbzUhQnaP3zjh4YHFF3QE7+CamemUW+HO7o0dNUMDb74Yaqoywi6BcsdCGhgGttY /zMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=J50TBreY; 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 z5si13152986edc.126.2021.05.10.05.33.23; Mon, 10 May 2021 05:34:09 -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=J50TBreY; 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 S244800AbhEJMT7 (ORCPT + 99 others); Mon, 10 May 2021 08:19:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:48686 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233660AbhEJLJG (ORCPT ); Mon, 10 May 2021 07:09:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D339B61627; Mon, 10 May 2021 11:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620644690; bh=vqaag6jGEU62qD4HKGhGr1XmbMT6b52gaHTbkhR6a5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J50TBreYtuq3IcyzaqMRXbazfGaCB15v9nY984APnTfq0COIIaPUuNQglY2krGJGg RHtpahtKjLgqaNkigYs6BUdCDAT9D/xCl9UeUTb8yHWY3h1lL/fuKkwaBjKQ3xLmxy 144MpArNaNS5yQZpI5vwReEQLH37GlqT5NIxc4mI= 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.12 183/384] backlight: qcom-wled: Fix FSC update issue for WLED5 Date: Mon, 10 May 2021 12:19:32 +0200 Message-Id: <20210510102020.928916796@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102014.849075526@linuxfoundation.org> References: <20210510102014.849075526@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 fc8b443d10fd..e9fbe2483844 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