From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10BD2C54EBC for ; Thu, 12 Jan 2023 15:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234936AbjALP2V (ORCPT ); Thu, 12 Jan 2023 10:28:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240325AbjALP06 (ORCPT ); Thu, 12 Jan 2023 10:26:58 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8064A44C73 for ; Thu, 12 Jan 2023 07:19:41 -0800 (PST) Received: from lhrpeml500005.china.huawei.com (unknown [172.18.147.226]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Nt7WR334vz6J9gt; Thu, 12 Jan 2023 23:19:31 +0800 (CST) Received: from localhost (10.202.227.76) by lhrpeml500005.china.huawei.com (7.191.163.240) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Thu, 12 Jan 2023 15:19:38 +0000 Date: Thu, 12 Jan 2023 15:19:37 +0000 From: Jonathan Cameron To: Lorenzo Bianconi CC: Philippe De Muyter , Subject: Re: sysfs mount_matrix for st_lsm6dsx gyro Message-ID: <20230112151937.0000505a@Huawei.com> In-Reply-To: References: <20230111120940.GA23351@frolo.macqel> <20230111171732.00006941@Huawei.com> <20230112112704.GA17933@frolo.macqel> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 4.1.0 (GTK 3.24.33; x86_64-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.76] X-ClientProxiedBy: lhrpeml500002.china.huawei.com (7.191.160.78) To lhrpeml500005.china.huawei.com (7.191.163.240) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On Thu, 12 Jan 2023 12:32:11 +0100 Lorenzo Bianconi wrote: > > Hello Lorenzo, > > > > On Thu, Jan 12, 2023 at 10:51:03AM +0100, Lorenzo Bianconi wrote: > > > Date: Thu, 12 Jan 2023 10:51:03 +0100 > > > From: Lorenzo Bianconi > > > To: Jonathan Cameron > > > Cc: Philippe De Muyter , linux-iio@vger.kernel.org > > > Subject: Re: sysfs mount_matrix for st_lsm6dsx gyro > > > > > > > On Wed, 11 Jan 2023 13:09:40 +0100 > > > > Philippe De Muyter wrote: > > > > > > > > > Hello Lorenzo and list, > > > > > > > > > > I do not find a "*mount_matrix" entry in sysfs for a 'ism330dlc_gyro' > > > > > iio device. > > > > > Is that normal ? > > > > > Is a fix available ? > > > > > > > > Looks like the channel definition for the gyro does not include an > > > > appropriate ext_info entry unlike the accelerometer channels which > > > > have one with mount_matrix support. > > > > > > > > From a quick glance looks like a simple fix. Add that entry. > > > > > > I am not sure if accel and gyro can be mounted with a different orientation. > > > Do you think we should have a per-sensor mount_matrix? > > > > My chip is a 'ism330dlc'. It's one chip containing an accel and a gyro, > > so the mount_matrix should be the same for the accel and the gyro. > > Unfortunately the accel and the gyro are presented in /sysfs as two > > separate devices, and only the accel one has a 'mount_matrix' entry. > > So a user looking for any gyro will find the gyro entry, but without > > 'mount_matrix'. > > > > I have followed Jonathan's proposal and added this simple patch in > > the definition of the ST_LSM6DSX_CHANNEL macro : > > > > diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h > > index d80ba2e688ed..9d18145d5041 100644 > > --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h > > +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h > > @@ -96,6 +96,7 @@ enum st_lsm6dsx_hw_id { > > .storagebits = 16, \ > > .endianness = IIO_LE, \ > > }, \ > > + .ext_info = st_lsm6dsx_accel_ext_info, \ > > } > > I am fine with this approach, probably having a per-sensor mount_matrix is > unnecessary. Can you please just rename st_lsm6dsx_accel_ext_info in > st_lsm6dsx_ext_info? > > Regards, > Lorenzo > > > > > struct st_lsm6dsx_reg { > > > > Another fix would be to create only one chip entry in sysfs, but that's > > above my knowledge of this driver. We can't make that change. It would be ABI breakage - userspace code would stop working. Jonathan > > > > Best regards > > > > Philippe >