|
|
@@ -32,6 +32,8 @@
|
|
|
#include <linux/module.h>
|
|
|
#include <linux/of.h>
|
|
|
#include <linux/of_graph.h>
|
|
|
+#include <linux/of_gpio.h>
|
|
|
+#include <linux/gpio/consumer.h>
|
|
|
#include <linux/slab.h>
|
|
|
#include <linux/uaccess.h>
|
|
|
#include <linux/videodev2.h>
|
|
|
@@ -232,6 +234,8 @@ struct ov2659 {
|
|
|
struct sensor_register *format_ctrl_regs;
|
|
|
struct ov2659_pll_ctrl pll;
|
|
|
int streaming;
|
|
|
+ /* used to control the sensor powerdownN pin */
|
|
|
+ struct gpio_desc *pwrdn_gpio;
|
|
|
};
|
|
|
|
|
|
static const struct sensor_register ov2659_init_regs[] = {
|
|
|
@@ -1390,6 +1394,7 @@ static int ov2659_probe(struct i2c_client *client,
|
|
|
struct v4l2_subdev *sd;
|
|
|
struct ov2659 *ov2659;
|
|
|
struct clk *clk;
|
|
|
+ struct gpio_desc *gpio;
|
|
|
int ret;
|
|
|
|
|
|
if (!pdata) {
|
|
|
@@ -1413,6 +1418,13 @@ static int ov2659_probe(struct i2c_client *client,
|
|
|
ov2659->xvclk_frequency > 27000000)
|
|
|
return -EINVAL;
|
|
|
|
|
|
+ /* Optional gpio don't fail if not present */
|
|
|
+ gpio = devm_gpiod_get_optional(&client->dev, "pwrdn", GPIOD_OUT_HIGH);
|
|
|
+ if (IS_ERR(gpio))
|
|
|
+ return PTR_ERR(gpio);
|
|
|
+
|
|
|
+ ov2659->pwrdn_gpio = gpio;
|
|
|
+
|
|
|
v4l2_ctrl_handler_init(&ov2659->ctrls, 2);
|
|
|
ov2659->link_frequency =
|
|
|
v4l2_ctrl_new_std(&ov2659->ctrls, &ov2659_ctrl_ops,
|