Commit 0f448294 authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

V4L/DVB (13650): soc-camera: switch drivers and platforms to use .priv in struct soc_camera_link

After this change drivers can be further extended to not fail, if they don't
get platform data, but to use defaults.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 3fd7ceff
...@@ -324,12 +324,14 @@ static struct soc_camera_platform_info camera_info = { ...@@ -324,12 +324,14 @@ static struct soc_camera_platform_info camera_info = {
.bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8, SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8,
.set_capture = camera_set_capture, .set_capture = camera_set_capture,
.link = { };
.bus_id = 0,
.add_device = ap325rxa_camera_add, struct soc_camera_link camera_link = {
.del_device = ap325rxa_camera_del, .bus_id = 0,
.module_name = "soc_camera_platform", .add_device = ap325rxa_camera_add,
}, .del_device = ap325rxa_camera_del,
.module_name = "soc_camera_platform",
.priv = &camera_info,
}; };
static void dummy_release(struct device *dev) static void dummy_release(struct device *dev)
...@@ -347,7 +349,7 @@ static struct platform_device camera_device = { ...@@ -347,7 +349,7 @@ static struct platform_device camera_device = {
static int ap325rxa_camera_add(struct soc_camera_link *icl, static int ap325rxa_camera_add(struct soc_camera_link *icl,
struct device *dev) struct device *dev)
{ {
if (icl != &camera_info.link || camera_probe() <= 0) if (icl != &camera_link || camera_probe() <= 0)
return -ENODEV; return -ENODEV;
camera_info.dev = dev; camera_info.dev = dev;
...@@ -357,7 +359,7 @@ static int ap325rxa_camera_add(struct soc_camera_link *icl, ...@@ -357,7 +359,7 @@ static int ap325rxa_camera_add(struct soc_camera_link *icl,
static void ap325rxa_camera_del(struct soc_camera_link *icl) static void ap325rxa_camera_del(struct soc_camera_link *icl)
{ {
if (icl != &camera_info.link) if (icl != &camera_link)
return; return;
platform_device_unregister(&camera_device); platform_device_unregister(&camera_device);
...@@ -470,13 +472,15 @@ static struct ov772x_camera_info ov7725_info = { ...@@ -470,13 +472,15 @@ static struct ov772x_camera_info ov7725_info = {
.buswidth = SOCAM_DATAWIDTH_8, .buswidth = SOCAM_DATAWIDTH_8,
.flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP, .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
.edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0), .edgectrl = OV772X_AUTO_EDGECTRL(0xf, 0),
.link = { };
.bus_id = 0,
.power = ov7725_power, static struct soc_camera_link ov7725_link = {
.board_info = &ap325rxa_i2c_camera[0], .bus_id = 0,
.i2c_adapter_id = 0, .power = ov7725_power,
.module_name = "ov772x", .board_info = &ap325rxa_i2c_camera[0],
}, .i2c_adapter_id = 0,
.module_name = "ov772x",
.priv = &ov7725_info,
}; };
static struct platform_device ap325rxa_camera[] = { static struct platform_device ap325rxa_camera[] = {
...@@ -484,13 +488,13 @@ static struct platform_device ap325rxa_camera[] = { ...@@ -484,13 +488,13 @@ static struct platform_device ap325rxa_camera[] = {
.name = "soc-camera-pdrv", .name = "soc-camera-pdrv",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &ov7725_info.link, .platform_data = &ov7725_link,
}, },
}, { }, {
.name = "soc-camera-pdrv", .name = "soc-camera-pdrv",
.id = 1, .id = 1,
.dev = { .dev = {
.platform_data = &camera_info.link, .platform_data = &camera_link,
}, },
}, },
}; };
......
...@@ -432,23 +432,27 @@ static struct i2c_board_info migor_i2c_camera[] = { ...@@ -432,23 +432,27 @@ static struct i2c_board_info migor_i2c_camera[] = {
static struct ov772x_camera_info ov7725_info = { static struct ov772x_camera_info ov7725_info = {
.buswidth = SOCAM_DATAWIDTH_8, .buswidth = SOCAM_DATAWIDTH_8,
.link = { };
.power = ov7725_power,
.board_info = &migor_i2c_camera[0], static struct soc_camera_link ov7725_link = {
.i2c_adapter_id = 0, .power = ov7725_power,
.module_name = "ov772x", .board_info = &migor_i2c_camera[0],
}, .i2c_adapter_id = 0,
.module_name = "ov772x",
.priv = &ov7725_info,
}; };
static struct tw9910_video_info tw9910_info = { static struct tw9910_video_info tw9910_info = {
.buswidth = SOCAM_DATAWIDTH_8, .buswidth = SOCAM_DATAWIDTH_8,
.mpout = TW9910_MPO_FIELD, .mpout = TW9910_MPO_FIELD,
.link = { };
.power = tw9910_power,
.board_info = &migor_i2c_camera[1], static struct soc_camera_link tw9910_link = {
.i2c_adapter_id = 0, .power = tw9910_power,
.module_name = "tw9910", .board_info = &migor_i2c_camera[1],
} .i2c_adapter_id = 0,
.module_name = "tw9910",
.priv = &tw9910_info,
}; };
static struct platform_device migor_camera[] = { static struct platform_device migor_camera[] = {
...@@ -456,13 +460,13 @@ static struct platform_device migor_camera[] = { ...@@ -456,13 +460,13 @@ static struct platform_device migor_camera[] = {
.name = "soc-camera-pdrv", .name = "soc-camera-pdrv",
.id = 0, .id = 0,
.dev = { .dev = {
.platform_data = &ov7725_info.link, .platform_data = &ov7725_link,
}, },
}, { }, {
.name = "soc-camera-pdrv", .name = "soc-camera-pdrv",
.id = 1, .id = 1,
.dev = { .dev = {
.platform_data = &tw9910_info.link, .platform_data = &tw9910_link,
}, },
}, },
}; };
......
...@@ -1143,10 +1143,10 @@ static int ov772x_probe(struct i2c_client *client, ...@@ -1143,10 +1143,10 @@ static int ov772x_probe(struct i2c_client *client,
} }
icl = to_soc_camera_link(icd); icl = to_soc_camera_link(icd);
if (!icl) if (!icl || !icl->priv)
return -EINVAL; return -EINVAL;
info = container_of(icl, struct ov772x_camera_info, link); info = icl->priv;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
dev_err(&adapter->dev, dev_err(&adapter->dev,
......
...@@ -955,10 +955,10 @@ static int tw9910_probe(struct i2c_client *client, ...@@ -955,10 +955,10 @@ static int tw9910_probe(struct i2c_client *client,
} }
icl = to_soc_camera_link(icd); icl = to_soc_camera_link(icd);
if (!icl) if (!icl || !icl->priv)
return -EINVAL; return -EINVAL;
info = container_of(icl, struct tw9910_video_info, link); info = icl->priv;
if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) { if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
dev_err(&client->dev, dev_err(&client->dev,
...@@ -976,7 +976,7 @@ static int tw9910_probe(struct i2c_client *client, ...@@ -976,7 +976,7 @@ static int tw9910_probe(struct i2c_client *client,
v4l2_i2c_subdev_init(&priv->subdev, client, &tw9910_subdev_ops); v4l2_i2c_subdev_init(&priv->subdev, client, &tw9910_subdev_ops);
icd->ops = &tw9910_ops; icd->ops = &tw9910_ops;
icd->iface = info->link.bus_id; icd->iface = icl->bus_id;
ret = tw9910_video_probe(icd, client); ret = tw9910_video_probe(icd, client);
if (ret) { if (ret) {
......
...@@ -55,7 +55,6 @@ struct ov772x_edge_ctrl { ...@@ -55,7 +55,6 @@ struct ov772x_edge_ctrl {
struct ov772x_camera_info { struct ov772x_camera_info {
unsigned long buswidth; unsigned long buswidth;
unsigned long flags; unsigned long flags;
struct soc_camera_link link;
struct ov772x_edge_ctrl edgectrl; struct ov772x_edge_ctrl edgectrl;
}; };
......
...@@ -23,7 +23,6 @@ struct soc_camera_platform_info { ...@@ -23,7 +23,6 @@ struct soc_camera_platform_info {
unsigned long bus_param; unsigned long bus_param;
struct device *dev; struct device *dev;
int (*set_capture)(struct soc_camera_platform_info *info, int enable); int (*set_capture)(struct soc_camera_platform_info *info, int enable);
struct soc_camera_link link;
}; };
#endif /* __SOC_CAMERA_H__ */ #endif /* __SOC_CAMERA_H__ */
...@@ -32,7 +32,6 @@ enum tw9910_mpout_pin { ...@@ -32,7 +32,6 @@ enum tw9910_mpout_pin {
struct tw9910_video_info { struct tw9910_video_info {
unsigned long buswidth; unsigned long buswidth;
enum tw9910_mpout_pin mpout; enum tw9910_mpout_pin mpout;
struct soc_camera_link link;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment