Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp102905pxb; Tue, 2 Mar 2021 20:52:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxVNXMRveAUMv7e8uHd3hqzl3CoRHsioe1mi3WkKfhdas6O3EoX8akzkhI0aZIzBHe6f2Lr X-Received: by 2002:a17:906:7f84:: with SMTP id f4mr8834233ejr.525.1614747167123; Tue, 02 Mar 2021 20:52:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614747167; cv=none; d=google.com; s=arc-20160816; b=v45urOmUkDDjBz0TYXgV1dtn4BUo+6ih6uKLWPo+/WqR+Bz2CTsD+hCMl/TroWjKzb kex7l9TaVIULjDyobcTJhIR3be6CoTMEZXxCCjwoY4glHaQL4iTuL2/Zo0hJDyvGx7KC OV+CRc0Qzl0u7741c+3RAZo+DKwp8rDoQpjwBP21h6ufcn+TwrXahkf7yNB2/cuRO1Nv bDanezEa4ihcGi9wAmBRDR++tRMZpXxw1sbSM5UzrqFzchxSiPWv2gA0+W4Idd+oE0oj lVGyRQoieFcbwkBB8n7QgdnbhINKREDRKHnAJrwz3JQfoYr1vzGbXci8AqrHrDLueazW HkQg== 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=jKJu5aDGrcqlDbzQ78CdwyQI6hSDHoApx/V49+oBu78=; b=Lbj6oH/uBnVPu1t3oMQn0pnj2PmZb7rpCq/mDiDxH4OK70aS2Xw2dH9C4NfWigvb82 TCL4D9wWwG7GKoWc19/ZIaAmJ8JcZg6ZMdbV0VLerTF5tEX17zIcu2ZTm9r4BWhpb1+K 3Hoa5rQ2Ac2PoLxdKperBvcLdelXUnpEBqQREy3AqazWdMW6pDT+K1dup3YlIekBLmIe 8vXhje8VyxQflzw7w/374MRHvebggK9YR0v4bkgR2BH8BU81Xyb5EamlVKy9yo5/ZRRD 11Lcg9sIRlRUUXf6O6rBYWisR/qnUmVo2QyjWgONtc4yFokEfaZxkJho9cO/GiyCflbX 1tJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b="WIC/2KFZ"; 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 ga28si14582679ejc.718.2021.03.02.20.52.24; Tue, 02 Mar 2021 20:52:47 -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="WIC/2KFZ"; 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 S237618AbhCAQOw (ORCPT + 99 others); Mon, 1 Mar 2021 11:14:52 -0500 Received: from z11.mailgun.us ([104.130.96.11]:54729 "EHLO z11.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237630AbhCAQL4 (ORCPT ); Mon, 1 Mar 2021 11:11:56 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1614615080; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=jKJu5aDGrcqlDbzQ78CdwyQI6hSDHoApx/V49+oBu78=; b=WIC/2KFZRNrS8omwFtEkuf6NvYETNDXHmlzQ67CkzenTZF8otiVF8+sNb8vNsB2yYdNEuPDk 37/cKuqs4seDEmUZJeyU0Dbs3r1yh23m3upx8VAEFZPZHFQZPx3TMx5JxrNntwMtapZ5KvL6 cAaq4xES3zFQP7m57DU/JNpwgcA= 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-n06.prod.us-west-2.postgun.com with SMTP id 603d120dfee96fcaf4aeb1ad (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 01 Mar 2021 16:10:53 GMT Sender: kgunda=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 1D6BFC43467; Mon, 1 Mar 2021 16:10:53 +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 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 3F9F1C43463; Mon, 1 Mar 2021 16:10:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3F9F1C43463 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 V4 1/2] backlight: qcom-wled: Fix FSC update issue for WLED5 Date: Mon, 1 Mar 2021 21:40:29 +0530 Message-Id: <1614615030-12703-2-git-send-email-kgunda@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1614615030-12703-1-git-send-email-kgunda@codeaurora.org> References: <1614615030-12703-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 Reviewed-by: Daniel Thompson --- 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