From patchwork Wed Nov 30 14:53:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerald Loacker X-Patchwork-Id: 2432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp975155wrr; Wed, 30 Nov 2022 06:59:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf7yvBtRgV+8biKhozJ+4b0e0kvKsl4iyqYqdOL+qCQLJSp0YEIVwX/Oa45sGH30AisHaZMk X-Received: by 2002:a62:33c4:0:b0:572:9681:1018 with SMTP id z187-20020a6233c4000000b0057296811018mr46185118pfz.39.1669820352094; Wed, 30 Nov 2022 06:59:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1669820352; cv=pass; d=google.com; s=arc-20160816; b=Cbtg+gxI8V36EBYO8dd1rL1pZRPBtZk3f1gy4XB7R2MkIw10XTOyKLCpf/CvDSCSX3 5ruL/V4GXHa5YD0Eer8hQHZGe8jaXMsYxdS9x8rAxH8pulnwmECrrjaQRpeMYjCRb4pt c4YnWct37aD+A6KNZMSIQfbD/eMB6YAhdCtgMCMwE+oYAVMjGy5WF+Mitz+Xgrp4XPHJ Dj4sgyWkRLwmg6qkQm7Ne2Exncl85r+YnCa+7lCI9WQdbxHjC3fA5LOy7mxpEdNLqBwy y55bCibTzW9rJz5UABu2MLB+xQtW1EWHVQtN/snXupEKnN1SdFqzQkbtBGdDvU1CPE/9 awFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=4u0SbBtVJwcSYLULPGq75gJGwIV38bdhZh0teNuQ4Xs=; b=QgSKO5wCVpYrPXff3Y6fdvxqJJUrJUrvLuDA3eYtiO/979yX9m4PwB2PAK4Wsoq6CX UKWhSXQUdIDgtYE0hQvIN/GHt9RbZqYwWVk3/TEkqV7rjh/ZdifsMreN7j2JkQ073MCE j0vXfQS3jWhaAi3nMRL8/zgFGZXknTKIUcbmcDn1Y4i9XgN49qn4CfS/36QHqpuKoQzm r7cX4WRNSm5QQ7QbKSSCO52oHENcqUXvTHR1ANZDUfaT3XMft6pwtUyShT9NFcnTqIOU ts4aFR+mzrT+bOPJ0te0h1tYucseeK4HTiNUb8XBbSwPo25GG8Vn3U550o6VZayOGi4L YmKw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wolfvision.net header.s=selector2 header.b=pUoOqlTw; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ju19-20020a170903429300b00188f882599csi1429486plb.58.2022.11.30.06.58.59; Wed, 30 Nov 2022 06:59:12 -0800 (PST) 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=@wolfvision.net header.s=selector2 header.b=pUoOqlTw; arc=pass (i=1 spf=pass spfdomain=wolfvision.net dkim=pass dkdomain=wolfvision.net dmarc=pass fromdomain=wolfvision.net); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=wolfvision.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229711AbiK3OyR (ORCPT + 99 others); Wed, 30 Nov 2022 09:54:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50598 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229532AbiK3OyQ (ORCPT ); Wed, 30 Nov 2022 09:54:16 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2076.outbound.protection.outlook.com [40.107.21.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54212209B5; Wed, 30 Nov 2022 06:54:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=an/5eE5d39Iq3EH+S0DDm9I2n955ytHBztdR+p/IGGif1k5C5k2hXvYWSTwk3Zl09X10g/lfGdwOSd9t73HRMJxyIuKM2ZF87jrAAlFVd720e7H+p2Bez7dikZaG1SAGeviNQnYP2X9LGdP4QHnL/AWUy201HEXJLjYoMg1IgAT7kGIkOZZsrDm2UwEukdawAIvQ4tGTmEX2ftjmXbh17cJagTW+0dnUuL/3QG0T9UQc5n1NgPTBE8bfA0v5hmbM5gIaqWt24KfOSSjJ5vDgNBmvMs0dW3cNRQWuke4B+F2Rh/UBJJulHGYi/77aCNcNMbzdD6cUvQWhhBMrzKTUOA== 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=4u0SbBtVJwcSYLULPGq75gJGwIV38bdhZh0teNuQ4Xs=; b=dnKOHf6d1uZhHK2gLrSXSYj1fM8HVZz5LFry48qBkQ4yFpzmWeQ3pAlYTxH7DrwfgLtgXweAQuDRE/fVnsEMSG38PiS0ibmJpw/yqUta7TqX2Iz7T1KJqFnQOV/69BfQ5n1bEwN1/4JPR1V0VdISv2BpeC0sjzh+Aopnd96BAkBxkwts0kN+CGJsNWFSprrsaURRB+imgTLJXFNQxWyjiSzA0JZu9JIjte+szbgk0f0VNGjG9n04HZjDXzuol2o7q9qWwHAvlwc4lI+KH4Ycd1u15ASgNiNIHvJNKpNHGmdVY6DMILPIP4F/YHuUUbuHHyVu0i9BfWwhLiOSWaoOjQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4u0SbBtVJwcSYLULPGq75gJGwIV38bdhZh0teNuQ4Xs=; b=pUoOqlTwB1oVQ5rMDM3cmicVdEKTSbFZqgXgmbpI6uzHWLkrlT708VC7J5s+sDS6BoVXefz6NHEBSUaE7t0tAXPwl6GfI2eRowyp91to/vFKHuexUS625KA4wqP+/efSfi8mQGYAfWFaTsL2jO1BYquFY9pjH8XQ6jgKwSvIw/I= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VI1PR08MB4544.eurprd08.prod.outlook.com (2603:10a6:803:100::13) by DBBPR08MB5977.eurprd08.prod.outlook.com (2603:10a6:10:209::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5880.8; Wed, 30 Nov 2022 14:54:11 +0000 Received: from VI1PR08MB4544.eurprd08.prod.outlook.com ([fe80::bcc7:bc51:bf44:1454]) by VI1PR08MB4544.eurprd08.prod.outlook.com ([fe80::bcc7:bc51:bf44:1454%6]) with mapi id 15.20.5880.008; Wed, 30 Nov 2022 14:54:11 +0000 From: Gerald Loacker To: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Andy Shevchenko , Jakob Hauser , Linus Walleij , Nikita Yushchenko , Michael Riesch , Gerald Loacker Subject: [PATCH v5 0/3] add ti tmag5273 driver Date: Wed, 30 Nov 2022 15:53:53 +0100 Message-Id: <20221130145356.1129901-1-gerald.loacker@wolfvision.net> X-Mailer: git-send-email 2.37.2 X-ClientProxiedBy: VI1PR0102CA0084.eurprd01.prod.exchangelabs.com (2603:10a6:803:15::25) To VI1PR08MB4544.eurprd08.prod.outlook.com (2603:10a6:803:100::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VI1PR08MB4544:EE_|DBBPR08MB5977:EE_ X-MS-Office365-Filtering-Correlation-Id: b38ec998-309f-47d2-d343-08dad2e2bdb7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uy+3Usn67EAvD/gAe+auqVE7ynQXr1KVI+UlT/jrdOFvv7TEX8ykpRA6dF6l5OQhhYPcrZkEjqY8ny2crWTEjdAMkRUSdLVdtxeVB2qwARvWVZzFDCQZdMkBa1irSDlxbg0l8tm9jQTmXre8v6itZC+XmCDhOkIE26i7mEt9zu8yZd7xMP6NDcT5N9TTK9ptXlBfs4mt5jXqoCbLSxgAu+ueu1na4vCWA7MVRsZzaueWpqLVsHJf4NnM1ef28/wArGpWPhenvhKRgEWab+YGV79/n3LSgGaXo9B2ZVvjMhoZZF9NG85exsJcY6/0sFmQ3dTcXJZGSFRoVdM36/cib1qFssg8wfSuAP34n917H3hLTged8mv2Cj4eVif1sz8//p8l8F0MuG/vBJ6VJtibBlMQkmzaKVW7pFVqI8ErS0Zk/bzeOy2/JetfJQ1qZpkZD9evRNytj0daUkBBV/Rq5Y2SILhbLrl4jM3iGraAPMBMmxNRMF/YAPzP6qa4PUaNEEULt0kXMPbQxv78prOzASRPnjf5hXa/nvicEROXKFhRBsseXIUlFcRsaF7ENLHbAfQgntBY6hWBOWyBAg2Bo07Ha2KC4yNDyNXtPfXzdN0VwmxHrY5Tn54vMyagkHbibXIAW48sTZvGYvGob86W1FHj882ZKTCvycLq/RMHpaeS1YD6/W05Nb22GrHKaUKq X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR08MB4544.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(39840400004)(346002)(136003)(396003)(376002)(366004)(451199015)(52116002)(478600001)(66556008)(36756003)(6486002)(26005)(38100700002)(38350700002)(6666004)(6506007)(66476007)(41300700001)(8676002)(66946007)(86362001)(4326008)(316002)(44832011)(54906003)(7416002)(5660300002)(8936002)(6512007)(2616005)(186003)(1076003)(107886003)(83380400001)(2906002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: fNSbsbDhAU+m4vMgsOKQ/kLw37PrQ4AFMw2RksL9jtyov+qtDzItlMvQY7f8nNzg4f+LYStI4bQnyDZMkE72mXu5ZNjeFXO6GrmWhNm4i26eW2NDYtDGEDDIvpjITteGRZWeXzXPRzbvL3wKqcN2PBMy7FcKdukuGsW3Y1Rm/+jaIvVbCocIuu0jmgPFW6HFVIzhLiXuZvG3ttEW2zC+y+YkgCG3wWVenGktRW/z7YWbx6xZDsLsaDgGaujTJjAH1ghDG9BJsXsyGBsf75YnCZdKRMqTWu3EzVqjvBMqc82B65NRL8DyvakKMee6/jcrJnfnOiWJvGaUzz5/qoxoOHv/hpZUmixr3dth/wxg6L5fq/7TV13azP0VJkSo1wauG8sb2909q8SJcWzEFLRgaFcKlFiPElmdZ6w+ulf7/N1wMPZFLhv90wXa6svyeJrA3CE9q+N0Vjiy5XlbpEShc3AmEQR/MDhF8Nn+sg7/czNVBCGM2MAQRvBsX2THv+PUJ1ndDxquezYXUP776puvNhzY6CbezhMYhIWiggIbWMPlkbuTUnpz7wOhwClBWTlkArIr+KhYL3leXFUAuQppCToa6lkF4vC9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-08dad2e2bdb7 X-MS-Exchange-CrossTenant-AuthSource: VI1PR08MB4544.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Nov 2022 14:54:11.5447 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +zMAsjAZsnJmHtUk9kzCr6II4kz0+NhzULkAGH0Z+/Vh+PBK/S0iLLxZEphI4RG6PZ1eTerwggTDJds2MEl4a0bjaebIbkR6UYXc49Nq++U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB5977 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 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?1750933545827300087?= X-GMAIL-MSGID: =?utf-8?q?1750933545827300087?= Hi all, This patch set adds support for the TI TMAG5273 Low-Power Linear 3D Hall- Effect Sensor. Additionally to temperature and magnetic X, Y and Z-axes the angle and magnitude are reported. The sensor is operating in continuous measurement mode and changes to sleep mode if not used for 5 seconds. Tests were done on a ROCK3 Model A board using the TMAG5273 evaluation module. Changes in v5: - Fixed dev_err_probe - Removed unnecessary '&' for function pointers - Removed warning for device tree reading failure as Linux should not validate device tree. - Added comment for device name - Added tmag5273_wake_up() and improved comments - Reformatted pm_ops Changes in v4: - Add only struct for IIO_VAL_INT_PLUS_MICRO iio type to iio.h. - Simplified tmag5273_write_scale() - Removed unnecessary != 0 - Fixed regmap max_register - Simplified tmag5273_read_device_property() - Fixed some line breaks. Changes in v3: - Added structs for iio types to iio.h. Using these structs for iio type arrays such as IIO_AVAIL_LIST makes the code more readable than just using (int *). It was suggested by Andy Shevchenko to move these structs to the iio headers to avoid different approaches. - dt-bindings: dropped quotes from strings - Added include | Reported-by: kernel test robot - Added include - Removed - Added missing "static const" for tmag5273_avg_table - Documented Device ID - Fixed index of tmag5273_scale definition - Clarify TMAG5273_MAG_CH_EN_X_Y_Z as an index - Removed unnecessary print - Introduced tmag5273_write_scale() and tmag5273_write_osr() helper functions - Use of match_string() - Format Changes in v2: Thanks to Krzysztof, Andy and Jonathan for your detailed review and explanations on the first version. This patch includes all your suggestions and some additional cleanup in the probe function. Gerald Loacker (3): iio: add struct declaration for iio types dt-bindings: iio: magnetometer: add ti tmag5273 documentation file iio: magnetometer: add ti tmag5273 driver .../iio/magnetometer/ti,tmag5273.yaml | 75 ++ MAINTAINERS | 7 + drivers/iio/magnetometer/Kconfig | 12 + drivers/iio/magnetometer/Makefile | 2 + drivers/iio/magnetometer/tmag5273.c | 738 ++++++++++++++++++ include/linux/iio/iio.h | 5 + 6 files changed, 839 insertions(+) create mode 100644 .../bindings/iio/magnetometer/ti,tmag5273.yaml create mode 100644 drivers/iio/magnetometer/tmag5273.c