Message ID | 20230929003901.15086-1-quic_amelende@quicinc.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3876407vqu; Fri, 29 Sep 2023 01:53:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHnYGzYFecMdfxKYx1SoLEQhAVanBoKT3pjMuOcDv5wk1j7bdw7kWr4d8vw/mg3/34Bxm/n X-Received: by 2002:a17:902:c10d:b0:1c7:3f3a:9b65 with SMTP id 13-20020a170902c10d00b001c73f3a9b65mr2441237pli.1.1695977586865; Fri, 29 Sep 2023 01:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695977586; cv=none; d=google.com; s=arc-20160816; b=jVA353xWchv8/2+Lgy3x/7ju/E/E9WIqR9PLI863hWFiJWQ0AfHPSqo4dUzJyZiEnu kBk7unklX4d19k25aVgq7I9HSfkF3VvlV6kbeI/6DnTC0mXcvEVVHxAkqxTn5IBWKeWu iwE19PiqBN7q5B8yNvU6Z2f0m+wACODkLh72xKlOYZwIGGwwgoPXLsvulGBQqY3zvgyA fU6KGQMvpCI4UsogOqAyc4LQvuLLOkHeObhoB9hsdouPN3FShw9QAusy+xbwSxoxNv25 De4V+NwCyMwUwri66z2LcSxeaumgjG75LQfKB/9PVPqi5t1d3jrYY3rwvKs05SZoJd9D pjiw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=6q15nGPM0tQmnNYPNotpVcBSBoi2DT5piGxQo/oZHXc=; fh=lDvKNFV5Xl6+a2SDgD5JDR2yxCiIT+vRupumJE4NWmE=; b=LEdceji3UqHGX4cBtG/1jZuwuw2nWUq0Xl3b2GBF4Zo08mlLfLCN9+nps9FQHZgHoL vsaY7a30sn7AC4CLkEn/xvNVfKRcSTrlyk+ZDQwgRudt7av0+Jurwcf682FX4w4VSl7B inSvcDj6mFUqS/0lkufnhnrmT03As2ccE51KaqHE45wFWfZxklhEeW49N8aUCtYovJKI 9nEWqOXw5Mx0NitJwlksz3D0fJeeRTU5hxMGYOTp0TbMoTqOf/xzxQL9xFm0SBYQbwx3 2baq4EoTyAdXl5+4lx41WHq6Kyd5kvyvTsBlhM4+LAULodK1NQyC9Z/Y7N0jaIUknYq7 OHDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=gqmXZ3G9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id k5-20020a170902c40500b001b80ecdcb88si22724087plk.473.2023.09.29.01.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 01:53:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=gqmXZ3G9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 54D7F83CD584; Thu, 28 Sep 2023 17:40:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232558AbjI2Ajs (ORCPT <rfc822;pwkd43@gmail.com> + 21 others); Thu, 28 Sep 2023 20:39:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232313AbjI2Ajl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 28 Sep 2023 20:39:41 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64206194; Thu, 28 Sep 2023 17:39:39 -0700 (PDT) Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38T0BwOu009656; Fri, 29 Sep 2023 00:39:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=qcppdkim1; bh=6q15nGPM0tQmnNYPNotpVcBSBoi2DT5piGxQo/oZHXc=; b=gqmXZ3G9DzkqGp3/0B5dpg1vwqmfFud1PVslbLuqq/E2J/kR6VFKw7oU9f994RkL8r6F yWvmV10Rj0A2h/M7f1J3/rMHzDpdEXGd6BexqmFivi/53bWdBqZCvCJBuZraWC9QZu4K kmXH9Goz/X8nkYY9oUANJ2hKadtLL+d5jUzg3TaUr2yugaMgParPXU87hGHpMl+moSLF n4xoIgrQjbT+i9ptUMKebI2nByIU6WwdgweiauSBnX0Xg02dZYEQy2JZ0U0kpnw6eweH ZSMEIvsHkurTauR5eJBcKQb36Nk50uVYRQCkXWtjwJ6/Svqhnrnm6RIR8I9Pbs9kdKij og== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3td24ua9wk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 00:39:25 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38T0dOnM029326 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 29 Sep 2023 00:39:24 GMT Received: from hu-amelende-lv.qualcomm.com (10.49.16.6) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Thu, 28 Sep 2023 17:39:22 -0700 From: Anjelique Melendez <quic_amelende@quicinc.com> To: <pavel@ucw.cz>, <lee@kernel.org>, <thierry.reding@gmail.com>, <robh+dt@kernel.org>, <krzysztof.kozlowski+dt@linaro.org>, <conor+dt@kernel.org>, <agross@kernel.org>, <andersson@kernel.org> CC: <luca.weiss@fairphone.com>, <konrad.dybcio@linaro.org>, <u.kleine-koenig@pengutronix.de>, <quic_subbaram@quicinc.com>, <quic_gurus@quicinc.com>, <linux-leds@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <linux-arm-msm@vger.kernel.org>, <linux-pwm@vger.kernel.org>, <kernel@quicinc.com>, Anjelique Melendez <quic_amelende@quicinc.com> Subject: [PATCH v5 0/7] Add support for LUT PPG Date: Thu, 28 Sep 2023 17:38:53 -0700 Message-ID: <20230929003901.15086-1-quic_amelende@quicinc.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01b.na.qualcomm.com (10.47.209.197) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: SIk62l1MpKXXoy2tfBcNGswaCttq1nEW X-Proofpoint-ORIG-GUID: SIk62l1MpKXXoy2tfBcNGswaCttq1nEW X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-09-28_23,2023-09-28_03,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 malwarescore=0 suspectscore=0 impostorscore=0 lowpriorityscore=0 spamscore=0 priorityscore=1501 mlxscore=0 mlxlogscore=999 adultscore=0 bulkscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2309290002 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 28 Sep 2023 17:40:28 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778361394125821796 X-GMAIL-MSGID: 1778361394125821796 |
Series |
Add support for LUT PPG
|
|
Message
Anjelique Melendez
Sept. 29, 2023, 12:38 a.m. UTC
In certain PMICs, LUT pattern and LPG configuration is stored in SDAM
modules instead of LUT peripheral. This feature is called PPG.
This change series adds support for PPG. Thanks!
Changes since v4:
- Patch 3/7
- Get rid of r/w helpers
- Use regmap_read_poll_timeout() in qcom_pbs_wait_for_ack()
- Update error path in qcom_pbs_trigger_event()
- Fix reverse christmas tree
- Patch 4/7
- Get rid of r/w helpers
- Update variables to use "sdam" instead of "nvmem"
- Fix comments
- Fix reverse christmas tree
- Update lpg_pattern_set() logic
- Patch 5/7
- Removed sdam_lut_base from lpg_data
Changes since v3:
- Patch 4/7
- Fix function returns
- Move register definition to top of file
- Revert max_brightness and probe accidental changes
- Combine init_sdam() and parse_sdam()
- Change error prints in probe to use dev_err_probe
- Remove ppg_en variable
- Update when pbs triggers are set/cleared
- Patch 6/7
- Remove use of nvmem_count
- Move register definition to top of file
- Remove lpg_get_sdam_lut_idx()
Changes since v2:
- Patch 1/7
- Fix dt_binding_check error
- Rename binding file to match compatible
- Iclude SoC specific comptaibles
- Patch 2/7
- Update nvmem-names list
- Patch 3/7
- Update EXPORT_SYMBOL to EXPORT_SYMBOL_GPL
- Fix return/break logic in qcom_pbs_wait_for_ack()
- Update iterators to be int
- Add constants
- Fix function calls in qcom_pbs_trigger_event()
- Remove unnessary comments
- Return -EPROBE_DEFER from get_pbs_client_device()
Changes since v1:
- Patch 1/7
- Fix dt_binding_check errors
- Update binding description
- Path 2/7
- Fix dt_binding_check errors
- Update per variant constraints
- Update nvmem description
- Patch 3/7
- Update get_pbs_client_device()
- Drop use of printk
- Remove unused function
Tested-by: Luca Weiss <luca.weiss@fairphone.com> # sdm632-fairphone-fp3 (pmi632)
Anjelique Melendez (7):
dt-bindings: soc: qcom: Add qcom,pbs bindings
dt-bindings: leds: leds-qcom-lpg: Add support for LPG PPG
soc: qcom: add QCOM PBS driver
leds: rgb: leds-qcom-lpg: Add support for single SDAM PPG
leds: rgb: leds-qcom-lpg: Update PMI632 lpg_data to support PPG
leds: rgb: leds-qcom-lpg: Include support for PPG with dedicated LUT
SDAM
leds: rgb: Update PM8350C lpg_data to support two-nvmem PPG Scheme
.../bindings/leds/leds-qcom-lpg.yaml | 89 ++++-
.../bindings/soc/qcom/qcom,pbs.yaml | 46 +++
drivers/leds/rgb/leds-qcom-lpg.c | 359 ++++++++++++++++--
drivers/soc/qcom/Kconfig | 9 +
drivers/soc/qcom/Makefile | 1 +
drivers/soc/qcom/qcom-pbs.c | 243 ++++++++++++
include/linux/soc/qcom/qcom-pbs.h | 30 ++
7 files changed, 749 insertions(+), 28 deletions(-)
create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,pbs.yaml
create mode 100644 drivers/soc/qcom/qcom-pbs.c
create mode 100644 include/linux/soc/qcom/qcom-pbs.h
Comments
On Fri Sep 29, 2023 at 2:38 AM CEST, Anjelique Melendez wrote: > In certain PMICs, LUT pattern and LPG configuration is stored in SDAM > modules instead of LUT peripheral. This feature is called PPG. > > This change series adds support for PPG. Thanks! > > Changes since v4: > - Patch 3/7 > - Get rid of r/w helpers > - Use regmap_read_poll_timeout() in qcom_pbs_wait_for_ack() > - Update error path in qcom_pbs_trigger_event() > - Fix reverse christmas tree > - Patch 4/7 > - Get rid of r/w helpers > - Update variables to use "sdam" instead of "nvmem" > - Fix comments > - Fix reverse christmas tree > - Update lpg_pattern_set() logic > - Patch 5/7 > - Removed sdam_lut_base from lpg_data > Changes since v3: > - Patch 4/7 > - Fix function returns > - Move register definition to top of file > - Revert max_brightness and probe accidental changes > - Combine init_sdam() and parse_sdam() > - Change error prints in probe to use dev_err_probe > - Remove ppg_en variable > - Update when pbs triggers are set/cleared > - Patch 6/7 > - Remove use of nvmem_count > - Move register definition to top of file > - Remove lpg_get_sdam_lut_idx() > Changes since v2: > - Patch 1/7 > - Fix dt_binding_check error > - Rename binding file to match compatible > - Iclude SoC specific comptaibles > - Patch 2/7 > - Update nvmem-names list > - Patch 3/7 > - Update EXPORT_SYMBOL to EXPORT_SYMBOL_GPL > - Fix return/break logic in qcom_pbs_wait_for_ack() > - Update iterators to be int > - Add constants > - Fix function calls in qcom_pbs_trigger_event() > - Remove unnessary comments > - Return -EPROBE_DEFER from get_pbs_client_device() > Changes since v1: > - Patch 1/7 > - Fix dt_binding_check errors > - Update binding description > - Path 2/7 > - Fix dt_binding_check errors > - Update per variant constraints > - Update nvmem description > - Patch 3/7 > - Update get_pbs_client_device() > - Drop use of printk > - Remove unused function > > Tested-by: Luca Weiss <luca.weiss@fairphone.com> # sdm632-fairphone-fp3 (pmi632) Hi Anjelique, Actually I've retested this now on PMI632 (and also realized that my previous tests weren't correct and wasn't actually using hw_pattern). Using the following commands (after boot) I'm expecting to get a 500ms on 500ms off blinking pattern between white (255 255 255) and off (0 0 0). echo pattern > /sys/class/leds/rgb:status/trigger echo -1 > /sys/class/leds/rgb:status/repeat echo "255 255 255" > /sys/class/leds/rgb:status/multi_intensity echo "255 500 255 0 0 500 0 0" > /sys/class/leds/rgb:status/hw_pattern What I actually see is it blinking between cyan (0 255 255) and red (255 0 0). At some point after playing with many patterns I got it to actually cycle between white and off, but I couldn't reproduce this again (or I didn't try hard enough). But with this example it correctly blinks red on-off. echo "255 0 0" > /sys/class/leds/rgb:status/multi_intensity echo "255 500 255 0 0 500 0 0" > /sys/class/leds/rgb:status/hw_pattern With "0 255 0" and "0 0 255" the other colors also work fine, it's just the combinations that seem somewhat broken. Regards Luca > > Anjelique Melendez (7): > dt-bindings: soc: qcom: Add qcom,pbs bindings > dt-bindings: leds: leds-qcom-lpg: Add support for LPG PPG > soc: qcom: add QCOM PBS driver > leds: rgb: leds-qcom-lpg: Add support for single SDAM PPG > leds: rgb: leds-qcom-lpg: Update PMI632 lpg_data to support PPG > leds: rgb: leds-qcom-lpg: Include support for PPG with dedicated LUT > SDAM > leds: rgb: Update PM8350C lpg_data to support two-nvmem PPG Scheme > > .../bindings/leds/leds-qcom-lpg.yaml | 89 ++++- > .../bindings/soc/qcom/qcom,pbs.yaml | 46 +++ > drivers/leds/rgb/leds-qcom-lpg.c | 359 ++++++++++++++++-- > drivers/soc/qcom/Kconfig | 9 + > drivers/soc/qcom/Makefile | 1 + > drivers/soc/qcom/qcom-pbs.c | 243 ++++++++++++ > include/linux/soc/qcom/qcom-pbs.h | 30 ++ > 7 files changed, 749 insertions(+), 28 deletions(-) > create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,pbs.yaml > create mode 100644 drivers/soc/qcom/qcom-pbs.c > create mode 100644 include/linux/soc/qcom/qcom-pbs.h
On 10/1/2023 7:15 AM, Luca Weiss wrote: > On Fri Sep 29, 2023 at 2:38 AM CEST, Anjelique Melendez wrote: >> In certain PMICs, LUT pattern and LPG configuration is stored in SDAM >> modules instead of LUT peripheral. This feature is called PPG. >> >> This change series adds support for PPG. Thanks! [..] >> >> Tested-by: Luca Weiss <luca.weiss@fairphone.com> # sdm632-fairphone-fp3 (pmi632) > > Hi Anjelique, > > Actually I've retested this now on PMI632 (and also realized that my > previous tests weren't correct and wasn't actually using hw_pattern). > > Using the following commands (after boot) I'm expecting to get a > 500ms on 500ms off blinking pattern between white (255 255 255) and off > (0 0 0). > > echo pattern > /sys/class/leds/rgb:status/trigger > echo -1 > /sys/class/leds/rgb:status/repeat > > echo "255 255 255" > /sys/class/leds/rgb:status/multi_intensity > echo "255 500 255 0 0 500 0 0" > /sys/class/leds/rgb:status/hw_pattern > > What I actually see is it blinking between cyan (0 255 255) and red (255 > 0 0). > At some point after playing with many patterns I got it to actually > cycle between white and off, but I couldn't reproduce this again (or I > didn't try hard enough). > > > But with this example it correctly blinks red on-off. > > echo "255 0 0" > /sys/class/leds/rgb:status/multi_intensity > echo "255 500 255 0 0 500 0 0" > /sys/class/leds/rgb:status/hw_pattern > > With "0 255 0" and "0 0 255" the other colors also work fine, it's just > the combinations that seem somewhat broken. > > Regards > Luca > > Hi Luca, Thanks for testing again and the feedback! Looks like for multicolor devices there is a small concurrency issue with enabling pattern at the same time for all the led channels. This could be why you observed your device blinking between red (255 0 0) and cyan (0 255 255), instead of seeing all channels (255 255 255) blink. The fix I'm planing to include in the next series is is to disable the multicolor led channels first, then configure all channels, and finally re-enable channels so that pattern is triggered at the same time for each all of the channels. I am currently testing with pm8350c device so if you are able to test next series on pmi632 it would be very appreciated! Thanks, Anjelique
On Thu Oct 12, 2023 at 11:50 PM CEST, Anjelique Melendez wrote: > > > On 10/1/2023 7:15 AM, Luca Weiss wrote: > > On Fri Sep 29, 2023 at 2:38 AM CEST, Anjelique Melendez wrote: > >> In certain PMICs, LUT pattern and LPG configuration is stored in SDAM > >> modules instead of LUT peripheral. This feature is called PPG. > >> > >> This change series adds support for PPG. Thanks! > [..] > >> > >> Tested-by: Luca Weiss <luca.weiss@fairphone.com> # sdm632-fairphone-fp3 (pmi632) > > > > Hi Anjelique, > > > > Actually I've retested this now on PMI632 (and also realized that my > > previous tests weren't correct and wasn't actually using hw_pattern). > > > > Using the following commands (after boot) I'm expecting to get a > > 500ms on 500ms off blinking pattern between white (255 255 255) and off > > (0 0 0). > > > > echo pattern > /sys/class/leds/rgb:status/trigger > > echo -1 > /sys/class/leds/rgb:status/repeat > > > > echo "255 255 255" > /sys/class/leds/rgb:status/multi_intensity > > echo "255 500 255 0 0 500 0 0" > /sys/class/leds/rgb:status/hw_pattern > > > > What I actually see is it blinking between cyan (0 255 255) and red (255 > > 0 0). > > At some point after playing with many patterns I got it to actually > > cycle between white and off, but I couldn't reproduce this again (or I > > didn't try hard enough). > > > > > > But with this example it correctly blinks red on-off. > > > > echo "255 0 0" > /sys/class/leds/rgb:status/multi_intensity > > echo "255 500 255 0 0 500 0 0" > /sys/class/leds/rgb:status/hw_pattern > > > > With "0 255 0" and "0 0 255" the other colors also work fine, it's just > > the combinations that seem somewhat broken. > > > > Regards > > Luca > > > > > Hi Luca, > > Thanks for testing again and the feedback! > Looks like for multicolor devices there is a small concurrency issue with > enabling pattern at the same time for all the led channels. This could be > why you observed your device blinking between red (255 0 0) and cyan (0 255 255), > instead of seeing all channels (255 255 255) blink. > The fix I'm planing to include in the next series is is to disable the multicolor led > channels first, then configure all channels, and finally re-enable channels > so that pattern is triggered at the same time for each all of the channels. Sounds reasonable I think! > > I am currently testing with pm8350c device so if you are able to test next series > on pmi632 it would be very appreciated! Will do, thanks for fixing it up! Regards Luca > > Thanks, > Anjelique