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=-2.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 78176C3F2CD for ; Mon, 23 Mar 2020 15:21:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 469B2206F8 for ; Mon, 23 Mar 2020 15:21:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="urWfSTCU" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727130AbgCWPVz (ORCPT ); Mon, 23 Mar 2020 11:21:55 -0400 Received: from mail-wr1-f52.google.com ([209.85.221.52]:45533 "EHLO mail-wr1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727113AbgCWPVz (ORCPT ); Mon, 23 Mar 2020 11:21:55 -0400 Received: by mail-wr1-f52.google.com with SMTP id t7so12895855wrw.12 for ; Mon, 23 Mar 2020 08:21:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=vXdvpTkOmEglHmM2yHjsDxxC5nrdm8XvoMKCOYdLBlA=; b=urWfSTCUjHV6ukVnb7VLozoUJNnGOv1Sjlr6lyuDO1Il5pCj6VWzJApPKxv1bLgXvi Htli9o5YxIj4qTmKlz42e61LbGs+r9FDSgYffIGIq2Wj2YwS074ox4F4kDuYuuFgSZch ASd9qtHBd1kbdtddFNQT6nuyFOH9bYgwPUja+GJJ0OG5EJgrrPsIzirJmPvwqesx9Et4 AjDw1wE2uuAaSg6qzfh5Y8KHWo7GYhPB9R1+EV3VXTWdV/utn1jr1RPyPZEx3KFIiIZK UatwYNhaj8poKvyZ0E2pRsil+nyOz+Xfe8OQE0EyFRR50yubJToxlxdhldP4yJYfVO+s DJcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=vXdvpTkOmEglHmM2yHjsDxxC5nrdm8XvoMKCOYdLBlA=; b=ENNX/yZ/86GabvpwWU1xvDnAe9jsDPIhy6YhKXQqlyTMbbbcQui80pqjH3/7AG4tB3 KPUuiFiYkOTMDV3orINIjKYUOD7J9GkaG8BFRcd8wsI4EipkE+HT0BND6QVnroL52zSI nEXtGbEWO9nnxJg1vRTfRetJ7uYy8D72emz64E/3CkKX6Q0kYs5mhpTR3pa31kRn0ro/ +F5Q277BzVllwxMaALdxUX17Eq0d90DbsON+ZgqGw7P09FH9nIvqoqS4AMP1qigy8kOy zaDfIWBQeL3piDpS+Xc5WENAnqqkhwvGiK0VMEXW+1DFrGQKkW8txB3onFfzhmWx4BWj /C/Q== X-Gm-Message-State: ANhLgQ3JFoQwU/9ClxUafZSvAlv7+8Ox7DFbJM+rb31+irOU7A+QQU25 2afz70UDcY4DvsMtplViAe7Ns0mI X-Google-Smtp-Source: ADFU+vsosS/+fiq1gFBUcvi1frH2Fuu4wSBRLmlj3B432c3aM44mTApd4Ybw316Ky4DPJJkf87JpNg== X-Received: by 2002:adf:e48c:: with SMTP id i12mr30654626wrm.173.1584976912507; Mon, 23 Mar 2020 08:21:52 -0700 (PDT) Received: from [192.168.16.194] (h-4-68-234.A785.priv.bahnhof.se. [155.4.68.234]) by smtp.googlemail.com with ESMTPSA id b187sm22633716wmb.42.2020.03.23.08.21.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Mar 2020 08:21:51 -0700 (PDT) Subject: Re: Use LIS3MDL with LSM6DSM sensor-hub To: Lorenzo Bianconi Cc: linux-iio@vger.kernel.org References: <20200314124324.GA144176@lore-desk-wlan> <217cb6b1-d3b3-bccf-b081-d4beb0888615@gmail.com> <20200319174039.GA1564882@lore-desk-wlan> <20200319204937.GB1564882@lore-desk-wlan> From: Jimmy Assarsson Message-ID: <37e50d0e-0618-eeba-8cf9-7c1272097a62@gmail.com> Date: Mon, 23 Mar 2020 16:21:49 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200319204937.GB1564882@lore-desk-wlan> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org On 2020-03-19 21:49, Lorenzo Bianconi wrote: >> On 2020-03-19 18:40, Lorenzo Bianconi wrote: >>>> On 2020-03-14 13:43, Lorenzo Bianconi wrote: >>>>> On Mar 11, Jimmy Assarsson wrote: >>>>>> Hi, >>>>>> > > [...] > >>>>> Hi Jimmy, >>>>> >>>>> in order to set the full scale on LIS3MDL you can try the following patch (just >>>>> compiled, not tested) >>>>> >>>>> Regards, >>>>> Lorenzo >>>> >>>> Hi Lorenzo, >>>> >>>> Sorry for the late response and thanks for the patch! >>> >>> Hi Jimmy, >>> >>> ok, I will post the patch, thx for testing. >> >> Great, you can add >> Tested-by: Jimmy Assarsson >> >>>> The patches seems to work. >>>> Are there any specific tests that we should carry out? >>>> Via the sysfs interface, we've tested reading raw values of each channel and >>>> configuring ODR and full scale. >>> >>> you can try to enable batching in the hw FIFO doing something like: >>> >>> $echo 1 > /sys/bus/iio/devices//scan_elements/in_magn_x_en >>> $echo 1 > /sys/bus/iio/devices//scan_elements/in_magn_y_en >>> $echo 1 > /sys/bus/iio/devices//scan_elements/in_magn_z_en >>> $echo 1 > /sys/bus/iio/devices//scan_elements/in_timestamp_en >>> >>> $watermark=64 >>> $echo $((2*watermark)) > /sys/bus/iio/devices//buffer/length >>> $echo $watermark > /sys/bus/iio/devices//buffer/watermark >>> >>> $generic_buffer -gn lsm6dsm_magn -c <# of samples> >> >> Ok. I don't got any scan_elements nor buffer directory, for any of the devices. >> I guess it is not possible to use the FIFO without configuring any interrupt? >> We got the following dts: >> &spi1 { >> #address-cells = <1>; >> #size-cells = <0>; >> lsm6dsm@0 { >> compatible = "st,lsm6dsm"; >> reg = <0x0>; >> >> spi-max-frequency = <500000>; >> st,pullups = "true"; > > yes, you need to provide the interrupt line doing something like (this is from > the dts on my rpi): > > lsm6dsm@0 { > ... > interrupt-parent = <&gpio>; > interrupts = <21 0x4>; > ... > }; > >> }; >> }; >> >> I'll look into this tomorrow or in the beginning of next week, thanks for the help. Now I've tested this. It looks fine, except for the very first sample: $ ./iio_generic_buffer -gn lsm6dsm_magn -c 1 iio device number being used is 3 trigger-less mode selected -3.250836 -2.796192 10.212408 1584976428879020199 1.893036 2.343738 -0.853224 1584976428917070199 1.888218 2.343300 -0.852786 1584976428955095199 1.888218 2.343300 -0.852786 1584976428993145199 1.889532 2.345490 -0.851472 1584976429031170199 Is this expected? Regards, jimmy