From patchwork Tue Jan 17 13:51:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bough Chen X-Patchwork-Id: 13104670 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0534FC3DA78 for ; Tue, 17 Jan 2023 13:53:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=h2P6e1QP5gz9SlgortvFGGVUhjeZuGymqHAz2NuQmQg=; b=4PeDBQdWeW6eQl EMwp9p8kJOiQZ8MXuz7/RfjZDz7dEvGadgGU5FoLaKad/aBdZCu5YgzCi1ltcC7NlzJ+HehFMDJSb 4e8TtN/lJifEMXwgWY7flt4yH/93HC2rOcN679bDUEUDJtq1rz1D2+/lyt5TBcDd6qa3yQRIV9K00 G0bQVhjr5nZOu+0fh7Gd+EhpHF0zWQdZlXaBfUnHDzFZXTTev45wnqcjOslfot+HFeJ504VUE7f/t Maakr8sDb6hmV0zeTrxnOk8DNdwF/pixw6N5qA7i1Py88nYWAIrfk1MmhPsyqa8o4r62XpZ9Jwsv8 ZaSkfo59j0NWiQ8FdcOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHmN6-00ETLu-Dc; Tue, 17 Jan 2023 13:51:29 +0000 Received: from mail-db3eur04on2047.outbound.protection.outlook.com ([40.107.6.47] helo=EUR04-DB3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pHmN0-00ETIb-0u for linux-arm-kernel@lists.infradead.org; Tue, 17 Jan 2023 13:51:23 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JTbiGrShRfxpNFFdsYjIH6pu1QX5+rIFL+aM7XGBZI7zIHK4gMNtu34H5TLHvHPXqoZqO7C25ImqJSjc+fDptMpESA3en+Vqp8olxhWibnTCLaY4UKQlm5Ux5og3MLHlrBjgNRMg4/gM4yOottMDz8IcxXvVspeP0oBSXTZLVc4JJro6fED0C8kI80AJBqEhPp2u701J2LkbQOoqX9qOrsZQvYXRxS/MBpx42Lh8rd0FVzO1kkhK/3DKss4XCgOi8G9d2Fs+NFiPiWjPwN5jpZgTtysCWlFmas3R1vyYw6JAsDsXaOA7yQdYK2ROk2UrMeW3TuNGNT5EbLJJtx7KDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=iglVQhnjgs0Hblt8fIhOEi7pA7rPjPnQz7K4ysdezOE=; b=g5l97PscjkVSUhIa8pjXo/FQ34MCufcSyOSSk4jjZWWGUo/hNqk0wiqYw2f8IWn46L5OYVNP0uA3HN+jeHP0exBJN4TqL6SXR6tWnfd3kab8E56koypjZATkz7EP3zJcvQH/XGVCuc/zdMP35HJ/eiKAxQcHJLQiZjqEs1ktgoNNV4i/i/eappoNegJmvzUkmntsheWFkYnmC1meJlLUyDy4JHl0Ljw5n9pNfGrj36l2CmyN4I3gTJqzX0P33eLv/DcW9qllS59sotANKGjUoYkyS6dHdIE/MYBfWQZjoBwIVf3fh+vAYuqo27H20Xd4gIIlyP5VfKfqaOoELuwX1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iglVQhnjgs0Hblt8fIhOEi7pA7rPjPnQz7K4ysdezOE=; b=ZaXL/jpmVGr2rXY45npCW78GrlAbw5opBXo3yIV6FsRuVYbM4nZMxLRcO2hXoyEPvX96H1lmFEDsgesJHfa9YubD9Yx/mFt7XDC7uuEUnjY4ys3qHyh5LJ2U6Ko9FWPlsWRVlAPXk2VdkehblrN6q3ADstaEiI19H/SNsAHgoNc= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4010.eurprd04.prod.outlook.com (2603:10a6:5:21::30) by VI1PR04MB6909.eurprd04.prod.outlook.com (2603:10a6:803:13d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.23; Tue, 17 Jan 2023 13:51:14 +0000 Received: from DB7PR04MB4010.eurprd04.prod.outlook.com ([fe80::7479:76ef:8e5:da0b]) by DB7PR04MB4010.eurprd04.prod.outlook.com ([fe80::7479:76ef:8e5:da0b%6]) with mapi id 15.20.6002.012; Tue, 17 Jan 2023 13:51:14 +0000 From: haibo.chen@nxp.com To: jic23@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de Cc: lars@metafoo.de, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, haibo.chen@nxp.com Subject: [PATCH v6 0/3] add imx93 adc support Date: Tue, 17 Jan 2023 21:51:34 +0800 Message-Id: <20230117135137.1735536-1-haibo.chen@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI2P153CA0016.APCP153.PROD.OUTLOOK.COM (2603:1096:4:140::17) To DB7PR04MB4010.eurprd04.prod.outlook.com (2603:10a6:5:21::30) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4010:EE_|VI1PR04MB6909:EE_ X-MS-Office365-Filtering-Correlation-Id: 8118ab13-0983-4a11-a728-08daf891e5d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3Lgc7I+KoFSCdmH8XuqO8RBdaE5KJ284x0AiKzmcB+p1rjpBXsmGPWd1CGnlo6qaRq00tf5HJhFch50WHr/CHx2ZPeIMr95XTLhnOt/36RRAtHoAeyWlLMc3TOSOUjmtEEMgKz53UxnM4eYd8JjTb4wvUstm6wFzb1UOfNrYG0quJgAEAKD4/aKOIlhfoExkZIuc9KhsnxjZub2gKhvUYy0v6yoGKAMlvvzWZoGN0Z3sSzCFS+pV29hCs7/70h4KYvHsPC84zDcwW5cldWdpTAKiP67CN6RsGERIqD2hWn8oYa10vaMRcjivV7vFc65LDCJPu4/5tbTZi2qAYkApZxjRpnT4dEE9FAUaxoDsH+To/l+F1vcNOkLS+CWDDAZ9wUdv32KF1HH5too3QIyCh534e870+3e1gV1Yuf83cl2pTV4xXcX2GMZWHIojMdUjFiM5N1N0cOlxLNnkPisbjMihPvzs58+SVdCC7RbW+xQUZLcX4O29dWIVBR3yKgP0LBSI/77vwUadgy0uwC/mGwfy2j50O8PuccMqP8mBZ8BaHzmdIHgHe4VJ6O1oNWcLPo/bKqIjRRxqZ4yNEdQpXsvK00qNU9FY/6VI9+Hr/Meb78z3gqxZE8bhqpSjYdIPnm3q5AW2c7KxAmsQ6kibjNJ/KErxpodIwZBwYvUDfvD8XFPIJIOwkBxhbZADbH2L7a0I776CyTBi7gjU8fZDqw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4010.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(366004)(136003)(39860400002)(346002)(376002)(451199015)(36756003)(86362001)(66946007)(66556008)(8936002)(8676002)(66476007)(7416002)(2906002)(4326008)(38100700002)(83380400001)(5660300002)(38350700002)(316002)(6666004)(6486002)(52116002)(41300700001)(478600001)(2616005)(6512007)(1076003)(9686003)(26005)(186003)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: p6hotdZs9+dJMOCD8aB9auEquJ8Li+92WXy1rKxvOo+5UCMy33c9CJqOl2viBNqlpq49BRNmnMp30RsXXa3xCnYjhKoAWTKeZn8ckjkY9ZGeE1hc3GZD1obxT5jAiAsOZ5Nn0KtaxR6E+WJ1SXe2ELuEBYiuEINJZHzlFV5JIPkWASPoVlnfwgdfGEwoziXG/flVBUGiCx1NfTwMtmy9XRpNZ3dqKmVuvoxJidz6kPhTJ6kNygmLb91GnoTgTsDs7kVmR+fkBdR8hIGLYJVJUTTreqUPQGnkMf8+6wRY1xeU6e/zRUVRNX3RAz7LFH6uJDB8xoA+EvWC+gWR5gKA5krQNBZ84o40ufUS1PJ55ax7g6sUVWQ7ts2gFXm5sRL7ZB5XGZBtQ7aqMCafj8hbXiDtZ/oTgTYaY5AaPi3ykaX1ibUJkTEGIGLQSmRkszn3CIJC5bIP3T/+BNvYnGE2OIGXaXaMgYHJjAD7BgfZzldZzHLVgpfn4tX47qI0qvc1hAcnZN5Fb7EgzVTA8PdjezcLxEViWwhlrUuRHNt1GOx31GDZpHxhYBbpgvOJY4JUlHu5HjMWv84AJxzL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a728-08daf891e5d0 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4010.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2023 13:51:13.9230 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: x/n1IO/DHmESaV9DYYb3UpMghDHh5dt2WGlEY04hOytyZFy2moMK6DRf5uM+TO/gQjXmlsIgBO+MAaYKvrZwdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230117_055122_354884_F4FC8C74 X-CRM114-Status: GOOD ( 14.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Haibo Chen V6: -Change the Copyright to 2023 -Power down the ADC if imx93_adc_calibration() if meet issue. -Add new error label in probe (error_adc_power_down) -Add back the pm_runtime_get_sync(dev) in imx93_adc_remove(). Though in imx93_adc_remove(), already in pm runtime resume due to the useage of autosuspend logic. But call this pm_runtime_get_sync(dev) will make the code logic more clear and will make the runtime pm counter balance after pm_runtime_put_noidle(dev). V5: -For ADC driver, use dev_err_probe() to replace dev_err() in dev_err_probe(). -Add imx93_adc_power_down() in the probe error path. -Re-order the function in imx93_adc_remove(), make them inverse in probe(). -Remove the pm_runtime_get_sync(dev) in imx93_adc_remove(), because this driver enable the pm_runtime autosuspend feature, and config the delay as 50ms. So when called imx93_adc_remove(), this device still in runtime resume state, no need to force resume the device back. -no changes for binding doc and dts. V4: For ADC driver, re-define the ADC status show the relation to specific register bit. Redo the imx93_adc_remove(), change the return error sequence in imx93_adc_read_raw(), and use a direct string for indio_dev->name. For dt-bings, change the commit title and add maintainer's reviewed by tag For dts, no change. V3: For dt-bings, add some change according to review comments, and pass dt_binding_check. For dts, add #io-channel-cells = <1>; to pass dtbs_check For ADC driver, no change. V2: For ADC driver, add change according to matainer's commets. Haibo Chen (3): iio: adc: add imx93 adc support dt-bindings: iio: adc: Add NXP IMX93 ADC arm64: dts: imx93: add ADC support .../bindings/iio/adc/nxp,imx93-adc.yaml | 81 +++ MAINTAINERS | 4 +- .../boot/dts/freescale/imx93-11x11-evk.dts | 12 + arch/arm64/boot/dts/freescale/imx93.dtsi | 13 + drivers/iio/adc/Kconfig | 10 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/imx93_adc.c | 484 ++++++++++++++++++ 7 files changed, 604 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/iio/adc/nxp,imx93-adc.yaml create mode 100644 drivers/iio/adc/imx93_adc.c