The patch number 11706 was added via Mauro Carvalho Chehab <[email protected]>
to http://linuxtv.org/hg/v4l-dvb master development tree.
Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel
If anyone has any objections, please let us know by sending a message to:
Linux Media Mailing List <[email protected]>
------
From: Mauro Carvalho Chehab <[email protected]>
merge: http://linuxtv.org/hg/~gliakhovetski/v4l-dvb
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---
linux/drivers/media/video/soc_camera.c | 77 ++++++++++++++++++++++---
linux/include/media/soc_camera.h | 5 +
2 files changed, 74 insertions(+), 8 deletions(-)
diff -r f459f515b1b6 -r 9e27a1001246 linux/drivers/media/video/soc_camera.c
--- a/linux/drivers/media/video/soc_camera.c Sat May 09 05:45:44 2009 -0300
+++ b/linux/drivers/media/video/soc_camera.c Sat May 09 05:48:08 2009 -0300
@@ -16,19 +16,21 @@
* published by the Free Software Foundation.
*/
+#include <linux/device.h>
+#include <linux/err.h>
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/list.h>
#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/device.h>
-#include <linux/list.h>
-#include <linux/err.h>
#include <linux/mutex.h>
+#include <linux/platform_device.h>
#include <linux/vmalloc.h>
+#include <media/soc_camera.h>
#include <media/v4l2-common.h>
+#include <media/v4l2-dev.h>
#include <media/v4l2-ioctl.h>
-#include <media/v4l2-dev.h>
#include <media/videobuf-core.h>
-#include <media/soc_camera.h>
#include "compat.h"
/* Default to VGA resolution */
@@ -1160,6 +1162,57 @@ void soc_camera_video_stop(struct soc_ca
}
EXPORT_SYMBOL(soc_camera_video_stop);
+static int __devinit soc_camera_pdrv_probe(struct platform_device *pdev)
+{
+ struct soc_camera_link *icl = pdev->dev.platform_data;
+ struct i2c_adapter *adap;
+ struct i2c_client *client;
+
+ if (!icl)
+ return -EINVAL;
+
+ adap = i2c_get_adapter(icl->i2c_adapter_id);
+ if (!adap) {
+ dev_warn(&pdev->dev, "Cannot get adapter #%d. No driver?\n",
+ icl->i2c_adapter_id);
+ /* -ENODEV and -ENXIO do not produce an error on probe()... */
+ return -ENOENT;
+ }
+
+ icl->board_info->platform_data = icl;
+ client = i2c_new_device(adap, icl->board_info);
+ if (!client) {
+ i2c_put_adapter(adap);
+ return -ENOMEM;
+ }
+
+ platform_set_drvdata(pdev, client);
+
+ return 0;
+}
+
+static int __devexit soc_camera_pdrv_remove(struct platform_device *pdev)
+{
+ struct i2c_client *client = platform_get_drvdata(pdev);
+
+ if (!client)
+ return -ENODEV;
+
+ i2c_unregister_device(client);
+ i2c_put_adapter(client->adapter);
+
+ return 0;
+}
+
+static struct platform_driver soc_camera_pdrv = {
+ .probe = soc_camera_pdrv_probe,
+ .remove = __exit_p(soc_camera_pdrv_remove),
+ .driver = {
+ .name = "soc-camera-pdrv",
+ .owner = THIS_MODULE,
+ },
+};
+
static int __init soc_camera_init(void)
{
int ret = bus_register(&soc_camera_bus_type);
@@ -1169,8 +1222,14 @@ static int __init soc_camera_init(void)
if (ret)
goto edrvr;
- return 0;
-
+ ret = platform_driver_register(&soc_camera_pdrv);
+ if (ret)
+ goto epdr;
+
+ return 0;
+
+epdr:
+ driver_unregister(&ic_drv);
edrvr:
bus_unregister(&soc_camera_bus_type);
return ret;
@@ -1178,6 +1237,7 @@ edrvr:
static void __exit soc_camera_exit(void)
{
+ platform_driver_unregister(&soc_camera_pdrv);
driver_unregister(&ic_drv);
bus_unregister(&soc_camera_bus_type);
}
@@ -1188,3 +1248,4 @@ MODULE_DESCRIPTION("Image capture bus dr
MODULE_DESCRIPTION("Image capture bus driver");
MODULE_AUTHOR("Guennadi Liakhovetski <[email protected]>");
MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:soc-camera-pdrv");
diff -r f459f515b1b6 -r 9e27a1001246 linux/include/media/soc_camera.h
--- a/linux/include/media/soc_camera.h Sat May 09 05:45:44 2009 -0300
+++ b/linux/include/media/soc_camera.h Sat May 09 05:48:08 2009 -0300
@@ -92,11 +92,16 @@ struct soc_camera_host_ops {
#define SOCAM_SENSOR_INVERT_VSYNC (1 << 3)
#define SOCAM_SENSOR_INVERT_DATA (1 << 4)
+struct i2c_board_info;
+
struct soc_camera_link {
/* Camera bus id, used to match a camera and a bus */
int bus_id;
/* Per camera SOCAM_SENSOR_* bus flags */
unsigned long flags;
+ int i2c_adapter_id;
+ struct i2c_board_info *board_info;
+ const char *module_name;
/* Optional callbacks to power on or off and reset the sensor */
int (*power)(struct device *, int);
int (*reset)(struct device *);
---
Patch is available at:
http://linuxtv.org/hg/v4l-dvb/rev/9e27a1001246d6174d98a7c35090893a9bf34bc8
_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits