From patchwork Sun Apr 2 16:42:45 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: 78267 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1827888vqo; Sun, 2 Apr 2023 09:46:37 -0700 (PDT) X-Google-Smtp-Source: AKy350YhkkRztVOcpeVVyWBUvmMgCOoy4vpwioGtdsl5f378NV3ZVuVc8S5FE3qoTRZAzd8VpGwX X-Received: by 2002:a17:90b:1647:b0:240:afb6:b07f with SMTP id il7-20020a17090b164700b00240afb6b07fmr18145356pjb.1.1680453996977; Sun, 02 Apr 2023 09:46:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680453996; cv=none; d=google.com; s=arc-20160816; b=fI4ySRy/FB9CTEWteq123LDd1d5uOAYp/UEPx3RrNUnWLZv42mo/skzKfUuWYg/sPe ol1kw0sRL8i4Jg/iESmXbZREn2tPFTxmMnnBhSxZUpu/lNr+oU+0Wq6iXTX2foy8IEMU tuWaVDOaUSQhiaxV/gNSHoazOnG/2EuOxzXApybGGWI+ehWl6RugOgnkZ8CZ2ArLYVQC 32zv6RL8RSgM4342hzFHN0qLNJvhxlg/RV14MGqeYwid88Iuj6ebYhwzD5lgXnq5UzqK 1CpEkTlUhbUlT5+F0WS7cqeGfJiDfhFASP3qKaSdkHBOxfsuRwUpqDa+GhBKiDpGPaNO 3Elw== 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=SX+fKY/jFV6GjJLUSAkILWqzlpnhiCRQ35BbFBddfMw=; b=lNZZ0k5cz/RzxK07WvdCTuLR0FYMjp+cM9TRuv/G2fsWwNQayNMcFUnlyg3YqTbUaD UV2FjweqcLVzrcWllqNStLDnXXEwMh/QVaKeppiPnM/+ETUaX2vw+dAse1PFvuD5EP04 x1Z6r/NwTDzyHLCsTDHBNO6cm1X9RDQbOzFmZGA7H+/BnHMIDGWeKcsyjpFETG57OMNu hNYECm1p1JQwgFH6Uu6MB+SAr54nbLVx10dGPx0ldwIGRGwWiRt4b3rsZdSouEaw3YIP /VfEJehU+o8MuBa8tGsNYkMGdxIRXP9ZQQeLQXiX8fDZEfAgMovvscZ2zGw+GI0vWBZ4 HoWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dalakolonin.se header.s=D374B428-D0A7-11ED-A657-75977B426508 header.b=NJT4Gn05; 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 c3-20020a17090a674300b0023d3980730bsi6225222pjm.16.2023.04.02.09.46.24; Sun, 02 Apr 2023 09:46: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=NJT4Gn05; 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 S231220AbjDBQns (ORCPT + 99 others); Sun, 2 Apr 2023 12:43:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230418AbjDBQnc (ORCPT ); Sun, 2 Apr 2023 12:43:32 -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 2F480FF03; Sun, 2 Apr 2023 09:43:31 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTP id D90F23FAF9; Sun, 2 Apr 2023 18:43:29 +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 2mpXd2prcB1z; Sun, 2 Apr 2023 18:43:29 +0200 (CEST) Received: by ste-pvt-msa1.bahnhof.se (Postfix) with ESMTPA id 1AF583FA1D; Sun, 2 Apr 2023 18:43:29 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id CD558937BC; Sun, 2 Apr 2023 16:43:27 +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 sZuPmShtmHMT; Sun, 2 Apr 2023 16:43:19 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTP id 61DBB9379A; Sun, 2 Apr 2023 16:43:19 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.10.3 zimbra.dalakolonin.se 61DBB9379A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dalakolonin.se; s=D374B428-D0A7-11ED-A657-75977B426508; t=1680453799; bh=SX+fKY/jFV6GjJLUSAkILWqzlpnhiCRQ35BbFBddfMw=; h=From:To:Date:Message-Id:MIME-Version; b=NJT4Gn05RwyL+o51xeSxGW5X5Ch3aYjbt69f9C+kGylP4LY62jcVrIPu77OuKsRQo Q7AmrtEW2AMLO4DKZMTdo10A/wodPrUCi3MYLI9YkuVnHC3T9kr/ZEgbGhUXxA0FzG Kfj1ORv9EjeiAxufplamUTG7T96pGUns7JRBFdf7vD5aN5sUNKdVfWQu9DVV9UwApB lyQgpcyd5EBPMq/RUd2r08HSSILnjJNGOT8/ECaVZgEHLcDQ3MMcswoFPli+rA6Ku3 OcnywGsYIRmdtDKseWIHu7wM+ZkDoj+CTlGTv8DZkVKfKIzCGZNyQZIXWUlSZd61Fw iMr7BZtD//diA== 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 dQCy-DsZFAMk; Sun, 2 Apr 2023 16:43:19 +0000 (UTC) Received: from rack-server-1.dalakolonin.se (unknown [172.17.0.1]) by zimbra.dalakolonin.se (Postfix) with ESMTPSA id 574269378D; Sun, 2 Apr 2023 16:43:18 +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 v2 5/7] iio: adc: palmas: always reset events on unload Date: Sun, 2 Apr 2023 18:42:45 +0200 Message-Id: <20230402164247.3089146-6-risca@dalakolonin.se> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230402164247.3089146-1-risca@dalakolonin.se> References: <20230402164247.3089146-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?1762083730328905527?= X-GMAIL-MSGID: =?utf-8?q?1762083730328905527?= This prevents leaving the adc in freerunning mode when removing the driver. Signed-off-by: Patrik Dahlström --- drivers/iio/adc/palmas_gpadc.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index f7eb445495b6..90fc20205df0 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -497,6 +497,13 @@ static int palmas_gpadc_get_adc_dt_data(struct platform_device *pdev, return 0; } +static void palmas_gpadc_reset(void *data) +{ + struct palmas_gpadc *adc = data; + if (adc->event0.enabled || adc->event1.enabled) + palmas_adc_reset_events(adc); +} + static int palmas_gpadc_probe(struct platform_device *pdev) { struct palmas_gpadc *adc; @@ -586,6 +593,10 @@ static int palmas_gpadc_probe(struct platform_device *pdev) palmas_gpadc_calibrate(adc, i); } + ret = devm_add_action(&pdev->dev, palmas_gpadc_reset, adc); + if (ret) + return ret; + return 0; }