[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VfFKY6nzb8aEWmop73v2haZ0P5+aTsKDEU8M=uUPn0u3g@mail.gmail.com>
Date: Tue, 31 Mar 2020 17:01:00 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Robert Foss <robert.foss@...aro.org>
Cc: Dongchun Zhu <dongchun.zhu@...iatek.com>,
Fabio Estevam <festevam@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Sakari Ailus <sakari.ailus@....fi>,
Tomasz Figa <tfiga@...omium.org>,
Linux Media Mailing List <linux-media@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v3 2/3] media: ov8856: Add devicetree support
On Tue, Mar 31, 2020 at 4:36 PM Robert Foss <robert.foss@...aro.org> wrote:
>
> Add devicetree match table, and enable ov8856_probe()
> to initialize power, clocks and reset pins.
...
> +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;
> + }
> +
> + if (is_acpi_node(ov8856->dev->fwnode))
Use dev_fwnode().
> + return 0;
> +
> + if (ov8856->reset_gpio) {
> + gpiod_set_value_cansleep(ov8856->reset_gpio, GPIOD_OUT_HIGH);
This is wrong. You have to fix it to use either 0 or 1.
> + usleep_range(1000, 2000);
> + }
> +
> + ret = regulator_bulk_enable(ARRAY_SIZE(ov8856_supply_names),
> + ov8856->supplies);
> + if (ret < 0) {
Do you need all ' < 0' parts all over the series?
> + dev_err(&client->dev, "failed to enable regulators\n");
> + goto disable_clk;
> + }
...
> + gpiod_set_value_cansleep(ov8856->reset_gpio, GPIOD_OUT_LOW);
Ditto.
...
> + gpiod_set_value_cansleep(ov8856->reset_gpio, GPIOD_OUT_HIGH);
Ditto.
...
> + gpiod_set_value_cansleep(ov8856->reset_gpio, GPIOD_OUT_HIGH);
Ditto.
...
> - ret = fwnode_property_read_u32(fwnode, "clock-frequency", &mclk);
> - if (ret)
> - return ret;
Where is it gone? Why?
> + ov8856->xvclk = devm_clk_get_optional(dev, "xvclk");
> + if (IS_ERR(ov8856->xvclk)) {
> + dev_err(dev, "could not get xvclk clock (%ld)\n",
> + PTR_ERR(ov8856->xvclk));
Also you may use %pe here and in similar cases.
> + return PTR_ERR(ov8856->xvclk);
> + }
> + ov8856->reset_gpio = devm_gpiod_get_optional(dev, "reset",
> + GPIOD_OUT_HIGH);
Here parameter is correct. The question is, what the value should be
HIGH or LOW?
Basically HIGH means to assert the signal.
> + if (IS_ERR(ov8856->reset_gpio)) {
> + dev_dbg(dev, "failed to get reset-gpio\n");
Noise.
Enable GPIO debug to see this kind of messages.
> + return PTR_ERR(ov8856->reset_gpio);
> + }
...
> + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ov8856_supply_names),
> + ov8856->supplies);
> + if (ret) {
> + dev_warn(dev, "failed to get regulators\n");
If it's a warning, why we return from here?
Same question to all other places with same issue.
> + return ret;
> }
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists