From: Fabio Estevam <festevam@gmail.com>
To: Robert Foss <robert.foss@linaro.org>
Cc: ben.kao@intel.com, Mauro Carvalho Chehab <mchehab@kernel.org>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jonathan.Cameron@huawei.com,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
linux-media <linux-media@vger.kernel.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
"moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE"
<linux-arm-kernel@lists.infradead.org>,
linux-mediatek@lists.infradead.org,
Dongchun Zhu <dongchun.zhu@mediatek.com>,
Tomasz Figa <tfiga@chromium.org>
Subject: Re: [v1 2/3] media: ov8856: Add devicetree support
Date: Tue, 10 Mar 2020 11:03:21 -0300 [thread overview]
Message-ID: <CAOMZO5D7N6FfPMiycGun-eui-G-tbp15stwRWBWs4L98JHFfGA@mail.gmail.com> (raw)
In-Reply-To: <20200310134603.30260-3-robert.foss@linaro.org>
On Tue, Mar 10, 2020 at 10:47 AM Robert Foss <robert.foss@linaro.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.
> +
> + 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.
> 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.
> + }
> +
> + 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.
next prev parent reply other threads:[~2020-03-10 14:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-10 13:46 [v1 0/3] media: ov8856: Add sensor modes & devicetree support Robert Foss
2020-03-10 13:46 ` [v1 1/3] media: dt-bindings: ov8856: Document YAML bindings Robert Foss
2020-03-10 13:57 ` Fabio Estevam
2020-03-10 15:51 ` Robert Foss
2020-03-12 10:13 ` Robert Foss
2020-03-10 18:38 ` Rob Herring
2020-03-10 13:46 ` [v1 2/3] media: ov8856: Add devicetree support Robert Foss
2020-03-10 14:03 ` Fabio Estevam [this message]
2020-03-10 15:46 ` Robert Foss
2020-03-10 14:26 ` Andy Shevchenko
2020-03-10 15:55 ` Robert Foss
2020-03-11 9:05 ` Andy Shevchenko
2020-03-11 11:48 ` Sakari Ailus
2020-03-11 13:32 ` Robert Foss
2020-03-11 16:16 ` Sakari Ailus
2020-03-10 13:46 ` [v1 3/3] media: ov8856: Implement sensor module revision identification Robert Foss
2020-03-10 14:30 ` Andy Shevchenko
2020-03-12 16:37 ` Robert Foss
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAOMZO5D7N6FfPMiycGun-eui-G-tbp15stwRWBWs4L98JHFfGA@mail.gmail.com \
--to=festevam@gmail.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=ben.kao@intel.com \
--cc=davem@davemloft.net \
--cc=devicetree@vger.kernel.org \
--cc=dongchun.zhu@mediatek.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=matthias.bgg@gmail.com \
--cc=mchehab@kernel.org \
--cc=robert.foss@linaro.org \
--cc=robh+dt@kernel.org \
--cc=tfiga@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).