r4942 - developers/werner/gta03/cam/patches

werner at docs.openmoko.org werner at docs.openmoko.org
Fri Feb 27 13:41:20 CET 2009


Author: werner
Date: 2009-02-27 13:41:19 +0100 (Fri, 27 Feb 2009)
New Revision: 4942

Added:
   developers/werner/gta03/cam/patches/wip.patch
Modified:
   developers/werner/gta03/cam/patches/add-s3c-cam-config.patch
   developers/werner/gta03/cam/patches/add-s3c-camif.patch
   developers/werner/gta03/cam/patches/fix-s3c64xx_setrate_clksrc.patch
   developers/werner/gta03/cam/patches/mach-gta03-add-cam.patch
   developers/werner/gta03/cam/patches/series
Log:
- hacked I2C registration to "work" (driver needs updating for new API)
- frequency is still x10 too high. can tweak this from user space.
- work around minor numbers not being assigned the way the driver expects



Modified: developers/werner/gta03/cam/patches/add-s3c-cam-config.patch
===================================================================
--- developers/werner/gta03/cam/patches/add-s3c-cam-config.patch	2009-02-27 09:06:45 UTC (rev 4941)
+++ developers/werner/gta03/cam/patches/add-s3c-cam-config.patch	2009-02-27 12:41:19 UTC (rev 4942)
@@ -1,7 +1,7 @@
 Index: cam/drivers/media/video/Kconfig
 ===================================================================
---- cam.orig/drivers/media/video/Kconfig	2009-02-26 19:40:37.000000000 +0800
-+++ cam/drivers/media/video/Kconfig	2009-02-26 19:42:02.000000000 +0800
+--- cam.orig/drivers/media/video/Kconfig	2009-02-27 18:34:40.000000000 +0800
++++ cam/drivers/media/video/Kconfig	2009-02-27 18:42:11.000000000 +0800
 @@ -711,6 +711,25 @@
  	  CMOS camera controller.  This is the controller found on first-
  	  generation OLPC systems.
@@ -30,8 +30,8 @@
  	depends on VIDEO_V4L2 && HAS_DMA
 Index: cam/drivers/media/video/Makefile
 ===================================================================
---- cam.orig/drivers/media/video/Makefile	2009-02-26 19:42:41.000000000 +0800
-+++ cam/drivers/media/video/Makefile	2009-02-26 19:43:10.000000000 +0800
+--- cam.orig/drivers/media/video/Makefile	2009-02-27 18:34:40.000000000 +0800
++++ cam/drivers/media/video/Makefile	2009-02-27 18:34:45.000000000 +0800
 @@ -134,6 +134,8 @@
  obj-$(CONFIG_VIDEO_VIVI) += vivi.o
  obj-$(CONFIG_VIDEO_CX23885) += cx23885/

Modified: developers/werner/gta03/cam/patches/add-s3c-camif.patch
===================================================================
--- developers/werner/gta03/cam/patches/add-s3c-camif.patch	2009-02-27 09:06:45 UTC (rev 4941)
+++ developers/werner/gta03/cam/patches/add-s3c-camif.patch	2009-02-27 12:41:19 UTC (rev 4942)
@@ -1,8 +1,8 @@
 Index: cam/drivers/media/video/s3c_camera_driver.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ cam/drivers/media/video/s3c_camera_driver.c	2009-02-27 15:24:15.000000000 +0800
