lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220918182731.26de1a02@jic23-huawei>
Date:   Sun, 18 Sep 2022 18:27:31 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     <andrea.merello@....it>
Cc:     <mchehab+huawei@...nel.org>, <linux-iio@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <lars@...afoo.de>, <robh+dt@...nel.org>,
        <andy.shevchenko@...il.com>, <matt.ranostay@...sulko.com>,
        <ardeleanalex@...il.com>, <jacopo@...ndi.org>,
        <andrea.merello@...il.com>, <bagasdotme@...il.com>
Subject: Re: [v7 08/14] iio: imu: add Bosch Sensortec BNO055 core driver

On Wed, 7 Sep 2022 15:21:59 +0200
<andrea.merello@....it> wrote:

> From: Andrea Merello <andrea.merello@....it>
> 
> 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 <andrea.merello@....it>

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");
> +	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