[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAN8YU5O2z+dxmtLRkKsiXjZjne8rLLdMG57xQRE3SXFMx8YUcQ@mail.gmail.com>
Date: Fri, 23 Sep 2022 09:25:06 +0200
From: Andrea Merello <andrea.merello@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: andrea.merello@....it, 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, bagasdotme@...il.com
Subject: Re: [v7 08/14] iio: imu: add Bosch Sensortec BNO055 core driver
Il giorno dom 18 set 2022 alle ore 19:27 Jonathan Cameron
<jic23@...nel.org> ha scritto:
[...]
>
> 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!
Hi, thank you for directly fixing, so that I can avoid a further
series version :)
I've looked at this change, and it looks good to me; also, I've run
some tests and nothing failed.
Andrea
> 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