-@@ -0,0 +1,1885 @@
++++ cam/drivers/media/video/s3c_camera_driver.c	2009-02-27 19:07:42.000000000 +0800
+@@ -0,0 +1,1884 @@
 +/* drivers/media/video/s3c_camera_driver.c
 + *
 + * Copyright (c) 2008 Samsung Electronics
@@ -1846,7 +1846,6 @@
 +
 +void s3c_camif_open_sensor(camif_cis_t *cis)
 +{
-+printk("@@@ s3c_camif_open_sensor: cam_clock %p cis %p\n", cam_clock, cis);
 +	clk_set_rate(cam_clock, cis->camclk);
 +	s3c_camif_reset(cis->reset_type, cis->reset_udelay);
 +}
@@ -1891,7 +1890,7 @@
 Index: cam/drivers/media/video/s3c_camif.c
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ cam/drivers/media/video/s3c_camif.c	2009-02-27 15:24:15.000000000 +0800
++++ cam/drivers/media/video/s3c_camif.c	2009-02-27 18:55:24.000000000 +0800
 @@ -0,0 +1,1872 @@
 +/* drivers/media/video/s3c_camif.c
 + *
@@ -3768,7 +3767,7 @@
 Index: cam/drivers/media/video/s3c_camif.h
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ cam/drivers/media/video/s3c_camif.h	2009-02-27 15:24:15.000000000 +0800
++++ cam/drivers/media/video/s3c_camif.h	2009-02-27 18:55:24.000000000 +0800
 @@ -0,0 +1,404 @@
 +/* drivers/media/video/s3c_camif.h
 + *
@@ -4177,7 +4176,7 @@
 Index: cam/drivers/media/video/videodev2_s3c.h
 ===================================================================
 --- /dev/null	1970-01-01 00:00:00.000000000 +0000
-+++ cam/drivers/media/video/videodev2_s3c.h	2009-02-27 15:24:15.000000000 +0800
++++ cam/drivers/media/video/videodev2_s3c.h	2009-02-27 18:55:24.000000000 +0800
 @@ -0,0 +1,210 @@
 +#ifndef __VIDEODEV2_S3C_H_
 +#define __VIDEODEV2_S3C_H_

Modified: developers/werner/gta03/cam/patches/fix-s3c64xx_setrate_clksrc.patch
===================================================================
--- developers/werner/gta03/cam/patches/fix-s3c64xx_setrate_clksrc.patch	2009-02-27 09:06:45 UTC (rev 4941)
+++ developers/werner/gta03/cam/patches/fix-s3c64xx_setrate_clksrc.patch	2009-02-27 12:41:19 UTC (rev 4942)
@@ -1,8 +1,8 @@
 Some of the rate selection logic in s3c64xx_setrate_clksrc uses what
 appears to be parent clock selection logic. This patch corrects it.
 
-I also added a BUG_ON, since an overly large divider can cause
-unrelated clocks to be changed.
+I also added a check for overly large dividers to prevent them
+from changing unrelated clocks.
 
 Signed-off-by: Werner Almesberger <werner at openmoko.org>
 
@@ -10,13 +10,14 @@
 
 Index: cam/arch/arm/plat-s3c64xx/s3c6400-clock.c
 ===================================================================
---- cam.orig/arch/arm/plat-s3c64xx/s3c6400-clock.c	2009-02-27 16:17:15.000000000 +0800
-+++ cam/arch/arm/plat-s3c64xx/s3c6400-clock.c	2009-02-27 16:52:50.000000000 +0800
-@@ -239,10 +239,11 @@
+--- cam.orig/arch/arm/plat-s3c64xx/s3c6400-clock.c	2009-02-27 18:55:24.000000000 +0800
++++ cam/arch/arm/plat-s3c64xx/s3c6400-clock.c	2009-02-27 18:56:07.000000000 +0800
+@@ -239,10 +239,12 @@
  
  	rate = clk_round_rate(clk, rate);
  	div = clk_get_rate(clk->parent) / rate;
-+	BUG_ON(div > 16);
++	if (div > 16)
++		return -EINVAL;
  
  	val = __raw_readl(reg);
 -	val &= ~sclk->mask;

Modified: developers/werner/gta03/cam/patches/mach-gta03-add-cam.patch
===================================================================
--- developers/werner/gta03/cam/patches/mach-gta03-add-cam.patch	2009-02-27 09:06:45 UTC (rev 4941)
+++ developers/werner/gta03/cam/patches/mach-gta03-add-cam.patch	2009-02-27 12:41:19 UTC (rev 4942)
@@ -1,7 +1,7 @@
 Index: cam/arch/arm/mach-s3c6410/mach-om-gta03.c
 ===================================================================
---- cam.orig/arch/arm/mach-s3c6410/mach-om-gta03.c	2009-02-27 14:02:45.000000000 +0800
-+++ cam/arch/arm/mach-s3c6410/mach-om-gta03.c	2009-02-27 14:05:14.000000000 +0800
+--- cam.orig/arch/arm/mach-s3c6410/mach-om-gta03.c	2009-02-27 17:54:12.000000000 +0800
++++ cam/arch/arm/mach-s3c6410/mach-om-gta03.c	2009-02-27 18:20:14.000000000 +0800
 @@ -84,6 +84,8 @@
  #include <plat/regs-usb-hs-otg.h>
  
@@ -11,7 +11,17 @@
  
  /* -------------------------------------------------------------------------------
   * GTA03 FIQ related
-@@ -873,6 +875,7 @@
+@@ -878,6 +880,9 @@
+ 		.irq = GTA03_IRQ_LED,
+ 		.platform_data = &om_gta03_lp5521_pdata,
+ 	},
++	{
++		I2C_BOARD_INFO("s5k4xa", 0x2d),
++	},
+ 
+ };
+ 
+@@ -894,6 +899,7 @@
  	&gta03_device_spi_lcm,
  	&s3c_device_usbgadget,
  	&s3c24xx_pwm_device,
@@ -19,10 +29,21 @@
  };
  
  
+@@ -951,6 +957,10 @@
+ 	pcf50633_reg_write(pcf, PCF50633_REG_LEDENA, 0x01);
+ 	pcf50633_reg_write(pcf, PCF50633_REG_LEDOUT, 0x3f);
+ 
++	/* @@@ do this properly later - WA */
++	pcf50633_reg_write(om_gta03_pcf, 0x30, 0x21);
++	pcf50633_reg_write(om_gta03_pcf, 0x39, 0x13);
++	pcf50633_reg_write(om_gta03_pcf, 0x3a, 0x21);
+ }
+ 
+ static void gta03_l1k002_pwronoff(int level)
 Index: cam/arch/arm/mach-s3c6410/Kconfig
 ===================================================================
