mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 14:42:24 +00:00
media: ov9650: Drop platform data code path
Nothing in the kernel uses the platform data code path. Drop it, and drop the use of the old legacy <linux/gpio.h> API in the process. Cc: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Cc: Andrzej Hajda <a.hajda@samsung.com> Cc: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
This commit is contained in:
parent
bee1bc81d3
commit
27cdfbdb9f
@ -10,7 +10,6 @@
|
||||
*/
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/kernel.h>
|
||||
@ -30,7 +29,6 @@
|
||||
#include <media/v4l2-image-sizes.h>
|
||||
#include <media/v4l2-subdev.h>
|
||||
#include <media/v4l2-mediabus.h>
|
||||
#include <media/i2c/ov9650.h>
|
||||
|
||||
static int debug;
|
||||
module_param(debug, int, 0644);
|
||||
@ -1402,38 +1400,6 @@ static const struct v4l2_subdev_ops ov965x_subdev_ops = {
|
||||
.video = &ov965x_video_ops,
|
||||
};
|
||||
|
||||
/*
|
||||
* Reset and power down GPIOs configuration
|
||||
*/
|
||||
static int ov965x_configure_gpios_pdata(struct ov965x *ov965x,
|
||||
const struct ov9650_platform_data *pdata)
|
||||
{
|
||||
int ret, i;
|
||||
int gpios[NUM_GPIOS];
|
||||
struct device *dev = regmap_get_device(ov965x->regmap);
|
||||
|
||||
gpios[GPIO_PWDN] = pdata->gpio_pwdn;
|
||||
gpios[GPIO_RST] = pdata->gpio_reset;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(ov965x->gpios); i++) {
|
||||
int gpio = gpios[i];
|
||||
|
||||
if (!gpio_is_valid(gpio))
|
||||
continue;
|
||||
ret = devm_gpio_request_one(dev, gpio,
|
||||
GPIOF_OUT_INIT_HIGH, "OV965X");
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
v4l2_dbg(1, debug, &ov965x->sd, "set gpio %d to 1\n", gpio);
|
||||
|
||||
gpio_set_value_cansleep(gpio, 1);
|
||||
gpio_export(gpio, 0);
|
||||
ov965x->gpios[i] = gpio_to_desc(gpio);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int ov965x_configure_gpios(struct ov965x *ov965x)
|
||||
{
|
||||
struct device *dev = regmap_get_device(ov965x->regmap);
|
||||
@ -1493,7 +1459,6 @@ out:
|
||||
|
||||
static int ov965x_probe(struct i2c_client *client)
|
||||
{
|
||||
const struct ov9650_platform_data *pdata = client->dev.platform_data;
|
||||
struct v4l2_subdev *sd;
|
||||
struct ov965x *ov965x;
|
||||
int ret;
|
||||
@ -1513,17 +1478,7 @@ static int ov965x_probe(struct i2c_client *client)
|
||||
return PTR_ERR(ov965x->regmap);
|
||||
}
|
||||
|
||||
if (pdata) {
|
||||
if (pdata->mclk_frequency == 0) {
|
||||
dev_err(&client->dev, "MCLK frequency not specified\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
ov965x->mclk_frequency = pdata->mclk_frequency;
|
||||
|
||||
ret = ov965x_configure_gpios_pdata(ov965x, pdata);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else if (dev_fwnode(&client->dev)) {
|
||||
if (dev_fwnode(&client->dev)) {
|
||||
ov965x->clk = devm_clk_get(&client->dev, NULL);
|
||||
if (IS_ERR(ov965x->clk))
|
||||
return PTR_ERR(ov965x->clk);
|
||||
@ -1534,7 +1489,7 @@ static int ov965x_probe(struct i2c_client *client)
|
||||
return ret;
|
||||
} else {
|
||||
dev_err(&client->dev,
|
||||
"Neither platform data nor device property specified\n");
|
||||
"No device properties specified\n");
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* OV9650/OV9652 camera sensors driver
|
||||
*
|
||||
* Copyright (C) 2013 Sylwester Nawrocki <sylvester.nawrocki@gmail.com>
|
||||
*/
|
||||
#ifndef OV9650_H_
|
||||
#define OV9650_H_
|
||||
|
||||
/**
|
||||
* struct ov9650_platform_data - ov9650 driver platform data
|
||||
* @mclk_frequency: the sensor's master clock frequency in Hz
|
||||
* @gpio_pwdn: number of a GPIO connected to OV965X PWDN pin
|
||||
* @gpio_reset: number of a GPIO connected to OV965X RESET pin
|
||||
*
|
||||
* If any of @gpio_pwdn or @gpio_reset are unused then they should be
|
||||
* set to a negative value. @mclk_frequency must always be specified.
|
||||
*/
|
||||
struct ov9650_platform_data {
|
||||
unsigned long mclk_frequency;
|
||||
int gpio_pwdn;
|
||||
int gpio_reset;
|
||||
};
|
||||
#endif /* OV9650_H_ */
|
Loading…
Reference in New Issue
Block a user