From patchwork Thu Jun 27 13:19:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Baptiste Maneyrol X-Patchwork-Id: 11019709 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2D19D13B4 for ; Thu, 27 Jun 2019 13:20:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1F7B928999 for ; Thu, 27 Jun 2019 13:20:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 138A228A13; Thu, 27 Jun 2019 13:20:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 944BD28999 for ; Thu, 27 Jun 2019 13:19:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726536AbfF0NT7 (ORCPT ); Thu, 27 Jun 2019 09:19:59 -0400 Received: from mx0b-00328301.pphosted.com ([148.163.141.47]:14416 "EHLO mx0b-00328301.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726059AbfF0NT7 (ORCPT ); Thu, 27 Jun 2019 09:19:59 -0400 Received: from pps.filterd (m0156136.ppops.net [127.0.0.1]) by mx0b-00328301.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x5RDJvCw014932; Thu, 27 Jun 2019 06:19:57 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=invensense.com; h=from : to : cc : subject : date : message-id : content-type : content-transfer-encoding : mime-version; s=pfpt1; bh=HgtP1RXkEGsA1aI9a7Puj0bHIr9+t2NSCo6mWXp6X6Q=; b=qGOOpxuWHo5jQQk3OBBQq+MpISde4CbL9WiKqLdp95cbH4thktikVTdesSNEEd7tDzIr usZRQh+FxpPSp0SZJ56kQHUybqYvCTgMAd9swqDykE0QfXXsqqlyGpIOpSoH1qEzGf+y sduzcnoh6VuOGzd5nAUv0bjxb3lF5UvzDb+0lpjNiwGp56IKUgXU9STFOmcYbLBbr8ES 0DeWGhks1RQevU6mvAQcWCn4tXxgVQ3aTR9BnrO7DJzoS0SBOJcQztqeC0vdpeOiYCQ1 PM84fshps85Ed/xskIic1cltm4jiF6r52f5Az3ZjuM8sMtbRkXHAutfujVEPxqyKQyz8 Lg== Received: from nam04-co1-obe.outbound.protection.outlook.com (mail-co1nam04lp2054.outbound.protection.outlook.com [104.47.45.54]) by mx0b-00328301.pphosted.com with ESMTP id 2tcaturf67-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 27 Jun 2019 06:19:57 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=invensense.onmicrosoft.com; s=selector1-invensense-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HgtP1RXkEGsA1aI9a7Puj0bHIr9+t2NSCo6mWXp6X6Q=; b=C2x3gjnuwhgFtqSxydq1gIRpU9fL7ZitO+JPyix4EY8ePaJKoaO2Lp2+dvlB1la/jS1Jhw1J2+6IhCGK/grFugTedlEVlyS+h+SLCixhMqZQ3z1neNPB2Fy5NGErLS69cN11Cg1rwrKGPRsrYF3uxxMgh/CtkcTvspXuc3qpFBQ= Received: from MN2PR12MB3373.namprd12.prod.outlook.com (20.178.242.33) by MN2PR12MB3550.namprd12.prod.outlook.com (20.179.84.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2008.16; Thu, 27 Jun 2019 13:19:53 +0000 Received: from MN2PR12MB3373.namprd12.prod.outlook.com ([fe80::f5e0:d455:c8e0:4c13]) by MN2PR12MB3373.namprd12.prod.outlook.com ([fe80::f5e0:d455:c8e0:4c13%5]) with mapi id 15.20.2008.017; Thu, 27 Jun 2019 13:19:53 +0000 From: Jean-Baptiste Maneyrol To: "linux-iio@vger.kernel.org" CC: "stable@vger.kernel.org" , Jean-Baptiste Maneyrol Subject: [PATCH v2] iio: imu: mpu6050: add missing available scan masks Thread-Topic: [PATCH v2] iio: imu: mpu6050: add missing available scan masks Thread-Index: AQHVLOsB+Bohq3cjZUigraO6Qp/HnA== Date: Thu, 27 Jun 2019 13:19:53 +0000 Message-ID: <20190627131918.19619-1-jmaneyrol@invensense.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: DB7PR05CA0054.eurprd05.prod.outlook.com (2603:10a6:10:2e::31) To MN2PR12MB3373.namprd12.prod.outlook.com (2603:10b6:208:c8::33) x-originating-ip: [77.157.193.39] x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e1df100a-113d-4343-b58d-08d6fb022406 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:MN2PR12MB3550; x-ms-traffictypediagnostic: MN2PR12MB3550: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:6108; x-forefront-prvs: 008184426E x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(366004)(346002)(376002)(39850400004)(396003)(199004)(189003)(50226002)(6116002)(3846002)(99286004)(52116002)(8936002)(2906002)(316002)(7736002)(305945005)(54906003)(8676002)(68736007)(2351001)(81156014)(81166006)(72206003)(36756003)(478600001)(5640700003)(6436002)(107886003)(6486002)(53936002)(6512007)(14454004)(2501003)(25786009)(386003)(186003)(80792005)(476003)(2616005)(6506007)(66066001)(4326008)(450100002)(26005)(6916009)(486006)(256004)(66946007)(66476007)(66556008)(64756008)(66446008)(1076003)(86362001)(73956011)(102836004)(71200400001)(71190400001)(5660300002);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR12MB3550;H:MN2PR12MB3373.namprd12.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: invensense.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: FixhnTNOa6EAteqeBSEwNrc6Andgtr8n93iT5lWoKjlGbGiZpWe8oKsnPVEZt4Pag3Le2zRAaRes/x0pWdw7BCwI/P0et/LwTt5bvCuocGPQSbgTLDSh6uNvwMpGwIqfTjOqJ+kQJv3gLNYsOFVJVJYikdKqMvyxUx4a7b/z5uc2K9QBXOBfmTxc0ZJV2XijHMLe6ImlKo7sM9su45bPEGJTZfG+a6PhPfcKtA/AowZ8hiRfVjiyPvpeTGyGXLhg1Dhq1TxOlOoVz9KPtLa9NHfXiUlJzCxlPI1S1WaDd6Ga8U/0Q/AiDLVlZzRPR74cie7mFJ2l/L/9NSILA4na2/mrkv28ID1gztM5UIAjsrhvyT8pLmBDJNaNegvEGOHFe8eSAPf1OyW8VKoi9C8cKJF5OV4bLItTIauYe3aA47A= MIME-Version: 1.0 X-OriginatorOrg: invensense.com X-MS-Exchange-CrossTenant-Network-Message-Id: e1df100a-113d-4343-b58d-08d6fb022406 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Jun 2019 13:19:53.5178 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 462b3b3b-e42b-47ea-801a-f1581aac892d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: JManeyrol@invensense.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB3550 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:5.22.84,1.0.8 definitions=2019-06-27_07:2019-06-25,2019-06-27 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 suspectscore=0 phishscore=0 malwarescore=0 priorityscore=1501 clxscore=1011 spamscore=0 impostorscore=0 adultscore=0 bulkscore=0 mlxlogscore=999 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1904300001 definitions=main-1906270156 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Driver only supports 3-axis gyro and/or 3-axis accel. For icm20602, temp data is mandatory for all configurations. Fix all single and double axis configurations (almost never used) and more importantly fix 3-axis gyro and 6-axis accel+gyro buffer on icm20602 when temp data is not enabled. Signed-off-by: Jean-Baptiste Maneyrol Fixes: 1615fe41a195 ("iio: imu: mpu6050: Fix FIFO layout for ICM20602") --- Changes in v2: - Use more explicit scan defines for masks drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 385f14a4d5a7..66629c3adc21 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -851,6 +851,25 @@ static const struct iio_chan_spec inv_mpu_channels[] = { INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_MPU6050_SCAN_ACCL_Z), }; +static const unsigned long inv_mpu_scan_masks[] = { + /* 3-axis accel */ + BIT(INV_MPU6050_SCAN_ACCL_X) + | BIT(INV_MPU6050_SCAN_ACCL_Y) + | BIT(INV_MPU6050_SCAN_ACCL_Z), + /* 3-axis gyro */ + BIT(INV_MPU6050_SCAN_GYRO_X) + | BIT(INV_MPU6050_SCAN_GYRO_Y) + | BIT(INV_MPU6050_SCAN_GYRO_Z), + /* 6-axis accel + gyro */ + BIT(INV_MPU6050_SCAN_ACCL_X) + | BIT(INV_MPU6050_SCAN_ACCL_Y) + | BIT(INV_MPU6050_SCAN_ACCL_Z) + | BIT(INV_MPU6050_SCAN_GYRO_X) + | BIT(INV_MPU6050_SCAN_GYRO_Y) + | BIT(INV_MPU6050_SCAN_GYRO_Z), + 0, +}; + static const struct iio_chan_spec inv_icm20602_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(INV_ICM20602_SCAN_TIMESTAMP), { @@ -877,6 +896,28 @@ static const struct iio_chan_spec inv_icm20602_channels[] = { INV_MPU6050_CHAN(IIO_ACCEL, IIO_MOD_Z, INV_ICM20602_SCAN_ACCL_Z), }; +static const unsigned long inv_icm20602_scan_masks[] = { + /* 3-axis accel + temp (mandatory) */ + BIT(INV_ICM20602_SCAN_ACCL_X) + | BIT(INV_ICM20602_SCAN_ACCL_Y) + | BIT(INV_ICM20602_SCAN_ACCL_Z) + | BIT(INV_ICM20602_SCAN_TEMP), + /* 3-axis gyro + temp (mandatory) */ + BIT(INV_ICM20602_SCAN_GYRO_X) + | BIT(INV_ICM20602_SCAN_GYRO_Y) + | BIT(INV_ICM20602_SCAN_GYRO_Z) + | BIT(INV_ICM20602_SCAN_TEMP), + /* 6-axis accel + gyro + temp (mandatory) */ + BIT(INV_ICM20602_SCAN_ACCL_X) + | BIT(INV_ICM20602_SCAN_ACCL_Y) + | BIT(INV_ICM20602_SCAN_ACCL_Z) + | BIT(INV_ICM20602_SCAN_GYRO_X) + | BIT(INV_ICM20602_SCAN_GYRO_Y) + | BIT(INV_ICM20602_SCAN_GYRO_Z) + | BIT(INV_ICM20602_SCAN_TEMP), + 0, +}; + /* * The user can choose any frequency between INV_MPU6050_MIN_FIFO_RATE and * INV_MPU6050_MAX_FIFO_RATE, but only these frequencies are matched by the @@ -1136,9 +1177,11 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, if (chip_type == INV_ICM20602) { indio_dev->channels = inv_icm20602_channels; indio_dev->num_channels = ARRAY_SIZE(inv_icm20602_channels); + indio_dev->available_scan_masks = inv_icm20602_scan_masks; } else { indio_dev->channels = inv_mpu_channels; indio_dev->num_channels = ARRAY_SIZE(inv_mpu_channels); + indio_dev->available_scan_masks = inv_mpu_scan_masks; } indio_dev->info = &mpu_info;