camera: omap24xxcam.c with device model
sorry... the patch :)
David
media/video/omap/omap24xxcam.c renamed from linux-ti/linux/drivers/media/video/omap/omap24xxcam.c +84 -54
@@ -37,6 +37,8 @@#include <linux/dma-mapping.h> #include <linux/device.h> #include <linux/input.h> +#include <linux/version.h> +#include <linux/platform_device.h> #include <asm/io.h> #include <asm/byteorder.h>
@@ -44,7 +46,6 @@#include <asm/irq.h> #include <asm/semaphore.h> #include <asm/processor.h> -#include <asm/arch/bus.h> #include "omap24xxcam.h"
@@ -57,6 +58,10 @@/* configuration macros */ #define CAM_NAME "omap24xxcam"#define CONFIG_H4 + +/* Should be moved from here */ +#define INT_CAM_MPU_IRQ 24 +extern struct camera_sensor camera_sensor_if;void omap24xxcam_cleanup (void );
@@ -2689,9 +2694,9 @@ };/* -------------------------------------------------------------------------- */ -static int omap24xxcam_suspend (struct omap_dev *dev,u32 state) +static int omap24xxcam_suspend (struct device *dev,u32 state) { -struct omap24xxcam_device *cam =omap_get_drvdata (dev); +struct omap24xxcam_device *cam =dev_get_drvdata (dev);/* disable previewing */ spin_lock (&cam->img_lock);
@@ -2721,9 +2726,9 @@return 0 ; } -static int omap24xxcam_resume (struct omap_dev *dev) +static int omap24xxcam_resume (struct device *dev) { -struct omap24xxcam_device *cam =omap_get_drvdata (dev); +struct omap24xxcam_device *cam =dev_get_drvdata (dev);/* power up the sensor */ cam->cam_sensor->power_on (cam->sensor);
@@ -2747,55 +2752,10 @@return 0 ; } -static int omap24xxcam_probe (struct omap_dev *dev) -{ -return 0 ; -} - -static void -omap_24xxcam_release (struct device *dev) -{ -} -static struct omap_dev omap24xxcam_dev = { - .name =CAM_NAME , - .devid = OMAP24xx_CAM_DEVID, - .dev = { - .release = omap_24xxcam_release, - }, - .busid =OMAP_BUS_L3 , - .irq = { -INT_CAM_MPU_IRQ , - }, - -}; - -static struct omap_driver omap24xxcam_driver = { - .drv = { - .name =CAM_NAME , - }, - .devid = OMAP24xx_CAM_DEVID, - .busid =OMAP_BUS_L3 , - .clocks =0 , - .probe = omap24xxcam_probe, - .suspend = omap24xxcam_suspend, - .resume = omap24xxcam_resume, -}; - -int __init -omap24xxcam_init (void ) +static int omap24xxcam_probe (struct device *dev) {struct omap24xxcam_device *cam;struct video_device *vfd; -int ret; - - ret =omap_driver_register (&omap24xxcam_driver); -if (ret !=0 ) -return ret; - ret =omap_device_register (&omap24xxcam_dev); -if ( ret !=0 ) { -omap_driver_unregister (&omap24xxcam_driver); -return ret; - } cam =kmalloc (sizeof (struct omap24xxcam_device ),GFP_KERNEL );if (!cam) {
@@ -2990,7 +2950,7 @@ goto init_error; }/* set driver specific data to use in power management functions */ -omap_set_drvdata (&omap24xxcam_dev, cam); +dev_set_drvdata (dev, cam); printk(KERN_INFO CAM_NAME ": registered device video%d [v4l2]\n", vfd->minor);
@@ -3021,6 +2981,76 @@return -ENODEV ; } +static void +omap_24xxcam_release (struct device *dev) +{ +} + +#if 0 +static struct omap_dev omap24xxcam_dev = { + .name =CAM_NAME , + .devid = OMAP24xx_CAM_DEVID, + .dev = { + .release = omap_24xxcam_release, + }, + .busid =OMAP_BUS_L3 , + .irq = { +INT_CAM_MPU_IRQ , + }, + +}; + +static struct omap_driver omap24xxcam_driver = { + .drv = { + .name =CAM_NAME , + }, + .devid = OMAP24xx_CAM_DEVID, + .busid =OMAP_BUS_L3 , + .clocks =0 , + .probe = omap24xxcam_probe, + .suspend = omap24xxcam_suspend, + .resume = omap24xxcam_resume, +}; +#endif + +static struct device_driver omap24xxcam_driver = { + .name =CAM_NAME , + .bus = &platform_bus_type, + .probe = omap24xxcam_probe, + .remove = omap24xxcam_release, +#ifdef CONFIG_PM + .suspend = omap24xxcam_suspend, + .resume = omap24xxcam_resume, +#endif + .shutdown =NULL , +}; + +static struct platform_device omap24xxcam_dev = { + .name =CAM_NAME , + .dev = + { + .release =NULL , + }, + .id =0 , +}; + +int __init +omap24xxcam_init (void ) +{ +int ret; + + ret =driver_register (&omap24xxcam_driver); +if (ret !=0 ) +return ret; + ret =platform_device_register (&omap24xxcam_dev); +if ( ret !=0 ) { +driver_unregister (&omap24xxcam_driver); +return ret; + } + +return 0 ; +} +void omap24xxcam_cleanup (void ) {
@@ -3086,8 +3116,8 @@ cam->cam_mmio_base_phys =0 ; } -omap_device_unregister (&omap24xxcam_dev); -omap_driver_unregister (&omap24xxcam_driver); +platform_device_unregister (&omap24xxcam_dev); +driver_unregister (&omap24xxcam_driver);kfree (cam); saved_cam =NULL ;
_______________________________________________
Linux-omap-open-source mailing list
[email protected]
http://linux.omap.com/mailman/listinfo/linux-omap-open-source