---- cam.orig/arch/arm/mach-s3c6410/Kconfig	2009-02-27 14:02:44.000000000 +0800
-+++ cam/arch/arm/mach-s3c6410/Kconfig	2009-02-27 14:02:52.000000000 +0800
+--- cam.orig/arch/arm/mach-s3c6410/Kconfig	2009-02-27 17:54:12.000000000 +0800
++++ cam/arch/arm/mach-s3c6410/Kconfig	2009-02-27 17:54:24.000000000 +0800
 @@ -70,6 +70,7 @@
  	select S3C6410_SETUP_SDHCI
  	select S3C64XX_SETUP_I2C1

Modified: developers/werner/gta03/cam/patches/series
===================================================================
--- developers/werner/gta03/cam/patches/series	2009-02-27 09:06:45 UTC (rev 4941)
+++ developers/werner/gta03/cam/patches/series	2009-02-27 12:41:19 UTC (rev 4942)
@@ -3,7 +3,8 @@
 add-samsung-cams-i2c.patch
 add-s5k4.patch
 add-s3c-cam-platform.patch
-mach-gta03-add-cam.patch
 add-64xx-cam-clock.patch
 add-s3c-camif.patch
+mach-gta03-add-cam.patch
 fix-s3c64xx_setrate_clksrc.patch
+wip.patch

