Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3106293pxb; Mon, 1 Mar 2021 01:32:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwaNe1YvzSKNhDHJHOBchto1Xkz3KFE0xvGw3WqS9AciQNCDOU7IyKphZmbdBMTdBqoMAwD X-Received: by 2002:a17:906:34c3:: with SMTP id h3mr15155337ejb.132.1614591124476; Mon, 01 Mar 2021 01:32:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614591124; cv=none; d=google.com; s=arc-20160816; b=HepbDRD/X44iBGhPe4P35GVVsSGUkHDsP6eqPek6cNYRa8T2H1gGCmwCuJ0ociXQna EBEA6E7oIC0ymyr1u4dQz1Pn/DMCSWwPLuUq0Pc4QH+yCvK8GmAX46ceb+yyXpUjmMG7 cbL7XjrQgP2aG3F2b4BCDAOJTWOo64d/sTEmLER1LFkLb5/g8iZkUeVd7OgfUC5TkBSU AMMvHLBhz6Q6WZuqZ1CvqGlq64MB0y1fjyoHnIO42E59IaekROqExB7tORpbIgXo5Q2F axGJBBOFLVsjl48mwaGX7dxtPCWf8amCT6xUTRiGoZ8E8Xx+OpMhWfjyaTN/8a7ml1gE UwJw== 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=ellF+eEH/DxZYUJRRCkNRXMwWivq7uOxEdN7feMr2f7QcafWXcLyuQwRfjAFEFZv+L f70PtiFkBbgjPbqo3705ns3+8LidmfNIChQGIT1UlGeOhZKfjowBvouEHTS4K5tCT7IW J7r8cRERAJHFu8rdEmXRBUBpHRZCDQpgIDPyLWek/m7dSeBuikRPj8m8yy06x3fru7HN +j2yy6mpeNMmSoF/EbolgISKuDYggLK8TtmKX92kFM+mGVupgfXfHojz6UmWY8PmI1ub aSQE1WRXruo6Nj4HNmqZ/ZPJr7BiwJBxftyViPMQMHX5M8CxOCrQilx1eldmUUhYHGOd D4VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mg.codeaurora.org header.s=smtp header.b=U8Oizz3x; 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 k5si11082502ejj.483.2021.03.01.01.31.41; Mon, 01 Mar 2021 01:32:04 -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=U8Oizz3x; 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 S233923AbhCAJ34 (ORCPT + 99 others); Mon, 1 Mar 2021 04:29:56 -0500 Received: from z11.mailgun.us ([104.130.96.11]:39351 "EHLO z11.mailgun.us" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233918AbhCAJ3z (ORCPT ); Mon, 1 Mar 2021 04:29:55 -0500 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1614590971; h=References: In-Reply-To: Message-Id: Date: Subject: Cc: To: From: Sender; bh=jKJu5aDGrcqlDbzQ78CdwyQI6hSDHoApx/V49+oBu78=; b=U8Oizz3xwLCH87sfAS5Ggj6Z1spX8dIdoFxaHAh0eNfZAbjVg10PD7rsedSoLnG+bQFV4fQs u/3oEq/3c+FxRCwnvs2WR3sVOrlOPUy2raSOi0j++okO86R7cr3WXPYlNWY2RvwCGjTd4+1O HFgrQYYaA8P0Ytsv+nud2frwOzo= 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-n03.prod.us-west-2.postgun.com with SMTP id 603cb3de7aa94c52e70c5751 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 01 Mar 2021 09:29:02 GMT Sender: kgunda=codeaurora.org@mg.codeaurora.org Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 852E2C433ED; Mon, 1 Mar 2021 09:29:02 +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 84F35C43463; Mon, 1 Mar 2021 09:28:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 84F35C43463 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 V3 1/2] backlight: qcom-wled: Fix FSC update issue for WLED5 Date: Mon, 1 Mar 2021 14:58:35 +0530 Message-Id: <1614590916-27070-2-git-send-email-kgunda@codeaurora.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1614590916-27070-1-git-send-email-kgunda@codeaurora.org> References: <1614590916-27070-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