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 X-Spam-Level: X-Spam-Status: No, score=-12.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5355C433ED for ; Mon, 10 May 2021 16:52:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B9CE7611C2 for ; Mon, 10 May 2021 16:52:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230152AbhEJQyC (ORCPT ); Mon, 10 May 2021 12:54:02 -0400 Received: from first.geanix.com ([116.203.34.67]:57878 "EHLO first.geanix.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231984AbhEJQx6 (ORCPT ); Mon, 10 May 2021 12:53:58 -0400 Received: from [192.168.100.11] (unknown [185.233.254.173]) by first.geanix.com (Postfix) with ESMTPSA id 050FD468AE9; Mon, 10 May 2021 16:52:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=geanix.com; s=first; t=1620665571; bh=Y0DUdfBRrpWLCGuinz0ADO3W/thjnRF4UJFQP0wvpd8=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=NHnvaTU+atXjwEcnS5GNp3jSlHQcoqMFi6RMYwL/M/4eXfxnxfHncOHEZWFPNgle4 r+lHbLHGm/6nQj9i42MJtTtEawL34LGqzUeK6xFHg94M9pRrysQLvpr5j7HNcNNTXH aRrTclKUiozMCV2C9MIbThi65SBak4fO1PvhYjPndqEqVUyzVR31AWQ36lxlZxApex 3tFkTWi84vMa9ZAukt9P/4F80OsUJFYA/4y+WfdhFQmRSkFI/KLM4XV+SPNv2efcAn wO4Wu+5Qyp/KXbt5k8DPZyz+C54SEAO7650W52jJmGYSFJSnDAY7ZrtTPGVNhdekKI MqQUTRqa2qhzw== Subject: Re: [PATCH] iio: imu: st_lsm6dsx: do not roundup set samplerate To: Lorenzo Bianconi Cc: lorenzo.bianconi83@gmail.com, jic23@kernel.org, linux-iio@vger.kernel.org References: <20210507103220.2194009-1-sean@geanix.com> <303a2899-2aff-410f-3bce-e40a7d7637e9@geanix.com> From: Sean Nyekjaer Message-ID: <431ddd82-8873-15a5-6f11-9556e0d37ef3@geanix.com> Date: Mon, 10 May 2021 18:52:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On 10/05/2021 16.47, Lorenzo Bianconi wrote: >> On 10/05/2021 14.07, Lorenzo Bianconi wrote: >>>> On 10/05/2021 08.28, Lorenzo Bianconi wrote: >>>>>> On 07/05/2021 13.02, Lorenzo Bianconi wrote: >>>>>>>> The correct way to set the sampling rate to 12.5 Hz before >>>>>>>> commit f8710f0357bc ("iio: imu: st_lsm6dsx: express odr in mHZ") >>>>>>>> was to write 13 Hz to sampling_frequency. >>>>>>>> Before this patch writing 13 to samplerate results in sample rate set >>>>>>>> to 26 Hz. >>>>>>>> Now we return EINVAL if the sampling rate is not in table. >>>>>>>> >>>>>>>> Signed-off-by: Sean Nyekjaer >>>>>>> >>>>>>> I think this patch is breaking i2c-master support available in st_lsm6dsx, have you tested it? >>>>>>> >>>>>> I have not tested with i2c-master. >>>>>> But it's not nice to round up sample rate from user space without any notice. >>>>> >>>>> the point is accel odr is used as trigger for i2c-slave sampling. Connected >>>>> i2c slave devices have different sample rates (e.g. LIS2MDL), so we need to >>>>> select the lower accel odr greather than slave device one. >>>>> >>>>> Regards, >>>>> Lorenzo >>>>> >>>> >>>> We could open up for custom sample rates if i2c-slaves are enabled? >>> >>> can you please explain what you mean? >>> >> If i2c-slaves are enabled, it's allowed to set off table sample rates.(We roundup samplerate like now) >> If i2c-slaves are disabled, we return -EINVAL if we can't find the chosen samplerate in the samplerate table? > > IMO this is not a big deal because if you set the proper ODR (e.g. 26Hz) with the > i2c-master disabled, the sample rate will not be rounded-up. If you set 20Hz, > the accel ODR will be set to 26Hz. I think it does not worth to make the code > uglier and more complex to maintain. > > Regards, > Lorenzo > Sure, but we had some existing code that was setting the samplerate to 13Hz as that was the way to set 12.5Hz samplerate in the past. Suddenly without any notice 13Hz(of cause the kernel was updated) resulted in a samplerate of 26Hz. :/ /Sean