From patchwork Sat Apr 8 11:46:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= X-Patchwork-Id: 81181 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp842693vqo; Sat, 8 Apr 2023 05:24:36 -0700 (PDT) X-Google-Smtp-Source: AKy350YsiOzUHq5Xh70aW1uDe/AdbZeUsPMBzbssB1Gi4Cy/am+TDUvcI6kyxZGEHMqNF/9Oy7Jy X-Received: by 2002:a17:902:ec8e:b0:1a5:2a50:e177 with SMTP id x14-20020a170902ec8e00b001a52a50e177mr1225751plg.55.1680956676056; Sat, 08 Apr 2023 05:24:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680956676; cv=none; d=google.com; s=arc-20160816; b=0VEu/YLOk94ACvBaIW0/cseWRpS0UXy5+nbFv9EkXl4zprQXE7O/EqzpuO5lrv+smf wnEDgg/5FkFu5jrq+tkHJYIDW8Y1ISbmtbDkDZ+Wwe1Z3kjyYGwZXRGWeuvyqcKUrzZh P9wxxfz91PutyZ/ElfbBfS1H8Y6IjgM3+6UpQmlyXUjZzb1in8sicRyb8YL7nT1EaURd 05QaZ1fg+hh0RoLBrm4QPBXT2z6HqgzCwmBDc4ZyR6MGrNrrFxTBLyII/bw+HzNoODYI 62ZsmEmzm0KTaizv0Lu8TJpn0wZdvFk1op8UdJJCYc/2+cWRc++uB7+w1SrNqcM0Es7a u4bA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=QpAkz8NzyhCd80cX7C/EMbSMfNw/jsM+n+BufT6T6ZU=; b=Ao2AM4J5/8R+DrgcnSYGdY4DozZWBKrZi9aqivhyUA9bli1ZME1PV39z5nibuBpCMV bpL79zEUNUhMaF8mbPBae/XKsE1Ywr0v3A6x/izIMDaWS8MnH0Qn+T76ZHt19Itiy+sc 2e03TVM1OVAweE3+6p3Ve6jobTxKOzQw0q+ghcWVo30tTSh0a6uXzhGEYBDpeNTCvomv enSGyFS1deN5jSqbJz1+ul+owgTHyYLgO39I1mFVmAnp1VcHiSduTvv8d8i4rKhuC41M n1K4igmH41tLXVt1htFCv6pKNKfOw4OAdZp1HnIMrLT86ge3hq3QVBcTI3MkV/2/6m/J 3OWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dalakolonin.se header.s=D374B428-D0A7-11ED-A657-75977B426508 header.b=TRv4YgPc; 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 l9-20020a170902f68900b0019c354055d0si6586425plg.304.2023.04.08.05.24.23; Sat, 08 Apr 2023 05:24:36 -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=TRv4YgPc; 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 S230364AbjDHLq7 (ORCPT + 99 others); Sat, 8 Apr 2023 07:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33036 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230338AbjDHLqw (ORCPT ); Sat, 8 Apr 2023 07:46:52 -0400 Received: from ste-pvt-msa2.bahnhof.se (ste-pvt-msa2.bahnhof.se [213.80.101.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EECDEFBD; Sat, 8 Apr 2023 04:46:46 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by ste-pvt-msa2.bahnhof.se (Postfix) with ESMTP id 5E1954040D; Sat, 8 Apr 2023 13:46:44 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Score: -2.1 X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Authentication-Results: ste-ftg-msa2.bahnhof.se (amavisd-new); dkim=pass (2048-bit key) header.d=dalakolonin.se Received: from ste-pvt-msa2.bahnhof.se ([127.0.0.1]) by localhost (ste-ftg-msa2.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id An0gfqvTNGqE; Sat, 8 Apr 2023 13:46:43 +0200 (CEST) Received: by ste-pvt-msa2.bahnhof.se (Postfix) with ESMTPA id 6F2663FF56; Sat, 8 Apr 2023 13:46:43 +0200 (CEST) Authentication-Results: ste-pvt-msa2.bahnhof.se; dkim=pass (2048-bit key; unprotected) header.d=dalakolonin.se header.i=@dalakolonin.se header.b="TRv4YgPc"; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id 4D6EA95F1B; Sat, 8 Apr 2023 11:46:43 +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 5mKt8oYuwbOU; Sat, 8 Apr 2023 11:46:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id 07E4C95F17; Sat, 8 Apr 2023 11:46:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra.dalakolonin.se 07E4C95F17 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dalakolonin.se; s=D374B428-D0A7-11ED-A657-75977B426508; t=1680954402; bh=QpAkz8NzyhCd80cX7C/EMbSMfNw/jsM+n+BufT6T6ZU=; h=From:To:Date:Message-Id:MIME-Version; b=TRv4YgPc7jqopecowqYjGjGoeWm1CoI0t24YbuY8l50kb4p3lkiq4FTRS+35E+xSB ZxeFlTzB7sqBiI5Ezfe5vkMpN9x8ua9OcZgnncUFnqlgcbcSs00Qh2ry6ZkIAnb9dW gZ5JpVr0cPpGEGNptdmEKStdkqIX1VcWm2GJ+rxQ7iDvzwnbH2R29u6L73wHQtWSya QL5luJwfQ/EFaaXJICz5uPXgFVvVoWAxNq36PlpDcTsduc1wAErfOgBge2dDHbScDn FuESHpgGscoW5qg3IxFBqeEyu8XOqz9QWSCZHnoxiPXUOS1CRYnFZPVbJPTtNHUuzH PcvFZwuk7K2Hg== 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 XovZAKi-2bup; Sat, 8 Apr 2023 11:46:41 +0000 (UTC) Received: from rack-server-1.dalakolonin.se (unknown [172.17.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTPSA id C0F7995F14; Sat, 8 Apr 2023 11:46:41 +0000 (UTC) From: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= 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?= Subject: [PATCH v3 1/7] iio: adc: palmas: remove adc_wakeupX_data Date: Sat, 8 Apr 2023 13:46:18 +0200 Message-Id: <20230408114624.824144-2-risca@dalakolonin.se> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230408114624.824144-1-risca@dalakolonin.se> References: <20230408114624.824144-1-risca@dalakolonin.se> MIME-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762610827446068962?= X-GMAIL-MSGID: =?utf-8?q?1762610827446068962?= It does not seem to be used by anyone and later patches in this series are made simpler by first removing this. There is now a lot of dead code that cannot be reached, until later patches revive it. Arguably, this is preferred over removing the code only to add it again. Signed-off-by: Patrik Dahlström --- drivers/iio/adc/palmas_gpadc.c | 50 ++++------------------------------ include/linux/mfd/palmas.h | 8 ------ 2 files changed, 6 insertions(+), 52 deletions(-) diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index 2921186458e0..03af6cd73ec8 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -76,6 +76,12 @@ static struct palmas_gpadc_info palmas_gpadc_info[] = { PALMAS_ADC_INFO(IN15, 0, 0, 0, 0, INVALID, INVALID, true), }; +struct palmas_adc_wakeup_property { + int adc_channel_number; + int adc_high_threshold; + int adc_low_threshold; +}; + /* * struct palmas_gpadc - the palmas_gpadc structure * @ch0_current: channel 0 current source setting @@ -493,11 +499,6 @@ static int palmas_gpadc_get_adc_dt_data(struct platform_device *pdev, return 0; } -static void palmas_disable_wakeup(void *dev) -{ - device_wakeup_disable(dev); -} - static int palmas_gpadc_probe(struct platform_device *pdev) { struct palmas_gpadc *adc; @@ -548,36 +549,6 @@ static int palmas_gpadc_probe(struct platform_device *pdev) return dev_err_probe(adc->dev, ret, "request irq %d failed\n", adc->irq); - if (gpadc_pdata->adc_wakeup1_data) { - memcpy(&adc->wakeup1_data, gpadc_pdata->adc_wakeup1_data, - sizeof(adc->wakeup1_data)); - adc->wakeup1_enable = true; - adc->irq_auto_0 = platform_get_irq(pdev, 1); - ret = devm_request_threaded_irq(&pdev->dev, adc->irq_auto_0, - NULL, palmas_gpadc_irq_auto, - IRQF_ONESHOT, - "palmas-adc-auto-0", adc); - if (ret < 0) - return dev_err_probe(adc->dev, ret, - "request auto0 irq %d failed\n", - adc->irq_auto_0); - } - - if (gpadc_pdata->adc_wakeup2_data) { - memcpy(&adc->wakeup2_data, gpadc_pdata->adc_wakeup2_data, - sizeof(adc->wakeup2_data)); - adc->wakeup2_enable = true; - adc->irq_auto_1 = platform_get_irq(pdev, 2); - ret = devm_request_threaded_irq(&pdev->dev, adc->irq_auto_1, - NULL, palmas_gpadc_irq_auto, - IRQF_ONESHOT, - "palmas-adc-auto-1", adc); - if (ret < 0) - return dev_err_probe(adc->dev, ret, - "request auto1 irq %d failed\n", - adc->irq_auto_1); - } - /* set the current source 0 (value 0/5/15/20 uA => 0..3) */ if (gpadc_pdata->ch0_current <= 1) adc->ch0_current = PALMAS_ADC_CH0_CURRENT_SRC_0; @@ -617,15 +588,6 @@ static int palmas_gpadc_probe(struct platform_device *pdev) palmas_gpadc_calibrate(adc, i); } - if (adc->wakeup1_enable || adc->wakeup2_enable) { - device_wakeup_enable(&pdev->dev); - ret = devm_add_action_or_reset(&pdev->dev, - palmas_disable_wakeup, - &pdev->dev); - if (ret) - return ret; - } - return 0; } diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 117d02708439..eda1ffd99c1a 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h @@ -128,12 +128,6 @@ struct palmas_pmic_driver_data { struct regulator_config config); }; -struct palmas_adc_wakeup_property { - int adc_channel_number; - int adc_high_threshold; - int adc_low_threshold; -}; - struct palmas_gpadc_platform_data { /* Channel 3 current source is only enabled during conversion */ int ch3_current; /* 0: off; 1: 10uA; 2: 400uA; 3: 800 uA */ @@ -152,8 +146,6 @@ struct palmas_gpadc_platform_data { int start_polarity; int auto_conversion_period_ms; - struct palmas_adc_wakeup_property *adc_wakeup1_data; - struct palmas_adc_wakeup_property *adc_wakeup2_data; }; struct palmas_reg_init { From patchwork Sat Apr 8 11:46:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= X-Patchwork-Id: 81175 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp840267vqo; Sat, 8 Apr 2023 05:19:25 -0700 (PDT) X-Google-Smtp-Source: AKy350YuXdpCMKHX+77xAoL+RzW0melleENsX61V8N1Nx1czNuGTURpfQweFbNn2lAjrvA/+BAsh X-Received: by 2002:a17:903:42cd:b0:1a5:898:37aa with SMTP id jy13-20020a17090342cd00b001a5089837aamr4937710plb.15.1680956364771; Sat, 08 Apr 2023 05:19:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680956364; cv=none; d=google.com; s=arc-20160816; b=EEMLqHjukfjGHSWNuP1xuRUzdzUnFuIynFZWpl33OF7Lmd0iT/7b6geL0s46OJG6tI 7655x1JVw4jTkjUBUjjEZ7g6u8oZ/QK5Goa4WjhavJoo5MTtu7TEIImE9HjSE9nkTqjj XZHcEuyYcJVY238bHx8WcBv57PVshLSwYi4OBuxl9GbT0ijRQd0LtPS+RuE7EIOR5kqs fNQZubAI96WSDc1eXaEM5cfevLuVhrmEFVjIisQgVTQVzI0Kpt9b5UWgev1zHQZgLbWd NStt/JR7CDNPIkKbzpnS28K4GwalLHnamaoT8YI/u31lDpS/4u4qoQjo/VPyUPPWD0/g 1XAw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=WEa42btgt5YoGy4wRFO15STm/DxrasoQ4xEIrCOV4as=; b=PhhkvwsDfULKL/9HoN3ulybt00DS/JmLUWP/Q6nmYKc55Ukcsi3EZf4+6tqao4HIKW MbOtJm2w82hHuMtqgwtF91TjEVRN7212rYg2E/OnURJOJ7Jd/4GgEz66TYsfPe48c1wE EHdu1jINq12AovOjuJ8S5qnlzOYDpvjUXNTgSDjtQthrFbd92CGj3Yv9M/BHWYWNOZsC hikKXmhUY1sr80GEDUKtSfg2xfXn8CWT7IrSkCAzZHm9SHeFINYhcLbzLEnb3L+4IydY 7JrwRNWJOcr65sHmIIpDrEPBbknUaNz1YnV8+zXvS1ogR/2RUwAECVFK5y0x98PMC/q2 Y62A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dalakolonin.se header.s=D374B428-D0A7-11ED-A657-75977B426508 header.b=UXeenewH; 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 l9-20020a170902f68900b0019c354055d0si6586425plg.304.2023.04.08.05.19.12; Sat, 08 Apr 2023 05:19:24 -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=UXeenewH; 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 S230237AbjDHLrG (ORCPT + 99 others); Sat, 8 Apr 2023 07:47:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230294AbjDHLrD (ORCPT ); Sat, 8 Apr 2023 07:47:03 -0400 Received: from ste-pvt-msa1.bahnhof.se (ste-pvt-msa1.bahnhof.se [213.80.101.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D63E3E181; Sat, 8 Apr 2023 04:46:53 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTP id BD1E13FB0D; Sat, 8 Apr 2023 13:46:51 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Score: -2.1 X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Authentication-Results: ste-pvt-msa1.bahnhof.se (amavisd-new); dkim=pass (2048-bit key) header.d=dalakolonin.se Received: from ste-pvt-msa1.bahnhof.se ([127.0.0.1]) by localhost (ste-pvt-msa1.bahnhof.se [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CF62xFLU9dtv; Sat, 8 Apr 2023 13:46:50 +0200 (CEST) Received: by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id C07BE3F303; Sat, 8 Apr 2023 13:46:50 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id 46F7095F3D; Sat, 8 Apr 2023 11:46:50 +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 UUcLjcrSyF76; Sat, 8 Apr 2023 11:46:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id 4EDCB95F2C; Sat, 8 Apr 2023 11:46:47 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra.dalakolonin.se 4EDCB95F2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dalakolonin.se; s=D374B428-D0A7-11ED-A657-75977B426508; t=1680954407; bh=WEa42btgt5YoGy4wRFO15STm/DxrasoQ4xEIrCOV4as=; h=From:To:Date:Message-Id:MIME-Version; b=UXeenewHLx0SG9jpB9Aw2BqZmJxvGBmPItV7yNj0xcfliKr186KhGMRh+aHim/sdw +E9IRGpfzFE+sUWdaUWj1DPhFFBsB3CQZn8Ar5a9IqhI1EmRxDDJ/XKmS59A71e+B+ WabAthAIBPZnMuL/3QhNJqfxDmYoA800YZtLQS4GJ+66iFkReC3qiYCDRPdf+CQ2Lh yKZ+r1Uewhp8C3xZrXgsq/mUh4h5RTlc2wh9lURjENrN4Mlak35Id1gSJeXRYYHp3H bFrV6uYWcX8JUn974X1whR317zBgGZWanfJWxe+pBfTzrz3ZoQmq4aF+FRnqo+jBBs gZj3DfEnLICUQ== 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 VynlEsiDmLKO; Sat, 8 Apr 2023 11:46:47 +0000 (UTC) Received: from rack-server-1.dalakolonin.se (unknown [172.17.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTPSA id 16A3295F29; Sat, 8 Apr 2023 11:46:47 +0000 (UTC) From: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= 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?= Subject: [PATCH v3 2/7] iio: adc: palmas: replace "wakeup" with "event" Date: Sat, 8 Apr 2023 13:46:19 +0200 Message-Id: <20230408114624.824144-3-risca@dalakolonin.se> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230408114624.824144-1-risca@dalakolonin.se> References: <20230408114624.824144-1-risca@dalakolonin.se> MIME-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762610501067797005?= X-GMAIL-MSGID: =?utf-8?q?1762610501067797005?= 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 is currently used to wake up the system from sleep, but the functionality is more generic than that. As such, change the naming of functions and variables to refer to it as events instead, except during suspend and resume where wakeup still make sense. Signed-off-by: Patrik Dahlström --- drivers/iio/adc/palmas_gpadc.c | 50 +++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index 03af6cd73ec8..55fdf59ef711 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -76,7 +76,7 @@ static struct palmas_gpadc_info palmas_gpadc_info[] = { PALMAS_ADC_INFO(IN15, 0, 0, 0, 0, INVALID, INVALID, true), }; -struct palmas_adc_wakeup_property { +struct palmas_adc_event { int adc_channel_number; int adc_high_threshold; int adc_low_threshold; @@ -117,10 +117,10 @@ struct palmas_gpadc { int irq_auto_1; struct palmas_gpadc_info *adc_info; struct completion conv_completion; - struct palmas_adc_wakeup_property wakeup1_data; - struct palmas_adc_wakeup_property wakeup2_data; - bool wakeup1_enable; - bool wakeup2_enable; + struct palmas_adc_event event0; + struct palmas_adc_event event1; + bool event0_enable; + bool event1_enable; int auto_conversion_period; struct mutex lock; }; @@ -591,7 +591,7 @@ static int palmas_gpadc_probe(struct platform_device *pdev) return 0; } -static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc) +static int palmas_adc_configure_events(struct palmas_gpadc *adc) { int adc_period, conv; int i; @@ -617,16 +617,16 @@ static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc) } conv = 0; - if (adc->wakeup1_enable) { + if (adc->event0_enable) { int polarity; - ch0 = adc->wakeup1_data.adc_channel_number; + ch0 = adc->event0.adc_channel_number; conv |= PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN; - if (adc->wakeup1_data.adc_high_threshold > 0) { - thres = adc->wakeup1_data.adc_high_threshold; + if (adc->event0.adc_high_threshold > 0) { + thres = adc->event0.adc_high_threshold; polarity = 0; } else { - thres = adc->wakeup1_data.adc_low_threshold; + thres = adc->event0.adc_low_threshold; polarity = PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL; } @@ -648,16 +648,16 @@ static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc) } } - if (adc->wakeup2_enable) { + if (adc->event1_enable) { int polarity; - ch1 = adc->wakeup2_data.adc_channel_number; + ch1 = adc->event1.adc_channel_number; conv |= PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN; - if (adc->wakeup2_data.adc_high_threshold > 0) { - thres = adc->wakeup2_data.adc_high_threshold; + if (adc->event1.adc_high_threshold > 0) { + thres = adc->event1.adc_high_threshold; polarity = 0; } else { - thres = adc->wakeup2_data.adc_low_threshold; + thres = adc->event1.adc_low_threshold; polarity = PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL; } @@ -696,7 +696,7 @@ static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc) return ret; } -static int palmas_adc_wakeup_reset(struct palmas_gpadc *adc) +static int palmas_adc_reset_events(struct palmas_gpadc *adc) { int ret; @@ -718,20 +718,20 @@ static int palmas_gpadc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct palmas_gpadc *adc = iio_priv(indio_dev); - int wakeup = adc->wakeup1_enable || adc->wakeup2_enable; + int wakeup = adc->event0_enable || adc->event1_enable; int ret; if (!device_may_wakeup(dev) || !wakeup) return 0; - ret = palmas_adc_wakeup_configure(adc); + ret = palmas_adc_configure_events(adc); if (ret < 0) return ret; - if (adc->wakeup1_enable) + if (adc->event0_enable) enable_irq_wake(adc->irq_auto_0); - if (adc->wakeup2_enable) + if (adc->event1_enable) enable_irq_wake(adc->irq_auto_1); return 0; @@ -741,20 +741,20 @@ static int palmas_gpadc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct palmas_gpadc *adc = iio_priv(indio_dev); - int wakeup = adc->wakeup1_enable || adc->wakeup2_enable; + int wakeup = adc->event0_enable || adc->event1_enable; int ret; if (!device_may_wakeup(dev) || !wakeup) return 0; - ret = palmas_adc_wakeup_reset(adc); + ret = palmas_adc_reset_events(adc); if (ret < 0) return ret; - if (adc->wakeup1_enable) + if (adc->event0_enable) disable_irq_wake(adc->irq_auto_0); - if (adc->wakeup2_enable) + if (adc->event1_enable) disable_irq_wake(adc->irq_auto_1); return 0; From patchwork Sat Apr 8 11:46:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= X-Patchwork-Id: 81178 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp840800vqo; Sat, 8 Apr 2023 05:20:31 -0700 (PDT) X-Google-Smtp-Source: AKy350YkPkMk+4KUS515PkO0njrNkEiV9ZvhdhGlHsfbdHwiFYD8eOLQOKFJck1IF14gD0Z152Gx X-Received: by 2002:a17:90b:4d0f:b0:23d:1143:c664 with SMTP id mw15-20020a17090b4d0f00b0023d1143c664mr6074553pjb.31.1680956431440; Sat, 08 Apr 2023 05:20:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680956431; cv=none; d=google.com; s=arc-20160816; b=gkpfDTZw8wNN0vRck97ijLcpexJ2/ElgmHby1pIIk1+R7Zn4S1KSaFuQsOwpUNKyJK oPr9nfWCeZG7AtL24oviuluGl8OHaVNIlMUsDLfGgpVv/oLRH2200H9CM4oYnYWJvys0 Co4ET0qtKrr0PyWK6mXF3ASinqbqxmpU2W/Tpk1xQ6Tr9NwLTZsINVzS1XDoBNaoXnoc w3vZ2pYYEB7z0C0egU7SFt4qV1TUJs4AYD/z0+jtlt6n9UyNnqJjSOWkskNYo+Ksj2HH NeqaIM+ytIXufCHBsQkjU9yi2uPPcwdA39HQ48peyNwovOHjVwfsnHxlyfbyV2D5z7rz lf9w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=8oCsKoWj+OT4dqdz4wKUl0ESprUGM0ZozVBAf1AeyA0=; b=tleakynjNFD8seIFhPV4aR2ACXgqm6WK91zn4cFmzlaM6lVg//l7YeR9L0mCKUKi+v NRGMvxpB7HPzzCbj/bOmwajWwi4XhRx+EPkO4lkfeW3ZhjnGt+SU1QUNW1bhgnpdAcHm hZAR3i/U9ANIU1zFDJGxchEJxnsjg245UIF/9XRjNc/UckJEQC1PcawAkIJovfXchXKK NIbeJmIa0sgV9Q88xiHz62vXgNr8y/bhD4Q6CgO8BaDtOaG6anUfHxBSeyJAW9foIsgl rRHxq9gd14+21ox8O595kWlN4of3AKt36yPLwek3sQ/SaovNri8CBlgSJgcoiPBP5L6k Y2gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dalakolonin.se header.s=D374B428-D0A7-11ED-A657-75977B426508 header.b=nDIG0lmB; 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 bf19-20020a17090b0b1300b00237413f8c6esi8249263pjb.154.2023.04.08.05.20.19; Sat, 08 Apr 2023 05:20:31 -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=nDIG0lmB; 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 S230296AbjDHLrQ (ORCPT + 99 others); Sat, 8 Apr 2023 07:47:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230367AbjDHLrN (ORCPT ); Sat, 8 Apr 2023 07:47:13 -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 B05B7FF37; Sat, 8 Apr 2023 04:46:59 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTP id 9FD0B3F6DD; Sat, 8 Apr 2023 13:46:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at bahnhof.se X-Spam-Score: -2.1 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 TV1ARSLbVha0; Sat, 8 Apr 2023 13:46:56 +0200 (CEST) Received: by pio-pvt-msa3.bahnhof.se (Postfix) with ESMTPA id A8FF03F645; Sat, 8 Apr 2023 13:46:56 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id 4C64095F46; Sat, 8 Apr 2023 11:46:56 +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 TXAn8zRf6FVy; Sat, 8 Apr 2023 11:46:54 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id CF6BD95F42; Sat, 8 Apr 2023 11:46:53 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra.dalakolonin.se CF6BD95F42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dalakolonin.se; s=D374B428-D0A7-11ED-A657-75977B426508; t=1680954413; bh=8oCsKoWj+OT4dqdz4wKUl0ESprUGM0ZozVBAf1AeyA0=; h=From:To:Date:Message-Id:MIME-Version; b=nDIG0lmBvcF8jmEvZZF4zN/YChcDQWKTGKZxmoUU5VlV3iwKWGmTlkhr/QHgBkOsr 3qp2Uq8to6NteGqWK4NuXUBg4pDpLmkn/KtUUcYFISboofE9D4LTODCTRXYtgShxgM 3rSRUGBFpw1QN8YV29YCpueTAVqQPLSwLmsHMIju3oVCndb4L+WQOLCaXdpbKUMWIX ZQgMQWWN1kXcuZ4TBUQ94R/aUV+F2Kj4MUXx/JXn2UzDq6x0HMzcypM2PNlt3ZSos4 1sUq3DhqcNe78ehfEXNqGAVX/Vk3lMDI0Dc+WMlXxn4f0O64yZPd9cY8MwvPuMy9Qo 7lNxh4gG6YCPw== 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 s7CCfjFJXs7L; Sat, 8 Apr 2023 11:46:53 +0000 (UTC) Received: from rack-server-1.dalakolonin.se (unknown [172.17.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTPSA id 35F6A95F3F; Sat, 8 Apr 2023 11:46:53 +0000 (UTC) From: =?utf-8?q?Patrik_Dahlstr=C3=B6m?= 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?= Subject: [PATCH v3 3/7] iio: adc: palmas: use iio_event_direction for threshold polarity Date: Sat, 8 Apr 2023 13:46:20 +0200 Message-Id: <20230408114624.824144-4-risca@dalakolonin.se> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230408114624.824144-1-risca@dalakolonin.se> References: <20230408114624.824144-1-risca@dalakolonin.se> MIME-Version: 1.0 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762610571024712822?= X-GMAIL-MSGID: =?utf-8?q?1762610571024712822?= Instead of having high_threshold > 0 as an indicator for upper threshold event and lower threshold event otherwise, use enum iio_event_direction instead. This is hopefully less ambiguous. Signed-off-by: Patrik Dahlström --- drivers/iio/adc/palmas_gpadc.c | 36 ++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index 55fdf59ef711..205a7628b235 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -77,9 +77,9 @@ static struct palmas_gpadc_info palmas_gpadc_info[] = { }; struct palmas_adc_event { - int adc_channel_number; - int adc_high_threshold; - int adc_low_threshold; + int channel; + int raw_thresh; + enum iio_event_direction direction; }; /* @@ -618,16 +618,21 @@ static int palmas_adc_configure_events(struct palmas_gpadc *adc) conv = 0; if (adc->event0_enable) { + struct palmas_adc_event *ev = &adc->event0; int polarity; - ch0 = adc->event0.adc_channel_number; + ch0 = ev->channel; + thres = ev->raw_thresh; conv |= PALMAS_GPADC_AUTO_CTRL_AUTO_CONV0_EN; - if (adc->event0.adc_high_threshold > 0) { - thres = adc->event0.adc_high_threshold; + switch (ev->direction) { + case IIO_EV_DIR_RISING: polarity = 0; - } else { - thres = adc->event0.adc_low_threshold; + break; + case IIO_EV_DIR_FALLING: polarity = PALMAS_GPADC_THRES_CONV0_MSB_THRES_CONV0_POL; + break; + default: + return -EINVAL; } ret = palmas_write(adc->palmas, PALMAS_GPADC_BASE, @@ -649,16 +654,21 @@ static int palmas_adc_configure_events(struct palmas_gpadc *adc) } if (adc->event1_enable) { + struct palmas_adc_event *ev = &adc->event1; int polarity; - ch1 = adc->event1.adc_channel_number; + ch1 = ev->channel; + thres = ev->raw_thresh; conv |= PALMAS_GPADC_AUTO_CTRL_AUTO_CONV1_EN; - if (adc->event1.adc_high_threshold > 0) { - thres = adc->event1.adc_high_threshold; + switch (ev->direction) { + case IIO_EV_DIR_RISING: polarity = 0; - } else { - thres = adc->event1.adc_low_threshold; + break; + case IIO_EV_DIR_FALLING: polarity = PALMAS_GPADC_THRES_CONV1_MSB_THRES_CONV1_POL; + break; + default: + return -EINVAL; } ret = palmas_write(adc->palmas, PALMAS_GPADC_BASE,