Message ID | 20230405212233.4167986-1-risca@dalakolonin.se |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6358:3d4a:b0:114:e959:cc0c with SMTP id b10csp629953rwc; Wed, 5 Apr 2023 14:29:33 -0700 (PDT) X-Google-Smtp-Source: AKy350Z+tjWvYTqpf883qz8IhTjZupAkCxe8I46b4eHr60ptzijr2Dq1LZxZsvkSxbYUKXv4XORe X-Received: by 2002:a05:6402:343:b0:4fa:4bc4:a911 with SMTP id r3-20020a056402034300b004fa4bc4a911mr3101080edw.13.1680730173294; Wed, 05 Apr 2023 14:29:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680730173; cv=none; d=google.com; s=arc-20160816; b=gfzXCO1iAVTDAjH0xJH/0f50L/hr7azIs7oWWwvGTkaPwHZTyyRllBRIIqTwIuVdTu /w0jlcC3h8KemhE7P2lPFcOG3agP0lMtvU6nj4F3fSSPbSVGQZ4yXLR8HD5rEIFD7EY3 lN3l3FbMqx5LzFriotRiQFIlr+dbQWTILYuZ1UE6deHMF+YBkJOGn3jvNwLtEI6moeEM A03WSnCVelWvSthPf1CmTlmVStyJKsIjpRRTmnpqhp2ZHeQaeF5EDY9RxsYT0aY5JhpF SAHCVVVZb8lcBo9JnrqvCFal40V3TZAzB66FDVnxYHSNB8bG5UxtXDMDP4hfBopp1TWx B9cA== 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:dkim-filter; bh=aj7BJRGxp0A9WS53Fydt2hDFp/YXbSvFyWVqf4RUrfw=; b=sPlUhQiUhPbO+kEJRXyCXy23tddZRsY3l6kNGBbbCLjwh1zVHe4VhMmTdKM7ynaQ22 o1kwgMpQEPJi9f8zkK8jyAWGZ0d6gc/XC4nGa89w/wfGfRSPIKOO7EQwPqXsBlzcHWEJ r4zMCcuLl8JORtU5zHd+M5IuDSFkIf1/aPWWz3Q3q7fkHwE+vIpXi11b7+eYGaUyh/wJ l9RQJTNtcM1wPUZXoTsjoPkMLVlo76wKVDkkoEMjhaL18oPntazG6v/W3rfVPQivwWXs AWpOxu5qmy/Agdjs3rW4pyr2jy/5dAR2M+EjeZZai8CEJSn6CWwWgGmxs5kz94Z2SXIP 4axQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dalakolonin.se header.s=D374B428-D0A7-11ED-A657-75977B426508 header.b=bgdIWoBU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dalakolonin.se Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t4-20020aa7d704000000b00501c10ec485si3550004edq.0.2023.04.05.14.29.09; Wed, 05 Apr 2023 14:29:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@dalakolonin.se header.s=D374B428-D0A7-11ED-A657-75977B426508 header.b=bgdIWoBU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dalakolonin.se Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234192AbjDEVXA (ORCPT <rfc822;lkml4gm@gmail.com> + 99 others); Wed, 5 Apr 2023 17:23:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229553AbjDEVW4 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 5 Apr 2023 17:22:56 -0400 Received: from pio-pvt-msa3.bahnhof.se (pio-pvt-msa3.bahnhof.se [79.136.2.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D58DB61BF; Wed, 5 Apr 2023 14:22:52 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTP id CE9563F7F6; Wed, 5 Apr 2023 23:22:49 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Score: -2.099 X-Spam-Level: X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Authentication-Results: pio-pvt-msa3.bahnhof.se (amavisd-new); dkim=pass (2048-bit key) header.d=dalakolonin.se Received: from pio-pvt-msa3.bahnhof.se ([127.0.0.1]) by localhost (pio-pvt-msa3.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CSjlo38pbiCi; Wed, 5 Apr 2023 23:22:48 +0200 (CEST) Received: by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTPA id 4FFD83F737; Wed, 5 Apr 2023 23:22:47 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id CBADB94DC3; Wed, 5 Apr 2023 21:22:46 +0000 (UTC) Received: from zimbra.dalakolonin.se ([127.0.0.1]) by localhost (zimbra.dalakolonin.se [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id gYLVWoSoLt8J; Wed, 5 Apr 2023 21:22:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id 7F8A194DBF; Wed, 5 Apr 2023 21:22:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra.dalakolonin.se 7F8A194DBF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dalakolonin.se; s=D374B428-D0A7-11ED-A657-75977B426508; t=1680729762; bh=aj7BJRGxp0A9WS53Fydt2hDFp/YXbSvFyWVqf4RUrfw=; h=From:To:Date:Message-Id:MIME-Version; b=bgdIWoBUGPYAQhu1xrYc6MAx9vWBNBCKkO0zkm/3GJ7H+ZPNaZ1vHbDdpEgfP2m8N fP4UiShsNJRTysFzMLYkDm1iCBLhmFnH64PMxWTqyZ9CHobGLArlkW0QlrnPKUiSf4 j8SSIlGa6HG5+SAnG+epPRZuLR4ZsooJTdMpHp9Ck2p0nDW3ExWxuMXBLalfBdnPPa v4VZ+9PHJbEsuQ+igZD3xcy3zF4Wpy4Yjt9LwO0EJbWFl1HwY5bO7X2ADT9OCMv4Eq /LULOV3xEZr+u9PN02g2qjQVfh4bkgXzz/KIcwjFzTrMpdz0IWuuB61fL5YGZ/oaTS /vj95R3EoynCg== X-Virus-Scanned: amavisd-new at dalakolonin.se Received: from zimbra.dalakolonin.se ([127.0.0.1]) by localhost (zimbra.dalakolonin.se [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id brz31VNIynod; Wed, 5 Apr 2023 21:22:42 +0000 (UTC) Received: from rack-server-1.dalakolonin.se (unknown [172.17.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTPSA id F0FE394DBC; Wed, 5 Apr 2023 21:22:41 +0000 (UTC) From: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= <risca@dalakolonin.se> To: linux-iio@vger.kernel.org Cc: linux-kernel@vger.kernel.org, letux-kernel@openphoenux.org, kernel@pyra-handheld.com, pgoudagunta@nvidia.com, hns@goldelico.com, jic23@kernel.org, lars@metafoo.de, linux-omap@vger.kernel.org, =?utf-8?q?Pa?= =?utf-8?q?trik_Dahlstr=C3=B6m?= <risca@dalakolonin.se> Subject: [PATCH v3 0/7] iio: adc: palmas_gpadc: add iio events Date: Wed, 5 Apr 2023 23:22:26 +0200 Message-Id: <20230405212233.4167986-1-risca@dalakolonin.se> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762373322272230515?= X-GMAIL-MSGID: =?utf-8?q?1762373322272230515?= |
Series |
iio: adc: palmas_gpadc: add iio events
|
|
Message
Patrik Dahlström
April 5, 2023, 9:22 p.m. UTC
This series is based on linux-next/master [1] and [2]. The palmas gpadc block has support for monitoring up to 2 ADC channels and issue an interrupt if they reach past a set threshold. This can be configured statically with device tree today, but it only gets enabled when reaching sleep mode. Also, it doesn't look like anyone is using it. Instead of this one special case, change the code so userspace can configure the ADC channels to their own needs through the iio events subsystem. The high and low threshold values can be set for every channel, but only 2 thresholds can be enabled at a time. Trying to enable more than 2 thresholds will result in an error. The configured thresholds will wake up the system from sleep mode if wakeup is enabled in /sys/devices/.../power/wakeup. The old platform data was removed. Thresholds, events, and wakeup were tested on omap5-uevm board. It wakes up from sleep mode when wakeup is enabled and a threshold is passed. A userspace tool for monitoring events and adjusting thresholds can be found at [3]. V2 -> V3: * Rebased to linux-next. * Avoid reconfiguring events on error and when old == new value. V1 -> V2: * Begin by removing adc_wakeupX_data instead of doing it last. * Split changes in smaller patches [1] git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git [2] https://lore.kernel.org/linux-iio/20230318163039.56115-1-jic23@kernel.org/ [3] https://github.com/Risca/pyra_vol_mon Patrik Dahlström (7): iio: adc: palmas: remove adc_wakeupX_data iio: adc: palmas: replace "wakeup" with "event" iio: adc: palmas: use iio_event_direction for threshold polarity iio: adc: palmas: move eventX_enable into palmas_adc_event iio: adc: palmas: always reset events on unload iio: adc: palmas: add support for iio threshold events iio: adc: palmas: don't alter event config on suspend/resume drivers/iio/adc/palmas_gpadc.c | 559 +++++++++++++++++++++++++++------ include/linux/mfd/palmas.h | 8 - 2 files changed, 464 insertions(+), 103 deletions(-) base-commit: 8417c8f5007bf4567ccffda850a3157c7d905f67 prerequisite-patch-id: b0418c707db13f514400956596e9ebe91c25bba0
Comments
On Wed, 5 Apr 2023 23:22:26 +0200 Patrik Dahlström <risca@dalakolonin.se> wrote: > This series is based on linux-next/master [1] and [2]. > > The palmas gpadc block has support for monitoring up to 2 ADC channels > and issue an interrupt if they reach past a set threshold. This can be > configured statically with device tree today, but it only gets enabled > when reaching sleep mode. Also, it doesn't look like anyone is using it. > > Instead of this one special case, change the code so userspace can > configure the ADC channels to their own needs through the iio events > subsystem. The high and low threshold values can be set for every > channel, but only 2 thresholds can be enabled at a time. Trying to > enable more than 2 thresholds will result in an error. > > The configured thresholds will wake up the system from sleep mode if > wakeup is enabled in /sys/devices/.../power/wakeup. > > The old platform data was removed. > > Thresholds, events, and wakeup were tested on omap5-uevm board. It wakes > up from sleep mode when wakeup is enabled and a threshold is passed. A > userspace tool for monitoring events and adjusting thresholds can be > found at [3]. > > V2 -> V3: > * Rebased to linux-next. As per reply to the earlier thread. Don't base on linux-next. It can be very unstable though not so much later in a cycle like this. If there isn't a lot of churn going on in the driver, fine to base on previous release kernel or rc1 (good to say if it is an rc1) If there is churn underway (which is true here) then iio/togreg + extra patches lists that need to be applied listed in this cover letter. I'm also fine with you just adding the devm patch to this series as the first patch. Jonathan > * Avoid reconfiguring events on error and when old == new value. > V1 -> V2: > * Begin by removing adc_wakeupX_data instead of doing it last. > * Split changes in smaller patches > > [1] git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > [2] https://lore.kernel.org/linux-iio/20230318163039.56115-1-jic23@kernel.org/ > [3] https://github.com/Risca/pyra_vol_mon > > Patrik Dahlström (7): > iio: adc: palmas: remove adc_wakeupX_data > iio: adc: palmas: replace "wakeup" with "event" > iio: adc: palmas: use iio_event_direction for threshold polarity > iio: adc: palmas: move eventX_enable into palmas_adc_event > iio: adc: palmas: always reset events on unload > iio: adc: palmas: add support for iio threshold events > iio: adc: palmas: don't alter event config on suspend/resume > > drivers/iio/adc/palmas_gpadc.c | 559 +++++++++++++++++++++++++++------ > include/linux/mfd/palmas.h | 8 - > 2 files changed, 464 insertions(+), 103 deletions(-) > > > base-commit: 8417c8f5007bf4567ccffda850a3157c7d905f67 > prerequisite-patch-id: b0418c707db13f514400956596e9ebe91c25bba0
On Fri, 7 Apr 2023 18:04:35 +0100 Jonathan Cameron <jic23@kernel.org> wrote: > On Wed, 5 Apr 2023 23:22:26 +0200 > Patrik Dahlström <risca@dalakolonin.se> wrote: > > > This series is based on linux-next/master [1] and [2]. > > > > The palmas gpadc block has support for monitoring up to 2 ADC channels > > and issue an interrupt if they reach past a set threshold. This can be > > configured statically with device tree today, but it only gets enabled > > when reaching sleep mode. Also, it doesn't look like anyone is using it. > > > > Instead of this one special case, change the code so userspace can > > configure the ADC channels to their own needs through the iio events > > subsystem. The high and low threshold values can be set for every > > channel, but only 2 thresholds can be enabled at a time. Trying to > > enable more than 2 thresholds will result in an error. > > > > The configured thresholds will wake up the system from sleep mode if > > wakeup is enabled in /sys/devices/.../power/wakeup. > > > > The old platform data was removed. > > > > Thresholds, events, and wakeup were tested on omap5-uevm board. It wakes > > up from sleep mode when wakeup is enabled and a threshold is passed. A > > userspace tool for monitoring events and adjusting thresholds can be > > found at [3]. > > > > V2 -> V3: > > * Rebased to linux-next. > > As per reply to the earlier thread. Don't base on linux-next. > It can be very unstable though not so much later in a cycle like this. > > If there isn't a lot of churn going on in the driver, fine to base on > previous release kernel or rc1 (good to say if it is an rc1) > > If there is churn underway (which is true here) then iio/togreg + extra > patches lists that need to be applied listed in this cover letter. Just goes to show I focused on the change log and skipped the rest :) As you have it here is fine though change log could have mentioned the extra patch as well even if just "Rebased to linux-next + devm patch." In this case linux-next is close enough for this driver to the iio/togreg tree that it doesn't matter that it shouldn't be used as a base (no impact in this particular case I think). Anyhow, all good. I noticed I'd misinterpreted what you'd done here when I saw the context in one of the patches. oops :) Jonathan > > I'm also fine with you just adding the devm patch to this series as > the first patch. > > Jonathan > > > > > * Avoid reconfiguring events on error and when old == new value. > > V1 -> V2: > > * Begin by removing adc_wakeupX_data instead of doing it last. > > * Split changes in smaller patches > > > > [1] git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > > [2] https://lore.kernel.org/linux-iio/20230318163039.56115-1-jic23@kernel.org/ > > [3] https://github.com/Risca/pyra_vol_mon > > > > Patrik Dahlström (7): > > iio: adc: palmas: remove adc_wakeupX_data > > iio: adc: palmas: replace "wakeup" with "event" > > iio: adc: palmas: use iio_event_direction for threshold polarity > > iio: adc: palmas: move eventX_enable into palmas_adc_event > > iio: adc: palmas: always reset events on unload > > iio: adc: palmas: add support for iio threshold events > > iio: adc: palmas: don't alter event config on suspend/resume > > > > drivers/iio/adc/palmas_gpadc.c | 559 +++++++++++++++++++++++++++------ > > include/linux/mfd/palmas.h | 8 - > > 2 files changed, 464 insertions(+), 103 deletions(-) > > > > > > base-commit: 8417c8f5007bf4567ccffda850a3157c7d905f67 > > prerequisite-patch-id: b0418c707db13f514400956596e9ebe91c25bba0 >
On Fri, Apr 07, 2023 at 06:09:41PM +0100, Jonathan Cameron wrote: > On Fri, 7 Apr 2023 18:04:35 +0100 > Jonathan Cameron <jic23@kernel.org> wrote: > > > On Wed, 5 Apr 2023 23:22:26 +0200 > > Patrik Dahlström <risca@dalakolonin.se> wrote: > > > > > This series is based on linux-next/master [1] and [2]. > > > > > > The palmas gpadc block has support for monitoring up to 2 ADC channels > > > and issue an interrupt if they reach past a set threshold. This can be > > > configured statically with device tree today, but it only gets enabled > > > when reaching sleep mode. Also, it doesn't look like anyone is using it. > > > > > > Instead of this one special case, change the code so userspace can > > > configure the ADC channels to their own needs through the iio events > > > subsystem. The high and low threshold values can be set for every > > > channel, but only 2 thresholds can be enabled at a time. Trying to > > > enable more than 2 thresholds will result in an error. > > > > > > The configured thresholds will wake up the system from sleep mode if > > > wakeup is enabled in /sys/devices/.../power/wakeup. > > > > > > The old platform data was removed. > > > > > > Thresholds, events, and wakeup were tested on omap5-uevm board. It wakes > > > up from sleep mode when wakeup is enabled and a threshold is passed. A > > > userspace tool for monitoring events and adjusting thresholds can be > > > found at [3]. > > > > > > V2 -> V3: > > > * Rebased to linux-next. > > > > As per reply to the earlier thread. Don't base on linux-next. > > It can be very unstable though not so much later in a cycle like this. > > > > If there isn't a lot of churn going on in the driver, fine to base on > > previous release kernel or rc1 (good to say if it is an rc1) > > > > If there is churn underway (which is true here) then iio/togreg + extra > > patches lists that need to be applied listed in this cover letter. > > Just goes to show I focused on the change log and skipped the rest :) > As you have it here is fine though change log could have mentioned the > extra patch as well even if just "Rebased to linux-next + devm patch." > > In this case linux-next is close enough for this driver to the > iio/togreg tree that it doesn't matter that it shouldn't be used as a base > (no impact in this particular case I think). I'll rebase to iio/togreg, fix up the cosmetics, and add the devm patch to the series. Sounds good? > > Anyhow, all good. I noticed I'd misinterpreted what you'd done here > when I saw the context in one of the patches. oops :) No worries, I'm just glad this is progressing :) > > Jonathan > > > > > > I'm also fine with you just adding the devm patch to this series as > > the first patch. > > > > Jonathan > > > > > > > > > * Avoid reconfiguring events on error and when old == new value. > > > V1 -> V2: > > > * Begin by removing adc_wakeupX_data instead of doing it last. > > > * Split changes in smaller patches > > > > > > [1] git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git > > > [2] https://lore.kernel.org/linux-iio/20230318163039.56115-1-jic23@kernel.org/ > > > [3] https://github.com/Risca/pyra_vol_mon > > > > > > Patrik Dahlström (7): > > > iio: adc: palmas: remove adc_wakeupX_data > > > iio: adc: palmas: replace "wakeup" with "event" > > > iio: adc: palmas: use iio_event_direction for threshold polarity > > > iio: adc: palmas: move eventX_enable into palmas_adc_event > > > iio: adc: palmas: always reset events on unload > > > iio: adc: palmas: add support for iio threshold events > > > iio: adc: palmas: don't alter event config on suspend/resume > > > > > > drivers/iio/adc/palmas_gpadc.c | 559 +++++++++++++++++++++++++++------ > > > include/linux/mfd/palmas.h | 8 - > > > 2 files changed, 464 insertions(+), 103 deletions(-) > > > > > > > > > base-commit: 8417c8f5007bf4567ccffda850a3157c7d905f67 > > > prerequisite-patch-id: b0418c707db13f514400956596e9ebe91c25bba0 > > >