Added: developers/werner/gta03/cam/patches/wip.patch
===================================================================
--- developers/werner/gta03/cam/patches/wip.patch	                        (rev 0)
+++ developers/werner/gta03/cam/patches/wip.patch	2009-02-27 12:41:19 UTC (rev 4942)
@@ -0,0 +1,190 @@
+Index: cam/drivers/i2c/i2c-core.c
+===================================================================
+--- cam.orig/drivers/i2c/i2c-core.c	2009-02-27 20:35:46.000000000 +0800
++++ cam/drivers/i2c/i2c-core.c	2009-02-27 20:35:50.000000000 +0800
+@@ -1139,6 +1139,7 @@
+ {
+ 	int err;
+ 
++printk("*** addr 0x%x kind %d\n", addr, kind);
+ 	/* Make sure the address is valid */
+ 	/*if (addr < 0x03 || addr > 0x77) {
+ 		dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n",
+@@ -1152,9 +1153,11 @@
+ 
+ 	/* Make sure there is something at this address, unless forced */
+ 	if (kind < 0) {
++printk("*** [1]\n");
+ 		if (i2c_smbus_xfer(adapter, addr, 0, 0, 0,
+ 				   I2C_SMBUS_QUICK, NULL) < 0)
+ 			return 0;
++printk("*** [2]\n");
+ 
+ 		/* prevent 24RF08 corruption */
+ 		if ((addr & ~0x0f) == 0x50)
+@@ -1163,7 +1166,9 @@
+ 	}
+ 
+ 	/* Finally call the custom detection function */
++printk("*** [3]\n");
+ 	err = found_proc(adapter, addr, kind);
++printk("*** err = %d\n", err);
+ 	/* -ENODEV can be returned if there is a chip at the given address
+ 	   but it isn't supported by this chip driver. We catch it here as
+ 	   this isn't an error. */
+Index: cam/drivers/media/video/s3c_camera_driver.c
+===================================================================
+--- cam.orig/drivers/media/video/s3c_camera_driver.c	2009-02-27 20:35:50.000000000 +0800
++++ cam/drivers/media/video/s3c_camera_driver.c	2009-02-27 20:35:50.000000000 +0800
+@@ -56,27 +56,21 @@
+ extern camif_cis_t msdma_input;
+ extern int s3c_camif_do_postprocess(camif_cfg_t *cfg);
+ 
++int codec_minor = CODEC_MINOR, preview_minor = PREVIEW_MINOR;
+ /*************************************************************************
+  * Utility part
+  ************************************************************************/
+ camif_cfg_t *s3c_camif_get_fimc_object(int nr)
+ {
+ 	camif_cfg_t *ret = NULL;
+-
+-	switch (nr) {
+-	case CODEC_MINOR:
+-		ret = &s3c_fimc[FIMC_CODEC_INDEX];
+-		break;
+-
+-	case PREVIEW_MINOR:
+-		ret = &s3c_fimc[FIMC_PREVIEW_INDEX];
+-		break;
+-
+-	default:
+-		printk(KERN_ERR "Unknown minor number\n");
+-	}
+-
+-	return ret;
++/* @@@ */
++return &s3c_fimc[FIMC_PREVIEW_INDEX];
++	if (nr == codec_minor)
++		return &s3c_fimc[FIMC_CODEC_INDEX];
++	if (nr == preview_minor)
++		return &s3c_fimc[FIMC_PREVIEW_INDEX];
++	printk(KERN_ERR "Unknown minor number\n");
++	return NULL;
+ }
+ 
+ #if defined(FSM_ON_PREVIEW)
+@@ -1362,7 +1356,12 @@
+ int s3c_camif_open(struct file *file)
+ {
+ 	int err;
++printk("file %p\n", file);
++printk("f_dentry %p\n", file->f_dentry);
++printk("d_inode %p\n", file->f_dentry->d_inode);
++printk("min %d\n", MINOR(file->f_dentry->d_inode->i_rdev));
+ 	camif_cfg_t *cfg = s3c_camif_get_fimc_object(MINOR(file->f_dentry->d_inode->i_rdev));
++printk("cfg %p\n", cfg);
+ 
+ 	if (!cfg->cis) {
+ 		printk(KERN_ERR "An object for a CIS is missing\n");
+@@ -1665,7 +1664,7 @@
+ 	cfg->status = CAMIF_STOPPED;
+ 
+ 	/* To get the handle of CODEC */
+-	cfg->other = s3c_camif_get_fimc_object(CODEC_MINOR);
++	cfg->other = s3c_camif_get_fimc_object(codec_minor);
+ 
+ 	return cfg->status;
+ }
+@@ -1691,7 +1690,7 @@
+ 	cfg->status = CAMIF_STOPPED;
+ 
+ 	/* To get the handle of PREVIEW */
+-	cfg->other = s3c_camif_get_fimc_object(PREVIEW_MINOR);
++	cfg->other = s3c_camif_get_fimc_object(preview_minor);
+ 
+ 	return cfg->status;
+ }
+@@ -1703,8 +1702,8 @@
+ 	int ret = 0;
+ 
+ 	/* Initialize fimc objects */
+-	codec = s3c_camif_get_fimc_object(CODEC_MINOR);
+-	preview = s3c_camif_get_fimc_object(PREVIEW_MINOR);
++	codec = s3c_camif_get_fimc_object(codec_minor);
++	preview = s3c_camif_get_fimc_object(preview_minor);
+ 
+ 	memset(codec, 0, sizeof(camif_cfg_t));
+ 	memset(preview, 0, sizeof(camif_cfg_t));
+@@ -1766,6 +1765,8 @@
+ 		printk(KERN_ERR "Couldn't register this preview driver\n");
+ 		return -1;
+ 	}
++codec_minor = codec->v->minor;
++preview_minor = preview->v->minor;
+ 
+ #if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)
+ 	cam_clock = clk_get(&pdev->dev, "camera");
+@@ -1793,8 +1794,8 @@
+ {
+ 	camif_cfg_t *codec, *preview;
+ 
+-	codec = s3c_camif_get_fimc_object(CODEC_MINOR);
+-	preview = s3c_camif_get_fimc_object(PREVIEW_MINOR);
++	codec = s3c_camif_get_fimc_object(codec_minor);
++	preview = s3c_camif_get_fimc_object(preview_minor);
+ 
+ 	s3c_camif_release_irq(codec);
+ 	s3c_camif_release_irq(preview);
+@@ -1850,8 +1851,8 @@
+ 	camif_cfg_t *codec, *preview;
+ 	camif_cis_t *cis = i2c_get_clientdata(ptr);
+ 
+-	codec = s3c_camif_get_fimc_object(CODEC_MINOR);
+-	preview = s3c_camif_get_fimc_object(PREVIEW_MINOR);
++	codec = s3c_camif_get_fimc_object(codec_minor);
++	preview = s3c_camif_get_fimc_object(preview_minor);
+ 
+ 	codec->cis = preview->cis = cis;
+ 
+Index: cam/drivers/media/video/samsung/4xa_sensor.c
+===================================================================
+--- cam.orig/drivers/media/video/samsung/4xa_sensor.c	2009-02-27 20:35:50.000000000 +0800
++++ cam/drivers/media/video/samsung/4xa_sensor.c	2009-02-27 20:38:55.000000000 +0800
+@@ -104,7 +104,7 @@
+ static unsigned short normal_addr[] = { (CAM_ID >> 1), I2C_CLIENT_END };
+ static const unsigned short *forces[] = { NULL };
+ 
+-static struct i2c_client_address_data addr_data = {
++static struct i2c_client_address_data exitaddr_data = {
+       .normal_i2c	= normal_addr,
+       .probe		= ignore,
+       .ignore		= ignore,
+@@ -164,6 +164,7 @@
+ {
+ 	struct i2c_client *c;
+ 
++printk("*** s5k4xa_attach\n");
+ 	c = kmalloc(sizeof(*c), GFP_KERNEL);
+ 	if (!c)
+ 		return -ENOMEM;
+@@ -184,8 +185,11 @@
+ 
+ static int sensor_attach_adapter(struct i2c_adapter *adap)
+ {
++printk("*** sensor_attach_adapter\n");
+ 	s3c_camif_open_sensor(&data);
+-	return i2c_probe(adap, &addr_data, s5k4xa_attach);
++/* I2C core thinks it's already there. weird. */
++return s5k4xa_attach(adap, 0x2d, -1);
++//	return i2c_probe(adap, &addr_data, s5k4xa_attach);
+ }
+ 
+ static int sensor_detach(struct i2c_client *client)
+@@ -328,6 +332,7 @@
+ 
+ static __init int camif_sensor_init(void)
+ {
++printk("*** camif_sensor_init\n");
+ 	return i2c_add_driver(&sensor_driver);
+ }
+ 




More information about the commitlog mailing list