public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* camera: omap24xxcam.c with device model
@ 2005-11-24 18:09 David Cohen
  0 siblings, 0 replies; 2+ messages in thread
From: David Cohen @ 2005-11-24 18:09 UTC (permalink / raw)
  To: Linux-omap-open-source@linux.omap.com

[-- Attachment #1: Type: text/plain, Size: 30 bytes --]

sorry... the patch :)

David


[-- Attachment #2: diff_omap24xxcam_devmodel --]
[-- Type: text/plain, Size: 4602 bytes --]

--- ../linux-ti/linux/drivers/media/video/omap/omap24xxcam.c	2004-11-09 00:01:51.000000000 -0400
+++ drivers/media/video/omap/omap24xxcam.c	2005-11-24 13:52:23.000000000 -0400
@@ -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;

[-- Attachment #3: Type: text/plain, Size: 184 bytes --]

_______________________________________________
Linux-omap-open-source mailing list
Linux-omap-open-source@linux.omap.com
http://linux.omap.com/mailman/listinfo/linux-omap-open-source

^ permalink raw reply	[flat|nested] 2+ messages in thread
* camera: omap24xxcam.c with device model
@ 2005-11-24 18:08 David Cohen
  0 siblings, 0 replies; 2+ messages in thread
From: David Cohen @ 2005-11-24 18:08 UTC (permalink / raw)
  To: Linux-omap-open-source@linux.omap.com

Hi all,

I've made this patch to update omap24xxcam.c to use the linux device
model. :) While this driver is not using the camera_core,  a compilable
and working code for the public tree is welcome.

Regards,

David Cohen

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-11-24 18:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-24 18:09 camera: omap24xxcam.c with device model David Cohen
  -- strict thread matches above, loose matches on Subject: below --
2005-11-24 18:08 David Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox