Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1633941rwb; Sun, 18 Sep 2022 10:57:46 -0700 (PDT) X-Google-Smtp-Source: AMsMyM64HxWSkLNcOi826/94BNuqRco7myzi1bMzltK0N+GMJWj6XqWinEfDtVPtDaLGVUioJ7rY X-Received: by 2002:a17:907:7f1c:b0:77d:248:c1c3 with SMTP id qf28-20020a1709077f1c00b0077d0248c1c3mr9639507ejc.416.1663523866748; Sun, 18 Sep 2022 10:57:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663523866; cv=none; d=google.com; s=arc-20160816; b=EVPRmGyJBlVLgyj5W2f+sfFP1eg9nBkQ7ITqgLQDfR9aMAUjvtN2sreKwOF2a6g63v jbUPkeJYtHAk84EypOEzze+zsVIKkhGrOE+rKFfTY+jHAnVfYuTPBEXJqjpCv19qU9l8 qwyDSCr+25OHRpSEE0MAJLyxmfsDGj0Wot2tSnSQrxvSjyN6WRPCC2Pj4Jtm9fc/zba7 7p6jw7U+RAdL/RSXOTg2g6LiUsOcsGU4tfGaMuIu5xCSvSxV7bhHOt4vJ8Y8TG0ot6Zo Feewn+4IMzDbxjaeX0ge4NosUR4FFU7kAMRFoWPdnY+i/a5VuNWBAc2WlpKnJeF6Srxq nEsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=MlZFb13fAkoklbUy3MXKY1sRuqBP+gWe8Ut4gh1/BQo=; b=ILKInTZR1xdo/akliJQ5r0Bm5pi70qLr7mrt+yCLqvJT8X41xIl0970lYcTDKjHzXf 3a0IiL9ZOC90cQa6RRAU9TS+2qTnzMh6dQh4H9Ly83oXgQ6GiZ8Vmgnci39arP+8dQJB Wou6HrrFAdjjiqwZps6s4g3jet8MAS1zBWi++CKWHzV7pmABH/GqCljKja1cLzFYawXo cU+eaWSrM1B4vEzONr1VeLZMOK9cle61LPEK8CGyrfezX7aoqw7GgAUtkyqQOa1ytRy/ I6MgICtaCtncp3+JAh7TroMB5nylPd+X2E27I+TJ5vkre2Jdl0fZxDbaP0CbSyZKPCqq 0k9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oSxsGSh6; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b10-20020a056402350a00b004485081f004si8916010edd.598.2022.09.18.10.57.19; Sun, 18 Sep 2022 10:57:46 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=oSxsGSh6; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229587AbiIRR1e (ORCPT + 99 others); Sun, 18 Sep 2022 13:27:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229479AbiIRR1b (ORCPT ); Sun, 18 Sep 2022 13:27:31 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0308186C8; Sun, 18 Sep 2022 10:27:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 83191B81167; Sun, 18 Sep 2022 17:27:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B894C433C1; Sun, 18 Sep 2022 17:27:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663522048; bh=mvFFQURIQTXvo9x/EMwDroyhj4af3+KhJCyIs5JP4Ro=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=oSxsGSh6S7VSsJ3M1h1OA+vixJgsMBDUPFA2kHP4AgDWeL2cwz80xwYrL0wEu37gY tcGRtQ2bcxLsqGw63PtyOE2ZPsQVV53pJ0zX1XeW6AMW4JUzTqvgG8sm/DPKmN5I+1 hUPZ/BGnxFEEgOiZdLJnUJE6gL42cO2Hw7xmTZxnXuw0FvXNkKLcP75nEv2EKPWwU7 p6UEuk6VK/50LgihyOyCZIjI8gj7H6l0YGNyF3v++3n9W00YLGICY6ZzsT1uqBBwo5 cbSEk3G3fM9qDRG/6fm28MphLyxipKv805HnDzjzezn7UlCRTo1t9GokGlfYpgeKYW 23x7KOrCLLtQw== Date: Sun, 18 Sep 2022 18:27:31 +0100 From: Jonathan Cameron To: Cc: , , , , , , , , , , , Subject: Re: [v7 08/14] iio: imu: add Bosch Sensortec BNO055 core driver Message-ID: <20220918182731.26de1a02@jic23-huawei> In-Reply-To: <20220907132205.28021-9-andrea.merello@iit.it> References: <20220907132205.28021-1-andrea.merello@iit.it> <20220907132205.28021-9-andrea.merello@iit.it> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,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 On Wed, 7 Sep 2022 15:21:59 +0200 wrote: > From: Andrea Merello > > Add the core driver for the BNO055 IMU from Bosch. This IMU can be > connected via both serial and I2C busses; separate patches will add support > for them. > > The driver supports "AMG" (Accelerometer, Magnetometer, Gyroscope) mode, > that provides raw data from the said internal sensors, and a couple of > "fusion" modes (i.e. the IMU also does calculations in order to provide > euler angles, quaternions, linear acceleration and gravity measurements). > > In fusion modes the AMG data is still available (with some calibration > refinements done by the IMU), but certain settings such as low pass filters > cut-off frequency and sensors' ranges are fixed, while in AMG mode they can > be customized; this is why AMG mode can still be interesting. > > Signed-off-by: Andrea Merello Hi Andrea, I think this is looking to be in a good state now. There is some devm handling for clks now available that should avoid the need to open code that here. I've made that change whilst applying. Please take a look to make sure I didn't mess it up! Jonathan > + > +static void bno055_clk_disable(void *arg) > +{ > + clk_disable_unprepare(arg); > +} > + > +int bno055_probe(struct device *dev, struct regmap *regmap, > + int xfer_burst_break_thr, bool sw_reset) > +{ ... > + priv->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_LOW); > + if (IS_ERR(priv->reset_gpio)) > + return dev_err_probe(dev, PTR_ERR(priv->reset_gpio), "Failed to get reset GPIO\n"); > + > + priv->clk = devm_clk_get_optional(dev, "clk"); > + if (IS_ERR(priv->clk)) > + return dev_err_probe(dev, PTR_ERR(priv->clk), "Failed to get CLK\n"); > + > + ret = clk_prepare_enable(priv->clk); > + if (ret) > + return ret; > + > + ret = devm_add_action_or_reset(dev, bno055_clk_disable, priv->clk); > + if (ret) > + return ret;# devm_clk_get_optional_enabled() is now available and should work here I think? > + > + if (priv->reset_gpio) { > + usleep_range(5000, 10000); > + gpiod_set_value_cansleep(priv->reset_gpio, 1); > + usleep_range(650000, 750000); > + } else if (!sw_reset) { > + dev_warn(dev, "No usable reset method; IMU may be unreliable\n"); > + }