[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG3jFyuwHEXHD1JbWMwNX_LDtawJ1+-zEptzq2yrn8Uk+S3fdQ@mail.gmail.com>
Date: Tue, 10 Mar 2020 16:46:56 +0100
From: Robert Foss <robert.foss@...aro.org>
To: Fabio Estevam <festevam@...il.com>
Cc: ben.kao@...el.com, Mauro Carvalho Chehab <mchehab@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Matthias Brugger <matthias.bgg@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jonathan.Cameron@...wei.com,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
linux-media <linux-media@...r.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@...ts.infradead.org>,
linux-mediatek@...ts.infradead.org,
Dongchun Zhu <dongchun.zhu@...iatek.com>,
Tomasz Figa <tfiga@...omium.org>
Subject: Re: [v1 2/3] media: ov8856: Add devicetree support
On Tue, 10 Mar 2020 at 15:03, Fabio Estevam <festevam@...il.com> wrote:
>
> On Tue, Mar 10, 2020 at 10:47 AM Robert Foss <robert.foss@...aro.org> wrote:
>
> > +static int __ov8856_power_on(struct ov8856 *ov8856)
> > +{
> > + struct i2c_client *client = v4l2_get_subdevdata(&ov8856->sd);
> > + int ret;
> > +
> > + ret = clk_prepare_enable(ov8856->xvclk);
> > + if (ret < 0) {
> > + dev_err(&client->dev, "failed to enable xvclk\n");
> > + return ret;
> > + }
> > +
> > + gpiod_set_value_cansleep(ov8856->n_shutdn_gpio, GPIOD_OUT_LOW);
> > +
> > + ret = regulator_bulk_enable(OV8856_NUM_SUPPLIES, ov8856->supplies);
> > + if (ret < 0) {
> > + dev_err(&client->dev, "failed to enable regulators\n");
> > + goto disable_clk;
> > + }
> > +
> > + gpiod_set_value_cansleep(ov8856->n_shutdn_gpio, GPIOD_OUT_HIGH);
>
> To power it up you probably only need:
>
> gpiod_set_value_cansleep(ov8856->n_shutdn_gpio, 0);
>
> And use reset-gpios as active low in your device tree. Assuming the
> reset-gpios is active low like other OmniVision sensors.
Ack.
>
> > +
> > + usleep_range(1500, 1800);
> > +
> > + return 0;
> > +
> > +disable_clk:
> > + clk_disable_unprepare(ov8856->xvclk);
> > +
> > + return ret;
> > +}
> > +
> > +static void __ov8856_power_off(struct ov8856 *ov8856)
> > +{
> > + gpiod_set_value_cansleep(ov8856->n_shutdn_gpio, GPIOD_OUT_LOW);
> > + regulator_bulk_disable(OV8856_NUM_SUPPLIES, ov8856->supplies);
> > + clk_disable_unprepare(ov8856->xvclk);
> > +}
> > +
> > +
>
> Unneede extra blank line.
Ack.
>
> > v4l2_i2c_subdev_init(&ov8856->sd, client, &ov8856_subdev_ops);
> > + ov8856->xvclk = devm_clk_get(&client->dev, "xvclk");
> > + if (IS_ERR(ov8856->xvclk)) {
> > + dev_err(&client->dev, "failed to get xvclk\n");
> > + return -EINVAL;
>
> You should better return the real error insteald
> PTR_ERR(ov8856->xvclk). This way defer probe could work.
>
Ack.
> > + }
> > +
> > + ret = clk_set_rate(ov8856->xvclk, OV8856_XVCLK_24);
> > + if (ret < 0) {
> > + dev_err(&client->dev, "failed to set xvclk rate (24MHz)\n");
> > + return ret;
> > + }
> > +
> > + ov8856->n_shutdn_gpio = devm_gpiod_get(&client->dev, "reset",
> > + GPIOD_OUT_LOW);
> > + if (IS_ERR(ov8856->n_shutdn_gpio)) {
> > + dev_err(&client->dev, "failed to get reset-gpios\n");
> > + return -EINVAL;
>
> Please return the real error.
Ack.
Powered by blists - more mailing lists