Messages in this thread |  | | From | Andrea Merello <> | | Date | Fri, 23 Sep 2022 09:25:06 +0200 | | 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@kernel.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"); > > + }
|  |