Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1161788pxb; Fri, 26 Feb 2021 04:15:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8Rnybc4DaEPmNX97BwNZymgJs/t1BI0STvMmAC8lTc7buIv7ATSB0/ydB6YI+doM0No9a X-Received: by 2002:a17:906:6817:: with SMTP id k23mr2954804ejr.6.1614341710929; Fri, 26 Feb 2021 04:15:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614341710; cv=none; d=google.com; s=arc-20160816; b=Uu6VhxANEMfeTCJjZLx6oB6kd9TKgBz2SIoB0Dhp9u2qAjeFhTQZU4Jvp4MinfnaAB CYQfS+MHqgKCG1pgregyyV3370u6UqtaNU9e0gW1MPECZDBEYzgLHrBl/KVMfq5iWlY7 NJZOlJDcKX3aF+FFX0ngCHMxkPnFGfv8Xs1pqaHNa1Up8YHYAhTVJZbX45RzgzBjx822 K2q8GsUs5M6nsPchlqOQHA1vRqNRx/lfhMgM0+A/E8MlrrOtat5QZymzPe+5j7zncXS5 BWoJk+KqWdF6k2wWOsqZ8CM1T/mxy3VjL77idVSotHO1RYSA1fQFHXfYfPksMrpE+Xbc P2ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dmarc-filter:sender:dkim-signature; bh=Psqfq0GEHaYgGCU3sauRIDYsprxH7PJBqjU+IC3/s8s=; b=Dz9FM9+wiBpCpNFd3ytuJ4BAMPB4YFVRfMVBxRI4gU3AD68uqxASylOOAOBH1TpPRo jLRMuE1GX2oW+rrnwH3VYYTbOzYwkI98qp6of69jOZ08cBjBWQmR5Zp3dcT8pM6c2NBi G0/2eUq+uTzuBObKJqAz7JqByy6RVxMMWeOu2h6RG/IzjEtTcb9BdvOCi3qJldIPYE2w jvSQ7HQEKwm8S7/bYyvI/39qdayerruOLnY8Wb0CkgVyAUn15Hl2186b5akdnxswv9P2 ohRft8Wnm6fDW5vZhWBsOV63H9VrFD7OGs/m5XkxKwFymoeadk2GD4QMHgpXW3K8IP5u ITeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=ocruWgVm; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n21si5331500ejb.90.2021.02.26.04.14.48; Fri, 26 Feb 2021 04:15:10 -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=@mg.codeaurora.org header.s=smtp header.b=ocruWgVm; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230206AbhBZMN4 (ORCPT + 99 others); Fri, 26 Feb 2021 07:13:56 -0500 Received: from z11.mailgun.us ([104.130.96.11]:14497 "EHLO z11.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230153AbhBZMNu (ORCPT ); Fri, 26 Feb 2021 07:13:50 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1614341611; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=Psqfq0GEHaYgGCU3sauRIDYsprxH7PJBqjU+IC3/s8s=; b=ocruWgVm+tXH5bRGog2E5+BIG+MTw3c5llq29cLfZ9CgwyboFxYZoh2UP/HaRsMFxcP5QGOi bmbgAJI9Uw7mvBF9dr8jN6xESHWVYacfyKRM3cKVCfHBeODKoNXF5hTrYp62nqVz+oCUGtMu CAZA1S8hyld4jEUuTe37LYxyN4s= X-Mailgun-Sending-Ip: 104.130.96.11 X-Mailgun-Sid: WyI0MWYwYSIsICJsaW51eC1rZXJuZWxAdmdlci5rZXJuZWwub3JnIiwgImJlOWU0YSJd Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-west-2.postgun.com with SMTP id 6038e5cb4ba4640b2bd5f08f (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Fri, 26 Feb 2021 12:12:59 GMT Sender: kgunda=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 3D2C2C43466; Fri, 26 Feb 2021 12:12:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-caf-mail-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=ALL_TRUSTED,BAYES_00,SPF_FAIL, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from kgunda-linux.qualcomm.com (unknown [202.46.22.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: kgunda) by smtp.codeaurora.org (Postfix) with ESMTPSA id A3FE5C43464; Fri, 26 Feb 2021 12:12:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org A3FE5C43464 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=fail smtp.mailfrom=kgunda@codeaurora.org From: Kiran Gunda To: bjorn.andersson@linaro.org, jingoohan1@gmail.com, lee.jones@linaro.org, b.zolnierkie@samsung.com, dri-devel@lists.freedesktop.org, daniel.thompson@linaro.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 Cc: phone-devel@vger.kernel.org, Kiran Gunda Subject: [PATCH V2 1/2] backlight: qcom-wled: Fix FSC update issue for WLED5 Date: Fri, 26 Feb 2021 17:42:23 +0530 Message-Id: <1614341544-5306-2-git-send-email-kgunda@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1614341544-5306-1-git-send-email-kgunda@codeaurora.org> References: <1614341544-5306-1-git-send-email-kgunda@codeaurora.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 3bc7800..aef52b9 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 = -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project