diff options
75 files changed, 10623 insertions, 44 deletions
diff --git a/conf/machine/include/omap3.inc b/conf/machine/include/omap3.inc index 943e1ef70e..98cb4acd3a 100644 --- a/conf/machine/include/omap3.inc +++ b/conf/machine/include/omap3.inc @@ -3,7 +3,7 @@ SOC_FAMILY = "omap3" require conf/machine/include/tune-cortexa8.inc PREFERRED_PROVIDER_virtual/kernel = "linux-omap" # Increase this everytime you change something in the kernel -MACHINE_KERNEL_PR = "r81" +MACHINE_KERNEL_PR = "r82" KERNEL_IMAGETYPE = "uImage" diff --git a/recipes/linux/linux-omap-psp-2.6.32/beagleboard/configs/cpuidle b/recipes/linux/linux-omap-psp-2.6.32/beagleboard/configs/cpuidle index 8b44e79c59..678585c870 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/beagleboard/configs/cpuidle +++ b/recipes/linux/linux-omap-psp-2.6.32/beagleboard/configs/cpuidle @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.32 -# Mon Jun 7 09:45:30 2010 +# Sun Jul 18 00:26:08 2010 # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -382,8 +382,8 @@ CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_STAT_DETAILS=y # CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set -CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set +# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y # CONFIG_CPU_FREQ_DEFAULT_GOV_CONSERVATIVE is not set CONFIG_CPU_FREQ_GOV_PERFORMANCE=y CONFIG_CPU_FREQ_GOV_POWERSAVE=y @@ -1736,9 +1736,10 @@ CONFIG_VIDEO_WM8775=m # CONFIG_VIDEO_KS0127 is not set # CONFIG_VIDEO_OV7670 is not set CONFIG_VIDEO_MT9V011=m +CONFIG_VIDEO_MT9V113=m # CONFIG_VIDEO_TCM825X is not set CONFIG_VIDEO_MT9P012=m -# CONFIG_VIDEO_MT9T111 is not set +CONFIG_VIDEO_MT9T112=m # CONFIG_VIDEO_DW9710 is not set # CONFIG_VIDEO_OV3640 is not set # CONFIG_VIDEO_IMX046 is not set @@ -2510,6 +2511,7 @@ CONFIG_ECHO=m CONFIG_OTUS=m # CONFIG_COMEDI is not set # CONFIG_ASUS_OLED is not set +CONFIG_RTL8192SU=m # CONFIG_INPUT_MIMIO is not set # CONFIG_TRANZPORT is not set diff --git a/recipes/linux/linux-omap-psp-2.6.32/beagleboard/defconfig b/recipes/linux/linux-omap-psp-2.6.32/beagleboard/defconfig index 0841f486d0..92237f2fda 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/beagleboard/defconfig +++ b/recipes/linux/linux-omap-psp-2.6.32/beagleboard/defconfig @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.32 -# Tue Apr 6 12:00:09 2010 +# Wed Jul 21 12:01:38 2010 # CONFIG_ARM=y CONFIG_SYS_SUPPORTS_APM_EMULATION=y @@ -267,8 +267,7 @@ CONFIG_OMAP_PACKAGE_CBB=y CONFIG_MACH_OMAP3_BEAGLE=y # CONFIG_MACH_OMAP_LDP is not set # CONFIG_MACH_OVERO is not set -CONFIG_MACH_OMAP3EVM=n -CONFIG_PMIC_TWL4030=y +# CONFIG_MACH_OMAP3EVM is not set # CONFIG_MACH_OMAP3517EVM is not set # CONFIG_MACH_OMAP3_PANDORA is not set # CONFIG_MACH_OMAP3_TOUCHBOOK is not set @@ -311,7 +310,7 @@ CONFIG_HAS_TLS_REG=y CONFIG_ARM_L1_CACHE_SHIFT=6 CONFIG_USER_L2_PLE=y CONFIG_USER_PMON=y -# CONFIG_ARM_ERRATA_430973 is not set +CONFIG_ARM_ERRATA_430973=y # CONFIG_ARM_ERRATA_458693 is not set # CONFIG_ARM_ERRATA_460075 is not set CONFIG_COMMON_CLKDEV=y @@ -381,7 +380,7 @@ CONFIG_CPU_FREQ_TABLE=y CONFIG_CPU_FREQ_DEBUG=y CONFIG_CPU_FREQ_STAT=y CONFIG_CPU_FREQ_STAT_DETAILS=y -# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE +# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set # CONFIG_CPU_FREQ_DEFAULT_GOV_POWERSAVE is not set CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y # CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND is not set @@ -1250,7 +1249,7 @@ CONFIG_USB_RTL8150=y CONFIG_USB_USBNET=y CONFIG_USB_NET_AX8817X=y CONFIG_USB_NET_CDCETHER=y -CONFIG_USB_NET_CDC_EEM=n +# CONFIG_USB_NET_CDC_EEM is not set CONFIG_USB_NET_DM9601=y CONFIG_USB_NET_SMSC95XX=y CONFIG_USB_NET_GL620A=y @@ -1735,9 +1734,10 @@ CONFIG_VIDEO_WM8775=m # CONFIG_VIDEO_KS0127 is not set # CONFIG_VIDEO_OV7670 is not set CONFIG_VIDEO_MT9V011=m +CONFIG_VIDEO_MT9V113=m # CONFIG_VIDEO_TCM825X is not set CONFIG_VIDEO_MT9P012=m -# CONFIG_VIDEO_MT9T111 is not set +CONFIG_VIDEO_MT9T112=m # CONFIG_VIDEO_DW9710 is not set # CONFIG_VIDEO_OV3640 is not set # CONFIG_VIDEO_IMX046 is not set @@ -2090,7 +2090,6 @@ CONFIG_SND_USB_CAIAQ_INPUT=y CONFIG_SND_SOC=y CONFIG_SND_OMAP_SOC=y CONFIG_SND_OMAP_SOC_MCBSP=y -# CONFIG_SND_OMAP_SOC_OMAP3EVM is not set CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE=y CONFIG_SND_SOC_I2C_AND_SPI=y # CONFIG_SND_SOC_ALL_CODECS is not set @@ -2510,6 +2509,7 @@ CONFIG_ECHO=m CONFIG_OTUS=m # CONFIG_COMEDI is not set # CONFIG_ASUS_OLED is not set +CONFIG_RTL8192SU=m # CONFIG_INPUT_MIMIO is not set # CONFIG_TRANZPORT is not set diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0001-mt9t111-first-stab-at-merging-sensor-driver-based-on.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0001-mt9t111-first-stab-at-merging-sensor-driver-based-on.patch index 00dc101add..75d781a75a 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0001-mt9t111-first-stab-at-merging-sensor-driver-based-on.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0001-mt9t111-first-stab-at-merging-sensor-driver-based-on.patch @@ -1,7 +1,7 @@ From 4a505672e75774854a02bf5c2a6c17f0789b1c93 Mon Sep 17 00:00:00 2001 From: OpenEmbedded User <oe@OE-builder.(none)> Date: Tue, 9 Feb 2010 17:16:13 +0100 -Subject: [PATCH 01/28] mt9t111: first stab at merging sensor driver based on a patch by Leopard Imaging +Subject: [PATCH 01/71] mt9t111: first stab at merging sensor driver based on a patch by Leopard Imaging --- drivers/media/video/Kconfig | 8 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0002-mt9t111-Fix-all-checkpatch-errors.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0002-mt9t111-Fix-all-checkpatch-errors.patch index f9b1ecff6f..49185d7dd3 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0002-mt9t111-Fix-all-checkpatch-errors.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0002-mt9t111-Fix-all-checkpatch-errors.patch @@ -1,7 +1,7 @@ From 5b1011bc9c2172027f3c84fa56b9f0e090e85193 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 11 Jun 2010 13:51:49 -0500 -Subject: [PATCH 02/28] mt9t111: Fix all checkpatch errors +Subject: [PATCH 02/71] mt9t111: Fix all checkpatch errors The code was plagued with checkpatch errors. Fix them! diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0003-mt9t111-Pass-v4l2_int_device-data.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0003-mt9t111-Pass-v4l2_int_device-data.patch index bf3d9c84a7..d95c3c2f7c 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0003-mt9t111-Pass-v4l2_int_device-data.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0003-mt9t111-Pass-v4l2_int_device-data.patch @@ -1,7 +1,7 @@ From e8188ea4c58ddf1b7006703b9caca3554fec68d7 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 11 Jun 2010 16:17:56 -0500 -Subject: [PATCH 03/28] mt9t111: Pass v4l2_int_device data +Subject: [PATCH 03/71] mt9t111: Pass v4l2_int_device data Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0004-omap3beagle-Add-camera-support.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0004-omap3beagle-Add-camera-support.patch index a4fd1ecb79..f64479ce66 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0004-omap3beagle-Add-camera-support.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0004-omap3beagle-Add-camera-support.patch @@ -1,7 +1,7 @@ From 06ff02b8346c0ed77fabba84a1b984f53bfaecb6 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 11 Jun 2010 16:15:58 -0500 -Subject: [PATCH 04/28] omap3beagle: Add camera support +Subject: [PATCH 04/71] omap3beagle: Add camera support This is tested with the xM + Leopard imaging module camera, which has a MT9T111. diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0005-TEMP-omap3beagle-camera-Add-defconfig.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0005-TEMP-omap3beagle-camera-Add-defconfig.patch index d30a21a0b8..aa255ba3a5 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0005-TEMP-omap3beagle-camera-Add-defconfig.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0005-TEMP-omap3beagle-camera-Add-defconfig.patch @@ -1,7 +1,7 @@ From e09768af6603baf2c692567f8651576152f021fe Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 11 Jun 2010 16:18:30 -0500 -Subject: [PATCH 05/28] TEMP: omap3beagle: camera: Add defconfig +Subject: [PATCH 05/71] TEMP: omap3beagle: camera: Add defconfig Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0006-omap3beagle-camera-Add-support-for-regulators.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0006-omap3beagle-camera-Add-support-for-regulators.patch index 11e03e2ced..673a3ce03a 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0006-omap3beagle-camera-Add-support-for-regulators.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0006-omap3beagle-camera-Add-support-for-regulators.patch @@ -1,7 +1,7 @@ From f99548efe1161c4f5418dcacb598b1c9637ca7d5 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 11 Jun 2010 16:50:39 -0500 -Subject: [PATCH 06/28] omap3beagle: camera: Add support for regulators +Subject: [PATCH 06/71] omap3beagle: camera: Add support for regulators Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0007-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0007-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch index c479f30e47..0d6da92632 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0007-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0007-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch @@ -1,7 +1,7 @@ From 7d5f49845f06feadb9bc97d458d1ce03814ff5f4 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 11 Jun 2010 16:52:25 -0500 -Subject: [PATCH 07/28] TEMP: omap3beagle: cam: Enable OMAP_MUX +Subject: [PATCH 07/71] TEMP: omap3beagle: cam: Enable OMAP_MUX Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0008-omap3beagle-camera-Fix-null-pointer-dereference.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0008-omap3beagle-camera-Fix-null-pointer-dereference.patch index 0c01030d0b..121d6ebe96 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0008-omap3beagle-camera-Fix-null-pointer-dereference.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0008-omap3beagle-camera-Fix-null-pointer-dereference.patch @@ -1,7 +1,7 @@ From 74fef5ae63ecf623ea3accdff05b092699437b11 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 11 Jun 2010 17:53:50 -0500 -Subject: [PATCH 08/28] omap3beagle: camera: Fix null pointer dereference +Subject: [PATCH 08/71] omap3beagle: camera: Fix null pointer dereference Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0009-Revert-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0009-Revert-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch index d8f4d080b3..62c49f1660 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0009-Revert-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0009-Revert-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch @@ -1,7 +1,7 @@ From 6d9afea5e436a57e66efd2784aa299e1baf3fe3a Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Wed, 16 Jun 2010 03:23:57 +0300 -Subject: [PATCH 09/28] Revert "TEMP: omap3beagle: cam: Enable OMAP_MUX" +Subject: [PATCH 09/71] Revert "TEMP: omap3beagle: cam: Enable OMAP_MUX" This reverts commit 7d5f49845f06feadb9bc97d458d1ce03814ff5f4. diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0010-omap3beagle-camera-Change-arch-late_initcall.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0010-omap3beagle-camera-Change-arch-late_initcall.patch index 12b25a04c8..da9fb7ee94 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0010-omap3beagle-camera-Change-arch-late_initcall.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0010-omap3beagle-camera-Change-arch-late_initcall.patch @@ -1,7 +1,7 @@ From 9ff295528695c3a1b0a369e989f556db02ddf6b9 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Wed, 16 Jun 2010 04:28:06 +0300 -Subject: [PATCH 10/28] omap3beagle: camera: Change arch -> late_initcall +Subject: [PATCH 10/71] omap3beagle: camera: Change arch -> late_initcall This is for ensuring that the regulators are initialized already. diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0011-omap3beagle-camera-Move-i2c-registration-to-the-main.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0011-omap3beagle-camera-Move-i2c-registration-to-the-main.patch index 3f83ed8e29..beb3b6e6f2 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0011-omap3beagle-camera-Move-i2c-registration-to-the-main.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0011-omap3beagle-camera-Move-i2c-registration-to-the-main.patch @@ -1,7 +1,7 @@ From 4855949888a0ad8aca69c1ca3eefc7fbc8dad6f9 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Wed, 16 Jun 2010 04:58:46 +0300 -Subject: [PATCH 11/28] omap3beagle: camera: Move i2c registration to the main board +Subject: [PATCH 11/71] omap3beagle: camera: Move i2c registration to the main board This is because the board-omap3beagle-camera.c file now is late_initcall, and the i2c bus registration needed to be before diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0012-ARM-OMAP3-make-camera-code-build-if-MT9T111-is-built.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0012-ARM-OMAP3-make-camera-code-build-if-MT9T111-is-built.patch index 8b7e2cf2bd..1adace2e05 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0012-ARM-OMAP3-make-camera-code-build-if-MT9T111-is-built.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0012-ARM-OMAP3-make-camera-code-build-if-MT9T111-is-built.patch @@ -1,7 +1,7 @@ From e37a8b39623910576c5784ccc10229fabe51b4c3 Mon Sep 17 00:00:00 2001 From: Koen Kooi <koen@dominion.thruhere.net> Date: Wed, 16 Jun 2010 09:45:46 +0200 -Subject: [PATCH 12/28] ARM: OMAP3: make camera code build if MT9T111 is built as module or disabled +Subject: [PATCH 12/71] ARM: OMAP3: make camera code build if MT9T111 is built as module or disabled --- arch/arm/mach-omap2/board-omap3beagle.c | 4 +++- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0013-DEBUG-omap3beagle-camera-Force-mode0-in-cam_xclka.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0013-DEBUG-omap3beagle-camera-Force-mode0-in-cam_xclka.patch index c697de3c5c..7cd9bfa7ef 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0013-DEBUG-omap3beagle-camera-Force-mode0-in-cam_xclka.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0013-DEBUG-omap3beagle-camera-Force-mode0-in-cam_xclka.patch @@ -1,7 +1,7 @@ From cc677d0cce4b39b7091e1e8c5675e98518968d3e Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Wed, 23 Jun 2010 15:03:24 -0500 -Subject: [PATCH 13/28] DEBUG: omap3beagle: camera: Force mode0 in cam_xclka +Subject: [PATCH 13/71] DEBUG: omap3beagle: camera: Force mode0 in cam_xclka Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0014-OMAP3-CLOCK-Add-capability-to-change-rate-of-dpll4_m.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0014-OMAP3-CLOCK-Add-capability-to-change-rate-of-dpll4_m.patch index 3cfeea6c0f..d7457ef070 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0014-OMAP3-CLOCK-Add-capability-to-change-rate-of-dpll4_m.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0014-OMAP3-CLOCK-Add-capability-to-change-rate-of-dpll4_m.patch @@ -1,7 +1,7 @@ From 62155e17564a986215d61697c6b8a20cc0b4e07f Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Thu, 4 Feb 2010 18:12:37 -0600 -Subject: [PATCH 14/28] OMAP3: CLOCK: Add capability to change rate of dpll4_m5_ck_3630 +Subject: [PATCH 14/71] OMAP3: CLOCK: Add capability to change rate of dpll4_m5_ck_3630 Add necessary clk_sel definitions to clock framework to allow changing dpll4_m5_ck_3630 rate. diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0015-Revert-DEBUG-omap3beagle-camera-Force-mode0-in-cam_x.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0015-Revert-DEBUG-omap3beagle-camera-Force-mode0-in-cam_x.patch index 76903bddcb..79d0696dfb 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0015-Revert-DEBUG-omap3beagle-camera-Force-mode0-in-cam_x.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0015-Revert-DEBUG-omap3beagle-camera-Force-mode0-in-cam_x.patch @@ -1,7 +1,7 @@ From 2cda8f55cb01496f88ba9ad15a276f84eaa02870 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Thu, 24 Jun 2010 14:27:39 -0500 -Subject: [PATCH 15/28] Revert "DEBUG: omap3beagle: camera: Force mode0 in cam_xclka" +Subject: [PATCH 15/71] Revert "DEBUG: omap3beagle: camera: Force mode0 in cam_xclka" This reverts commit 158e14b3d449dde2c6aa9f8cddb86fbbee2d2cd7. --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0016-omap3beagle-camera-Fix-wrong-XCLKA-selection.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0016-omap3beagle-camera-Fix-wrong-XCLKA-selection.patch index 4b7990ef5b..e4b756f533 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0016-omap3beagle-camera-Fix-wrong-XCLKA-selection.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0016-omap3beagle-camera-Fix-wrong-XCLKA-selection.patch @@ -1,7 +1,7 @@ From 6add1bee85d7cbe5c89650b1325ee345aba904cd Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Thu, 24 Jun 2010 17:31:49 -0500 -Subject: [PATCH 16/28] omap3beagle: camera: Fix wrong XCLKA selection +Subject: [PATCH 16/71] omap3beagle: camera: Fix wrong XCLKA selection The CAM_USE_XCLKA should have been 0 instead of 1. diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0017-omap3isp-set-CAM_MCLK-to-172.8-MHz-allows-exact-9.6-.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0017-omap3isp-set-CAM_MCLK-to-172.8-MHz-allows-exact-9.6-.patch index 6975aae2bc..77e5c1515d 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0017-omap3isp-set-CAM_MCLK-to-172.8-MHz-allows-exact-9.6-.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0017-omap3isp-set-CAM_MCLK-to-172.8-MHz-allows-exact-9.6-.patch @@ -1,7 +1,7 @@ From da7a0c9d99ac42332cab5fcc961006a56531e1c4 Mon Sep 17 00:00:00 2001 From: Tuukka Toivonen <tuukka.o.toivonen@nokia.com> Date: Thu, 2 Jul 2009 16:17:55 +0200 -Subject: [PATCH 17/28] omap3isp: set CAM_MCLK to 172.8 MHz, allows exact 9.6 MHz for camera xclka/b +Subject: [PATCH 17/71] omap3isp: set CAM_MCLK to 172.8 MHz, allows exact 9.6 MHz for camera xclka/b Camera cam_xclka and cam_xclkb clocks are generated by dividing CAM_MCLK with an integer. We want to use 9.6 MHz for cameras, diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch index 95b3fcdd64..ffd3320976 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch @@ -1,7 +1,7 @@ From fc51d55718e20246c18c45c9e5545a0ef31d8b05 Mon Sep 17 00:00:00 2001 From: Penda, Naveen <pnaveen@ti.com> Date: Thu, 22 Oct 2009 06:07:01 +0530 -Subject: [PATCH 18/28] Fix: Moved MCLK setting to the board file +Subject: [PATCH 18/71] Fix: Moved MCLK setting to the board file This patch provides the flexibility to set the MCLK frequency from the board file diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0019-omap3isp-core-Do-smarter-MCLK-setting.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0019-omap3isp-core-Do-smarter-MCLK-setting.patch index 769ad6a5d7..dbd5dd6a3e 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0019-omap3isp-core-Do-smarter-MCLK-setting.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0019-omap3isp-core-Do-smarter-MCLK-setting.patch @@ -1,7 +1,7 @@ From 4f010e99c75490daf2f89cf5aed95ea5cd1f3fad Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Wed, 25 Nov 2009 12:30:46 -0600 -Subject: [PATCH 19/28] omap3isp: core: Do smarter MCLK setting +Subject: [PATCH 19/71] omap3isp: core: Do smarter MCLK setting Since the ratio between MCLK and DPLL4_M5 could not be 1:1 (i.e. on 3430 its 2:1), it's necessary to check ratio diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0020-omap3beagle-camera-set-mclk-for-mt9t111.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0020-omap3beagle-camera-set-mclk-for-mt9t111.patch index 6420443fb0..a87563edd1 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0020-omap3beagle-camera-set-mclk-for-mt9t111.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0020-omap3beagle-camera-set-mclk-for-mt9t111.patch @@ -1,7 +1,7 @@ From 140f36e6a0a01ccef5a13ff2a1a466bd38fa3b2d Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Thu, 24 Jun 2010 16:34:13 -0500 -Subject: [PATCH 20/28] omap3beagle: camera: set mclk for mt9t111 +Subject: [PATCH 20/71] omap3beagle: camera: set mclk for mt9t111 Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0021-mt9t111-Fix-max-supported-xclk.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0021-mt9t111-Fix-max-supported-xclk.patch index e63f5d9073..41b1c49b1b 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0021-mt9t111-Fix-max-supported-xclk.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0021-mt9t111-Fix-max-supported-xclk.patch @@ -1,7 +1,7 @@ From 04f40f398ac899504e4836e78f8e791f98200cf2 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Thu, 24 Jun 2010 17:43:23 -0500 -Subject: [PATCH 21/28] mt9t111: Fix max supported xclk +Subject: [PATCH 21/71] mt9t111: Fix max supported xclk According to Aptina documentation, the max should be 54 MHz, not 75 MHz. diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0022-omap3beagle-camera-Clarify-regulators-names.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0022-omap3beagle-camera-Clarify-regulators-names.patch index 310c47a046..016b573cef 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0022-omap3beagle-camera-Clarify-regulators-names.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0022-omap3beagle-camera-Clarify-regulators-names.patch @@ -1,7 +1,7 @@ From 769bd80474aeb9951046336c4332f1cee3d27619 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Thu, 24 Jun 2010 17:53:55 -0500 -Subject: [PATCH 22/28] omap3beagle: camera: Clarify regulators names +Subject: [PATCH 22/71] omap3beagle: camera: Clarify regulators names Changed: - beagle_mt9t111_reg1 -> beagle_mt9t111_1_8v diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0023-omap3beagle-camera-Fix-powerup-sequence.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0023-omap3beagle-camera-Fix-powerup-sequence.patch index fb424eedcb..56a5e6ee03 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0023-omap3beagle-camera-Fix-powerup-sequence.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0023-omap3beagle-camera-Fix-powerup-sequence.patch @@ -1,7 +1,7 @@ From 1f300b7451ed1aef6f9b9902f2070b7340cb4d0a Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Thu, 24 Jun 2010 18:21:52 -0500 -Subject: [PATCH 23/28] omap3beagle: camera: Fix powerup sequence +Subject: [PATCH 23/71] omap3beagle: camera: Fix powerup sequence The powerup sequence was very incomplete. After revisiting the Aptina developer's guide, the resulting powerup sequence is followed. diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0024-omap3beagle-camera-Change-vaux4-to-1.8v.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0024-omap3beagle-camera-Change-vaux4-to-1.8v.patch index 93916e51a7..571ab2a122 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0024-omap3beagle-camera-Change-vaux4-to-1.8v.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0024-omap3beagle-camera-Change-vaux4-to-1.8v.patch @@ -1,7 +1,7 @@ From 838274e9850c8dfbb723c892604b017ebf5f0528 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 25 Jun 2010 11:24:07 -0500 -Subject: [PATCH 24/28] omap3beagle: camera: Change vaux4 to 1.8v +Subject: [PATCH 24/71] omap3beagle: camera: Change vaux4 to 1.8v Both voltage sources seem to need 1.8v. diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0025-omap3beagle-camera-Rename-regulators-to-match-actual.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0025-omap3beagle-camera-Rename-regulators-to-match-actual.patch index 3d9914894a..bfb5ad10a4 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0025-omap3beagle-camera-Rename-regulators-to-match-actual.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0025-omap3beagle-camera-Rename-regulators-to-match-actual.patch @@ -1,7 +1,7 @@ From b8f60d7198d5df18336cb0151ac593cfa422f83a Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 25 Jun 2010 12:03:59 -0500 -Subject: [PATCH 25/28] omap3beagle: camera: Rename regulators to match actual voltage levels +Subject: [PATCH 25/71] omap3beagle: camera: Rename regulators to match actual voltage levels Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0026-omap3beagle-camera-Complement-remainig-sensor-hw-con.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0026-omap3beagle-camera-Complement-remainig-sensor-hw-con.patch index 943510910a..827ef36540 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0026-omap3beagle-camera-Complement-remainig-sensor-hw-con.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0026-omap3beagle-camera-Complement-remainig-sensor-hw-con.patch @@ -1,7 +1,7 @@ From f01fb232e43dcbc8f61c2ed29d8eb865ebb386b7 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 25 Jun 2010 12:04:48 -0500 -Subject: [PATCH 26/28] omap3beagle: camera: Complement remainig sensor hw config settings +Subject: [PATCH 26/71] omap3beagle: camera: Complement remainig sensor hw config settings Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0027-mt9t111-Fix-detect-function-retval-and-cleanup-print.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0027-mt9t111-Fix-detect-function-retval-and-cleanup-print.patch index 6eb26a2129..59d13f553a 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0027-mt9t111-Fix-detect-function-retval-and-cleanup-print.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0027-mt9t111-Fix-detect-function-retval-and-cleanup-print.patch @@ -1,7 +1,7 @@ From 5c343b5261a3a7382cb9aa414be9f1b57acb3056 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 25 Jun 2010 13:43:54 -0500 -Subject: [PATCH 27/28] mt9t111: Fix detect function retval and cleanup prints +Subject: [PATCH 27/71] mt9t111: Fix detect function retval and cleanup prints Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0028-omap3beagle-camera-Set-padconf-settings-in-cam-init.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0028-omap3beagle-camera-Set-padconf-settings-in-cam-init.patch index 25e157d65e..1a5b8b9b78 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/cam/0028-omap3beagle-camera-Set-padconf-settings-in-cam-init.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0028-omap3beagle-camera-Set-padconf-settings-in-cam-init.patch @@ -1,7 +1,7 @@ From 8ece4d6cbc52b7a41d1feb411d62c84cebc1e9fe Mon Sep 17 00:00:00 2001 From: Sergio Aguirre <saaguirre@ti.com> Date: Fri, 25 Jun 2010 16:01:00 -0500 -Subject: [PATCH 28/28] omap3beagle: camera: Set padconf settings in cam init +Subject: [PATCH 28/71] omap3beagle: camera: Set padconf settings in cam init Signed-off-by: Sergio Aguirre <saaguirre@ti.com> --- diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0029-omap3beagle-camera-only-register-camera-driver-for-3.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0029-omap3beagle-camera-only-register-camera-driver-for-3.patch new file mode 100644 index 0000000000..169fe982f9 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0029-omap3beagle-camera-only-register-camera-driver-for-3.patch @@ -0,0 +1,31 @@ +From 0e5fd12767472b52744c5dce43c77451aa89ba3d Mon Sep 17 00:00:00 2001 +From: Koen Kooi <koen@dominion.thruhere.net> +Date: Sun, 27 Jun 2010 16:11:39 +0200 +Subject: [PATCH 29/71] omap3beagle: camera: only register camera driver for 36xx based SoCs + +This is a workaround for the bootcrash when used on 35xx based beagleboards. + +Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 6 ++++-- + 1 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index 75471f2..8faa437 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -355,7 +355,9 @@ static struct platform_driver beagle_cam_driver = { + */ + int __init omap3beaglelmb_init(void) + { +- platform_driver_register(&beagle_cam_driver); +- return 0; ++ if (cpu_is_omap3630()) { ++ platform_driver_register(&beagle_cam_driver); ++ } ++ return 0; + } + late_initcall(omap3beaglelmb_init); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0030-WIP-mt9t111-Work-in-progress-for-camera-enablement.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0030-WIP-mt9t111-Work-in-progress-for-camera-enablement.patch new file mode 100644 index 0000000000..f204aca384 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0030-WIP-mt9t111-Work-in-progress-for-camera-enablement.patch @@ -0,0 +1,53 @@ +From 250e5bf211583993d5e56cb5fc736a07945fa496 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Fri, 25 Jun 2010 16:01:47 -0500 +Subject: [PATCH 30/71] WIP: mt9t111: Work in progress for camera enablement + +This is changing so far: +- Remove useless printk's in enum_frameinterval calls. +- Call mt9t111_loaddefault instead of mt9t111_configure dummy function. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t111.c | 11 +---------- + 1 files changed, 1 insertions(+), 10 deletions(-) + +diff --git a/drivers/media/video/mt9t111.c b/drivers/media/video/mt9t111.c +index 08122ff..10080af 100644 +--- a/drivers/media/video/mt9t111.c ++++ b/drivers/media/video/mt9t111.c +@@ -288,14 +288,6 @@ static int ioctl_enum_frameintervals(struct v4l2_int_device *s, + { + int ifmt; + +- printk(KERN_INFO "entering ioctl_enum_frameintervals\n"); +- printk(KERN_INFO "index = %d, pixel_format = 0x%x," +- " width = %d, height = %d\n", +- frmi->index, frmi->pixel_format, +- frmi->width, frmi->height); +- printk(KERN_INFO "mt9t111 format = 0x%x\n", +- mt9t111_formats[0].pixelformat); +- + if (frmi->index >= NUM_CAPTURE_FRAMEINTERVALS) + return -EINVAL; + +@@ -379,7 +371,7 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) + } + + if ((on == V4L2_POWER_ON) && (sensor->state == SENSOR_DETECTED)) +- mt9t111_configure(s); ++ mt9t111_loaddefault(c); + + if ((on == V4L2_POWER_ON) && (sensor->state == SENSOR_NOT_DETECTED)) { + rval = mt9t111_detect(c); +@@ -392,7 +384,6 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) + dev_info(&c->dev, "chip version 0x%02x detected\n", rval); + sensor->state = SENSOR_DETECTED; + sensor->ver = rval; +- mt9t111_loaddefault(c); + } + return 0; + } +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0031-BeagleXM-Cam-Add-support-for-MT9V113-VGA-Sensor.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0031-BeagleXM-Cam-Add-support-for-MT9V113-VGA-Sensor.patch new file mode 100644 index 0000000000..ccec95ce3e --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0031-BeagleXM-Cam-Add-support-for-MT9V113-VGA-Sensor.patch @@ -0,0 +1,2441 @@ +From eed14c95dbe46b0e34b489ad5e0452654e0f1661 Mon Sep 17 00:00:00 2001 +From: Vaibhav Hiremath <hvaibhav@ti.com> +Date: Wed, 7 Jul 2010 11:55:43 +0530 +Subject: [PATCH 31/71] BeagleXM:Cam: Add support for MT9V113 VGA Sensor + +This patch replaces the MT9T111 to MT9V113 sensor. +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 132 ++- + arch/arm/mach-omap2/board-omap3beagle.c | 32 +- + drivers/media/video/Kconfig | 10 + + drivers/media/video/Makefile | 1 + + drivers/media/video/mt9v113.c | 1522 ++++++++++++++++++++++++ + drivers/media/video/mt9v113_regs.h | 294 +++++ + include/media/mt9v113.h | 83 ++ + include/media/v4l2-int-device.h | 27 + + 8 files changed, 2023 insertions(+), 78 deletions(-) + create mode 100644 drivers/media/video/mt9v113.c + create mode 100644 drivers/media/video/mt9v113_regs.h + create mode 100644 include/media/mt9v113.h + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index 8faa437..6c06265 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -37,7 +37,7 @@ + #include <plat/control.h> + + #include <media/v4l2-int-device.h> +-#include <media/mt9t111.h> ++#include <media/mt9v113.h> + + /* Include V4L2 ISP-Camera driver related header file */ + #include <../drivers/media/video/omap34xxcam.h> +@@ -50,99 +50,99 @@ + + #define CAM_USE_XCLKA 0 + +-#define ISP_MT9T111_MCLK 216000000 ++#define ISP_MT9V113_MCLK 216000000 + + #define LEOPARD_RESET_GPIO 98 + +-static struct regulator *beagle_mt9t111_1_8v1; +-static struct regulator *beagle_mt9t111_1_8v2; ++static struct regulator *beagle_mt9v113_1_8v1; ++static struct regulator *beagle_mt9v113_1_8v2; + +-#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) ++#if defined(CONFIG_VIDEO_MT9V113) || defined(CONFIG_VIDEO_MT9V113_MODULE) + + /* Arbitrary memory handling limit */ +-#define MT9T111_BIGGEST_FRAME_BYTE_SIZE PAGE_ALIGN(2048 * 1536 * 4) ++#define MT9V113_BIGGEST_FRAME_BYTE_SIZE PAGE_ALIGN(2048 * 1536 * 4) + +-static struct isp_interface_config mt9t111_if_config = { +- .ccdc_par_ser = ISP_PARLL, ++static struct isp_interface_config mt9v113_if_config = { ++ .ccdc_par_ser = ISP_PARLL, + .dataline_shift = 0x0, + .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE, + .strobe = 0x0, + .prestrobe = 0x0, + .shutter = 0x0, +- .cam_mclk = ISP_MT9T111_MCLK, ++ .cam_mclk = ISP_MT9V113_MCLK, + .wenlog = ISPCCDC_CFG_WENLOG_AND, + .wait_hs_vs = 2, + .u.par.par_bridge = 0x1, + .u.par.par_clk_pol = 0x0, + }; + +-static struct v4l2_ifparm mt9t111_ifparm_s = { ++static struct v4l2_ifparm mt9v113_ifparm_s = { + #if 1 +- .if_type = V4L2_IF_TYPE_RAW, ++ .if_type = V4L2_IF_TYPE_RAW, + .u = { +- .raw = { ++ .raw = { + .frame_start_on_rising_vs = 1, + .bt_sync_correct = 0, + .swap = 0, + .latch_clk_inv = 0, + .nobt_hs_inv = 0, /* active high */ + .nobt_vs_inv = 0, /* active high */ +- .clock_min = MT9T111_CLK_MIN, +- .clock_max = MT9T111_CLK_MAX, ++ .clock_min = MT9V113_CLK_MIN, ++ .clock_max = MT9V113_CLK_MAX, + }, + }, +-#else +- .if_type = V4L2_IF_TYPE_YCbCr, ++#else ++ .if_type = V4L2_IF_TYPE_YCbCr, + .u = { +- .ycbcr = { ++ .ycbcr = { + .frame_start_on_rising_vs = 1, + .bt_sync_correct = 0, + .swap = 0, + .latch_clk_inv = 0, + .nobt_hs_inv = 0, /* active high */ + .nobt_vs_inv = 0, /* active high */ +- .clock_min = MT9T111_CLK_MIN, +- .clock_max = MT9T111_CLK_MAX, ++ .clock_min = MT9V113_CLK_MIN, ++ .clock_max = MT9V113_CLK_MAX, + }, + }, + #endif + }; + + /** +- * @brief mt9t111_ifparm - Returns the mt9t111 interface parameters ++ * @brief mt9v113_ifparm - Returns the mt9v113 interface parameters + * + * @param p - pointer to v4l2_ifparm structure + * + * @return result of operation - 0 is success + */ +-static int mt9t111_ifparm(struct v4l2_ifparm *p) ++static int mt9v113_ifparm(struct v4l2_ifparm *p) + { + if (p == NULL) + return -EINVAL; + +- *p = mt9t111_ifparm_s; ++ *p = mt9v113_ifparm_s; + return 0; + } + + #if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) +-static struct omap34xxcam_hw_config mt9t111_hwc = { ++static struct omap34xxcam_hw_config mt9v113_hwc = { + .dev_index = 0, + .dev_minor = 0, + .dev_type = OMAP34XXCAM_SLAVE_SENSOR, + .u.sensor.sensor_isp = 1, +- .u.sensor.capture_mem = MT9T111_BIGGEST_FRAME_BYTE_SIZE * 2, ++ .u.sensor.capture_mem = MT9V113_BIGGEST_FRAME_BYTE_SIZE * 2, + .u.sensor.ival_default = { 1, 10 }, + }; + #endif + + /** +- * @brief mt9t111_set_prv_data - Returns mt9t111 omap34xx driver private data ++ * @brief mt9v113_set_prv_data - Returns mt9v113 omap34xx driver private data + * + * @param priv - pointer to omap34xxcam_hw_config structure + * + * @return result of operation - 0 is success + */ +-static int mt9t111_set_prv_data(void *priv) ++static int mt9v113_set_prv_data(void *priv) + { + #if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) + struct omap34xxcam_hw_config *hwc = priv; +@@ -150,10 +150,10 @@ static int mt9t111_set_prv_data(void *priv) + if (priv == NULL) + return -EINVAL; + +- hwc->u.sensor = mt9t111_hwc.u.sensor; +- hwc->dev_index = mt9t111_hwc.dev_index; +- hwc->dev_minor = mt9t111_hwc.dev_minor; +- hwc->dev_type = mt9t111_hwc.dev_type; ++ hwc->u.sensor = mt9v113_hwc.u.sensor; ++ hwc->dev_index = mt9v113_hwc.dev_index; ++ hwc->dev_minor = mt9v113_hwc.dev_minor; ++ hwc->dev_type = mt9v113_hwc.dev_type; + return 0; + #else + return -EINVAL; +@@ -161,13 +161,13 @@ static int mt9t111_set_prv_data(void *priv) + } + + /** +- * @brief mt9t111_power_set - Power-on or power-off TVP5146 device ++ * @brief mt9v113_power_set - Power-on or power-off TVP5146 device + * + * @param power - enum, Power on/off, resume/standby + * + * @return result of operation - 0 is success + */ +-static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power) ++static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power) + { + struct omap34xxcam_videodev *vdev = s->u.slave->master->priv; + +@@ -176,32 +176,32 @@ static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power) + case V4L2_POWER_STANDBY: + isp_set_xclk(vdev->cam->isp, 0, CAM_USE_XCLKA); + +- if (regulator_is_enabled(beagle_mt9t111_1_8v1)) +- regulator_disable(beagle_mt9t111_1_8v1); +- if (regulator_is_enabled(beagle_mt9t111_1_8v2)) +- regulator_disable(beagle_mt9t111_1_8v2); ++ if (regulator_is_enabled(beagle_mt9v113_1_8v1)) ++ regulator_disable(beagle_mt9v113_1_8v1); ++ if (regulator_is_enabled(beagle_mt9v113_1_8v2)) ++ regulator_disable(beagle_mt9v113_1_8v2); + break; + + case V4L2_POWER_ON: + #if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) +- isp_configure_interface(vdev->cam->isp, &mt9t111_if_config); ++ isp_configure_interface(vdev->cam->isp, &mt9v113_if_config); + #endif + + /* Set RESET_BAR to 0 */ + gpio_set_value(LEOPARD_RESET_GPIO, 0); + + /* turn on VDD */ +- regulator_enable(beagle_mt9t111_1_8v1); ++ regulator_enable(beagle_mt9v113_1_8v1); + + mdelay(1); + + /* turn on VDD_IO */ +- regulator_enable(beagle_mt9t111_1_8v2); ++ regulator_enable(beagle_mt9v113_1_8v2); + + mdelay(50); + + /* Enable EXTCLK */ +- isp_set_xclk(vdev->cam->isp, MT9T111_CLK_MIN, CAM_USE_XCLKA); ++ isp_set_xclk(vdev->cam->isp, MT9V113_CLK_MIN, CAM_USE_XCLKA); + + /* + * Wait at least 70 CLK cycles (w/EXTCLK = 6MHz, or CLK_MIN): +@@ -229,44 +229,48 @@ static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power) + return 0; + } + +-struct mt9t111_platform_data mt9t111_pdata = { ++struct mt9v113_platform_data mt9v113_pdata = { + .master = "omap34xxcam", +- .power_set = mt9t111_power_set, +- .priv_data_set = mt9t111_set_prv_data, +- .ifparm = mt9t111_ifparm, ++ .power_set = mt9v113_power_set, ++ .priv_data_set = mt9v113_set_prv_data, ++ .ifparm = mt9v113_ifparm, + /* Some interface dependent params */ + .clk_polarity = 0, /* data clocked out on falling edge */ + .hs_polarity = 1, /* 0 - Active low, 1- Active high */ + .vs_polarity = 1, /* 0 - Active low, 1- Active high */ + }; + +-#endif /* #ifdef CONFIG_VIDEO_MT9T111 */ ++#endif /* #ifdef CONFIG_VIDEO_MT9V113 */ + + + static int beagle_cam_probe(struct platform_device *pdev) + { + int err; + +- beagle_mt9t111_1_8v1 = regulator_get(&pdev->dev, "vaux3_1"); +- if (IS_ERR(beagle_mt9t111_1_8v1)) { ++ printk("%s:%d\n", __func__, __LINE__); ++ beagle_mt9v113_1_8v1 = regulator_get(&pdev->dev, "vaux3_1"); ++ if (IS_ERR(beagle_mt9v113_1_8v1)) { + dev_err(&pdev->dev, "vaux3_1 regulator missing\n"); +- return PTR_ERR(beagle_mt9t111_1_8v1); ++ return PTR_ERR(beagle_mt9v113_1_8v1); + } +- beagle_mt9t111_1_8v2 = regulator_get(&pdev->dev, "vaux4_1"); +- if (IS_ERR(beagle_mt9t111_1_8v2)) { ++ printk("%s:%d\n", __func__, __LINE__); ++ beagle_mt9v113_1_8v2 = regulator_get(&pdev->dev, "vaux4_1"); ++ if (IS_ERR(beagle_mt9v113_1_8v2)) { + dev_err(&pdev->dev, "vaux4_1 regulator missing\n"); +- regulator_put(beagle_mt9t111_1_8v1); +- return PTR_ERR(beagle_mt9t111_1_8v2); ++ regulator_put(beagle_mt9v113_1_8v1); ++ return PTR_ERR(beagle_mt9v113_1_8v2); + } + ++ printk("%s:%d\n", __func__, __LINE__); + if (gpio_request(LEOPARD_RESET_GPIO, "cam_rst") != 0) { + dev_err(&pdev->dev, "Could not request GPIO %d", + LEOPARD_RESET_GPIO); +- regulator_put(beagle_mt9t111_1_8v2); +- regulator_put(beagle_mt9t111_1_8v1); ++ regulator_put(beagle_mt9v113_1_8v2); ++ regulator_put(beagle_mt9v113_1_8v1); + return -ENODEV; + } + ++ printk("%s:%d\n", __func__, __LINE__); + /* set to output mode, default value 0 */ + gpio_direction_output(LEOPARD_RESET_GPIO, 0); + +@@ -277,12 +281,13 @@ static int beagle_cam_probe(struct platform_device *pdev) + + static int beagle_cam_remove(struct platform_device *pdev) + { +- if (regulator_is_enabled(beagle_mt9t111_1_8v1)) +- regulator_disable(beagle_mt9t111_1_8v1); +- regulator_put(beagle_mt9t111_1_8v1); +- if (regulator_is_enabled(beagle_mt9t111_1_8v2)) +- regulator_disable(beagle_mt9t111_1_8v2); +- regulator_put(beagle_mt9t111_1_8v2); ++ printk("%s:%d\n", __func__, __LINE__); ++ if (regulator_is_enabled(beagle_mt9v113_1_8v1)) ++ regulator_disable(beagle_mt9v113_1_8v1); ++ regulator_put(beagle_mt9v113_1_8v1); ++ if (regulator_is_enabled(beagle_mt9v113_1_8v2)) ++ regulator_disable(beagle_mt9v113_1_8v2); ++ regulator_put(beagle_mt9v113_1_8v2); + + gpio_free(LEOPARD_RESET_GPIO); + +@@ -355,9 +360,12 @@ static struct platform_driver beagle_cam_driver = { + */ + int __init omap3beaglelmb_init(void) + { ++ printk("%s:%d\n", __func__, __LINE__); + if (cpu_is_omap3630()) { +- platform_driver_register(&beagle_cam_driver); ++ printk("%s:%d\n", __func__, __LINE__); ++ platform_driver_register(&beagle_cam_driver); + } +- return 0; ++ printk("%s:%d\n", __func__, __LINE__); ++ return 0; + } + late_initcall(omap3beaglelmb_init); +diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c +index af9b818..d4b0b0a 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle.c ++++ b/arch/arm/mach-omap2/board-omap3beagle.c +@@ -71,10 +71,10 @@ static struct omap_opp * _omap35x_l3_rate_table = NULL; + static struct omap_opp * _omap37x_l3_rate_table = NULL; + #endif /* CONFIG_PM */ + +-#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) ++#if defined(CONFIG_VIDEO_MT9V113) || defined(CONFIG_VIDEO_MT9V113_MODULE) + #include <media/v4l2-int-device.h> +-#include <media/mt9t111.h> +-extern struct mt9t111_platform_data mt9t111_pdata; ++#include <media/mt9v113.h> ++extern struct mt9v113_platform_data mt9v113_pdata; + #endif + + #define GPMC_CS0_BASE 0x60 +@@ -159,7 +159,7 @@ static void __init omap3beagle_ks8851_init(void) + printk(KERN_ERR "could not obtain gpio for KS8851_IRQ\n"); + return; + } +- ++ + spi_register_board_info(omap3beagle_zippy2_spi_board_info, + ARRAY_SIZE(omap3beagle_zippy2_spi_board_info)); + } +@@ -369,9 +369,9 @@ static int beagle_twl_gpio_setup(struct device *dev, + */ + + if (cpu_is_omap3630()) { +- /* Power on DVI, Serial and PWR led */ ++ /* Power on DVI, Serial and PWR led */ + gpio_request(gpio + 1, "nDVI_PWR_EN"); +- gpio_direction_output(gpio + 1, 0); ++ gpio_direction_output(gpio + 1, 0); + + /* Power on camera interface */ + gpio_request(gpio + 2, "CAM_EN"); +@@ -560,7 +560,7 @@ static struct i2c_board_info __initdata beagle_i2c1_boardinfo[] = { + }, + }; + +- ++ + #if defined(CONFIG_EEPROM_AT24) || defined(CONFIG_EEPROM_AT24_MODULE) + #include <linux/i2c/at24.h> + +@@ -594,10 +594,10 @@ static struct i2c_board_info __initdata beagle_zippy_i2c2_boardinfo[] = {}; + #endif + + static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = { +-#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) ++#if defined(CONFIG_VIDEO_MT9V113) || defined(CONFIG_VIDEO_MT9V113_MODULE) + { +- I2C_BOARD_INFO("mt9t111", MT9T111_I2C_ADDR), +- .platform_data = &mt9t111_pdata, ++ I2C_BOARD_INFO("mt9v113", MT9V113_I2C_ADDR), ++ .platform_data = &mt9v113_pdata, + }, + #endif + }; +@@ -606,7 +606,7 @@ static int __init omap3_beagle_i2c_init(void) + { + omap_register_i2c_bus(1, 2600, beagle_i2c1_boardinfo, + ARRAY_SIZE(beagle_i2c1_boardinfo)); +- if(!strcmp(expansionboard_name, "zippy") || !strcmp(expansionboard_name, "zippy2")) ++ if(!strcmp(expansionboard_name, "zippy") || !strcmp(expansionboard_name, "zippy2")) + { + printk(KERN_INFO "Beagle expansionboard: registering i2c2 bus for zippy/zippy2\n"); + omap_register_i2c_bus(2, 400, beagle_zippy_i2c2_boardinfo, +@@ -681,7 +681,7 @@ static struct spi_board_info beaglefpga_mcspi_board_info[] = { + .modalias = "spidev", + .max_speed_hz = 48000000, //48 Mbps + .bus_num = 4, +- .chip_select = 0, ++ .chip_select = 0, + .mode = SPI_MODE_1, + }, + }; +@@ -830,7 +830,7 @@ static void __init omap3_beagle_init(void) + /* REVISIT leave DVI powered down until it's needed ... */ + gpio_direction_output(170, true); + +- if(!strcmp(expansionboard_name, "zippy")) ++ if(!strcmp(expansionboard_name, "zippy")) + { + printk(KERN_INFO "Beagle expansionboard: initializing enc28j60\n"); + omap3beagle_enc28j60_init(); +@@ -838,8 +838,8 @@ static void __init omap3_beagle_init(void) + mmc[1].gpio_wp = 141; + mmc[1].gpio_cd = 162; + } +- +- if(!strcmp(expansionboard_name, "zippy2")) ++ ++ if(!strcmp(expansionboard_name, "zippy2")) + { + printk(KERN_INFO "Beagle expansionboard: initializing ks_8851\n"); + omap3beagle_ks8851_init(); +@@ -880,7 +880,7 @@ static void __init omap3_beagle_init(void) + } + + if(!strcmp(expansionboard_name, "beaglefpga")) +- { ++ { + printk(KERN_INFO "Beagle expansionboard: Using McSPI for SPI\n"); + beaglefpga_init_spi(); + } +diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig +index f67ed46..c14d758 100644 +--- a/drivers/media/video/Kconfig ++++ b/drivers/media/video/Kconfig +@@ -329,6 +329,16 @@ config VIDEO_MT9V011 + mt0v011 1.3 Mpixel camera. It currently only works with the + em28xx driver. + ++config VIDEO_MT9V113 ++ tristate "Aptina MT9V113 VGA CMOS IMAGE SENSOR" ++ depends on VIDEO_V4L2 && I2C ++ ---help--- ++ This is a Video4Linux2 sensor-level driver for the Aptina MT9V113 ++ image sensor. ++ ++ To compile this driver as a module, choose M here: the ++ module will be called mt9v113. ++ + config VIDEO_TCM825X + tristate "TCM825x camera sensor support" + depends on I2C && VIDEO_V4L2 +diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile +index 31688bf..763c157 100644 +--- a/drivers/media/video/Makefile ++++ b/drivers/media/video/Makefile +@@ -75,6 +75,7 @@ obj-$(CONFIG_VIDEO_OV7670) += ov7670.o + obj-$(CONFIG_VIDEO_TCM825X) += tcm825x.o + obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o + obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o ++obj-$(CONFIG_VIDEO_MT9V113) += mt9v113.o + + obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o + obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o +diff --git a/drivers/media/video/mt9v113.c b/drivers/media/video/mt9v113.c +new file mode 100644 +index 0000000..755a88a +--- /dev/null ++++ b/drivers/media/video/mt9v113.c +@@ -0,0 +1,1522 @@ ++/* ++ * drivers/media/video/mt9v113.c ++ * ++ * Based on TI TVP5146/47 decoder driver ++ * ++ * ++ * This package is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ */ ++ ++#include <linux/i2c.h> ++#include <linux/delay.h> ++#include <linux/videodev2.h> ++#include <media/v4l2-int-device.h> ++#include <media/mt9v113.h> ++#include <mach/hardware.h> ++#include <linux/io.h> ++ ++#include "mt9v113_regs.h" ++ ++/* Module Name */ ++#define MT9V113_MODULE_NAME "mt9v113" ++ ++/* Private macros for TVP */ ++#define I2C_RETRY_COUNT (5) ++#define LOCK_RETRY_COUNT (5) ++#define LOCK_RETRY_DELAY (200) ++ ++/* Debug functions */ ++static int debug = 1; ++module_param(debug, bool, 0644); ++MODULE_PARM_DESC(debug, "Debug level (0-1)"); ++ ++#define dump_reg(client, reg, val) \ ++ do { \ ++ val = mt9v113_read_reg(client, reg); \ ++ v4l_info(client, "Reg(0x%.2X): 0x%.2X\n", reg, val); \ ++ } while (0) ++ ++/** ++ * enum mt9v113_std - enum for supported standards ++ */ ++enum mt9v113_std { ++ MT9V113_STD_VGA = 0, ++ MT9V113_STD_QVGA, ++ MT9V113_STD_INVALID ++}; ++ ++/** ++ * enum mt9v113_state - enum for different decoder states ++ */ ++enum mt9v113_state { ++ STATE_NOT_DETECTED, ++ STATE_DETECTED ++}; ++ ++/** ++ * struct mt9v113_std_info - Structure to store standard informations ++ * @width: Line width in pixels ++ * @height:Number of active lines ++ * @video_std: Value to write in REG_VIDEO_STD register ++ * @standard: v4l2 standard structure information ++ */ ++struct mt9v113_std_info { ++ unsigned long width; ++ unsigned long height; ++ u8 video_std; ++ struct v4l2_standard standard; ++}; ++ ++/** ++ * struct mt9v113_decoded - decoder object ++ * @v4l2_int_device: Slave handle ++ * @pdata: Board specific ++ * @client: I2C client data ++ * @id: Entry from I2C table ++ * @ver: Chip version ++ * @state: decoder state - detected or not-detected ++ * @pix: Current pixel format ++ * @num_fmts: Number of formats ++ * @fmt_list: Format list ++ * @current_std: Current standard ++ * @num_stds: Number of standards ++ * @std_list: Standards list ++ * @route: input and output routing at chip level ++ */ ++struct mt9v113_decoder { ++ struct v4l2_int_device *v4l2_int_device; ++ const struct mt9v113_platform_data *pdata; ++ struct i2c_client *client; ++ ++ struct i2c_device_id *id; ++ ++ int ver; ++ enum mt9v113_state state; ++ ++ struct v4l2_pix_format pix; ++ int num_fmts; ++ const struct v4l2_fmtdesc *fmt_list; ++ ++ enum mt9v113_std current_std; ++ int num_stds; ++ struct mt9v113_std_info *std_list; ++ ++ struct v4l2_routing route; ++}; ++ ++/* MT9V113 register set for VGA mode */ ++static struct mt9v113_reg mt9v113_vga_reg[] = { ++ {TOK_WRITE, 0x098C, 0x2739}, ++ {TOK_WRITE, 0x0990, 0x0000}, ++ {TOK_WRITE, 0x098C, 0x273B}, ++ {TOK_WRITE, 0x0990, 0x027F}, ++ {TOK_WRITE, 0x098C, 0x273D}, ++ {TOK_WRITE, 0x0990, 0x0000}, ++ {TOK_WRITE, 0x098C, 0x273F}, ++ {TOK_WRITE, 0x0990, 0x01DF}, ++ {TOK_WRITE, 0x098C, 0x2703}, ++ {TOK_WRITE, 0x0990, 0x0280}, ++ {TOK_WRITE, 0x098C, 0x2705}, ++ {TOK_WRITE, 0x0990, 0x01E0}, ++ {TOK_WRITE, 0x098C, 0xA103}, ++ {TOK_WRITE, 0x0990, 0x0005}, ++ {TOK_DELAY, 0, 100}, ++ {TOK_TERM, 0, 0}, ++}; ++ ++/* MT9V113 default register values */ ++static struct mt9v113_reg mt9v113_reg_list[] = { ++ {TOK_WRITE, 0x0018, 0x4028}, ++ {TOK_DELAY, 0, 100}, ++ {TOK_WRITE, 0x001A, 0x0011}, ++ {TOK_WRITE, 0x001A, 0x0010}, ++ {TOK_WRITE, 0x0018, 0x4028}, ++ {TOK_DELAY, 0, 100}, ++ {TOK_WRITE, 0x098C, 0x02F0}, ++ {TOK_WRITE, 0x0990, 0x0000}, ++ {TOK_WRITE, 0x098C, 0x02F2}, ++ {TOK_WRITE, 0x0990, 0x0210}, ++ {TOK_WRITE, 0x098C, 0x02F4}, ++ {TOK_WRITE, 0x0990, 0x001A}, ++ {TOK_WRITE, 0x098C, 0x2145}, ++ {TOK_WRITE, 0x0990, 0x02F4}, ++ {TOK_WRITE, 0x098C, 0xA134}, ++ {TOK_WRITE, 0x0990, 0x0001}, ++ {TOK_WRITE, 0x31E0, 0x0001}, ++ {TOK_WRITE, 0x001A, 0x0210}, ++ {TOK_WRITE, 0x001E, 0x0777}, ++ {TOK_WRITE, 0x0016, 0x42DF}, ++ {TOK_WRITE, 0x0014, 0x2145}, ++ {TOK_WRITE, 0x0014, 0x2145}, ++ {TOK_WRITE, 0x0010, 0x0431}, ++ {TOK_WRITE, 0x0012, 0x0000}, ++ {TOK_WRITE, 0x0014, 0x244B}, ++ {TOK_WRITE, 0x0014, 0x304B}, ++ {TOK_DELAY, 0, 100}, ++ {TOK_WRITE, 0x0014, 0xB04A}, ++ {TOK_WRITE, 0x098C, 0xAB1F}, ++ {TOK_WRITE, 0x0990, 0x00C7}, ++ {TOK_WRITE, 0x098C, 0xAB31}, ++ {TOK_WRITE, 0x0990, 0x001E}, ++ {TOK_WRITE, 0x098C, 0x274F}, ++ {TOK_WRITE, 0x0990, 0x0004}, ++ {TOK_WRITE, 0x098C, 0x2741}, ++ {TOK_WRITE, 0x0990, 0x0004}, ++ {TOK_WRITE, 0x098C, 0xAB20}, ++ {TOK_WRITE, 0x0990, 0x0054}, ++ {TOK_WRITE, 0x098C, 0xAB21}, ++ {TOK_WRITE, 0x0990, 0x0046}, ++ {TOK_WRITE, 0x098C, 0xAB22}, ++ {TOK_WRITE, 0x0990, 0x0002}, ++ {TOK_WRITE, 0x098C, 0xAB24}, ++ {TOK_WRITE, 0x0990, 0x0005}, ++ {TOK_WRITE, 0x098C, 0x2B28}, ++ {TOK_WRITE, 0x0990, 0x170C}, ++ {TOK_WRITE, 0x098C, 0x2B2A}, ++ {TOK_WRITE, 0x0990, 0x3E80}, ++ {TOK_WRITE, 0x3210, 0x09A8}, ++ {TOK_WRITE, 0x098C, 0x2306}, ++ {TOK_WRITE, 0x0990, 0x0315}, ++ {TOK_WRITE, 0x098C, 0x2308}, ++ {TOK_WRITE, 0x0990, 0xFDDC}, ++ {TOK_WRITE, 0x098C, 0x230A}, ++ {TOK_WRITE, 0x0990, 0x003A}, ++ {TOK_WRITE, 0x098C, 0x230C}, ++ {TOK_WRITE, 0x0990, 0xFF58}, ++ {TOK_WRITE, 0x098C, 0x230E}, ++ {TOK_WRITE, 0x0990, 0x02B7}, ++ {TOK_WRITE, 0x098C, 0x2310}, ++ {TOK_WRITE, 0x0990, 0xFF31}, ++ {TOK_WRITE, 0x098C, 0x2312}, ++ {TOK_WRITE, 0x0990, 0xFF4C}, ++ {TOK_WRITE, 0x098C, 0x2314}, ++ {TOK_WRITE, 0x0990, 0xFE4C}, ++ {TOK_WRITE, 0x098C, 0x2316}, ++ {TOK_WRITE, 0x0990, 0x039E}, ++ {TOK_WRITE, 0x098C, 0x2318}, ++ {TOK_WRITE, 0x0990, 0x001C}, ++ {TOK_WRITE, 0x098C, 0x231A}, ++ {TOK_WRITE, 0x0990, 0x0039}, ++ {TOK_WRITE, 0x098C, 0x231C}, ++ {TOK_WRITE, 0x0990, 0x007F}, ++ {TOK_WRITE, 0x098C, 0x231E}, ++ {TOK_WRITE, 0x0990, 0xFF77}, ++ {TOK_WRITE, 0x098C, 0x2320}, ++ {TOK_WRITE, 0x0990, 0x000A}, ++ {TOK_WRITE, 0x098C, 0x2322}, ++ {TOK_WRITE, 0x0990, 0x0020}, ++ {TOK_WRITE, 0x098C, 0x2324}, ++ {TOK_WRITE, 0x0990, 0x001B}, ++ {TOK_WRITE, 0x098C, 0x2326}, ++ {TOK_WRITE, 0x0990, 0xFFC6}, ++ {TOK_WRITE, 0x098C, 0x2328}, ++ {TOK_WRITE, 0x0990, 0x0086}, ++ {TOK_WRITE, 0x098C, 0x232A}, ++ {TOK_WRITE, 0x0990, 0x00B5}, ++ {TOK_WRITE, 0x098C, 0x232C}, ++ {TOK_WRITE, 0x0990, 0xFEC3}, ++ {TOK_WRITE, 0x098C, 0x232E}, ++ {TOK_WRITE, 0x0990, 0x0001}, ++ {TOK_WRITE, 0x098C, 0x2330}, ++ {TOK_WRITE, 0x0990, 0xFFEF}, ++ {TOK_WRITE, 0x098C, 0xA348}, ++ {TOK_WRITE, 0x0990, 0x0008}, ++ {TOK_WRITE, 0x098C, 0xA349}, ++ {TOK_WRITE, 0x0990, 0x0002}, ++ {TOK_WRITE, 0x098C, 0xA34A}, ++ {TOK_WRITE, 0x0990, 0x0090}, ++ {TOK_WRITE, 0x098C, 0xA34B}, ++ {TOK_WRITE, 0x0990, 0x00FF}, ++ {TOK_WRITE, 0x098C, 0xA34C}, ++ {TOK_WRITE, 0x0990, 0x0075}, ++ {TOK_WRITE, 0x098C, 0xA34D}, ++ {TOK_WRITE, 0x0990, 0x00EF}, ++ {TOK_WRITE, 0x098C, 0xA351}, ++ {TOK_WRITE, 0x0990, 0x0000}, ++ {TOK_WRITE, 0x098C, 0xA352}, ++ {TOK_WRITE, 0x0990, 0x007F}, ++ {TOK_WRITE, 0x098C, 0xA354}, ++ {TOK_WRITE, 0x0990, 0x0043}, ++ {TOK_WRITE, 0x098C, 0xA355}, ++ {TOK_WRITE, 0x0990, 0x0001}, ++ {TOK_WRITE, 0x098C, 0xA35D}, ++ {TOK_WRITE, 0x0990, 0x0078}, ++ {TOK_WRITE, 0x098C, 0xA35E}, ++ {TOK_WRITE, 0x0990, 0x0086}, ++ {TOK_WRITE, 0x098C, 0xA35F}, ++ {TOK_WRITE, 0x0990, 0x007E}, ++ {TOK_WRITE, 0x098C, 0xA360}, ++ {TOK_WRITE, 0x0990, 0x0082}, ++ {TOK_WRITE, 0x098C, 0x2361}, ++ {TOK_WRITE, 0x0990, 0x0040}, ++ {TOK_WRITE, 0x098C, 0xA363}, ++ {TOK_WRITE, 0x0990, 0x00D2}, ++ {TOK_WRITE, 0x098C, 0xA364}, ++ {TOK_WRITE, 0x0990, 0x00F6}, ++ {TOK_WRITE, 0x098C, 0xA302}, ++ {TOK_WRITE, 0x0990, 0x0000}, ++ {TOK_WRITE, 0x098C, 0xA303}, ++ {TOK_WRITE, 0x0990, 0x00EF}, ++ {TOK_WRITE, 0x098C, 0xAB20}, ++ {TOK_WRITE, 0x0990, 0x0024}, ++ {TOK_WRITE, 0x098C, 0xA103}, ++ {TOK_WRITE, 0x0990, 0x0006}, ++ {TOK_DELAY, 0, 100}, ++ {TOK_WRITE, 0x098C, 0xA103}, ++ {TOK_WRITE, 0x0990, 0x0005}, ++ {TOK_DELAY, 0, 100}, ++ {TOK_WRITE, 0x098C, 0x222D}, ++ {TOK_WRITE, 0x0990, 0x0088}, ++ {TOK_WRITE, 0x098C, 0xA408}, ++ {TOK_WRITE, 0x0990, 0x0020}, ++ {TOK_WRITE, 0x098C, 0xA409}, ++ {TOK_WRITE, 0x0990, 0x0023}, ++ {TOK_WRITE, 0x098C, 0xA40A}, ++ {TOK_WRITE, 0x0990, 0x0027}, ++ {TOK_WRITE, 0x098C, 0xA40B}, ++ {TOK_WRITE, 0x0990, 0x002A}, ++ {TOK_WRITE, 0x098C, 0x2411}, ++ {TOK_WRITE, 0x0990, 0x0088}, ++ {TOK_WRITE, 0x098C, 0x2413}, ++ {TOK_WRITE, 0x0990, 0x00A4}, ++ {TOK_WRITE, 0x098C, 0x2415}, ++ {TOK_WRITE, 0x0990, 0x0088}, ++ {TOK_WRITE, 0x098C, 0x2417}, ++ {TOK_WRITE, 0x0990, 0x00A4}, ++ {TOK_WRITE, 0x098C, 0xA404}, ++ {TOK_WRITE, 0x0990, 0x0010}, ++ {TOK_WRITE, 0x098C, 0xA40D}, ++ {TOK_WRITE, 0x0990, 0x0002}, ++ {TOK_WRITE, 0x098C, 0xA40E}, ++ {TOK_WRITE, 0x0990, 0x0003}, ++ {TOK_WRITE, 0x098C, 0xA103}, ++ {TOK_WRITE, 0x0990, 0x0006}, ++ {TOK_DELAY, 0, 100}, ++ /* test pattern all white*/ ++ /* {TOK_WRITE, 0x098C, 0xA766}, ++ {TOK_WRITE, 0x0990, 0x0001}, ++ */ ++ {TOK_WRITE, 0x098C, 0xA103}, ++ {TOK_WRITE, 0x0990, 0x0005}, ++ {TOK_DELAY, 0, 100}, ++ {TOK_TERM, 0, 0}, ++}; ++ ++/* List of image formats supported by mt9v113 ++ * Currently we are using 8 bit mode only, but can be ++ * extended to 10/20 bit mode. ++ */ ++static const struct v4l2_fmtdesc mt9v113_fmt_list[] = { ++ { ++ .index = 0, ++ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE, ++ .flags = 0, ++ .description = "8-bit UYVY 4:2:2 Format", ++ .pixelformat = V4L2_PIX_FMT_UYVY, ++ }, ++}; ++ ++/* ++ * Supported standards - ++ * ++ * Currently supports two standards only, need to add support for rest of the ++ * modes, like SECAM, etc... ++ */ ++static struct mt9v113_std_info mt9v113_std_list[] = { ++ /* Standard: STD_NTSC_MJ */ ++ [MT9V113_STD_VGA] = { ++ .width = VGA_NUM_ACTIVE_PIXELS, ++ .height = VGA_NUM_ACTIVE_LINES, ++ .video_std = MT9V113_IMAGE_STD_VGA, ++ .standard = { ++ .index = 0, ++ .id = MT9V113_IMAGE_STD_VGA, ++ .name = "VGA", ++ .frameperiod = {1001, 30000}, ++ .framelines = 480 ++ }, ++ /* Standard: STD_PAL_BDGHIN */ ++ }, ++ [MT9V113_STD_QVGA] = { ++ .width = QVGA_NUM_ACTIVE_PIXELS, ++ .height = QVGA_NUM_ACTIVE_LINES, ++ .video_std = MT9V113_IMAGE_STD_QVGA, ++ .standard = { ++ .index = 1, ++ .id = MT9V113_IMAGE_STD_QVGA, ++ .name = "QVGA", ++ .frameperiod = {1001, 30000}, ++ .framelines = 320 ++ }, ++ }, ++ /* Standard: need to add for additional standard */ ++}; ++/* ++ * Control structure for Auto Gain ++ * This is temporary data, will get replaced once ++ * v4l2_ctrl_query_fill supports it. ++ */ ++static const struct v4l2_queryctrl mt9v113_autogain_ctrl = { ++ .id = V4L2_CID_AUTOGAIN, ++ .name = "Gain, Automatic", ++ .type = V4L2_CTRL_TYPE_BOOLEAN, ++ .minimum = 0, ++ .maximum = 1, ++ .step = 1, ++ .default_value = 1, ++}; ++ ++static int mt9v113_read_reg(struct i2c_client *client, unsigned short reg) ++{ ++ int err = 0; ++ struct i2c_msg msg[1]; ++ unsigned char data[2]; ++ unsigned short val = 0; ++ ++ if (!client->adapter) { ++ err = -ENODEV; ++ return err; ++ }else { ++ // TODO: addr should be set up where else ++ msg->addr = MT9V113_I2C_ADDR;//client->addr; ++ msg->flags = 0; ++ msg->len = I2C_TWO_BYTE_TRANSFER; ++ msg->buf = data; ++ data[0] = (reg & I2C_TXRX_DATA_MASK_UPPER) >> ++ I2C_TXRX_DATA_SHIFT; ++ data[1] = (reg & I2C_TXRX_DATA_MASK); ++ err = i2c_transfer(client->adapter, msg, 1); ++ if (err >= 0) { ++ msg->flags = I2C_M_RD; ++ msg->len = I2C_TWO_BYTE_TRANSFER; /* 2 byte read */ ++ err = i2c_transfer(client->adapter, msg, 1); ++ if (err >= 0) { ++ val = ((data[0] & I2C_TXRX_DATA_MASK) ++ << I2C_TXRX_DATA_SHIFT) ++ | (data[1] & I2C_TXRX_DATA_MASK); ++ } ++ } ++ } ++ return (int)(0x0000ffff & val); ++} ++ ++ ++ ++static int mt9v113_write_reg(struct i2c_client *client, unsigned short reg, unsigned short val) ++{ ++ int err = 0; ++ int trycnt = 0; ++ ++ struct i2c_msg msg[1]; ++ unsigned char data[4]; ++ err = -1; ++ ++ v4l_dbg(1, debug, client, ++ "mt9v113_write_reg reg=0x%x, val=0x%x\n", ++ reg,val); ++ ++ while ((err < 0) && (trycnt < I2C_RETRY_COUNT)) { ++ trycnt++; ++ if (!client->adapter) { ++ err = -ENODEV; ++ } else { ++ // TODO: addr should be set up where else ++ msg->addr = MT9V113_I2C_ADDR;//client->addr; ++ msg->flags = 0; ++ msg->len = I2C_FOUR_BYTE_TRANSFER; ++ msg->buf = data; ++ data[0] = (reg & I2C_TXRX_DATA_MASK_UPPER) >> ++ I2C_TXRX_DATA_SHIFT; ++ data[1] = (reg & I2C_TXRX_DATA_MASK); ++ data[2] = (val & I2C_TXRX_DATA_MASK_UPPER) >> ++ I2C_TXRX_DATA_SHIFT; ++ data[3] = (val & I2C_TXRX_DATA_MASK); ++ err = i2c_transfer(client->adapter, msg, 1); ++ } ++ } ++ if (err < 0) { ++ printk(KERN_INFO "\n I2C write failed"); ++ } ++ return err; ++} ++ ++/* configure mux, for DM355 EVM only */ ++#ifndef CONFIG_MACH_DM355_LEOPARD ++static int mt9v113_en_mux(struct i2c_client *client) ++{ ++ int err = 0; ++ int trycnt = 0; ++ /* unsigned short readval = 0;*/ ++ ++ struct i2c_msg msg[1]; ++ unsigned char data[4]; ++ err = -1; ++ printk(KERN_INFO ++ "\n entering mt9v113_en_mux \n"); ++ ++ while ((err < 0) && (trycnt < 5)) { ++ trycnt++; ++ if (!client->adapter) { ++ err = -ENODEV; ++ } else { ++ msg->addr = 0x25; ++ msg->flags = 0; ++ msg->len = I2C_TWO_BYTE_TRANSFER; ++ msg->buf = data; ++ data[0] = (unsigned char)(0x08 & I2C_TXRX_DATA_MASK); ++ data[1] = (unsigned char)(0x80 & I2C_TXRX_DATA_MASK); ++ ++ err = i2c_transfer(client->adapter, msg, 1); ++ if (err < 0) { ++ printk(KERN_INFO ++ "\n ERROR in ECP register write\n"); ++ } ++ } ++ } ++ if (err < 0) { ++ printk(KERN_INFO "\n I2C write failed"); ++ } ++ return err; ++} ++#endif ++ ++/* ++ * mt9v113_write_regs : Initializes a list of registers ++ * if token is TOK_TERM, then entire write operation terminates ++ * if token is TOK_DELAY, then a delay of 'val' msec is introduced ++ * if token is TOK_SKIP, then the register write is skipped ++ * if token is TOK_WRITE, then the register write is performed ++ * ++ * reglist - list of registers to be written ++ * Returns zero if successful, or non-zero otherwise. ++ */ ++static int mt9v113_write_regs(struct i2c_client *client, ++ const struct mt9v113_reg reglist[]) ++{ ++ int err; ++ const struct mt9v113_reg *next = reglist; ++ ++ for (; next->token != TOK_TERM; next++) { ++ if (next->token == TOK_DELAY) { ++ msleep(next->val); ++ continue; ++ } ++ ++ if (next->token == TOK_SKIP) ++ continue; ++ ++ err = mt9v113_write_reg(client, next->reg, next->val); ++ if (err < 0) { ++ v4l_err(client, "Write failed. Err[%d]\n", err); ++ return err; ++ } ++ } ++ return 0; ++} ++ ++/* ++ * mt9v113_get_current_std: ++ * Returns the current standard ++ */ ++static enum mt9v113_std mt9v113_get_current_std(struct mt9v113_decoder ++ *decoder) ++{ ++ return MT9V113_STD_VGA; ++} ++ ++/* ++ * Configure the mt9v113 with the current register settings ++ * Returns zero if successful, or non-zero otherwise. ++ */ ++static int mt9v113_configure(struct mt9v113_decoder *decoder) ++{ ++ int err; ++ ++ /* common register initialization */ ++ err = ++ mt9v113_write_regs(decoder->client, mt9v113_reg_list); ++ if (err) ++ return err; ++ ++// if (debug) ++// mt9v113_reg_dump(decoder); ++ ++ return 0; ++} ++ ++/* ++ * Configure the MT9V113 to VGA mode ++ * Returns zero if successful, or non-zero otherwise. ++ */ ++static int mt9v113_vga_mode(struct mt9v113_decoder *decoder) ++{ ++ int err; ++ ++ err = ++ mt9v113_write_regs(decoder->client, mt9v113_vga_reg); ++ if (err) ++ return err; ++ ++ return 0; ++} ++ ++ ++/* ++ * Detect if an mt9v113 is present, and if so which revision. ++ * A device is considered to be detected if the chip ID (LSB and MSB) ++ * registers match the expected values. ++ * Any value of the rom version register is accepted. ++ * Returns ENODEV error number if no device is detected, or zero ++ * if a device is detected. ++ */ ++static int mt9v113_detect(struct mt9v113_decoder *decoder) ++{ ++ unsigned short val=0; ++ ++#ifndef CONFIG_MACH_DM355_LEOPARD ++// mt9v113_en_mux(decoder->client); ++#endif ++ ++ val = mt9v113_read_reg(decoder->client, REG_CHIP_ID); ++ ++ v4l_dbg(1, debug, decoder->client, ++ "chip id detected 0x%x\n", ++ val); ++ ++ if (MT9V113_CHIP_ID != val) { ++ /* We didn't read the values we expected, so this must not be ++ * MT9V113. ++ */ ++ v4l_err(decoder->client, ++ "chip id mismatch read 0x%x, expecting 0x%x\n", val, MT9V113_CHIP_ID); ++ return -ENODEV; ++ } ++ ++ decoder->ver = val; ++ decoder->state = STATE_DETECTED; ++ ++ v4l_info(decoder->client, ++ "%s found at 0x%x (%s)\n", decoder->client->name, ++ decoder->client->addr << 1, ++ decoder->client->adapter->name); ++ ++ return 0; ++} ++ ++/* ++ * Following are decoder interface functions implemented by ++ * mt9v113 decoder driver. ++ */ ++ ++/** ++ * ioctl_querystd - V4L2 decoder interface handler for VIDIOC_QUERYSTD ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @std_id: standard V4L2 std_id ioctl enum ++ * ++ * Returns the current standard detected by mt9v113. If no active input is ++ * detected, returns -EINVAL ++ */ ++static int ioctl_querystd(struct v4l2_int_device *s, v4l2_std_id *std_id) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ enum mt9v113_std current_std; ++ ++ if (std_id == NULL) ++ return -EINVAL; ++ ++ /* get the current standard */ ++ current_std = mt9v113_get_current_std(decoder); ++ if (current_std == MT9V113_IMAGE_STD_INVALID) ++ return -EINVAL; ++ ++ decoder->current_std = current_std; ++ *std_id = decoder->std_list[current_std].standard.id; ++ ++ v4l_dbg(1, debug, decoder->client, "Current STD: %s", ++ decoder->std_list[current_std].standard.name); ++ return 0; ++} ++ ++/** ++ * ioctl_s_std - V4L2 decoder interface handler for VIDIOC_S_STD ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @std_id: standard V4L2 v4l2_std_id ioctl enum ++ * ++ * If std_id is supported, sets the requested standard. Otherwise, returns ++ * -EINVAL ++ */ ++static int ioctl_s_std(struct v4l2_int_device *s, v4l2_std_id *std_id) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ int err, i; ++ ++ if (std_id == NULL) ++ return -EINVAL; ++ ++ for (i = 0; i < decoder->num_stds; i++) ++ if (*std_id & decoder->std_list[i].standard.id) ++ break; ++ ++ if ((i == decoder->num_stds) || (i == MT9V113_STD_INVALID)) ++ return -EINVAL; ++ ++ err = mt9v113_write_reg(decoder->client, REG_VIDEO_STD, ++ decoder->std_list[i].video_std); ++ if (err) ++ return err; ++ ++ decoder->current_std = i; ++ mt9v113_reg_list[REG_VIDEO_STD].val = decoder->std_list[i].video_std; ++ ++ v4l_dbg(1, debug, decoder->client, "Standard set to: %s", ++ decoder->std_list[i].standard.name); ++ return 0; ++} ++ ++/** ++ * ioctl_s_routing - V4L2 decoder interface handler for VIDIOC_S_INPUT ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @index: number of the input ++ * ++ * If index is valid, selects the requested input. Otherwise, returns -EINVAL if ++ * the input is not supported or there is no active signal present in the ++ * selected input. ++ */ ++static int ioctl_s_routing(struct v4l2_int_device *s, ++ struct v4l2_routing *route) ++{ ++ return 0; ++} ++ ++/** ++ * ioctl_queryctrl - V4L2 decoder interface handler for VIDIOC_QUERYCTRL ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @qctrl: standard V4L2 v4l2_queryctrl structure ++ * ++ * If the requested control is supported, returns the control information. ++ * Otherwise, returns -EINVAL if the control is not supported. ++ */ ++static int ++ioctl_queryctrl(struct v4l2_int_device *s, struct v4l2_queryctrl *qctrl) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ int err = -EINVAL; ++ ++ if (qctrl == NULL) ++ return err; ++ ++ switch (qctrl->id) { ++ case V4L2_CID_BRIGHTNESS: ++ /* Brightness supported is same as standard one (0-255), ++ * so make use of standard API provided. ++ */ ++ err = v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 128); ++ break; ++ case V4L2_CID_CONTRAST: ++ case V4L2_CID_SATURATION: ++ /* Saturation and Contrast supported is - ++ * Contrast: 0 - 255 (Default - 128) ++ * Saturation: 0 - 255 (Default - 128) ++ */ ++ err = v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 128); ++ break; ++ case V4L2_CID_HUE: ++ /* Hue Supported is - ++ * Hue - -180 - +180 (Default - 0, Step - +180) ++ */ ++ err = v4l2_ctrl_query_fill(qctrl, -180, 180, 180, 0); ++ break; ++ case V4L2_CID_AUTOGAIN: ++ /* Autogain is either 0 or 1*/ ++ memcpy(qctrl, &mt9v113_autogain_ctrl, ++ sizeof(struct v4l2_queryctrl)); ++ err = 0; ++ break; ++ default: ++ v4l_err(decoder->client, ++ "invalid control id %d\n", qctrl->id); ++ return err; ++ } ++ ++ v4l_dbg(1, debug, decoder->client, ++ "Query Control: %s : Min - %d, Max - %d, Def - %d", ++ qctrl->name, ++ qctrl->minimum, ++ qctrl->maximum, ++ qctrl->default_value); ++ ++ return err; ++} ++ ++/** ++ * ioctl_g_ctrl - V4L2 decoder interface handler for VIDIOC_G_CTRL ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @ctrl: pointer to v4l2_control structure ++ * ++ * If the requested control is supported, returns the control's current ++ * value from the decoder. Otherwise, returns -EINVAL if the control is not ++ * supported. ++ */ ++static int ++ioctl_g_ctrl(struct v4l2_int_device *s, struct v4l2_control *ctrl) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ ++ if (ctrl == NULL) ++ return -EINVAL; ++ ++ switch (ctrl->id) { ++ case V4L2_CID_BRIGHTNESS: ++ ctrl->value = mt9v113_reg_list[REG_BRIGHTNESS].val; ++ break; ++ case V4L2_CID_CONTRAST: ++ ctrl->value = mt9v113_reg_list[REG_CONTRAST].val; ++ break; ++ case V4L2_CID_SATURATION: ++ ctrl->value = mt9v113_reg_list[REG_SATURATION].val; ++ break; ++ case V4L2_CID_HUE: ++ ctrl->value = mt9v113_reg_list[REG_HUE].val; ++ if (ctrl->value == 0x7F) ++ ctrl->value = 180; ++ else if (ctrl->value == 0x80) ++ ctrl->value = -180; ++ else ++ ctrl->value = 0; ++ ++ break; ++ case V4L2_CID_AUTOGAIN: ++ ctrl->value = mt9v113_reg_list[REG_AFE_GAIN_CTRL].val; ++ if ((ctrl->value & 0x3) == 3) ++ ctrl->value = 1; ++ else ++ ctrl->value = 0; ++ ++ break; ++ default: ++ v4l_err(decoder->client, ++ "invalid control id %d\n", ctrl->id); ++ return -EINVAL; ++ } ++ ++ v4l_dbg(1, debug, decoder->client, ++ "Get Control: ID - %d - %d", ++ ctrl->id, ctrl->value); ++ return 0; ++} ++ ++/** ++ * ioctl_s_ctrl - V4L2 decoder interface handler for VIDIOC_S_CTRL ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @ctrl: pointer to v4l2_control structure ++ * ++ * If the requested control is supported, sets the control's current ++ * value in HW. Otherwise, returns -EINVAL if the control is not supported. ++ */ ++static int ++ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *ctrl) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ int err = -EINVAL, value; ++ ++ if (ctrl == NULL) ++ return err; ++ ++ value = (__s32) ctrl->value; ++ ++ switch (ctrl->id) { ++ case V4L2_CID_BRIGHTNESS: ++ if (ctrl->value < 0 || ctrl->value > 255) { ++ v4l_err(decoder->client, ++ "invalid brightness setting %d\n", ++ ctrl->value); ++ return -ERANGE; ++ } ++ err = mt9v113_write_reg(decoder->client, REG_BRIGHTNESS, ++ value); ++ if (err) ++ return err; ++ mt9v113_reg_list[REG_BRIGHTNESS].val = value; ++ break; ++ case V4L2_CID_CONTRAST: ++ if (ctrl->value < 0 || ctrl->value > 255) { ++ v4l_err(decoder->client, ++ "invalid contrast setting %d\n", ++ ctrl->value); ++ return -ERANGE; ++ } ++ err = mt9v113_write_reg(decoder->client, REG_CONTRAST, ++ value); ++ if (err) ++ return err; ++ mt9v113_reg_list[REG_CONTRAST].val = value; ++ break; ++ case V4L2_CID_SATURATION: ++ if (ctrl->value < 0 || ctrl->value > 255) { ++ v4l_err(decoder->client, ++ "invalid saturation setting %d\n", ++ ctrl->value); ++ return -ERANGE; ++ } ++ err = mt9v113_write_reg(decoder->client, REG_SATURATION, ++ value); ++ if (err) ++ return err; ++ mt9v113_reg_list[REG_SATURATION].val = value; ++ break; ++ case V4L2_CID_HUE: ++ if (value == 180) ++ value = 0x7F; ++ else if (value == -180) ++ value = 0x80; ++ else if (value == 0) ++ value = 0; ++ else { ++ v4l_err(decoder->client, ++ "invalid hue setting %d\n", ++ ctrl->value); ++ return -ERANGE; ++ } ++ err = mt9v113_write_reg(decoder->client, REG_HUE, ++ value); ++ if (err) ++ return err; ++ mt9v113_reg_list[REG_HUE].val = value; ++ break; ++ case V4L2_CID_AUTOGAIN: ++ if (value == 1) ++ value = 0x0F; ++ else if (value == 0) ++ value = 0x0C; ++ else { ++ v4l_err(decoder->client, ++ "invalid auto gain setting %d\n", ++ ctrl->value); ++ return -ERANGE; ++ } ++ err = mt9v113_write_reg(decoder->client, REG_AFE_GAIN_CTRL, ++ value); ++ if (err) ++ return err; ++ mt9v113_reg_list[REG_AFE_GAIN_CTRL].val = value; ++ break; ++ default: ++ v4l_err(decoder->client, ++ "invalid control id %d\n", ctrl->id); ++ return err; ++ } ++ ++ v4l_dbg(1, debug, decoder->client, ++ "Set Control: ID - %d - %d", ++ ctrl->id, ctrl->value); ++ ++ return err; ++} ++ ++/** ++ * ioctl_enum_fmt_cap - Implement the CAPTURE buffer VIDIOC_ENUM_FMT ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @fmt: standard V4L2 VIDIOC_ENUM_FMT ioctl structure ++ * ++ * Implement the VIDIOC_ENUM_FMT ioctl to enumerate supported formats ++ */ ++static int ++ioctl_enum_fmt_cap(struct v4l2_int_device *s, struct v4l2_fmtdesc *fmt) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ int index; ++ ++ if (fmt == NULL) ++ return -EINVAL; ++ ++ index = fmt->index; ++ if ((index >= decoder->num_fmts) || (index < 0)) ++ return -EINVAL; /* Index out of bound */ ++ ++ if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; /* only capture is supported */ ++ ++ memcpy(fmt, &decoder->fmt_list[index], ++ sizeof(struct v4l2_fmtdesc)); ++ ++ v4l_dbg(1, debug, decoder->client, ++ "Current FMT: index - %d (%s)", ++ decoder->fmt_list[index].index, ++ decoder->fmt_list[index].description); ++ return 0; ++} ++ ++/** ++ * ioctl_try_fmt_cap - Implement the CAPTURE buffer VIDIOC_TRY_FMT ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @f: pointer to standard V4L2 VIDIOC_TRY_FMT ioctl structure ++ * ++ * Implement the VIDIOC_TRY_FMT ioctl for the CAPTURE buffer type. This ++ * ioctl is used to negotiate the image capture size and pixel format ++ * without actually making it take effect. ++ */ ++static int ++ioctl_try_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ int ifmt; ++ struct v4l2_pix_format *pix; ++ enum mt9v113_std current_std; ++ ++ if (f == NULL) ++ return -EINVAL; ++ ++ if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ ++ pix = &f->fmt.pix; ++ ++ /* Calculate height and width based on current standard */ ++ current_std = mt9v113_get_current_std(decoder); ++ if (current_std == MT9V113_STD_INVALID) ++ return -EINVAL; ++ ++ decoder->current_std = current_std; ++ pix->width = decoder->std_list[current_std].width; ++ pix->height = decoder->std_list[current_std].height; ++ ++ for (ifmt = 0; ifmt < decoder->num_fmts; ifmt++) { ++ if (pix->pixelformat == ++ decoder->fmt_list[ifmt].pixelformat) ++ break; ++ } ++ if (ifmt == decoder->num_fmts) ++ ifmt = 0; /* None of the format matched, select default */ ++ pix->pixelformat = decoder->fmt_list[ifmt].pixelformat; ++ ++ pix->field = V4L2_FIELD_NONE; ++ pix->bytesperline = pix->width * 2; ++ pix->sizeimage = pix->bytesperline * pix->height; ++ pix->colorspace = V4L2_COLORSPACE_SMPTE170M; ++ pix->priv = 0; ++ ++ v4l_dbg(1, debug, decoder->client, ++ "Try FMT: pixelformat - %s, bytesperline - %d" ++ "Width - %d, Height - %d", ++ decoder->fmt_list[ifmt].description, pix->bytesperline, ++ pix->width, pix->height); ++ return 0; ++} ++ ++/** ++ * ioctl_s_fmt_cap - V4L2 decoder interface handler for VIDIOC_S_FMT ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @f: pointer to standard V4L2 VIDIOC_S_FMT ioctl structure ++ * ++ * If the requested format is supported, configures the HW to use that ++ * format, returns error code if format not supported or HW can't be ++ * correctly configured. ++ */ ++static int ++ioctl_s_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ struct v4l2_pix_format *pix; ++ int rval; ++ ++ if (f == NULL) ++ return -EINVAL; ++ ++ if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; /* only capture is supported */ ++ ++ pix = &f->fmt.pix; ++ rval = ioctl_try_fmt_cap(s, f); ++ if (rval) ++ return rval; ++ ++ decoder->pix = *pix; ++ ++ return rval; ++} ++ ++/** ++ * ioctl_g_fmt_cap - V4L2 decoder interface handler for ioctl_g_fmt_cap ++ * @s: pointer to standard V4L2 device structure ++ * @f: pointer to standard V4L2 v4l2_format structure ++ * ++ * Returns the decoder's current pixel format in the v4l2_format ++ * parameter. ++ */ ++static int ++ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ ++ if (f == NULL) ++ return -EINVAL; ++ ++ if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; /* only capture is supported */ ++ ++ f->fmt.pix = decoder->pix; ++ ++ v4l_dbg(1, debug, decoder->client, ++ "Current FMT: bytesperline - %d" ++ "Width - %d, Height - %d", ++ decoder->pix.bytesperline, ++ decoder->pix.width, decoder->pix.height); ++ return 0; ++} ++ ++/** ++ * ioctl_g_parm - V4L2 decoder interface handler for VIDIOC_G_PARM ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @a: pointer to standard V4L2 VIDIOC_G_PARM ioctl structure ++ * ++ * Returns the decoder's video CAPTURE parameters. ++ */ ++static int ++ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ struct v4l2_captureparm *cparm; ++ enum mt9v113_std current_std; ++ ++ if (a == NULL) ++ return -EINVAL; ++ ++ if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; /* only capture is supported */ ++ ++ memset(a, 0, sizeof(*a)); ++ a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ ++ /* get the current standard */ ++ current_std = mt9v113_get_current_std(decoder); ++ if (current_std == MT9V113_STD_INVALID) ++ return -EINVAL; ++ ++ decoder->current_std = current_std; ++ ++ cparm = &a->parm.capture; ++ cparm->capability = V4L2_CAP_TIMEPERFRAME; ++ cparm->timeperframe = ++ decoder->std_list[current_std].standard.frameperiod; ++ ++ return 0; ++} ++ ++/** ++ * ioctl_s_parm - V4L2 decoder interface handler for VIDIOC_S_PARM ioctl ++ * @s: pointer to standard V4L2 device structure ++ * @a: pointer to standard V4L2 VIDIOC_S_PARM ioctl structure ++ * ++ * Configures the decoder to use the input parameters, if possible. If ++ * not possible, returns the appropriate error code. ++ */ ++static int ++ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ struct v4l2_fract *timeperframe; ++ enum mt9v113_std current_std; ++ ++ if (a == NULL) ++ return -EINVAL; ++ ++ if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; /* only capture is supported */ ++ ++ timeperframe = &a->parm.capture.timeperframe; ++ ++ /* get the current standard */ ++ current_std = mt9v113_get_current_std(decoder); ++ if (current_std == MT9V113_STD_INVALID) ++ return -EINVAL; ++ ++ decoder->current_std = current_std; ++ ++ *timeperframe = ++ decoder->std_list[current_std].standard.frameperiod; ++ ++ return 0; ++} ++ ++/** ++ * ioctl_g_ifparm - V4L2 decoder interface handler for vidioc_int_g_ifparm_num ++ * @s: pointer to standard V4L2 device structure ++ * @p: pointer to standard V4L2 vidioc_int_g_ifparm_num ioctl structure ++ * ++ * Gets slave interface parameters. ++ * Calculates the required xclk value to support the requested ++ * clock parameters in p. This value is returned in the p ++ * parameter. ++ */ ++static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ int rval; ++ ++ if (p == NULL) ++ return -EINVAL; ++ ++ if (NULL == decoder->pdata->ifparm) ++ return -EINVAL; ++ ++ rval = decoder->pdata->ifparm(p); ++ if (rval) { ++ v4l_err(decoder->client, "g_ifparm.Err[%d]\n", rval); ++ return rval; ++ } ++ ++ p->u.bt656.clock_curr = 27000000; // TODO: read clock rate from sensor ++ ++ return 0; ++} ++ ++/** ++ * ioctl_g_priv - V4L2 decoder interface handler for vidioc_int_g_priv_num ++ * @s: pointer to standard V4L2 device structure ++ * @p: void pointer to hold decoder's private data address ++ * ++ * Returns device's (decoder's) private data area address in p parameter ++ */ ++static int ioctl_g_priv(struct v4l2_int_device *s, void *p) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ ++ if (NULL == decoder->pdata->priv_data_set) ++ return -EINVAL; ++ ++ return decoder->pdata->priv_data_set(p); ++} ++ ++/** ++ * ioctl_s_power - V4L2 decoder interface handler for vidioc_int_s_power_num ++ * @s: pointer to standard V4L2 device structure ++ * @on: power state to which device is to be set ++ * ++ * Sets devices power state to requrested state, if possible. ++ */ ++static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ int err = 0; ++ ++ switch (on) { ++ case V4L2_POWER_OFF: ++ /* Power Down Sequence */ ++ err = ++ mt9v113_write_reg(decoder->client, REG_OPERATION_MODE, ++ 0x01); ++ /* Disable mux for mt9v113 data path */ ++ if (decoder->pdata->power_set) ++ err |= decoder->pdata->power_set(s, on); ++ decoder->state = STATE_NOT_DETECTED; ++ break; ++ ++ case V4L2_POWER_STANDBY: ++ if (decoder->pdata->power_set) ++ err = decoder->pdata->power_set(s, on); ++ break; ++ ++ case V4L2_POWER_ON: ++ /* Enable mux for mt9v113 data path */ ++ if ((decoder->pdata->power_set) && ++ (decoder->state == STATE_NOT_DETECTED)) { ++ ++ err = decoder->pdata->power_set(s, on); ++ ++ /* Detect the sensor is not already detected */ ++ err |= mt9v113_detect(decoder); ++ if (err) { ++ v4l_err(decoder->client, ++ "Unable to detect decoder\n"); ++ return err; ++ } ++ } ++ // Only VGA mode for now ++ err |= mt9v113_vga_mode(decoder); ++ break; ++ ++ default: ++ err = -ENODEV; ++ break; ++ } ++ ++ return err; ++} ++ ++/** ++ * ioctl_init - V4L2 decoder interface handler for VIDIOC_INT_INIT ++ * @s: pointer to standard V4L2 device structure ++ * ++ * Initialize the decoder device (calls mt9v113_configure()) ++ */ ++static int ioctl_init(struct v4l2_int_device *s) ++{ ++// struct mt9v113_decoder *decoder = s->priv; ++ int err = 0; ++ ++ /* Set default standard to auto */ ++ //mt9v113_reg_list[REG_VIDEO_STD].val = ++ // VIDEO_STD_AUTO_SWITCH_BIT; ++// err |= mt9v113_configure(decoder); ++// err |= mt9v113_vga_mode(decoder); ++ ++ return err; ++} ++ ++/** ++ * ioctl_dev_exit - V4L2 decoder interface handler for vidioc_int_dev_exit_num ++ * @s: pointer to standard V4L2 device structure ++ * ++ * Delinitialise the dev. at slave detach. The complement of ioctl_dev_init. ++ */ ++static int ioctl_dev_exit(struct v4l2_int_device *s) ++{ ++ return 0; ++} ++ ++/** ++ * ioctl_dev_init - V4L2 decoder interface handler for vidioc_int_dev_init_num ++ * @s: pointer to standard V4L2 device structure ++ * ++ * Initialise the device when slave attaches to the master. Returns 0 if ++ * mt9v113 device could be found, otherwise returns appropriate error. ++ */ ++static int ioctl_dev_init(struct v4l2_int_device *s) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ int err; ++ ++ printk("%s: %d\n", __func__, __LINE__); ++ err = mt9v113_detect(decoder); ++ if (err < 0) { ++ v4l_err(decoder->client, ++ "Unable to detect decoder\n"); ++ return err; ++ } ++ ++ v4l_info(decoder->client, ++ "chip version 0x%.2x detected\n", decoder->ver); ++ ++ err |= mt9v113_configure(decoder); ++ err |= mt9v113_vga_mode(decoder); ++ ++ return 0; ++} ++ ++static struct v4l2_int_ioctl_desc mt9v113_ioctl_desc[] = { ++ {vidioc_int_dev_init_num, (v4l2_int_ioctl_func*) ioctl_dev_init}, ++ {vidioc_int_dev_exit_num, (v4l2_int_ioctl_func*) ioctl_dev_exit}, ++ {vidioc_int_s_power_num, (v4l2_int_ioctl_func*) ioctl_s_power}, ++ {vidioc_int_g_priv_num, (v4l2_int_ioctl_func*) ioctl_g_priv}, ++ {vidioc_int_g_ifparm_num, (v4l2_int_ioctl_func*) ioctl_g_ifparm}, ++ {vidioc_int_init_num, (v4l2_int_ioctl_func*) ioctl_init}, ++ {vidioc_int_enum_fmt_cap_num, ++ (v4l2_int_ioctl_func *) ioctl_enum_fmt_cap}, ++ {vidioc_int_try_fmt_cap_num, ++ (v4l2_int_ioctl_func *) ioctl_try_fmt_cap}, ++ {vidioc_int_g_fmt_cap_num, ++ (v4l2_int_ioctl_func *) ioctl_g_fmt_cap}, ++ {vidioc_int_s_fmt_cap_num, ++ (v4l2_int_ioctl_func *) ioctl_s_fmt_cap}, ++ {vidioc_int_g_parm_num, (v4l2_int_ioctl_func *) ioctl_g_parm}, ++ {vidioc_int_s_parm_num, (v4l2_int_ioctl_func *) ioctl_s_parm}, ++ {vidioc_int_queryctrl_num, ++ (v4l2_int_ioctl_func *) ioctl_queryctrl}, ++ {vidioc_int_g_ctrl_num, (v4l2_int_ioctl_func *) ioctl_g_ctrl}, ++ {vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func *) ioctl_s_ctrl}, ++ {vidioc_int_querystd_num, (v4l2_int_ioctl_func *) ioctl_querystd}, ++ {vidioc_int_s_std_num, (v4l2_int_ioctl_func *) ioctl_s_std}, ++ {vidioc_int_s_video_routing_num, ++ (v4l2_int_ioctl_func *) ioctl_s_routing}, ++}; ++ ++static struct v4l2_int_slave mt9v113_slave = { ++ .ioctls = mt9v113_ioctl_desc, ++ .num_ioctls = ARRAY_SIZE(mt9v113_ioctl_desc), ++}; ++ ++static struct mt9v113_decoder mt9v113_dev = { ++ .state = STATE_NOT_DETECTED, ++ ++ .fmt_list = mt9v113_fmt_list, ++ .num_fmts = ARRAY_SIZE(mt9v113_fmt_list), ++ ++ .pix = { /* Default to 8-bit YUV 422 */ ++ .width = VGA_NUM_ACTIVE_PIXELS, ++ .height = VGA_NUM_ACTIVE_LINES, ++ .pixelformat = V4L2_PIX_FMT_UYVY, ++ .field = V4L2_FIELD_NONE, ++ .bytesperline = VGA_NUM_ACTIVE_PIXELS * 2, ++ .sizeimage = ++ VGA_NUM_ACTIVE_PIXELS * 2 * VGA_NUM_ACTIVE_LINES, ++ .colorspace = V4L2_COLORSPACE_SMPTE170M, ++ }, ++ ++ .current_std = MT9V113_STD_VGA, ++ .std_list = mt9v113_std_list, ++ .num_stds = ARRAY_SIZE(mt9v113_std_list), ++ ++}; ++ ++static struct v4l2_int_device mt9v113_int_device = { ++ .module = THIS_MODULE, ++ .name = MT9V113_MODULE_NAME, ++ .priv = &mt9v113_dev, ++ .type = v4l2_int_type_slave, ++ .u = { ++ .slave = &mt9v113_slave, ++ }, ++}; ++ ++/** ++ * mt9v113_probe - decoder driver i2c probe handler ++ * @client: i2c driver client device structure ++ * ++ * Register decoder as an i2c client device and V4L2 ++ * device. ++ */ ++static int ++mt9v113_probe(struct i2c_client *client, const struct i2c_device_id *id) ++{ ++ struct mt9v113_decoder *decoder = &mt9v113_dev; ++ int err; ++ ++ printk("%s: %d\n", __func__, __LINE__); ++ /* Check if the adapter supports the needed features */ ++ if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) ++ return -EIO; ++ ++ printk("%s: %d\n", __func__, __LINE__); ++ decoder->pdata = client->dev.platform_data; ++ if (!decoder->pdata) { ++ v4l_err(client, "No platform data!!\n"); ++ return -ENODEV; ++ } ++ printk("%s: %d\n", __func__, __LINE__); ++ /* ++ * Fetch platform specific data, and configure the ++ * mt9v113_reg_list[] accordingly. Since this is one ++ * time configuration, no need to preserve. ++ */ ++ ++ /*mt9v113_reg_list[REG_OUTPUT_FORMATTER2].val |= ++ (decoder->pdata->clk_polarity << 1); ++ mt9v113_reg_list[REG_SYNC_CONTROL].val |= ++ ((decoder->pdata->hs_polarity << 2) | ++ (decoder->pdata->vs_polarity << 3)); ++ */ ++ /* ++ * Save the id data, required for power up sequence ++ */ ++ decoder->id = (struct i2c_device_id *)id; ++ /* Attach to Master */ ++ strcpy(mt9v113_int_device.u.slave->attach_to, decoder->pdata->master); ++ decoder->v4l2_int_device = &mt9v113_int_device; ++ decoder->client = client; ++ i2c_set_clientdata(client, decoder); ++ ++ /* Register with V4L2 layer as slave device */ ++ err = v4l2_int_device_register(decoder->v4l2_int_device); ++ if (err) { ++ i2c_set_clientdata(client, NULL); ++ v4l_err(client, ++ "Unable to register to v4l2. Err[%d]\n", err); ++ ++ } else ++ v4l_info(client, "Registered to v4l2 master %s!!\n", ++ decoder->pdata->master); ++ ++ return 0; ++} ++ ++/** ++ * mt9v113_remove - decoder driver i2c remove handler ++ * @client: i2c driver client device structure ++ * ++ * Unregister decoder as an i2c client device and V4L2 ++ * device. Complement of mt9v113_probe(). ++ */ ++static int __exit mt9v113_remove(struct i2c_client *client) ++{ ++ struct mt9v113_decoder *decoder = i2c_get_clientdata(client); ++ ++ if (!client->adapter) ++ return -ENODEV; /* our client isn't attached */ ++ ++ v4l2_int_device_unregister(decoder->v4l2_int_device); ++ i2c_set_clientdata(client, NULL); ++ ++ return 0; ++} ++/* ++ * mt9v113 Init/Power on Sequence ++ */ ++static const struct mt9v113_reg mt9v113m_init_reg_seq[] = { ++ {TOK_WRITE, REG_OPERATION_MODE, 0x01}, ++ {TOK_WRITE, REG_OPERATION_MODE, 0x00}, ++}; ++static const struct mt9v113_init_seq mt9v113m_init = { ++ .no_regs = ARRAY_SIZE(mt9v113m_init_reg_seq), ++ .init_reg_seq = mt9v113m_init_reg_seq, ++}; ++/* ++ * I2C Device Table - ++ * ++ * name - Name of the actual device/chip. ++ * driver_data - Driver data ++ */ ++static const struct i2c_device_id mt9v113_id[] = { ++ {"mt9v113", (unsigned long)&mt9v113m_init}, ++ {}, ++}; ++ ++MODULE_DEVICE_TABLE(i2c, mt9v113_id); ++ ++static struct i2c_driver mt9v113_i2c_driver = { ++ .driver = { ++ .name = MT9V113_MODULE_NAME, ++ .owner = THIS_MODULE, ++ }, ++ .probe = mt9v113_probe, ++ .remove = __exit_p(mt9v113_remove), ++ .id_table = mt9v113_id, ++}; ++ ++/** ++ * mt9v113_init ++ * ++ * Module init function ++ */ ++static int __init mt9v113_init(void) ++{ ++ return i2c_add_driver(&mt9v113_i2c_driver); ++} ++ ++/** ++ * mt9v113_cleanup ++ * ++ * Module exit function ++ */ ++static void __exit mt9v113_cleanup(void) ++{ ++ i2c_del_driver(&mt9v113_i2c_driver); ++} ++ ++module_init(mt9v113_init); ++module_exit(mt9v113_cleanup); ++ ++MODULE_AUTHOR("Texas Instruments"); ++MODULE_DESCRIPTION("MT9V113 linux decoder driver"); ++MODULE_LICENSE("GPL"); +diff --git a/drivers/media/video/mt9v113_regs.h b/drivers/media/video/mt9v113_regs.h +new file mode 100644 +index 0000000..64b065f +--- /dev/null ++++ b/drivers/media/video/mt9v113_regs.h +@@ -0,0 +1,294 @@ ++/* ++ * drivers/media/video/mt9v113_regs.h ++ * ++ * Copyright (C) 2008 Texas Instruments Inc ++ * Author: Vaibhav Hiremath <hvaibhav@ti.com> ++ * ++ * Contributors: ++ * Sivaraj R <sivaraj@ti.com> ++ * Brijesh R Jadav <brijesh.j@ti.com> ++ * Hardik Shah <hardik.shah@ti.com> ++ * Manjunath Hadli <mrh@ti.com> ++ * Karicheri Muralidharan <m-karicheri2@ti.com> ++ * ++ * This package is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ */ ++ ++#ifndef _MT9V113_REGS_H ++#define _MT9V113_REGS_H ++ ++/* ++ * MT9V113 registers ++ */ ++#define REG_CHIP_ID (0x00) ++ ++/* ++ * MT9V113 registers ++ */ ++#define REG_INPUT_SEL (0x00) ++#define REG_AFE_GAIN_CTRL (0x01) ++#define REG_VIDEO_STD (0x02) ++#define REG_OPERATION_MODE (0x03) ++#define REG_AUTOSWITCH_MASK (0x04) ++ ++#define REG_COLOR_KILLER (0x05) ++#define REG_LUMA_CONTROL1 (0x06) ++#define REG_LUMA_CONTROL2 (0x07) ++#define REG_LUMA_CONTROL3 (0x08) ++ ++#define REG_BRIGHTNESS (0x09) ++#define REG_CONTRAST (0x0A) ++#define REG_SATURATION (0x0B) ++#define REG_HUE (0x0C) ++ ++#define REG_CHROMA_CONTROL1 (0x0D) ++#define REG_CHROMA_CONTROL2 (0x0E) ++ ++/* 0x0F Reserved */ ++ ++#define REG_COMP_PR_SATURATION (0x10) ++#define REG_COMP_Y_CONTRAST (0x11) ++#define REG_COMP_PB_SATURATION (0x12) ++ ++/* 0x13 Reserved */ ++ ++#define REG_COMP_Y_BRIGHTNESS (0x14) ++ ++/* 0x15 Reserved */ ++ ++#define REG_AVID_START_PIXEL_LSB (0x16) ++#define REG_AVID_START_PIXEL_MSB (0x17) ++#define REG_AVID_STOP_PIXEL_LSB (0x18) ++#define REG_AVID_STOP_PIXEL_MSB (0x19) ++ ++#define REG_HSYNC_START_PIXEL_LSB (0x1A) ++#define REG_HSYNC_START_PIXEL_MSB (0x1B) ++#define REG_HSYNC_STOP_PIXEL_LSB (0x1C) ++#define REG_HSYNC_STOP_PIXEL_MSB (0x1D) ++ ++#define REG_VSYNC_START_LINE_LSB (0x1E) ++#define REG_VSYNC_START_LINE_MSB (0x1F) ++#define REG_VSYNC_STOP_LINE_LSB (0x20) ++#define REG_VSYNC_STOP_LINE_MSB (0x21) ++ ++#define REG_VBLK_START_LINE_LSB (0x22) ++#define REG_VBLK_START_LINE_MSB (0x23) ++#define REG_VBLK_STOP_LINE_LSB (0x24) ++#define REG_VBLK_STOP_LINE_MSB (0x25) ++ ++/* 0x26 - 0x27 Reserved */ ++ ++#define REG_FAST_SWTICH_CONTROL (0x28) ++ ++/* 0x29 Reserved */ ++ ++#define REG_FAST_SWTICH_SCART_DELAY (0x2A) ++ ++/* 0x2B Reserved */ ++ ++#define REG_SCART_DELAY (0x2C) ++#define REG_CTI_DELAY (0x2D) ++#define REG_CTI_CONTROL (0x2E) ++ ++/* 0x2F - 0x31 Reserved */ ++ ++#define REG_SYNC_CONTROL (0x32) ++#define REG_OUTPUT_FORMATTER1 (0x33) ++#define REG_OUTPUT_FORMATTER2 (0x34) ++#define REG_OUTPUT_FORMATTER3 (0x35) ++#define REG_OUTPUT_FORMATTER4 (0x36) ++#define REG_OUTPUT_FORMATTER5 (0x37) ++#define REG_OUTPUT_FORMATTER6 (0x38) ++#define REG_CLEAR_LOST_LOCK (0x39) ++ ++#define REG_STATUS1 (0x3A) ++#define REG_STATUS2 (0x3B) ++ ++#define REG_AGC_GAIN_STATUS_LSB (0x3C) ++#define REG_AGC_GAIN_STATUS_MSB (0x3D) ++ ++/* 0x3E Reserved */ ++ ++#define REG_VIDEO_STD_STATUS (0x3F) ++#define REG_GPIO_INPUT1 (0x40) ++#define REG_GPIO_INPUT2 (0x41) ++ ++/* 0x42 - 0x45 Reserved */ ++ ++#define REG_AFE_COARSE_GAIN_CH1 (0x46) ++#define REG_AFE_COARSE_GAIN_CH2 (0x47) ++#define REG_AFE_COARSE_GAIN_CH3 (0x48) ++#define REG_AFE_COARSE_GAIN_CH4 (0x49) ++ ++#define REG_AFE_FINE_GAIN_PB_B_LSB (0x4A) ++#define REG_AFE_FINE_GAIN_PB_B_MSB (0x4B) ++#define REG_AFE_FINE_GAIN_Y_G_CHROMA_LSB (0x4C) ++#define REG_AFE_FINE_GAIN_Y_G_CHROMA_MSB (0x4D) ++#define REG_AFE_FINE_GAIN_PR_R_LSB (0x4E) ++#define REG_AFE_FINE_GAIN_PR_R_MSB (0x4F) ++#define REG_AFE_FINE_GAIN_CVBS_LUMA_LSB (0x50) ++#define REG_AFE_FINE_GAIN_CVBS_LUMA_MSB (0x51) ++ ++/* 0x52 - 0x68 Reserved */ ++ ++#define REG_FBIT_VBIT_CONTROL1 (0x69) ++ ++/* 0x6A - 0x6B Reserved */ ++ ++#define REG_BACKEND_AGC_CONTROL (0x6C) ++ ++/* 0x6D - 0x6E Reserved */ ++ ++#define REG_AGC_DECREMENT_SPEED_CONTROL (0x6F) ++#define REG_ROM_VERSION (0x70) ++ ++/* 0x71 - 0x73 Reserved */ ++ ++#define REG_AGC_WHITE_PEAK_PROCESSING (0x74) ++#define REG_FBIT_VBIT_CONTROL2 (0x75) ++#define REG_VCR_TRICK_MODE_CONTROL (0x76) ++#define REG_HORIZONTAL_SHAKE_INCREMENT (0x77) ++#define REG_AGC_INCREMENT_SPEED (0x78) ++#define REG_AGC_INCREMENT_DELAY (0x79) ++ ++/* 0x7A - 0x7F Reserved */ ++ ++#define REG_CHIP_ID_MSB (0x80) ++#define REG_CHIP_ID_LSB (0x81) ++ ++/* 0x82 Reserved */ ++ ++#define REG_CPLL_SPEED_CONTROL (0x83) ++ ++/* 0x84 - 0x96 Reserved */ ++ ++#define REG_STATUS_REQUEST (0x97) ++ ++/* 0x98 - 0x99 Reserved */ ++ ++#define REG_VERTICAL_LINE_COUNT_LSB (0x9A) ++#define REG_VERTICAL_LINE_COUNT_MSB (0x9B) ++ ++/* 0x9C - 0x9D Reserved */ ++ ++#define REG_AGC_DECREMENT_DELAY (0x9E) ++ ++/* 0x9F - 0xB0 Reserved */ ++ ++#define REG_VDP_TTX_FILTER_1_MASK1 (0xB1) ++#define REG_VDP_TTX_FILTER_1_MASK2 (0xB2) ++#define REG_VDP_TTX_FILTER_1_MASK3 (0xB3) ++#define REG_VDP_TTX_FILTER_1_MASK4 (0xB4) ++#define REG_VDP_TTX_FILTER_1_MASK5 (0xB5) ++#define REG_VDP_TTX_FILTER_2_MASK1 (0xB6) ++#define REG_VDP_TTX_FILTER_2_MASK2 (0xB7) ++#define REG_VDP_TTX_FILTER_2_MASK3 (0xB8) ++#define REG_VDP_TTX_FILTER_2_MASK4 (0xB9) ++#define REG_VDP_TTX_FILTER_2_MASK5 (0xBA) ++#define REG_VDP_TTX_FILTER_CONTROL (0xBB) ++#define REG_VDP_FIFO_WORD_COUNT (0xBC) ++#define REG_VDP_FIFO_INTERRUPT_THRLD (0xBD) ++ ++/* 0xBE Reserved */ ++ ++#define REG_VDP_FIFO_RESET (0xBF) ++#define REG_VDP_FIFO_OUTPUT_CONTROL (0xC0) ++#define REG_VDP_LINE_NUMBER_INTERRUPT (0xC1) ++#define REG_VDP_PIXEL_ALIGNMENT_LSB (0xC2) ++#define REG_VDP_PIXEL_ALIGNMENT_MSB (0xC3) ++ ++/* 0xC4 - 0xD5 Reserved */ ++ ++#define REG_VDP_LINE_START (0xD6) ++#define REG_VDP_LINE_STOP (0xD7) ++#define REG_VDP_GLOBAL_LINE_MODE (0xD8) ++#define REG_VDP_FULL_FIELD_ENABLE (0xD9) ++#define REG_VDP_FULL_FIELD_MODE (0xDA) ++ ++/* 0xDB - 0xDF Reserved */ ++ ++#define REG_VBUS_DATA_ACCESS_NO_VBUS_ADDR_INCR (0xE0) ++#define REG_VBUS_DATA_ACCESS_VBUS_ADDR_INCR (0xE1) ++#define REG_FIFO_READ_DATA (0xE2) ++ ++/* 0xE3 - 0xE7 Reserved */ ++ ++#define REG_VBUS_ADDRESS_ACCESS1 (0xE8) ++#define REG_VBUS_ADDRESS_ACCESS2 (0xE9) ++#define REG_VBUS_ADDRESS_ACCESS3 (0xEA) ++ ++/* 0xEB - 0xEF Reserved */ ++ ++#define REG_INTERRUPT_RAW_STATUS0 (0xF0) ++#define REG_INTERRUPT_RAW_STATUS1 (0xF1) ++#define REG_INTERRUPT_STATUS0 (0xF2) ++#define REG_INTERRUPT_STATUS1 (0xF3) ++#define REG_INTERRUPT_MASK0 (0xF4) ++#define REG_INTERRUPT_MASK1 (0xF5) ++#define REG_INTERRUPT_CLEAR0 (0xF6) ++#define REG_INTERRUPT_CLEAR1 (0xF7) ++ ++/* 0xF8 - 0xFF Reserved */ ++ ++/* The ID values we are looking for */ ++#define MT9V113_CHIP_ID_MSB (0x51) ++ ++#define MT9V113_IMAGE_STD_VGA (0x01) ++#define MT9V113_IMAGE_STD_QVGA (0x02) ++#define MT9V113_IMAGE_STD_INVALID (0xFF) ++ ++/* ++ * Status bit ++ */ ++#define STATUS_TV_VCR_BIT (1<<0) ++#define STATUS_HORZ_SYNC_LOCK_BIT (1<<1) ++#define STATUS_VIRT_SYNC_LOCK_BIT (1<<2) ++#define STATUS_CLR_SUBCAR_LOCK_BIT (1<<3) ++#define STATUS_LOST_LOCK_DETECT_BIT (1<<4) ++#define STATUS_FEILD_RATE_BIT (1<<5) ++#define STATUS_LINE_ALTERNATING_BIT (1<<6) ++#define STATUS_PEAK_WHITE_DETECT_BIT (1<<7) ++ ++/* Tokens for register write */ ++#define TOK_WRITE (0) /* token for write operation */ ++#define TOK_TERM (1) /* terminating token */ ++#define TOK_DELAY (2) /* delay token for reg list */ ++#define TOK_SKIP (3) /* token to skip a register */ ++/** ++ * struct mt9v113_reg - Structure for TVP5146/47 register initialization values ++ * @token - Token: TOK_WRITE, TOK_TERM etc.. ++ * @reg - Register offset ++ * @val - Register Value for TOK_WRITE or delay in ms for TOK_DELAY ++ */ ++struct mt9v113_reg { ++ unsigned short token; ++ unsigned short reg; ++ unsigned short val; ++}; ++ ++/** ++ * struct mt9v113_init_seq - Structure for TVP5146/47/46M2/47M1 power up ++ * Sequence. ++ * @ no_regs - Number of registers to write for power up sequence. ++ * @ init_reg_seq - Array of registers and respective value to write. ++ */ ++struct mt9v113_init_seq { ++ unsigned int no_regs; ++ const struct mt9v113_reg *init_reg_seq; ++}; ++ ++#define MT9V113_CHIP_ID (0x2280) ++ ++#endif /* ifndef _MT9V113_REGS_H */ +diff --git a/include/media/mt9v113.h b/include/media/mt9v113.h +new file mode 100644 +index 0000000..c7ad362 +--- /dev/null ++++ b/include/media/mt9v113.h +@@ -0,0 +1,83 @@ ++/* ++ * drivers/media/video/mt9v113.h ++ * ++ * Copyright (C) 2008 Texas Instruments Inc ++ * Author: Vaibhav Hiremath <hvaibhav@ti.com> ++ * ++ * Contributors: ++ * Sivaraj R <sivaraj@ti.com> ++ * Brijesh R Jadav <brijesh.j@ti.com> ++ * Hardik Shah <hardik.shah@ti.com> ++ * Manjunath Hadli <mrh@ti.com> ++ * Karicheri Muralidharan <m-karicheri2@ti.com> ++ * ++ * This package is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ++ * ++ */ ++ ++#ifndef _MT9V113_H ++#define _MT9V113_H ++ ++/* ++ * Other macros ++ */ ++#define MT9V113_MODULE_NAME "mt9v113" ++ ++/* Number of pixels and number of lines per frame for different standards */ ++#define VGA_NUM_ACTIVE_PIXELS (640*2) ++#define VGA_NUM_ACTIVE_LINES (480) ++#define QVGA_NUM_ACTIVE_PIXELS (320*2) ++#define QVGA_NUM_ACTIVE_LINES (240) ++ ++/** ++ * struct mt9v113_platform_data - Platform data values and access functions. ++ * @power_set: Power state access function, zero is off, non-zero is on. ++ * @ifparm: Interface parameters access function. ++ * @priv_data_set: Device private data (pointer) access function. ++ * @clk_polarity: Clock polarity of the current interface. ++ * @ hs_polarity: HSYNC Polarity configuration for current interface. ++ * @ vs_polarity: VSYNC Polarity configuration for current interface. ++ */ ++struct mt9v113_platform_data { ++ char *master; ++ int (*power_set) (struct v4l2_int_device *s, enum v4l2_power on); ++ int (*ifparm) (struct v4l2_ifparm *p); ++ int (*priv_data_set) (void *); ++ /* Interface control params */ ++ bool clk_polarity; ++ bool hs_polarity; ++ bool vs_polarity; ++}; ++ ++// new ++ ++/*i2c adress for MT9V113*/ ++#define MT9V113_I2C_ADDR (0x78 >>1) ++ ++#define I2C_ONE_BYTE_TRANSFER (1) ++#define I2C_TWO_BYTE_TRANSFER (2) ++#define I2C_THREE_BYTE_TRANSFER (3) ++#define I2C_FOUR_BYTE_TRANSFER (4) ++#define I2C_TXRX_DATA_MASK (0x00FF) ++#define I2C_TXRX_DATA_MASK_UPPER (0xFF00) ++#define I2C_TXRX_DATA_SHIFT (8) ++ ++#define MT9V113_VGA_30FPS (1130) ++#define MT9V113_QVGA_30FPS (1131) ++ ++#define MT9V113_CLK_MAX (54000000) /* 54MHz */ ++#define MT9V113_CLK_MIN (6000000) /* 6Mhz */ ++ ++#endif /* ifndef _MT9V113_H */ ++ +diff --git a/include/media/v4l2-int-device.h b/include/media/v4l2-int-device.h +index ce415ec..7827575 100644 +--- a/include/media/v4l2-int-device.h ++++ b/include/media/v4l2-int-device.h +@@ -115,6 +115,7 @@ enum v4l2_if_type { + V4L2_IF_TYPE_BT656, + V4L2_IF_TYPE_YCbCr, + V4L2_IF_TYPE_RAW, ++ V4L2_IF_TYPE_PARALLEL, + }; + + enum v4l2_if_type_bt656_mode { +@@ -215,12 +216,38 @@ struct v4l2_if_type_raw { + u32 clock_curr; + }; + ++struct v4l2_if_type_parallel { ++ /* ++ * 0: Frame begins when vsync is high. ++ * 1: Frame begins when vsync changes from low to high. ++ */ ++ unsigned frame_start_on_rising_vs:1; ++ /* Swap every two adjacent image data elements. */ ++ unsigned swap:1; ++ /* Inverted latch clock polarity from slave. */ ++ unsigned latch_clk_inv:1; ++ /* Hs polarity. 0 is active high, 1 active low. */ ++ unsigned no_hs_inv:1; ++ /* Vs polarity. 0 is active high, 1 active low. */ ++ unsigned no_vs_inv:1; ++ /* Minimum accepted bus clock for slave (in Hz). */ ++ u32 clock_min; ++ /* Maximum accepted bus clock for slave. */ ++ u32 clock_max; ++ /* ++ * Current wish of the slave. May only change in response to ++ * ioctls that affect image capture. ++ */ ++ u32 clock_curr; ++}; ++ + struct v4l2_ifparm { + enum v4l2_if_type if_type; + union { + struct v4l2_if_type_bt656 bt656; + struct v4l2_if_type_ycbcr ycbcr; + struct v4l2_if_type_raw raw; ++ struct v4l2_if_type_parallel parallel; + } u; + }; + +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0032-MT9V113-Fixed-sensor-nitialization-issues.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0032-MT9V113-Fixed-sensor-nitialization-issues.patch new file mode 100644 index 0000000000..6842c4b099 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0032-MT9V113-Fixed-sensor-nitialization-issues.patch @@ -0,0 +1,294 @@ +From 85fc82296bf6f9eaaad63e0aee2c0ec98a0d6ed9 Mon Sep 17 00:00:00 2001 +From: Vaibhav Hiremath <hvaibhav@ti.com> +Date: Fri, 9 Jul 2010 17:38:09 +0530 +Subject: [PATCH 32/71] MT9V113: Fixed sensor nitialization issues + +With this patch sensor is now able to generate HS, VS and pixel clock, also +CCDC is able to generate HS/VS, VD0, VD1 interrupts. + +There are some issues with Buffer processing in ISR routine because of which +DQBUF still hangs. +--- + drivers/media/video/mt9v113.c | 155 ++++++++++++++++++++---------------- + drivers/media/video/omap34xxcam.c | 2 +- + 2 files changed, 87 insertions(+), 70 deletions(-) + +diff --git a/drivers/media/video/mt9v113.c b/drivers/media/video/mt9v113.c +index 755a88a..8f8ba35 100644 +--- a/drivers/media/video/mt9v113.c ++++ b/drivers/media/video/mt9v113.c +@@ -389,8 +389,8 @@ static int mt9v113_read_reg(struct i2c_client *client, unsigned short reg) + err = -ENODEV; + return err; + }else { +- // TODO: addr should be set up where else +- msg->addr = MT9V113_I2C_ADDR;//client->addr; ++ /* TODO: addr should be set up where else client->addr */ ++ msg->addr = MT9V113_I2C_ADDR; + msg->flags = 0; + msg->len = I2C_TWO_BYTE_TRANSFER; + msg->buf = data; +@@ -432,8 +432,8 @@ static int mt9v113_write_reg(struct i2c_client *client, unsigned short reg, unsi + if (!client->adapter) { + err = -ENODEV; + } else { +- // TODO: addr should be set up where else +- msg->addr = MT9V113_I2C_ADDR;//client->addr; ++ /* TODO:addr should be set up where else client->addr */ ++ msg->addr = MT9V113_I2C_ADDR; + msg->flags = 0; + msg->len = I2C_FOUR_BYTE_TRANSFER; + msg->buf = data; +@@ -446,51 +446,11 @@ static int mt9v113_write_reg(struct i2c_client *client, unsigned short reg, unsi + err = i2c_transfer(client->adapter, msg, 1); + } + } +- if (err < 0) { ++ if (err < 0) + printk(KERN_INFO "\n I2C write failed"); +- } +- return err; +-} +- +-/* configure mux, for DM355 EVM only */ +-#ifndef CONFIG_MACH_DM355_LEOPARD +-static int mt9v113_en_mux(struct i2c_client *client) +-{ +- int err = 0; +- int trycnt = 0; +- /* unsigned short readval = 0;*/ +- +- struct i2c_msg msg[1]; +- unsigned char data[4]; +- err = -1; +- printk(KERN_INFO +- "\n entering mt9v113_en_mux \n"); +- +- while ((err < 0) && (trycnt < 5)) { +- trycnt++; +- if (!client->adapter) { +- err = -ENODEV; +- } else { +- msg->addr = 0x25; +- msg->flags = 0; +- msg->len = I2C_TWO_BYTE_TRANSFER; +- msg->buf = data; +- data[0] = (unsigned char)(0x08 & I2C_TXRX_DATA_MASK); +- data[1] = (unsigned char)(0x80 & I2C_TXRX_DATA_MASK); + +- err = i2c_transfer(client->adapter, msg, 1); +- if (err < 0) { +- printk(KERN_INFO +- "\n ERROR in ECP register write\n"); +- } +- } +- } +- if (err < 0) { +- printk(KERN_INFO "\n I2C write failed"); +- } + return err; + } +-#endif + + /* + * mt9v113_write_regs : Initializes a list of registers +@@ -550,9 +510,10 @@ static int mt9v113_configure(struct mt9v113_decoder *decoder) + if (err) + return err; + +-// if (debug) +-// mt9v113_reg_dump(decoder); +- ++#if 0 ++ if (debug) ++ mt9v113_reg_dump(decoder); ++#endif + return 0; + } + +@@ -573,6 +534,62 @@ static int mt9v113_vga_mode(struct mt9v113_decoder *decoder) + } + + ++/** ++ * ioctl_enum_framesizes - V4L2 sensor if handler for vidioc_int_enum_framesizes ++ * @s: pointer to standard V4L2 device structure ++ * @frms: pointer to standard V4L2 framesizes enumeration structure ++ * ++ * Returns possible framesizes depending on choosen pixel format ++ **/ ++static int ioctl_enum_framesizes(struct v4l2_int_device *s, ++ struct v4l2_frmsizeenum *frms) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ int ifmt; ++ ++ for (ifmt = 0; ifmt < decoder->num_fmts; ifmt++) { ++ if (frms->pixel_format == decoder->fmt_list[ifmt].pixelformat) ++ break; ++ } ++ /* Is requested pixelformat not found on sensor? */ ++ if (ifmt == decoder->num_fmts) ++ return -EINVAL; ++ ++ /* Do we already reached all discrete framesizes? */ ++ if (frms->index >= decoder->num_stds) ++ return -EINVAL; ++ ++ frms->type = V4L2_FRMSIZE_TYPE_DISCRETE; ++ frms->discrete.width = decoder->std_list[frms->index].width; ++ frms->discrete.height = decoder->std_list[frms->index].height; ++ ++ return 0; ++ ++} ++ ++static int ioctl_enum_frameintervals(struct v4l2_int_device *s, ++ struct v4l2_frmivalenum *frmi) ++{ ++ struct mt9v113_decoder *decoder = s->priv; ++ int ifmt; ++ ++ if (frmi->index >= 1) ++ return -EINVAL; ++ ++ for (ifmt = 0; ifmt < decoder->num_fmts; ifmt++) { ++ if (frmi->pixel_format == decoder->fmt_list[ifmt].pixelformat) ++ break; ++ } ++ /* Is requested pixelformat not found on sensor? */ ++ if (ifmt == decoder->num_fmts) ++ return -EINVAL; ++ ++ frmi->type = V4L2_FRMSIZE_TYPE_DISCRETE; ++ frmi->discrete.numerator = 1; ++ frmi->discrete.denominator = 10; ++ return 0; ++} ++ + /* + * Detect if an mt9v113 is present, and if so which revision. + * A device is considered to be detected if the chip ID (LSB and MSB) +@@ -585,15 +602,9 @@ static int mt9v113_detect(struct mt9v113_decoder *decoder) + { + unsigned short val=0; + +-#ifndef CONFIG_MACH_DM355_LEOPARD +-// mt9v113_en_mux(decoder->client); +-#endif +- + val = mt9v113_read_reg(decoder->client, REG_CHIP_ID); + +- v4l_dbg(1, debug, decoder->client, +- "chip id detected 0x%x\n", +- val); ++ v4l_dbg(1, debug, decoder->client, "chip id detected 0x%x\n", val); + + if (MT9V113_CHIP_ID != val) { + /* We didn't read the values we expected, so this must not be +@@ -1042,7 +1053,7 @@ ioctl_s_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f) + if (rval) + return rval; + +- decoder->pix = *pix; ++ decoder->pix = *pix; + + return rval; + } +@@ -1177,7 +1188,7 @@ static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p) + return rval; + } + +- p->u.bt656.clock_curr = 27000000; // TODO: read clock rate from sensor ++ p->u.bt656.clock_curr = 27000000; /* TODO:read clock rate from sensor */ + + return 0; + } +@@ -1211,12 +1222,17 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) + struct mt9v113_decoder *decoder = s->priv; + int err = 0; + ++ if (decoder->state == STATE_DETECTED) ++ return 0; ++ + switch (on) { + case V4L2_POWER_OFF: + /* Power Down Sequence */ +- err = +- mt9v113_write_reg(decoder->client, REG_OPERATION_MODE, +- 0x01); ++/* TODO: FIXME: implement proper OFF and Standby code here */ ++#if 0 ++ err = mt9v113_write_reg(decoder->client, REG_OPERATION_MODE, ++ 0x01); ++#endif + /* Disable mux for mt9v113 data path */ + if (decoder->pdata->power_set) + err |= decoder->pdata->power_set(s, on); +@@ -1242,9 +1258,10 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) + "Unable to detect decoder\n"); + return err; + } ++ /* Only VGA mode for now */ ++ err |= mt9v113_configure(decoder); ++ err |= mt9v113_vga_mode(decoder); + } +- // Only VGA mode for now +- err |= mt9v113_vga_mode(decoder); + break; + + default: +@@ -1263,14 +1280,11 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) + */ + static int ioctl_init(struct v4l2_int_device *s) + { +-// struct mt9v113_decoder *decoder = s->priv; ++ struct mt9v113_decoder *decoder = s->priv; + int err = 0; + +- /* Set default standard to auto */ +- //mt9v113_reg_list[REG_VIDEO_STD].val = +- // VIDEO_STD_AUTO_SWITCH_BIT; +-// err |= mt9v113_configure(decoder); +-// err |= mt9v113_vga_mode(decoder); ++ err |= mt9v113_configure(decoder); ++ err |= mt9v113_vga_mode(decoder); + + return err; + } +@@ -1298,7 +1312,6 @@ static int ioctl_dev_init(struct v4l2_int_device *s) + struct mt9v113_decoder *decoder = s->priv; + int err; + +- printk("%s: %d\n", __func__, __LINE__); + err = mt9v113_detect(decoder); + if (err < 0) { + v4l_err(decoder->client, +@@ -1340,6 +1353,10 @@ static struct v4l2_int_ioctl_desc mt9v113_ioctl_desc[] = { + {vidioc_int_s_std_num, (v4l2_int_ioctl_func *) ioctl_s_std}, + {vidioc_int_s_video_routing_num, + (v4l2_int_ioctl_func *) ioctl_s_routing}, ++ {vidioc_int_enum_framesizes_num, ++ (v4l2_int_ioctl_func *)ioctl_enum_framesizes}, ++ {vidioc_int_enum_frameintervals_num, ++ (v4l2_int_ioctl_func *)ioctl_enum_frameintervals}, + }; + + static struct v4l2_int_slave mt9v113_slave = { +diff --git a/drivers/media/video/omap34xxcam.c b/drivers/media/video/omap34xxcam.c +index 6301ed3..2e8153b 100644 +--- a/drivers/media/video/omap34xxcam.c ++++ b/drivers/media/video/omap34xxcam.c +@@ -1852,8 +1852,8 @@ static int omap34xxcam_open(struct file *file) + vdev->slave_config[OMAP34XXCAM_SLAVE_SENSOR] + .cur_input = route.input; + } +- sensor_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + } ++ sensor_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + /* Get the format the sensor is using. */ + rval = vidioc_int_g_fmt_cap(vdev->vdev_sensor, &sensor_format); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0033-mt9v113-Fix-wrong-active-widths.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0033-mt9v113-Fix-wrong-active-widths.patch new file mode 100644 index 0000000000..54b8bb64b5 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0033-mt9v113-Fix-wrong-active-widths.patch @@ -0,0 +1,29 @@ +From 7838aaa29f4b131cb034d56ea41b900ff9f04551 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Fri, 9 Jul 2010 16:22:38 -0500 +Subject: [PATCH 33/71] mt9v113: Fix wrong active widths + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + include/media/mt9v113.h | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/include/media/mt9v113.h b/include/media/mt9v113.h +index c7ad362..0a30f4c 100644 +--- a/include/media/mt9v113.h ++++ b/include/media/mt9v113.h +@@ -35,9 +35,9 @@ + #define MT9V113_MODULE_NAME "mt9v113" + + /* Number of pixels and number of lines per frame for different standards */ +-#define VGA_NUM_ACTIVE_PIXELS (640*2) ++#define VGA_NUM_ACTIVE_PIXELS (640) + #define VGA_NUM_ACTIVE_LINES (480) +-#define QVGA_NUM_ACTIVE_PIXELS (320*2) ++#define QVGA_NUM_ACTIVE_PIXELS (320) + #define QVGA_NUM_ACTIVE_LINES (240) + + /** +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0034-omap3isp-Fix-Wrong-check-on-non-interlaced-sensor-on.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0034-omap3isp-Fix-Wrong-check-on-non-interlaced-sensor-on.patch new file mode 100644 index 0000000000..ce9cb1a364 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0034-omap3isp-Fix-Wrong-check-on-non-interlaced-sensor-on.patch @@ -0,0 +1,34 @@ +From 242df5600b1bb1173670846eac802840d4601de0 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Fri, 9 Jul 2010 16:56:18 -0500 +Subject: [PATCH 34/71] omap3isp: Fix Wrong check on non-interlaced sensor on isr + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/isp/isp.c | 9 +++++---- + 1 files changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/media/video/isp/isp.c b/drivers/media/video/isp/isp.c +index 29dd005..2ef2d58 100644 +--- a/drivers/media/video/isp/isp.c ++++ b/drivers/media/video/isp/isp.c +@@ -978,11 +978,12 @@ static irqreturn_t omap34xx_isp_isr(int irq, void *_pdev) + } + + if (irqstatus & CCDC_VD0) { +- if (isp->pipeline.pix.field == V4L2_FIELD_INTERLACED) { ++ if (((isp->pipeline.pix.field == V4L2_FIELD_INTERLACED) && ++ (isp->current_field != 0)) || ++ (isp->pipeline.pix.field != V4L2_FIELD_INTERLACED)) { + /* Skip even fields, and process only odd fields */ +- if (isp->current_field != 0) +- if (RAW_CAPTURE(isp)) +- isp_buf_process(dev, bufs); ++ if (RAW_CAPTURE(isp)) ++ isp_buf_process(dev, bufs); + } + if (!ispccdc_busy(&isp->isp_ccdc)) + ispccdc_config_shadow_registers(&isp->isp_ccdc); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0035-omap3isp-Fix-bad-YUV_BT-checks-in-datapath_config.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0035-omap3isp-Fix-bad-YUV_BT-checks-in-datapath_config.patch new file mode 100644 index 0000000000..11f1ce6255 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0035-omap3isp-Fix-bad-YUV_BT-checks-in-datapath_config.patch @@ -0,0 +1,45 @@ +From 6a768a155a2758aa55e27574dd2e5d268b54079b Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Sat, 10 Jul 2010 09:51:16 -0500 +Subject: [PATCH 35/71] omap3isp: Fix bad YUV_BT checks in datapath_config + +The use of an external write enable signals (from ISP point of +view) shouldn't depend on the sensor parallel interface type. + +Also, the bit shift selection should NOT be other than 9_0 by +default (i.e. No shift). + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/isp/ispccdc.c | 15 +++++---------- + 1 files changed, 5 insertions(+), 10 deletions(-) + +diff --git a/drivers/media/video/isp/ispccdc.c b/drivers/media/video/isp/ispccdc.c +index 137a5e6..ea6d87c 100644 +--- a/drivers/media/video/isp/ispccdc.c ++++ b/drivers/media/video/isp/ispccdc.c +@@ -602,16 +602,11 @@ static int ispccdc_config_datapath(struct isp_ccdc_device *isp_ccdc, + syn_mode &= ~ISPCCDC_SYN_MODE_VP2SDR; + syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ; + syn_mode |= ISPCCDC_SYN_MODE_WEN; +- if (pipe->ccdc_in == CCDC_YUV_BT) { +- syn_mode &= ~ISPCCDC_SYN_MODE_EXWEN; +- isp_reg_and(isp_ccdc->dev, OMAP3_ISP_IOMEM_CCDC, +- ISPCCDC_CFG, ~ISPCCDC_CFG_WENLOG); +- } else { +- syn_mode |= ISPCCDC_SYN_MODE_EXWEN; +- isp_reg_or(isp_ccdc->dev, OMAP3_ISP_IOMEM_CCDC, +- ISPCCDC_CFG, ISPCCDC_CFG_WENLOG); +- } +- vpcfg.bitshift_sel = BIT11_2; ++ syn_mode &= ~ISPCCDC_SYN_MODE_EXWEN; ++ ++ isp_reg_and(isp_ccdc->dev, OMAP3_ISP_IOMEM_CCDC, ++ ISPCCDC_CFG, ~ISPCCDC_CFG_WENLOG); ++ vpcfg.bitshift_sel = BIT9_0; + vpcfg.freq_sel = PIXCLKBY2; + ispccdc_config_vp(isp_ccdc, vpcfg); + ispccdc_enable_vp(isp_ccdc, 0); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0036-omap3isp-Set-vd_pol-to-0-by-default-on-all-cases.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0036-omap3isp-Set-vd_pol-to-0-by-default-on-all-cases.patch new file mode 100644 index 0000000000..a6750d3a16 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0036-omap3isp-Set-vd_pol-to-0-by-default-on-all-cases.patch @@ -0,0 +1,35 @@ +From 92135e4024ba2115305da23acb9d13bd0f9251b1 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Sat, 10 Jul 2010 09:57:40 -0500 +Subject: [PATCH 36/71] omap3isp: Set vd_pol to 0 by default on all cases + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/isp/ispccdc.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/video/isp/ispccdc.c b/drivers/media/video/isp/ispccdc.c +index ea6d87c..b4691c0 100644 +--- a/drivers/media/video/isp/ispccdc.c ++++ b/drivers/media/video/isp/ispccdc.c +@@ -671,7 +671,7 @@ static int ispccdc_config_datapath(struct isp_ccdc_device *isp_ccdc, + syncif.fldstat = 0; + syncif.hdpol = 0; + syncif.ipmod = YUV16; +- syncif.vdpol = 1; ++ syncif.vdpol = 0; + syncif.bt_r656_en = 0; + ispccdc_config_imgattr(isp_ccdc, 0); + ispccdc_config_sync_if(isp_ccdc, syncif); +@@ -688,7 +688,7 @@ static int ispccdc_config_datapath(struct isp_ccdc_device *isp_ccdc, + syncif.fldstat = 0; + syncif.hdpol = 0; + syncif.ipmod = YUV8; +- syncif.vdpol = 1; ++ syncif.vdpol = 0; + syncif.bt_r656_en = 1; + ispccdc_config_imgattr(isp_ccdc, 0); + ispccdc_config_sync_if(isp_ccdc, syncif); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0037-omap3isp-ccdc-Set-datalines-to-10-for-YUV_SYNC.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0037-omap3isp-ccdc-Set-datalines-to-10-for-YUV_SYNC.patch new file mode 100644 index 0000000000..479d79d553 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0037-omap3isp-ccdc-Set-datalines-to-10-for-YUV_SYNC.patch @@ -0,0 +1,29 @@ +From 059f8c94d288f5e40f38aa86344ae7556c0f0f45 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Mon, 12 Jul 2010 14:09:38 -0500 +Subject: [PATCH 37/71] omap3isp: ccdc: Set datalines to 10 for YUV_SYNC + +Most of the sensors we use are 10 bits, so set this as +default. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/isp/ispccdc.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/drivers/media/video/isp/ispccdc.c b/drivers/media/video/isp/ispccdc.c +index b4691c0..280a721 100644 +--- a/drivers/media/video/isp/ispccdc.c ++++ b/drivers/media/video/isp/ispccdc.c +@@ -664,7 +664,7 @@ static int ispccdc_config_datapath(struct isp_ccdc_device *isp_ccdc, + case CCDC_YUV_SYNC: + syncif.ccdc_mastermode = 0; + syncif.datapol = 0; +- syncif.datsz = DAT8; ++ syncif.datsz = DAT10; + syncif.fldmode = 0; + syncif.fldout = 0; + syncif.fldpol = 0; +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0038-omap3beagle-camera-Fix-parallel-i-f-settings.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0038-omap3beagle-camera-Fix-parallel-i-f-settings.patch new file mode 100644 index 0000000000..1d66de72b6 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0038-omap3beagle-camera-Fix-parallel-i-f-settings.patch @@ -0,0 +1,43 @@ +From 35c871dc139883d790a0080b9f3a9bfcf0a5a24c Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Mon, 12 Jul 2010 14:11:44 -0500 +Subject: [PATCH 38/71] omap3beagle: camera: Fix parallel i/f settings + +This makes the sensor input be shifted from 13:4 -> 9:0, as +in YUV streaming, the 8 least significant pins are used. + +Also, activate the 8 to 16 bit conversion bridge in ISP, in +big endian mode. + +This makes the ISP interpret the data correctly now. ;) + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index 6c06265..0a591a1 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -64,7 +64,7 @@ static struct regulator *beagle_mt9v113_1_8v2; + + static struct isp_interface_config mt9v113_if_config = { + .ccdc_par_ser = ISP_PARLL, +- .dataline_shift = 0x0, ++ .dataline_shift = 0x2, + .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE, + .strobe = 0x0, + .prestrobe = 0x0, +@@ -72,7 +72,7 @@ static struct isp_interface_config mt9v113_if_config = { + .cam_mclk = ISP_MT9V113_MCLK, + .wenlog = ISPCCDC_CFG_WENLOG_AND, + .wait_hs_vs = 2, +- .u.par.par_bridge = 0x1, ++ .u.par.par_bridge = 0x3, + .u.par.par_clk_pol = 0x0, + }; + +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0039-omap3beagle-camera-Clean-up-Remove-unneccessary-code.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0039-omap3beagle-camera-Clean-up-Remove-unneccessary-code.patch new file mode 100644 index 0000000000..28b92fd7c9 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0039-omap3beagle-camera-Clean-up-Remove-unneccessary-code.patch @@ -0,0 +1,118 @@ +From a776cd344136f046bea77e223bf53912cd5f21bc Mon Sep 17 00:00:00 2001 +From: Vaibhav Hiremath <hvaibhav@ti.com> +Date: Tue, 13 Jul 2010 19:38:51 +0530 +Subject: [PATCH 39/71] omap3beagle-camera:Clean up: Remove unneccessary code/printf + +Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 25 +++-------------------- + 1 files changed, 4 insertions(+), 21 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index 0a591a1..be59040 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -77,7 +77,7 @@ static struct isp_interface_config mt9v113_if_config = { + }; + + static struct v4l2_ifparm mt9v113_ifparm_s = { +-#if 1 ++#if 0 + .if_type = V4L2_IF_TYPE_RAW, + .u = { + .raw = { +@@ -192,32 +192,24 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power) + + /* turn on VDD */ + regulator_enable(beagle_mt9v113_1_8v1); +- + mdelay(1); +- + /* turn on VDD_IO */ + regulator_enable(beagle_mt9v113_1_8v2); +- + mdelay(50); + + /* Enable EXTCLK */ + isp_set_xclk(vdev->cam->isp, MT9V113_CLK_MIN, CAM_USE_XCLKA); +- + /* + * Wait at least 70 CLK cycles (w/EXTCLK = 6MHz, or CLK_MIN): + * ((1000000 * 70) / 6000000) = aprox 12 us. + */ +- + udelay(12); +- + /* Set RESET_BAR to 1 */ + gpio_set_value(LEOPARD_RESET_GPIO, 1); +- + /* + * Wait at least 100 CLK cycles (w/EXTCLK = 6MHz, or CLK_MIN): + * ((1000000 * 100) / 6000000) = aprox 17 us. + */ +- + udelay(17); + + break; +@@ -245,15 +237,11 @@ struct mt9v113_platform_data mt9v113_pdata = { + + static int beagle_cam_probe(struct platform_device *pdev) + { +- int err; +- +- printk("%s:%d\n", __func__, __LINE__); + beagle_mt9v113_1_8v1 = regulator_get(&pdev->dev, "vaux3_1"); + if (IS_ERR(beagle_mt9v113_1_8v1)) { + dev_err(&pdev->dev, "vaux3_1 regulator missing\n"); + return PTR_ERR(beagle_mt9v113_1_8v1); + } +- printk("%s:%d\n", __func__, __LINE__); + beagle_mt9v113_1_8v2 = regulator_get(&pdev->dev, "vaux4_1"); + if (IS_ERR(beagle_mt9v113_1_8v2)) { + dev_err(&pdev->dev, "vaux4_1 regulator missing\n"); +@@ -261,7 +249,6 @@ static int beagle_cam_probe(struct platform_device *pdev) + return PTR_ERR(beagle_mt9v113_1_8v2); + } + +- printk("%s:%d\n", __func__, __LINE__); + if (gpio_request(LEOPARD_RESET_GPIO, "cam_rst") != 0) { + dev_err(&pdev->dev, "Could not request GPIO %d", + LEOPARD_RESET_GPIO); +@@ -270,7 +257,6 @@ static int beagle_cam_probe(struct platform_device *pdev) + return -ENODEV; + } + +- printk("%s:%d\n", __func__, __LINE__); + /* set to output mode, default value 0 */ + gpio_direction_output(LEOPARD_RESET_GPIO, 0); + +@@ -281,10 +267,10 @@ static int beagle_cam_probe(struct platform_device *pdev) + + static int beagle_cam_remove(struct platform_device *pdev) + { +- printk("%s:%d\n", __func__, __LINE__); + if (regulator_is_enabled(beagle_mt9v113_1_8v1)) + regulator_disable(beagle_mt9v113_1_8v1); + regulator_put(beagle_mt9v113_1_8v1); ++ + if (regulator_is_enabled(beagle_mt9v113_1_8v2)) + regulator_disable(beagle_mt9v113_1_8v2); + regulator_put(beagle_mt9v113_1_8v2); +@@ -360,12 +346,9 @@ static struct platform_driver beagle_cam_driver = { + */ + int __init omap3beaglelmb_init(void) + { +- printk("%s:%d\n", __func__, __LINE__); +- if (cpu_is_omap3630()) { +- printk("%s:%d\n", __func__, __LINE__); ++ if (cpu_is_omap3630()) + platform_driver_register(&beagle_cam_driver); +- } +- printk("%s:%d\n", __func__, __LINE__); ++ + return 0; + } + late_initcall(omap3beaglelmb_init); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0040-mt9v113-Clean-Up-Remove-unneccessary-code-printf.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0040-mt9v113-Clean-Up-Remove-unneccessary-code-printf.patch new file mode 100644 index 0000000000..ef7b425473 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0040-mt9v113-Clean-Up-Remove-unneccessary-code-printf.patch @@ -0,0 +1,390 @@ +From aea0e79b7ace8ffc3b6752276d693af54a23cdb8 Mon Sep 17 00:00:00 2001 +From: Vaibhav Hiremath <hvaibhav@ti.com> +Date: Tue, 13 Jul 2010 19:39:34 +0530 +Subject: [PATCH 40/71] mt9v113:Clean Up: Remove unneccessary code/printf + +Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com> +--- + drivers/media/video/mt9v113.c | 105 ++++++++++++++++------------------------ + 1 files changed, 42 insertions(+), 63 deletions(-) + +diff --git a/drivers/media/video/mt9v113.c b/drivers/media/video/mt9v113.c +index 8f8ba35..9a86cce 100644 +--- a/drivers/media/video/mt9v113.c ++++ b/drivers/media/video/mt9v113.c +@@ -22,10 +22,10 @@ + #include <linux/i2c.h> + #include <linux/delay.h> + #include <linux/videodev2.h> ++#include <linux/io.h> ++ + #include <media/v4l2-int-device.h> + #include <media/mt9v113.h> +-#include <mach/hardware.h> +-#include <linux/io.h> + + #include "mt9v113_regs.h" + +@@ -34,21 +34,13 @@ + + /* Private macros for TVP */ + #define I2C_RETRY_COUNT (5) +-#define LOCK_RETRY_COUNT (5) +-#define LOCK_RETRY_DELAY (200) + + /* Debug functions */ + static int debug = 1; + module_param(debug, bool, 0644); + MODULE_PARM_DESC(debug, "Debug level (0-1)"); + +-#define dump_reg(client, reg, val) \ +- do { \ +- val = mt9v113_read_reg(client, reg); \ +- v4l_info(client, "Reg(0x%.2X): 0x%.2X\n", reg, val); \ +- } while (0) +- +-/** ++/* + * enum mt9v113_std - enum for supported standards + */ + enum mt9v113_std { +@@ -57,7 +49,7 @@ enum mt9v113_std { + MT9V113_STD_INVALID + }; + +-/** ++/* + * enum mt9v113_state - enum for different decoder states + */ + enum mt9v113_state { +@@ -65,7 +57,7 @@ enum mt9v113_state { + STATE_DETECTED + }; + +-/** ++/* + * struct mt9v113_std_info - Structure to store standard informations + * @width: Line width in pixels + * @height:Number of active lines +@@ -79,7 +71,7 @@ struct mt9v113_std_info { + struct v4l2_standard standard; + }; + +-/** ++/* + * struct mt9v113_decoded - decoder object + * @v4l2_int_device: Slave handle + * @pdata: Board specific +@@ -93,7 +85,6 @@ struct mt9v113_std_info { + * @current_std: Current standard + * @num_stds: Number of standards + * @std_list: Standards list +- * @route: input and output routing at chip level + */ + struct mt9v113_decoder { + struct v4l2_int_device *v4l2_int_device; +@@ -112,8 +103,6 @@ struct mt9v113_decoder { + enum mt9v113_std current_std; + int num_stds; + struct mt9v113_std_info *std_list; +- +- struct v4l2_routing route; + }; + + /* MT9V113 register set for VGA mode */ +@@ -160,7 +149,7 @@ static struct mt9v113_reg mt9v113_reg_list[] = { + {TOK_WRITE, 0x0016, 0x42DF}, + {TOK_WRITE, 0x0014, 0x2145}, + {TOK_WRITE, 0x0014, 0x2145}, +- {TOK_WRITE, 0x0010, 0x0431}, ++ {TOK_WRITE, 0x0010, 0x0231}, + {TOK_WRITE, 0x0012, 0x0000}, + {TOK_WRITE, 0x0014, 0x244B}, + {TOK_WRITE, 0x0014, 0x304B}, +@@ -378,6 +367,10 @@ static const struct v4l2_queryctrl mt9v113_autogain_ctrl = { + .default_value = 1, + }; + ++const struct v4l2_fract mt9v113_frameintervals[] = { ++ { .numerator = 1, .denominator = 10 } ++}; ++ + static int mt9v113_read_reg(struct i2c_client *client, unsigned short reg) + { + int err = 0; +@@ -510,10 +503,6 @@ static int mt9v113_configure(struct mt9v113_decoder *decoder) + if (err) + return err; + +-#if 0 +- if (debug) +- mt9v113_reg_dump(decoder); +-#endif + return 0; + } + +@@ -534,13 +523,13 @@ static int mt9v113_vga_mode(struct mt9v113_decoder *decoder) + } + + +-/** ++/* + * ioctl_enum_framesizes - V4L2 sensor if handler for vidioc_int_enum_framesizes + * @s: pointer to standard V4L2 device structure + * @frms: pointer to standard V4L2 framesizes enumeration structure + * + * Returns possible framesizes depending on choosen pixel format +- **/ ++ */ + static int ioctl_enum_framesizes(struct v4l2_int_device *s, + struct v4l2_frmsizeenum *frms) + { +@@ -584,9 +573,14 @@ static int ioctl_enum_frameintervals(struct v4l2_int_device *s, + if (ifmt == decoder->num_fmts) + return -EINVAL; + ++ if (frmi->index >= ARRAY_SIZE(mt9v113_frameintervals)) ++ return -EINVAL; ++ + frmi->type = V4L2_FRMSIZE_TYPE_DISCRETE; +- frmi->discrete.numerator = 1; +- frmi->discrete.denominator = 10; ++ frmi->discrete.numerator = ++ mt9v113_frameintervals[frmi->index].numerator; ++ frmi->discrete.denominator = ++ mt9v113_frameintervals[frmi->index].denominator; + return 0; + } + +@@ -631,7 +625,7 @@ static int mt9v113_detect(struct mt9v113_decoder *decoder) + * mt9v113 decoder driver. + */ + +-/** ++/* + * ioctl_querystd - V4L2 decoder interface handler for VIDIOC_QUERYSTD ioctl + * @s: pointer to standard V4L2 device structure + * @std_id: standard V4L2 std_id ioctl enum +@@ -660,7 +654,7 @@ static int ioctl_querystd(struct v4l2_int_device *s, v4l2_std_id *std_id) + return 0; + } + +-/** ++/* + * ioctl_s_std - V4L2 decoder interface handler for VIDIOC_S_STD ioctl + * @s: pointer to standard V4L2 device structure + * @std_id: standard V4L2 v4l2_std_id ioctl enum +@@ -696,7 +690,7 @@ static int ioctl_s_std(struct v4l2_int_device *s, v4l2_std_id *std_id) + return 0; + } + +-/** ++/* + * ioctl_s_routing - V4L2 decoder interface handler for VIDIOC_S_INPUT ioctl + * @s: pointer to standard V4L2 device structure + * @index: number of the input +@@ -711,7 +705,7 @@ static int ioctl_s_routing(struct v4l2_int_device *s, + return 0; + } + +-/** ++/* + * ioctl_queryctrl - V4L2 decoder interface handler for VIDIOC_QUERYCTRL ioctl + * @s: pointer to standard V4L2 device structure + * @qctrl: standard V4L2 v4l2_queryctrl structure +@@ -771,7 +765,7 @@ ioctl_queryctrl(struct v4l2_int_device *s, struct v4l2_queryctrl *qctrl) + return err; + } + +-/** ++/* + * ioctl_g_ctrl - V4L2 decoder interface handler for VIDIOC_G_CTRL ioctl + * @s: pointer to standard V4L2 device structure + * @ctrl: pointer to v4l2_control structure +@@ -828,7 +822,7 @@ ioctl_g_ctrl(struct v4l2_int_device *s, struct v4l2_control *ctrl) + return 0; + } + +-/** ++/* + * ioctl_s_ctrl - V4L2 decoder interface handler for VIDIOC_S_CTRL ioctl + * @s: pointer to standard V4L2 device structure + * @ctrl: pointer to v4l2_control structure +@@ -936,7 +930,7 @@ ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *ctrl) + return err; + } + +-/** ++/* + * ioctl_enum_fmt_cap - Implement the CAPTURE buffer VIDIOC_ENUM_FMT ioctl + * @s: pointer to standard V4L2 device structure + * @fmt: standard V4L2 VIDIOC_ENUM_FMT ioctl structure +@@ -969,7 +963,7 @@ ioctl_enum_fmt_cap(struct v4l2_int_device *s, struct v4l2_fmtdesc *fmt) + return 0; + } + +-/** ++/* + * ioctl_try_fmt_cap - Implement the CAPTURE buffer VIDIOC_TRY_FMT ioctl + * @s: pointer to standard V4L2 device structure + * @f: pointer to standard V4L2 VIDIOC_TRY_FMT ioctl structure +@@ -1026,7 +1020,7 @@ ioctl_try_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f) + return 0; + } + +-/** ++/* + * ioctl_s_fmt_cap - V4L2 decoder interface handler for VIDIOC_S_FMT ioctl + * @s: pointer to standard V4L2 device structure + * @f: pointer to standard V4L2 VIDIOC_S_FMT ioctl structure +@@ -1058,7 +1052,7 @@ ioctl_s_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f) + return rval; + } + +-/** ++/* + * ioctl_g_fmt_cap - V4L2 decoder interface handler for ioctl_g_fmt_cap + * @s: pointer to standard V4L2 device structure + * @f: pointer to standard V4L2 v4l2_format structure +@@ -1087,7 +1081,7 @@ ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f) + return 0; + } + +-/** ++/* + * ioctl_g_parm - V4L2 decoder interface handler for VIDIOC_G_PARM ioctl + * @s: pointer to standard V4L2 device structure + * @a: pointer to standard V4L2 VIDIOC_G_PARM ioctl structure +@@ -1125,7 +1119,7 @@ ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a) + return 0; + } + +-/** ++/* + * ioctl_s_parm - V4L2 decoder interface handler for VIDIOC_S_PARM ioctl + * @s: pointer to standard V4L2 device structure + * @a: pointer to standard V4L2 VIDIOC_S_PARM ioctl structure +@@ -1161,7 +1155,7 @@ ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a) + return 0; + } + +-/** ++/* + * ioctl_g_ifparm - V4L2 decoder interface handler for vidioc_int_g_ifparm_num + * @s: pointer to standard V4L2 device structure + * @p: pointer to standard V4L2 vidioc_int_g_ifparm_num ioctl structure +@@ -1193,7 +1187,7 @@ static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p) + return 0; + } + +-/** ++/* + * ioctl_g_priv - V4L2 decoder interface handler for vidioc_int_g_priv_num + * @s: pointer to standard V4L2 device structure + * @p: void pointer to hold decoder's private data address +@@ -1210,7 +1204,7 @@ static int ioctl_g_priv(struct v4l2_int_device *s, void *p) + return decoder->pdata->priv_data_set(p); + } + +-/** ++/* + * ioctl_s_power - V4L2 decoder interface handler for vidioc_int_s_power_num + * @s: pointer to standard V4L2 device structure + * @on: power state to which device is to be set +@@ -1272,7 +1266,7 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) + return err; + } + +-/** ++/* + * ioctl_init - V4L2 decoder interface handler for VIDIOC_INT_INIT + * @s: pointer to standard V4L2 device structure + * +@@ -1289,7 +1283,7 @@ static int ioctl_init(struct v4l2_int_device *s) + return err; + } + +-/** ++/* + * ioctl_dev_exit - V4L2 decoder interface handler for vidioc_int_dev_exit_num + * @s: pointer to standard V4L2 device structure + * +@@ -1300,7 +1294,7 @@ static int ioctl_dev_exit(struct v4l2_int_device *s) + return 0; + } + +-/** ++/* + * ioctl_dev_init - V4L2 decoder interface handler for vidioc_int_dev_init_num + * @s: pointer to standard V4L2 device structure + * +@@ -1397,7 +1391,7 @@ static struct v4l2_int_device mt9v113_int_device = { + }, + }; + +-/** ++/* + * mt9v113_probe - decoder driver i2c probe handler + * @client: i2c driver client device structure + * +@@ -1410,30 +1404,15 @@ mt9v113_probe(struct i2c_client *client, const struct i2c_device_id *id) + struct mt9v113_decoder *decoder = &mt9v113_dev; + int err; + +- printk("%s: %d\n", __func__, __LINE__); + /* Check if the adapter supports the needed features */ + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) + return -EIO; + +- printk("%s: %d\n", __func__, __LINE__); + decoder->pdata = client->dev.platform_data; + if (!decoder->pdata) { + v4l_err(client, "No platform data!!\n"); + return -ENODEV; + } +- printk("%s: %d\n", __func__, __LINE__); +- /* +- * Fetch platform specific data, and configure the +- * mt9v113_reg_list[] accordingly. Since this is one +- * time configuration, no need to preserve. +- */ +- +- /*mt9v113_reg_list[REG_OUTPUT_FORMATTER2].val |= +- (decoder->pdata->clk_polarity << 1); +- mt9v113_reg_list[REG_SYNC_CONTROL].val |= +- ((decoder->pdata->hs_polarity << 2) | +- (decoder->pdata->vs_polarity << 3)); +- */ + /* + * Save the id data, required for power up sequence + */ +@@ -1458,7 +1437,7 @@ mt9v113_probe(struct i2c_client *client, const struct i2c_device_id *id) + return 0; + } + +-/** ++/* + * mt9v113_remove - decoder driver i2c remove handler + * @client: i2c driver client device structure + * +@@ -1511,7 +1490,7 @@ static struct i2c_driver mt9v113_i2c_driver = { + .id_table = mt9v113_id, + }; + +-/** ++/* + * mt9v113_init + * + * Module init function +@@ -1521,7 +1500,7 @@ static int __init mt9v113_init(void) + return i2c_add_driver(&mt9v113_i2c_driver); + } + +-/** ++/* + * mt9v113_cleanup + * + * Module exit function +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0041-MT9V113-Min-Max-clk-input-changed-as-per-the-spec.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0041-MT9V113-Min-Max-clk-input-changed-as-per-the-spec.patch new file mode 100644 index 0000000000..93ee2a0456 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0041-MT9V113-Min-Max-clk-input-changed-as-per-the-spec.patch @@ -0,0 +1,54 @@ +From ffaa0e141898987cba2618d8e5b0ef2a285e79a9 Mon Sep 17 00:00:00 2001 +From: Vaibhav Hiremath <hvaibhav@ti.com> +Date: Tue, 13 Jul 2010 19:40:39 +0530 +Subject: [PATCH 41/71] MT9V113: Min, Max clk input changed as per the spec + +Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 2 +- + drivers/media/video/isp/ispreg.h | 2 +- + include/media/mt9v113.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index be59040..8d4e5ab 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -198,7 +198,7 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power) + mdelay(50); + + /* Enable EXTCLK */ +- isp_set_xclk(vdev->cam->isp, MT9V113_CLK_MIN, CAM_USE_XCLKA); ++ isp_set_xclk(vdev->cam->isp, MT9V113_CLK_MIN*2, CAM_USE_XCLKA); + /* + * Wait at least 70 CLK cycles (w/EXTCLK = 6MHz, or CLK_MIN): + * ((1000000 * 70) / 6000000) = aprox 12 us. +diff --git a/drivers/media/video/isp/ispreg.h b/drivers/media/video/isp/ispreg.h +index 1240e0e..098713e 100644 +--- a/drivers/media/video/isp/ispreg.h ++++ b/drivers/media/video/isp/ispreg.h +@@ -116,7 +116,7 @@ + #define ISP_32B_BOUNDARY_BUF 0xFFFFFFE0 + #define ISP_32B_BOUNDARY_OFFSET 0x0000FFE0 + +-#define CM_CAM_MCLK_HZ 172800000 /* Hz */ ++#define CM_CAM_MCLK_HZ 216000000 /* Hz */ + + /* ISP Submodules offset */ + +diff --git a/include/media/mt9v113.h b/include/media/mt9v113.h +index 0a30f4c..4504f26 100644 +--- a/include/media/mt9v113.h ++++ b/include/media/mt9v113.h +@@ -76,7 +76,7 @@ struct mt9v113_platform_data { + #define MT9V113_VGA_30FPS (1130) + #define MT9V113_QVGA_30FPS (1131) + +-#define MT9V113_CLK_MAX (54000000) /* 54MHz */ ++#define MT9V113_CLK_MAX (48000000) /* 48MHz */ + #define MT9V113_CLK_MIN (6000000) /* 6Mhz */ + + #endif /* ifndef _MT9V113_H */ +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0042-omap3beagle-camera-Further-clode-cleanup.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0042-omap3beagle-camera-Further-clode-cleanup.patch new file mode 100644 index 0000000000..9892d6a8f6 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0042-omap3beagle-camera-Further-clode-cleanup.patch @@ -0,0 +1,237 @@ +From 3db061a3a65a93a0b5a4bd6c7619e4082c098b7f Mon Sep 17 00:00:00 2001 +From: Vaibhav Hiremath <hvaibhav@ti.com> +Date: Wed, 14 Jul 2010 19:07:06 +0530 +Subject: [PATCH 42/71] omap3beagle-camera: Further clode cleanup + +Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 89 ++++-------------------- + drivers/media/video/isp/isp.h | 13 ++++ + 2 files changed, 28 insertions(+), 74 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index 8d4e5ab..90eadd0 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -46,21 +46,19 @@ + #include "mux.h" + #include "board-omap3beagle-camera.h" + +-#define MODULE_NAME "omap3beaglelmb" ++#define MODULE_NAME "omap3beaglelmb" + +-#define CAM_USE_XCLKA 0 ++#define CAM_USE_XCLKA 0 + +-#define ISP_MT9V113_MCLK 216000000 ++#define ISP_MT9V113_MCLK 216000000 + +-#define LEOPARD_RESET_GPIO 98 ++#define LEOPARD_RESET_GPIO 98 + + static struct regulator *beagle_mt9v113_1_8v1; + static struct regulator *beagle_mt9v113_1_8v2; + +-#if defined(CONFIG_VIDEO_MT9V113) || defined(CONFIG_VIDEO_MT9V113_MODULE) +- + /* Arbitrary memory handling limit */ +-#define MT9V113_BIGGEST_FRAME_BYTE_SIZE PAGE_ALIGN(2048 * 1536 * 4) ++#define MT9V113_MAX_FRAME_SIZE PAGE_ALIGN(640 * 480 * 4) + + static struct isp_interface_config mt9v113_if_config = { + .ccdc_par_ser = ISP_PARLL, +@@ -77,21 +75,6 @@ static struct isp_interface_config mt9v113_if_config = { + }; + + static struct v4l2_ifparm mt9v113_ifparm_s = { +-#if 0 +- .if_type = V4L2_IF_TYPE_RAW, +- .u = { +- .raw = { +- .frame_start_on_rising_vs = 1, +- .bt_sync_correct = 0, +- .swap = 0, +- .latch_clk_inv = 0, +- .nobt_hs_inv = 0, /* active high */ +- .nobt_vs_inv = 0, /* active high */ +- .clock_min = MT9V113_CLK_MIN, +- .clock_max = MT9V113_CLK_MAX, +- }, +- }, +-#else + .if_type = V4L2_IF_TYPE_YCbCr, + .u = { + .ycbcr = { +@@ -99,13 +82,12 @@ static struct v4l2_ifparm mt9v113_ifparm_s = { + .bt_sync_correct = 0, + .swap = 0, + .latch_clk_inv = 0, +- .nobt_hs_inv = 0, /* active high */ +- .nobt_vs_inv = 0, /* active high */ ++ .nobt_hs_inv = 0, ++ .nobt_vs_inv = 0, + .clock_min = MT9V113_CLK_MIN, + .clock_max = MT9V113_CLK_MAX, + }, + }, +-#endif + }; + + /** +@@ -124,16 +106,14 @@ static int mt9v113_ifparm(struct v4l2_ifparm *p) + return 0; + } + +-#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) + static struct omap34xxcam_hw_config mt9v113_hwc = { + .dev_index = 0, + .dev_minor = 0, + .dev_type = OMAP34XXCAM_SLAVE_SENSOR, + .u.sensor.sensor_isp = 1, +- .u.sensor.capture_mem = MT9V113_BIGGEST_FRAME_BYTE_SIZE * 2, ++ .u.sensor.capture_mem = MT9V113_MAX_FRAME_SIZE * 2, + .u.sensor.ival_default = { 1, 10 }, + }; +-#endif + + /** + * @brief mt9v113_set_prv_data - Returns mt9v113 omap34xx driver private data +@@ -144,7 +124,6 @@ static struct omap34xxcam_hw_config mt9v113_hwc = { + */ + static int mt9v113_set_prv_data(void *priv) + { +-#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) + struct omap34xxcam_hw_config *hwc = priv; + + if (priv == NULL) +@@ -154,10 +133,8 @@ static int mt9v113_set_prv_data(void *priv) + hwc->dev_index = mt9v113_hwc.dev_index; + hwc->dev_minor = mt9v113_hwc.dev_minor; + hwc->dev_type = mt9v113_hwc.dev_type; ++ + return 0; +-#else +- return -EINVAL; +-#endif + } + + /** +@@ -172,21 +149,22 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power) + struct omap34xxcam_videodev *vdev = s->u.slave->master->priv; + + switch (power) { +- case V4L2_POWER_OFF: + case V4L2_POWER_STANDBY: ++ break; ++ ++ case V4L2_POWER_OFF: + isp_set_xclk(vdev->cam->isp, 0, CAM_USE_XCLKA); + + if (regulator_is_enabled(beagle_mt9v113_1_8v1)) + regulator_disable(beagle_mt9v113_1_8v1); + if (regulator_is_enabled(beagle_mt9v113_1_8v2)) + regulator_disable(beagle_mt9v113_1_8v2); ++ + break; + + case V4L2_POWER_ON: +-#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) +- isp_configure_interface(vdev->cam->isp, &mt9v113_if_config); +-#endif + ++ isp_configure_interface(vdev->cam->isp, &mt9v113_if_config); + /* Set RESET_BAR to 0 */ + gpio_set_value(LEOPARD_RESET_GPIO, 0); + +@@ -216,8 +194,8 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power) + + default: + return -ENODEV; +- break; + } ++ + return 0; + } + +@@ -232,9 +210,6 @@ struct mt9v113_platform_data mt9v113_pdata = { + .vs_polarity = 1, /* 0 - Active low, 1- Active high */ + }; + +-#endif /* #ifdef CONFIG_VIDEO_MT9V113 */ +- +- + static int beagle_cam_probe(struct platform_device *pdev) + { + beagle_mt9v113_1_8v1 = regulator_get(&pdev->dev, "vaux3_1"); +@@ -277,40 +252,6 @@ static int beagle_cam_remove(struct platform_device *pdev) + + gpio_free(LEOPARD_RESET_GPIO); + +- /* MUX init */ +- omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, +- 0x10C); /* CAM_HS */ +- omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, +- 0x10E); /* CAM_VS */ +- omap_ctrl_writew(OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, +- 0x110); /* CAM_XCLKA */ +- omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, +- 0x112); /* CAM_PCLK */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x116); /* CAM_D0 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x118); /* CAM_D1 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x11A); /* CAM_D2 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x11C); /* CAM_D3 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x11E); /* CAM_D4 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x120); /* CAM_D5 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x122); /* CAM_D6 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x124); /* CAM_D7 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x126); /* CAM_D8 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x128); /* CAM_D9 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x12A); /* CAM_D10 */ +- omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, +- 0x12C); /* CAM_D11 */ +- + return 0; + } + +diff --git a/drivers/media/video/isp/isp.h b/drivers/media/video/isp/isp.h +index 85c3fa9..4929fad 100644 +--- a/drivers/media/video/isp/isp.h ++++ b/drivers/media/video/isp/isp.h +@@ -482,10 +482,23 @@ int isp_set_callback(struct device *dev, enum isp_callback_type type, + + int isp_unset_callback(struct device *dev, enum isp_callback_type type); + ++#if defined(CONFIG_VIDEO_OMAP3_ISP) + u32 isp_set_xclk(struct device *dev, u32 xclk, u8 xclksel); + + int isp_configure_interface(struct device *dev, + struct isp_interface_config *config); ++#else ++static inline u32 isp_set_xclk(struct device *dev, u32 xclk, u8 xclksel) ++{ ++ return 0; ++} ++static inline int isp_configure_interface(struct device *dev, ++ struct isp_interface_config *config) ++{ ++ return 0; ++} ++ ++#endif + + struct device *isp_get(void); + +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0043-mt9v113-Settings-from-Aptima-used-to-increase-FPS.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0043-mt9v113-Settings-from-Aptima-used-to-increase-FPS.patch new file mode 100644 index 0000000000..cbf9788d96 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0043-mt9v113-Settings-from-Aptima-used-to-increase-FPS.patch @@ -0,0 +1,135 @@ +From b61ff796dd0bb5bb34d7d2125983baa78f8a3831 Mon Sep 17 00:00:00 2001 +From: Vaibhav Hiremath <hvaibhav@ti.com> +Date: Wed, 14 Jul 2010 19:07:34 +0530 +Subject: [PATCH 43/71] mt9v113: Settings from Aptima used to increase FPS + +The FPS is still low at around ~15FPS, expected one is 30FPS. + +Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com> +--- + drivers/media/video/mt9v113.c | 55 +++++++++++++++++++++++++--------------- + 1 files changed, 34 insertions(+), 21 deletions(-) + +diff --git a/drivers/media/video/mt9v113.c b/drivers/media/video/mt9v113.c +index 9a86cce..466702e 100644 +--- a/drivers/media/video/mt9v113.c ++++ b/drivers/media/video/mt9v113.c +@@ -119,6 +119,21 @@ static struct mt9v113_reg mt9v113_vga_reg[] = { + {TOK_WRITE, 0x0990, 0x0280}, + {TOK_WRITE, 0x098C, 0x2705}, + {TOK_WRITE, 0x0990, 0x01E0}, ++ {TOK_WRITE, 0x098C, 0x2715}, ++ {TOK_WRITE, 0x0990, 0x0001}, ++ {TOK_WRITE, 0x098C, 0x2717}, ++ {TOK_WRITE, 0x0990, 0x0026}, ++ {TOK_WRITE, 0x098C, 0x2719}, ++ {TOK_WRITE, 0x0990, 0x001A}, ++ {TOK_WRITE, 0x098C, 0x271B}, ++ {TOK_WRITE, 0x0990, 0x006B}, ++ {TOK_WRITE, 0x098C, 0x271D}, ++ {TOK_WRITE, 0x0990, 0x006B}, ++ {TOK_WRITE, 0x098C, 0x271F}, ++ {TOK_WRITE, 0x0990, 0x0202}, ++ {TOK_WRITE, 0x098C, 0x2721}, ++ {TOK_WRITE, 0x0990, 0x034A}, ++ + {TOK_WRITE, 0x098C, 0xA103}, + {TOK_WRITE, 0x0990, 0x0005}, + {TOK_DELAY, 0, 100}, +@@ -148,8 +163,7 @@ static struct mt9v113_reg mt9v113_reg_list[] = { + {TOK_WRITE, 0x001E, 0x0777}, + {TOK_WRITE, 0x0016, 0x42DF}, + {TOK_WRITE, 0x0014, 0x2145}, +- {TOK_WRITE, 0x0014, 0x2145}, +- {TOK_WRITE, 0x0010, 0x0231}, ++ {TOK_WRITE, 0x0010, 0x0234}, + {TOK_WRITE, 0x0012, 0x0000}, + {TOK_WRITE, 0x0014, 0x244B}, + {TOK_WRITE, 0x0014, 0x304B}, +@@ -267,29 +281,31 @@ static struct mt9v113_reg mt9v113_reg_list[] = { + {TOK_WRITE, 0x0990, 0x0005}, + {TOK_DELAY, 0, 100}, + {TOK_WRITE, 0x098C, 0x222D}, +- {TOK_WRITE, 0x0990, 0x0088}, ++ {TOK_WRITE, 0x0990, 0x0081}, + {TOK_WRITE, 0x098C, 0xA408}, +- {TOK_WRITE, 0x0990, 0x0020}, ++ {TOK_WRITE, 0x0990, 0x001F}, + {TOK_WRITE, 0x098C, 0xA409}, +- {TOK_WRITE, 0x0990, 0x0023}, ++ {TOK_WRITE, 0x0990, 0x0021}, + {TOK_WRITE, 0x098C, 0xA40A}, +- {TOK_WRITE, 0x0990, 0x0027}, ++ {TOK_WRITE, 0x0990, 0x0025}, + {TOK_WRITE, 0x098C, 0xA40B}, +- {TOK_WRITE, 0x0990, 0x002A}, ++ {TOK_WRITE, 0x0990, 0x0027}, + {TOK_WRITE, 0x098C, 0x2411}, +- {TOK_WRITE, 0x0990, 0x0088}, ++ {TOK_WRITE, 0x0990, 0x0081}, + {TOK_WRITE, 0x098C, 0x2413}, +- {TOK_WRITE, 0x0990, 0x00A4}, ++ {TOK_WRITE, 0x0990, 0x009A}, + {TOK_WRITE, 0x098C, 0x2415}, +- {TOK_WRITE, 0x0990, 0x0088}, ++ {TOK_WRITE, 0x0990, 0x0081}, + {TOK_WRITE, 0x098C, 0x2417}, +- {TOK_WRITE, 0x0990, 0x00A4}, ++ {TOK_WRITE, 0x0990, 0x009A}, + {TOK_WRITE, 0x098C, 0xA404}, + {TOK_WRITE, 0x0990, 0x0010}, + {TOK_WRITE, 0x098C, 0xA40D}, + {TOK_WRITE, 0x0990, 0x0002}, + {TOK_WRITE, 0x098C, 0xA40E}, + {TOK_WRITE, 0x0990, 0x0003}, ++ {TOK_WRITE, 0x098C, 0xA410}, ++ {TOK_WRITE, 0x0990, 0x000A}, + {TOK_WRITE, 0x098C, 0xA103}, + {TOK_WRITE, 0x0990, 0x0006}, + {TOK_DELAY, 0, 100}, +@@ -1216,13 +1232,10 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) + struct mt9v113_decoder *decoder = s->priv; + int err = 0; + +- if (decoder->state == STATE_DETECTED) +- return 0; +- + switch (on) { + case V4L2_POWER_OFF: + /* Power Down Sequence */ +-/* TODO: FIXME: implement proper OFF and Standby code here */ ++ /* TODO: FIXME: implement proper OFF and Standby code here */ + #if 0 + err = mt9v113_write_reg(decoder->client, REG_OPERATION_MODE, + 0x01); +@@ -1240,10 +1253,10 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) + + case V4L2_POWER_ON: + /* Enable mux for mt9v113 data path */ +- if ((decoder->pdata->power_set) && +- (decoder->state == STATE_NOT_DETECTED)) { ++ if (decoder->state == STATE_NOT_DETECTED) { + +- err = decoder->pdata->power_set(s, on); ++ if (decoder->pdata->power_set) ++ err = decoder->pdata->power_set(s, on); + + /* Detect the sensor is not already detected */ + err |= mt9v113_detect(decoder); +@@ -1252,10 +1265,10 @@ static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) + "Unable to detect decoder\n"); + return err; + } +- /* Only VGA mode for now */ +- err |= mt9v113_configure(decoder); +- err |= mt9v113_vga_mode(decoder); + } ++ /* Only VGA mode for now */ ++ err |= mt9v113_configure(decoder); ++ err |= mt9v113_vga_mode(decoder); + break; + + default: +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0044-mt9v113-AE-param-tuned-to-get-28-30FPS.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0044-mt9v113-AE-param-tuned-to-get-28-30FPS.patch new file mode 100644 index 0000000000..b059c25e1e --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0044-mt9v113-AE-param-tuned-to-get-28-30FPS.patch @@ -0,0 +1,33 @@ +From 9bff3b599cc43bb716d1f1190318122b169ab723 Mon Sep 17 00:00:00 2001 +From: Vaibhav Hiremath <hvaibhav@ti.com> +Date: Thu, 15 Jul 2010 13:53:03 +0530 +Subject: [PATCH 44/71] mt9v113: AE param tuned to get 28~30FPS + +Please note that with this change we are compromising with +image quality, so should be used only in case of high FPS use-case. +--- + drivers/media/video/mt9v113.c | 8 ++++++++ + 1 files changed, 8 insertions(+), 0 deletions(-) + +diff --git a/drivers/media/video/mt9v113.c b/drivers/media/video/mt9v113.c +index 466702e..6714240 100644 +--- a/drivers/media/video/mt9v113.c ++++ b/drivers/media/video/mt9v113.c +@@ -306,6 +306,14 @@ static struct mt9v113_reg mt9v113_reg_list[] = { + {TOK_WRITE, 0x0990, 0x0003}, + {TOK_WRITE, 0x098C, 0xA410}, + {TOK_WRITE, 0x0990, 0x000A}, ++ ++ {TOK_WRITE, 0x098C, 0xA20C}, ++ {TOK_WRITE, 0x0990, 0x0003}, ++ {TOK_WRITE, 0x098C, 0xA20B}, ++ {TOK_WRITE, 0x0990, 0x0000}, ++ {TOK_WRITE, 0x098C, 0xA215}, ++ {TOK_WRITE, 0x0990, 0x0004}, ++ + {TOK_WRITE, 0x098C, 0xA103}, + {TOK_WRITE, 0x0990, 0x0006}, + {TOK_DELAY, 0, 100}, +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0045-omap3beagle-camera-Cleanup-of-boardfile.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0045-omap3beagle-camera-Cleanup-of-boardfile.patch new file mode 100644 index 0000000000..16c0d23a48 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0045-omap3beagle-camera-Cleanup-of-boardfile.patch @@ -0,0 +1,161 @@ +From 67792c04d84e341ce964c8c4fd5ddf2e6822ef3b Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Mon, 12 Jul 2010 15:44:18 -0500 +Subject: [PATCH 45/71] omap3beagle: camera: Cleanup of boardfile + +This removes a lot of dead code. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 51 ++++++++++++++++++------ + arch/arm/mach-omap2/board-omap3beagle-camera.h | 41 ------------------- + 2 files changed, 38 insertions(+), 54 deletions(-) + delete mode 100644 arch/arm/mach-omap2/board-omap3beagle-camera.h + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index 90eadd0..befa7d4 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -44,9 +44,6 @@ + #include <../drivers/media/video/isp/ispreg.h> + + #include "mux.h" +-#include "board-omap3beagle-camera.h" +- +-#define MODULE_NAME "omap3beaglelmb" + + #define CAM_USE_XCLKA 0 + +@@ -129,11 +126,7 @@ static int mt9v113_set_prv_data(void *priv) + if (priv == NULL) + return -EINVAL; + +- hwc->u.sensor = mt9v113_hwc.u.sensor; +- hwc->dev_index = mt9v113_hwc.dev_index; +- hwc->dev_minor = mt9v113_hwc.dev_minor; +- hwc->dev_type = mt9v113_hwc.dev_type; +- ++ *hwc = mt9v113_hwc; + return 0; + } + +@@ -204,10 +197,6 @@ struct mt9v113_platform_data mt9v113_pdata = { + .power_set = mt9v113_power_set, + .priv_data_set = mt9v113_set_prv_data, + .ifparm = mt9v113_ifparm, +- /* Some interface dependent params */ +- .clk_polarity = 0, /* data clocked out on falling edge */ +- .hs_polarity = 1, /* 0 - Active low, 1- Active high */ +- .vs_polarity = 1, /* 0 - Active low, 1- Active high */ + }; + + static int beagle_cam_probe(struct platform_device *pdev) +@@ -217,6 +206,7 @@ static int beagle_cam_probe(struct platform_device *pdev) + dev_err(&pdev->dev, "vaux3_1 regulator missing\n"); + return PTR_ERR(beagle_mt9v113_1_8v1); + } ++ + beagle_mt9v113_1_8v2 = regulator_get(&pdev->dev, "vaux4_1"); + if (IS_ERR(beagle_mt9v113_1_8v2)) { + dev_err(&pdev->dev, "vaux4_1 regulator missing\n"); +@@ -235,7 +225,41 @@ static int beagle_cam_probe(struct platform_device *pdev) + /* set to output mode, default value 0 */ + gpio_direction_output(LEOPARD_RESET_GPIO, 0); + +- printk(KERN_INFO MODULE_NAME ": Driver registration complete \n"); ++ /* MUX init */ ++ omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, ++ 0x10C); /* CAM_HS */ ++ omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, ++ 0x10E); /* CAM_VS */ ++ omap_ctrl_writew(OMAP_PIN_OUTPUT | OMAP_MUX_MODE0, ++ 0x110); /* CAM_XCLKA */ ++ omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0, ++ 0x112); /* CAM_PCLK */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x116); /* CAM_D0 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x118); /* CAM_D1 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x11A); /* CAM_D2 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x11C); /* CAM_D3 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x11E); /* CAM_D4 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x120); /* CAM_D5 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x122); /* CAM_D6 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x124); /* CAM_D7 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x126); /* CAM_D8 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x128); /* CAM_D9 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x12A); /* CAM_D10 */ ++ omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0, ++ 0x12C); /* CAM_D11 */ ++ ++ printk(KERN_INFO "omap3beaglelmb: Driver registration complete\n"); + + return 0; + } +@@ -287,6 +311,7 @@ static struct platform_driver beagle_cam_driver = { + */ + int __init omap3beaglelmb_init(void) + { ++ /* NOTE: Beagle xM boards are the only ones with camera interface */ + if (cpu_is_omap3630()) + platform_driver_register(&beagle_cam_driver); + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.h b/arch/arm/mach-omap2/board-omap3beagle-camera.h +deleted file mode 100644 +index 1026aeb..0000000 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.h ++++ /dev/null +@@ -1,41 +0,0 @@ +-/* +- * Copyright (C) 2010 Texas Instruments Inc +- * Author: Sergio Aguirre <saaguirre@ti.com> +- * +- * Based on work done by: +- * Vaibhav Hiremath <hvaibhav@ti.com> +- * Anuj Aggarwal <anuj.aggarwal@ti.com> +- * Sivaraj R <sivaraj@ti.com> +- * +- * This package is free software; you can redistribute it and/or modify +- * it under the terms of the GNU General Public License version 2 as +- * published by the Free Software Foundation. +- * +- * This program is distributed in the hope that it will be useful, +- * but WITHOUT ANY WARRANTY; without even the implied warranty of +- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +- * GNU General Public License for more details. +- * +- * You should have received a copy of the GNU General Public License +- * along with this program; if not, write to the Free Software +- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +- */ +- +-#ifndef __BOARD_OMAP3BEAGLE_LMB_H_ +-#define __BOARD_OMAP3BEAGLE_LMB_H_ +- +-/* mux id to enable/disable signal routing to different peripherals */ +-enum omap3beaglelmb_mux { +- MUX_TVP5146 = 0, +- MUX_CAMERA_SENSOR, +- MUX_EXP_CAMERA_SENSOR, +- NUM_MUX +-}; +- +-/* enum to enable or disable mux */ +-enum config_mux { +- DISABLE_MUX, +- ENABLE_MUX +-}; +- +-#endif /* __BOARD_OMAP3BEAGLE_LMB_H_ */ +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0046-omap3beagle-camera-Cleanup-regulator-usage.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0046-omap3beagle-camera-Cleanup-regulator-usage.patch new file mode 100644 index 0000000000..a2392cae79 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0046-omap3beagle-camera-Cleanup-regulator-usage.patch @@ -0,0 +1,172 @@ +From f976a2d7fc5b5e13a3445c668d5771605fee80c8 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Mon, 12 Jul 2010 15:53:44 -0500 +Subject: [PATCH 46/71] omap3beagle: camera: Cleanup regulator usage + +We were missing the point of regulator abstraction layer. + +Camera board file shouldn't be aware of what vaux is using, but +just asking for a specific power supply (for cam_1v8 and cam_2v8). + +How is that mapped before, is something that the regulator machine +should figure out. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 50 ++++++++++++------------ + arch/arm/mach-omap2/board-omap3beagle.c | 24 +++++------- + 2 files changed, 35 insertions(+), 39 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index befa7d4..c91529d 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -51,8 +51,8 @@ + + #define LEOPARD_RESET_GPIO 98 + +-static struct regulator *beagle_mt9v113_1_8v1; +-static struct regulator *beagle_mt9v113_1_8v2; ++static struct regulator *cam_1v8_reg; ++static struct regulator *cam_2v8_reg; + + /* Arbitrary memory handling limit */ + #define MT9V113_MAX_FRAME_SIZE PAGE_ALIGN(640 * 480 * 4) +@@ -148,10 +148,10 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power) + case V4L2_POWER_OFF: + isp_set_xclk(vdev->cam->isp, 0, CAM_USE_XCLKA); + +- if (regulator_is_enabled(beagle_mt9v113_1_8v1)) +- regulator_disable(beagle_mt9v113_1_8v1); +- if (regulator_is_enabled(beagle_mt9v113_1_8v2)) +- regulator_disable(beagle_mt9v113_1_8v2); ++ if (regulator_is_enabled(cam_1v8_reg)) ++ regulator_disable(cam_1v8_reg); ++ if (regulator_is_enabled(cam_2v8_reg)) ++ regulator_disable(cam_2v8_reg); + + break; + +@@ -162,10 +162,10 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power) + gpio_set_value(LEOPARD_RESET_GPIO, 0); + + /* turn on VDD */ +- regulator_enable(beagle_mt9v113_1_8v1); ++ regulator_enable(cam_1v8_reg); + mdelay(1); + /* turn on VDD_IO */ +- regulator_enable(beagle_mt9v113_1_8v2); ++ regulator_enable(cam_2v8_reg); + mdelay(50); + + /* Enable EXTCLK */ +@@ -201,24 +201,24 @@ struct mt9v113_platform_data mt9v113_pdata = { + + static int beagle_cam_probe(struct platform_device *pdev) + { +- beagle_mt9v113_1_8v1 = regulator_get(&pdev->dev, "vaux3_1"); +- if (IS_ERR(beagle_mt9v113_1_8v1)) { +- dev_err(&pdev->dev, "vaux3_1 regulator missing\n"); +- return PTR_ERR(beagle_mt9v113_1_8v1); ++ cam_1v8_reg = regulator_get(&pdev->dev, "cam_1v8"); ++ if (IS_ERR(cam_1v8_reg)) { ++ dev_err(&pdev->dev, "cam_1v8 regulator missing\n"); ++ return PTR_ERR(cam_1v8_reg); + } + +- beagle_mt9v113_1_8v2 = regulator_get(&pdev->dev, "vaux4_1"); +- if (IS_ERR(beagle_mt9v113_1_8v2)) { +- dev_err(&pdev->dev, "vaux4_1 regulator missing\n"); +- regulator_put(beagle_mt9v113_1_8v1); +- return PTR_ERR(beagle_mt9v113_1_8v2); ++ cam_2v8_reg = regulator_get(&pdev->dev, "cam_2v8"); ++ if (IS_ERR(cam_2v8_reg)) { ++ dev_err(&pdev->dev, "cam_2v8 regulator missing\n"); ++ regulator_put(cam_1v8_reg); ++ return PTR_ERR(cam_2v8_reg); + } + + if (gpio_request(LEOPARD_RESET_GPIO, "cam_rst") != 0) { + dev_err(&pdev->dev, "Could not request GPIO %d", + LEOPARD_RESET_GPIO); +- regulator_put(beagle_mt9v113_1_8v2); +- regulator_put(beagle_mt9v113_1_8v1); ++ regulator_put(cam_2v8_reg); ++ regulator_put(cam_1v8_reg); + return -ENODEV; + } + +@@ -266,13 +266,13 @@ static int beagle_cam_probe(struct platform_device *pdev) + + static int beagle_cam_remove(struct platform_device *pdev) + { +- if (regulator_is_enabled(beagle_mt9v113_1_8v1)) +- regulator_disable(beagle_mt9v113_1_8v1); +- regulator_put(beagle_mt9v113_1_8v1); ++ if (regulator_is_enabled(cam_1v8_reg)) ++ regulator_disable(cam_1v8_reg); ++ regulator_put(cam_1v8_reg); + +- if (regulator_is_enabled(beagle_mt9v113_1_8v2)) +- regulator_disable(beagle_mt9v113_1_8v2); +- regulator_put(beagle_mt9v113_1_8v2); ++ if (regulator_is_enabled(cam_2v8_reg)) ++ regulator_disable(cam_2v8_reg); ++ regulator_put(cam_2v8_reg); + + gpio_free(LEOPARD_RESET_GPIO); + +diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c +index d4b0b0a..b0da483 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle.c ++++ b/arch/arm/mach-omap2/board-omap3beagle.c +@@ -414,18 +414,14 @@ static struct platform_device beagle_cam_device = { + .id = -1, + }; + +-static struct regulator_consumer_supply beagle_vaux3_supplies[] = { +- { +- .supply = "vaux3_1", +- .dev = &beagle_cam_device.dev, +- }, ++static struct regulator_consumer_supply beagle_vaux3_supply = { ++ .supply = "cam_1v8", ++ .dev = &beagle_cam_device.dev, + }; + +-static struct regulator_consumer_supply beagle_vaux4_supplies[] = { +- { +- .supply = "vaux4_1", +- .dev = &beagle_cam_device.dev, +- }, ++static struct regulator_consumer_supply beagle_vaux4_supply = { ++ .supply = "cam_2v8", ++ .dev = &beagle_cam_device.dev, + }; + + /* VAUX3 for CAM_1V8 */ +@@ -439,8 +435,8 @@ static struct regulator_init_data beagle_vaux3 = { + .valid_ops_mask = REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, +- .num_consumer_supplies = ARRAY_SIZE(beagle_vaux3_supplies), +- .consumer_supplies = beagle_vaux3_supplies, ++ .num_consumer_supplies = 1, ++ .consumer_supplies = &beagle_vaux3_supply, + }; + + /* VAUX4 for CAM_2V8 */ +@@ -454,8 +450,8 @@ static struct regulator_init_data beagle_vaux4 = { + .valid_ops_mask = REGULATOR_CHANGE_MODE + | REGULATOR_CHANGE_STATUS, + }, +- .num_consumer_supplies = ARRAY_SIZE(beagle_vaux4_supplies), +- .consumer_supplies = beagle_vaux4_supplies, ++ .num_consumer_supplies = 1, ++ .consumer_supplies = &beagle_vaux4_supply, + }; + + /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0047-omap3beagle-camera-Bring-back-mt9t111-support.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0047-omap3beagle-camera-Bring-back-mt9t111-support.patch new file mode 100644 index 0000000000..36ffd1da7c --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0047-omap3beagle-camera-Bring-back-mt9t111-support.patch @@ -0,0 +1,251 @@ +From 7e836bcc19cd61006cbc8bc0eb3360b2c188fa47 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Mon, 12 Jul 2010 16:42:41 -0500 +Subject: [PATCH 47/71] omap3beagle: camera: Bring back mt9t111 support + +Restore MT9T111 sensor support. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 175 +++++++++++++++++++++++- + arch/arm/mach-omap2/board-omap3beagle.c | 12 ++ + 2 files changed, 184 insertions(+), 3 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index c91529d..2e49158 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -37,7 +37,6 @@ + #include <plat/control.h> + + #include <media/v4l2-int-device.h> +-#include <media/mt9v113.h> + + /* Include V4L2 ISP-Camera driver related header file */ + #include <../drivers/media/video/omap34xxcam.h> +@@ -47,13 +46,16 @@ + + #define CAM_USE_XCLKA 0 + +-#define ISP_MT9V113_MCLK 216000000 +- + #define LEOPARD_RESET_GPIO 98 + + static struct regulator *cam_1v8_reg; + static struct regulator *cam_2v8_reg; + ++#if defined(CONFIG_VIDEO_MT9V113) || defined(CONFIG_VIDEO_MT9V113_MODULE) ++#include <media/mt9v113.h> ++ ++#define ISP_MT9V113_MCLK 216000000 ++ + /* Arbitrary memory handling limit */ + #define MT9V113_MAX_FRAME_SIZE PAGE_ALIGN(640 * 480 * 4) + +@@ -199,6 +201,173 @@ struct mt9v113_platform_data mt9v113_pdata = { + .ifparm = mt9v113_ifparm, + }; + ++#endif /* #ifdef CONFIG_VIDEO_MT9V113 */ ++ ++#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) ++#include <media/mt9t111.h> ++ ++#define ISP_MT9T111_MCLK 216000000 ++ ++/* Arbitrary memory handling limit */ ++#define MT9T111_BIGGEST_FRAME_BYTE_SIZE PAGE_ALIGN((2048 * 2) * 1536 * 4) ++ ++static struct isp_interface_config mt9t111_if_config = { ++ .ccdc_par_ser = ISP_PARLL, ++ .dataline_shift = 0x2, ++ .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE, ++ .strobe = 0x0, ++ .prestrobe = 0x0, ++ .shutter = 0x0, ++ .cam_mclk = ISP_MT9T111_MCLK, ++ .wenlog = ISPCCDC_CFG_WENLOG_AND, ++ .wait_hs_vs = 2, ++ .u.par.par_bridge = 0x3, ++ .u.par.par_clk_pol = 0x0, ++}; ++ ++static struct v4l2_ifparm mt9t111_ifparm_s = { ++ .if_type = V4L2_IF_TYPE_RAW, ++ .u = { ++ .raw = { ++ .frame_start_on_rising_vs = 1, ++ .bt_sync_correct = 0, ++ .swap = 0, ++ .latch_clk_inv = 0, ++ .nobt_hs_inv = 0, /* active high */ ++ .nobt_vs_inv = 0, /* active high */ ++ .clock_min = MT9T111_CLK_MIN, ++ .clock_max = MT9T111_CLK_MAX, ++ }, ++ }, ++}; ++ ++/** ++ * @brief mt9t111_ifparm - Returns the mt9t111 interface parameters ++ * ++ * @param p - pointer to v4l2_ifparm structure ++ * ++ * @return result of operation - 0 is success ++ */ ++static int mt9t111_ifparm(struct v4l2_ifparm *p) ++{ ++ if (p == NULL) ++ return -EINVAL; ++ ++ *p = mt9t111_ifparm_s; ++ return 0; ++} ++ ++#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) ++static struct omap34xxcam_hw_config mt9t111_hwc = { ++ .dev_index = 0, ++ .dev_minor = 0, ++ .dev_type = OMAP34XXCAM_SLAVE_SENSOR, ++ .u.sensor.sensor_isp = 0, ++ .u.sensor.capture_mem = MT9T111_BIGGEST_FRAME_BYTE_SIZE, ++ .u.sensor.ival_default = { 1, 10 }, ++}; ++#endif ++ ++/** ++ * @brief mt9t111_set_prv_data - Returns mt9t111 omap34xx driver private data ++ * ++ * @param priv - pointer to omap34xxcam_hw_config structure ++ * ++ * @return result of operation - 0 is success ++ */ ++static int mt9t111_set_prv_data(void *priv) ++{ ++#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) ++ struct omap34xxcam_hw_config *hwc = priv; ++ ++ if (priv == NULL) ++ return -EINVAL; ++ ++ *hwc = mt9t111_hwc; ++ return 0; ++#else ++ return -EINVAL; ++#endif ++} ++ ++/** ++ * @brief mt9t111_power_set - Power-on or power-off TVP5146 device ++ * ++ * @param power - enum, Power on/off, resume/standby ++ * ++ * @return result of operation - 0 is success ++ */ ++static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power) ++{ ++ struct omap34xxcam_videodev *vdev = s->u.slave->master->priv; ++ ++ switch (power) { ++ case V4L2_POWER_OFF: ++ case V4L2_POWER_STANDBY: ++ isp_set_xclk(vdev->cam->isp, 0, CAM_USE_XCLKA); ++ ++ if (regulator_is_enabled(cam_1v8_reg)) ++ regulator_disable(cam_1v8_reg); ++ if (regulator_is_enabled(cam_2v8_reg)) ++ regulator_disable(cam_2v8_reg); ++ break; ++ ++ case V4L2_POWER_ON: ++#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) ++ isp_configure_interface(vdev->cam->isp, &mt9t111_if_config); ++#endif ++ ++ /* Set RESET_BAR to 0 */ ++ gpio_set_value(LEOPARD_RESET_GPIO, 0); ++ ++ /* turn on VDD */ ++ regulator_enable(cam_1v8_reg); ++ ++ mdelay(1); ++ ++ /* turn on VDD_IO */ ++ regulator_enable(cam_2v8_reg); ++ ++ mdelay(50); ++ ++ /* Enable EXTCLK */ ++ isp_set_xclk(vdev->cam->isp, MT9T111_CLK_MIN, CAM_USE_XCLKA); ++ ++ /* ++ * Wait at least 70 CLK cycles (w/EXTCLK = 6MHz, or CLK_MIN): ++ * ((1000000 * 70) / 6000000) = aprox 12 us. ++ */ ++ ++ udelay(12); ++ ++ /* Set RESET_BAR to 1 */ ++ gpio_set_value(LEOPARD_RESET_GPIO, 1); ++ ++ /* ++ * Wait at least 100 CLK cycles (w/EXTCLK = 6MHz, or CLK_MIN): ++ * ((1000000 * 100) / 6000000) = aprox 17 us. ++ */ ++ ++ udelay(17); ++ ++ break; ++ ++ default: ++ return -ENODEV; ++ break; ++ } ++ return 0; ++} ++ ++struct mt9t111_platform_data mt9t111_pdata = { ++ .master = "omap34xxcam", ++ .power_set = mt9t111_power_set, ++ .priv_data_set = mt9t111_set_prv_data, ++ .ifparm = mt9t111_ifparm, ++}; ++ ++#endif /* #ifdef CONFIG_VIDEO_MT9T111 */ ++ + static int beagle_cam_probe(struct platform_device *pdev) + { + cam_1v8_reg = regulator_get(&pdev->dev, "cam_1v8"); +diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c +index b0da483..0e7e8b2 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle.c ++++ b/arch/arm/mach-omap2/board-omap3beagle.c +@@ -77,6 +77,12 @@ static struct omap_opp * _omap37x_l3_rate_table = NULL; + extern struct mt9v113_platform_data mt9v113_pdata; + #endif + ++#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) ++#include <media/v4l2-int-device.h> ++#include <media/mt9t111.h> ++extern struct mt9t111_platform_data mt9t111_pdata; ++#endif ++ + #define GPMC_CS0_BASE 0x60 + #define GPMC_CS_SIZE 0x30 + +@@ -596,6 +602,12 @@ static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = { + .platform_data = &mt9v113_pdata, + }, + #endif ++#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) ++ { ++ I2C_BOARD_INFO("mt9t111", MT9T111_I2C_ADDR), ++ .platform_data = &mt9t111_pdata, ++ }, ++#endif + }; + + static int __init omap3_beagle_i2c_init(void) +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0048-REMOVE-v4l2-Delete-MT9T111-sensor-driver.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0048-REMOVE-v4l2-Delete-MT9T111-sensor-driver.patch new file mode 100644 index 0000000000..06b18c97b0 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0048-REMOVE-v4l2-Delete-MT9T111-sensor-driver.patch @@ -0,0 +1,2402 @@ +From 0652f5802a6ac2b741b0c23fffe9bedaaae968ab Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 15 Jul 2010 00:50:07 -0500 +Subject: [PATCH 48/71] REMOVE: v4l2: Delete MT9T111 sensor driver + +This removes MT9T111 support from the kernel. + +Reason? Driver already exists in open source, and we're going to +reuse that one instead. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/Kconfig | 8 - + drivers/media/video/Makefile | 1 - + drivers/media/video/mt9t111.c | 885 ------------------------ + drivers/media/video/mt9t111_reg.h | 1364 ------------------------------------- + include/media/mt9t111.h | 79 --- + 5 files changed, 0 insertions(+), 2337 deletions(-) + delete mode 100644 drivers/media/video/mt9t111.c + delete mode 100644 drivers/media/video/mt9t111_reg.h + delete mode 100644 include/media/mt9t111.h + +diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig +index c14d758..780b246 100644 +--- a/drivers/media/video/Kconfig ++++ b/drivers/media/video/Kconfig +@@ -354,14 +354,6 @@ config VIDEO_MT9P012 + MT9P012 camera. It is currently working with the TI OMAP3 + camera controller. + +-config VIDEO_MT9T111 +- tristate "Micron MT9T111 raw sensor driver (3MP)" +- depends on I2C && VIDEO_V4L2 +- ---help--- +- This is a Video4Linux2 sensor-level driver for the Micron +- MT9T111 camera. It is currently working with the TI OMAP3 +- camera controller. +- + config VIDEO_DW9710 + tristate "Lens driver for DW9710" + depends on I2C && VIDEO_V4L2 +diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile +index 763c157..3828723 100644 +--- a/drivers/media/video/Makefile ++++ b/drivers/media/video/Makefile +@@ -128,7 +128,6 @@ obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o + obj-y += isp/ + obj-$(CONFIG_VIDEO_OMAP3) += omap34xxcam.o + obj-$(CONFIG_VIDEO_MT9P012) += mt9p012.o +-obj-$(CONFIG_VIDEO_MT9T111) += mt9t111.o + obj-$(CONFIG_VIDEO_DW9710) += dw9710.o + obj-$(CONFIG_VIDEO_TPS61059) += tps61059.o + obj-$(CONFIG_VIDEO_OV3640) += ov3640.o +diff --git a/drivers/media/video/mt9t111.c b/drivers/media/video/mt9t111.c +deleted file mode 100644 +index 10080af..0000000 +--- a/drivers/media/video/mt9t111.c ++++ /dev/null +@@ -1,885 +0,0 @@ +-/* +- * drivers/media/video/mt9t111.c +- * +- * mt9t111 sensor driver +- * +- * Copyright (C) 2009 Leopard Imaging +- * +- * This file is licensed under the terms of the GNU General Public License +- * version 2. This program is licensed "as is" without any warranty of any +- * kind, whether express or implied. +- */ +- +-#include <linux/i2c.h> +-#include <linux/delay.h> +-#include <media/v4l2-int-device.h> +- +-#include <media/mt9t111.h> +-#include "mt9t111_reg.h" +- +-/* YCbCr mode does not work yet */ +-#define USE_RAW +-/* Create a Color bar test pattern, Blue, Green, Red, Grey */ +-/* #define COLOR_BAR */ +- +-#define SENSOR_DETECTED 1 +-#define SENSOR_NOT_DETECTED 0 +- +-static void mt9t111_loaddefault(struct i2c_client *client); +- +-/* +- * as a place holder for further development +- */ +-static void debug_dummy(char *in_msg) +-{ +-} +- +-/* list of image formats supported by mt9t111 sensor */ +-const static struct v4l2_fmtdesc mt9t111_formats[] = { +-#ifdef USE_RAW +- { +- .description = "RAW ", +- .pixelformat = V4L2_PIX_FMT_SGRBG10, +- }, +-#else +- { +- .description = "YUV 422 ", +- .pixelformat = V4L2_PIX_FMT_YUYV, +- }, +-#endif +-}; +- +-#define NUM_CAPTURE_FORMATS ARRAY_SIZE(mt9t111_formats) +- +-/* +- * Array of image sizes supported by MT9T111. These must be ordered from +- * smallest image size to largest. +- */ +-const static struct capture_size mt9t111_sizes[] = { +- { 640, 480 }, +- /* { 2048, 1536} */ +-}; +- +-#define NUM_CAPTURE_SIZE ARRAY_SIZE(mt9t111_sizes) +- +- +-const struct v4l2_fract mt9t111_frameintervals[] = { +- { .numerator = 1, .denominator = 10 } +-}; +- +-#define NUM_CAPTURE_FRAMEINTERVALS ARRAY_SIZE(mt9t111_frameintervals) +- +-/** +- * struct mt9t111_sensor - main structure for storage of sensor information +- * @pdata: access functions and data for platform level information +- * @v4l2_int_device: V4L2 device structure structure +- * @i2c_client: iic client device structure +- * @pix: V4L2 pixel format information structure +- * @timeperframe: time per frame expressed as V4L fraction +- * @scaler: +- * @ver: mt9t111 chip version +- * @fps: frames per second value +- */ +-struct mt9t111_sensor { +- const struct mt9t111_platform_data *pdata; +- struct v4l2_int_device *v4l2_int_device; +- struct i2c_client *i2c_client; +- struct v4l2_pix_format pix; +- struct v4l2_fract timeperframe; +- int scaler; +- int ver; +- int fps; +- int state; +-}; +- +-static struct mt9t111_sensor mt9t111 = { +- .timeperframe = { +- .numerator = 1, +- .denominator = 10, +- }, +- .state = SENSOR_NOT_DETECTED, +-}; +- +-/** +- * mt9t111_read_reg - Read a value from a register in an mt9t111 sensor device +- * @client: i2c driver client structure +- * @data_length: length of data to be read +- * @reg: register address / offset +- * @val: stores the value that gets read +- * +- * Read a value from a register in an mt9t111 sensor device. +- * The value is returned in 'val'. +- * Returns zero if successful, or non-zero otherwise. +- */ +-static int +-mt9t111_read_reg(struct i2c_client *client, u16 reg, u16 *val) +-{ +- struct i2c_msg msg[1]; +- u8 data[4]; +- int err; +- +- msg->addr = client->addr; +- msg->flags = 0; +- msg->len = 2; +- msg->buf = data; +- data[0] = (reg & 0xff00) >> 8; +- data[1] = (reg & 0x00ff); +- err = i2c_transfer(client->adapter, msg, 1); +- if (err >= 0) { +- msg->flags = I2C_M_RD; +- msg->len = 2; /* 2 byte read */ +- err = i2c_transfer(client->adapter, msg, 1); +- if (err >= 0) { +- *val = ((data[0] & 0x00ff) << 8) +- | (data[1] & 0x00ff); +- return 0; +- } +- } +- return err; +-} +- +-/** +- * mt9t111_write_reg - Write a value to a register in an mt9t111 sensor device +- * @client: i2c driver client structure +- * @data_length: length of data to be read +- * @reg: register address / offset +- * @val: value to be written to specified register +- * +- * Write a value to a register in an mt9t111 sensor device. +- * Returns zero if successful, or non-zero otherwise. +- */ +-static int +-mt9t111_write_reg(struct i2c_client *client, u16 reg, u16 val) +-{ +- struct i2c_msg msg[1]; +- u8 data[20]; +- int err; +- +- msg->addr = client->addr; +- msg->flags = 0; +- msg->len = 4; +- msg->buf = data; +- data[0] = (u8)((reg & 0xff00) >> 8); +- data[1] = (u8)(reg & 0x00ff); +- data[2] = (u8)((val & 0xff00) >> 8); +- data[3] = (u8)(val & 0x00ff); +- err = i2c_transfer(client->adapter, msg, 1); +- +- return err; +-} +- +-/** +- * mt9t111_write_regs - Write registers to an mt9t111 sensor device +- * @client: i2c driver client structure +- * @reg_in: pointer to registers to write +- * @cnt: the number of registers +- * +- * Write registers . +- * Returns zero if successful, or non-zero otherwise. +- */ +-static int +-mt9t111_write_regs(struct i2c_client *client, mt9t111_regs *reg_in, int cnt) +-{ +- int err = 0; +- int i; +- mt9t111_regs *reg = reg_in; +- +- for (i = 0; i < cnt; i++) { +- if (reg->delay_time == 0) { +- err |= mt9t111_write_reg(client, reg->addr, reg->data); +- } else if (reg->addr != 0 || reg->data != 0) { +- err |= mt9t111_write_reg(client, reg->addr, reg->data); +- mdelay(reg->delay_time); +- } else { +- mdelay(reg->delay_time); +- } +- +- if (err < 0) { +- dev_warn(&client->dev, "write reg error, addr = 0x%x," +- " data = 0x%x \n", +- reg->addr, reg->data); +- return err; +- } +- reg++; +- } +- return err; +-} +- +-/** +- * mt9t111_detect - Detect if an mt9t111 is present, and if so which revision +- * @client: pointer to the i2c client driver structure +- * +- * Detect if an mt9t111 is present +- * Returns a negative error number if no device is detected, or the +- * non-negative value of the version ID register if a device is detected. +- */ +-static int +-mt9t111_detect(struct i2c_client *client) +-{ +- u16 val; +- +- /* chip ID is at address 0 */ +- if (mt9t111_read_reg(client, MT9T111_CHIP_ID, &val) < 0) +- return -ENODEV; +- +- if (val != MT9T111_CHIP_ID_VALUE) { +- dev_warn(&client->dev, "model id mismatch received 0x%x" +- " expecting 0x%x\n", +- val, MT9T111_CHIP_ID_VALUE); +- +- return -ENODEV; +- } +- +- return (int)val; +- +-} +- +-/** +- * mt9t111_configure - Configure the mt9t111 for the specified image mode +- * @s: pointer to standard V4L2 device structure +- * +- * Configure the mt9t111 for a specified image size, pixel format, and frame +- * period. xclk is the frequency (in Hz) of the xclk input to the mt9t111. +- * fper is the frame period (in seconds) expressed as a fraction. +- * Returns zero if successful, or non-zero otherwise. +- * The actual frame period is returned in fper. +- */ +-static int mt9t111_configure(struct v4l2_int_device *s) +-{ +- debug_dummy("debug_dummy -- to set imager mode"); +- +- return 0; +-} +- +-/** +- * ioctl_enum_framesizes - V4L2 sensor if handler for vidioc_int_enum_framesizes +- * @s: pointer to standard V4L2 device structure +- * @frms: pointer to standard V4L2 framesizes enumeration structure +- * +- * Returns possible framesizes depending on choosen pixel format +- **/ +-static int ioctl_enum_framesizes(struct v4l2_int_device *s, +- struct v4l2_frmsizeenum *frms) +-{ +- int ifmt; +- +- for (ifmt = 0; ifmt < NUM_CAPTURE_FORMATS; ifmt++) { +- if (frms->pixel_format == mt9t111_formats[ifmt].pixelformat) +- break; +- } +- /* Is requested pixelformat not found on sensor? */ +- if (ifmt == NUM_CAPTURE_FORMATS) +- return -EINVAL; +- +- /* Do we already reached all discrete framesizes? */ +- if (frms->index >= NUM_CAPTURE_SIZE) +- return -EINVAL; +- +- frms->type = V4L2_FRMSIZE_TYPE_DISCRETE; +- frms->discrete.width = mt9t111_sizes[frms->index].width; +- frms->discrete.height = mt9t111_sizes[frms->index].height; +- +- return 0; +- +-} +- +-static int ioctl_enum_frameintervals(struct v4l2_int_device *s, +- struct v4l2_frmivalenum *frmi) +-{ +- int ifmt; +- +- if (frmi->index >= NUM_CAPTURE_FRAMEINTERVALS) +- return -EINVAL; +- +- for (ifmt = 0; ifmt < NUM_CAPTURE_FORMATS; ifmt++) { +- if (frmi->pixel_format == mt9t111_formats[ifmt].pixelformat) +- break; +- } +- /* Is requested pixelformat not found on sensor? */ +- if (ifmt == NUM_CAPTURE_FORMATS) +- return -EINVAL; +- +- frmi->type = V4L2_FRMSIZE_TYPE_DISCRETE; +- frmi->discrete.numerator = +- mt9t111_frameintervals[frmi->index].numerator; +- frmi->discrete.denominator = +- mt9t111_frameintervals[frmi->index].denominator; +- return 0; +-} +- +-/** +- * ioctl_init - V4L2 sensor interface handler for VIDIOC_INT_INIT +- * @s: pointer to standard V4L2 device structure +- * +- * Initialize the sensor device (call mt9t111_configure()) +- */ +-static int ioctl_init(struct v4l2_int_device *s) +-{ +- return 0; +-} +- +-/** +- * ioctl_dev_exit - V4L2 sensor interface handler for vidioc_int_dev_exit_num +- * @s: pointer to standard V4L2 device structure +- * +- * Delinitialise the dev. at slave detach. The complement of ioctl_dev_init. +- */ +-static int ioctl_dev_exit(struct v4l2_int_device *s) +-{ +- return 0; +-} +- +-/** +- * ioctl_dev_init - V4L2 sensor interface handler for vidioc_int_dev_init_num +- * @s: pointer to standard V4L2 device structure +- * +- * Initialise the device when slave attaches to the master. Returns 0 if +- * mt9t111 device could be found, otherwise returns appropriate error. +- */ +-static int ioctl_dev_init(struct v4l2_int_device *s) +-{ +- return 0; +-} +- +-/** +- * ioctl_s_power - V4L2 sensor interface handler for vidioc_int_s_power_num +- * @s: pointer to standard V4L2 device structure +- * @on: power state to which device is to be set +- * +- * Sets devices power state to requrested state, if possible. +- */ +-static int ioctl_s_power(struct v4l2_int_device *s, enum v4l2_power on) +-{ +- struct mt9t111_sensor *sensor = s->priv; +- struct i2c_client *c = sensor->i2c_client; +- int rval; +- +- if ((on == V4L2_POWER_STANDBY) && (sensor->state == SENSOR_DETECTED)) +- debug_dummy("debug_dummy -- put to standby\n"); +- +- if (on != V4L2_POWER_ON) +- debug_dummy("debug_dummy -- stop master clock\n"); +- else +- debug_dummy("debug_dummy -- enable clock\n");; +- +- rval = sensor->pdata->power_set(s, on); +- if (rval < 0) { +- dev_err(&c->dev, "Unable to set the power state: " "mt9t111" +- " sensor\n"); +- /* sensor->pdata->set_xclk(0); */ +- return rval; +- } +- +- if ((on == V4L2_POWER_ON) && (sensor->state == SENSOR_DETECTED)) +- mt9t111_loaddefault(c); +- +- if ((on == V4L2_POWER_ON) && (sensor->state == SENSOR_NOT_DETECTED)) { +- rval = mt9t111_detect(c); +- if (rval < 0) { +- dev_err(&c->dev, "Unable to detect " "mt9t111" +- " sensor\n"); +- sensor->state = SENSOR_NOT_DETECTED; +- return rval; +- } +- dev_info(&c->dev, "chip version 0x%02x detected\n", rval); +- sensor->state = SENSOR_DETECTED; +- sensor->ver = rval; +- } +- return 0; +-} +- +-/** +- * ioctl_g_priv - V4L2 sensor interface handler for vidioc_int_g_priv_num +- * @s: pointer to standard V4L2 device structure +- * @p: void pointer to hold sensor's private data address +- * +- * Returns device's (sensor's) private data area address in p parameter +- */ +-static int ioctl_g_priv(struct v4l2_int_device *s, void *p) +-{ +- struct mt9t111_sensor *sensor = s->priv; +- +- return sensor->pdata->priv_data_set(p); +-} +- +-/** +- * ioctl_s_parm - V4L2 sensor interface handler for VIDIOC_S_PARM ioctl +- * @s: pointer to standard V4L2 device structure +- * @a: pointer to standard V4L2 VIDIOC_S_PARM ioctl structure +- * +- * Configures the sensor to use the input parameters, if possible. If +- * not possible, reverts to the old parameters and returns the +- * appropriate error code. +- */ +-static int ioctl_s_parm(struct v4l2_int_device *s, +- struct v4l2_streamparm *a) +-{ +- /* TODO: set paramters */ +- debug_dummy("debug_dummy -- VIDIOC_S_PARM "); +- return 0; +-} +- +-/** +- * ioctl_g_parm - V4L2 sensor interface handler for VIDIOC_G_PARM ioctl +- * @s: pointer to standard V4L2 device structure +- * @a: pointer to standard V4L2 VIDIOC_G_PARM ioctl structure +- * +- * Returns the sensor's video CAPTURE parameters. +- */ +-static int ioctl_g_parm(struct v4l2_int_device *s, +- struct v4l2_streamparm *a) +-{ +- struct mt9t111_sensor *sensor = s->priv; +- struct v4l2_captureparm *cparm = &a->parm.capture; +- +- if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) +- return -EINVAL; +- +- memset(a, 0, sizeof(*a)); +- a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; +- +- cparm->capability = V4L2_CAP_TIMEPERFRAME; +- cparm->timeperframe = sensor->timeperframe; +- +- return 0; +-} +- +-/** +- * ioctl_g_fmt_cap - V4L2 sensor interface handler for ioctl_g_fmt_cap +- * @s: pointer to standard V4L2 device structure +- * @f: pointer to standard V4L2 v4l2_format structure +- * +- * Returns the sensor's current pixel format in the v4l2_format +- * parameter. +- */ +-static int ioctl_g_fmt_cap(struct v4l2_int_device *s, +- struct v4l2_format *f) +-{ +- struct mt9t111_sensor *sensor = s->priv; +- f->fmt.pix = sensor->pix; +- +- return 0; +-} +- +-/** +- * ioctl_try_fmt_cap - Implement the CAPTURE buffer VIDIOC_TRY_FMT ioctl +- * @s: pointer to standard V4L2 device structure +- * @f: pointer to standard V4L2 VIDIOC_TRY_FMT ioctl structure +- * +- * Implement the VIDIOC_TRY_FMT ioctl for the CAPTURE buffer type. This +- * ioctl is used to negotiate the image capture size and pixel format +- * without actually making it take effect. +- */ +-static int ioctl_try_fmt_cap(struct v4l2_int_device *s, +- struct v4l2_format *f) +-{ +- struct v4l2_pix_format *pix = &f->fmt.pix; +- struct mt9t111_sensor *sensor = s->priv; +- struct v4l2_pix_format *pix2 = &sensor->pix; +- +- pix->width = 640; +- pix->height = 480; +-#ifdef USE_RAW +- pix->pixelformat = V4L2_PIX_FMT_SGRBG10; +- pix->bytesperline = pix->width; +- pix->colorspace = V4L2_COLORSPACE_SRGB; +-#else +- pix->pixelformat = V4L2_PIX_FMT_YUYV; +- pix->bytesperline = pix->width * 2; +- pix->colorspace = V4L2_COLORSPACE_JPEG; +-#endif +- pix->field = V4L2_FIELD_NONE; +- +- pix->sizeimage = pix->bytesperline * pix->height; +- pix->priv = 0; +- *pix2 = *pix; +- return 0; +-} +- +-/** +- * ioctl_s_fmt_cap - V4L2 sensor interface handler for VIDIOC_S_FMT ioctl +- * @s: pointer to standard V4L2 device structure +- * @f: pointer to standard V4L2 VIDIOC_S_FMT ioctl structure +- * +- * If the requested format is supported, configures the HW to use that +- * format, returns error code if format not supported or HW can't be +- * correctly configured. +- */ +-static int ioctl_s_fmt_cap(struct v4l2_int_device *s, +- struct v4l2_format *f) +-{ +- struct mt9t111_sensor *sensor = s->priv; +- struct v4l2_pix_format *pix = &f->fmt.pix; +- int rval; +- +- rval = ioctl_try_fmt_cap(s, f); +- if (!rval) +- sensor->pix = *pix; +- +- return rval; +-} +- +-/** +- * ioctl_enum_fmt_cap - Implement the CAPTURE buffer VIDIOC_ENUM_FMT ioctl +- * @s: pointer to standard V4L2 device structure +- * @fmt: standard V4L2 VIDIOC_ENUM_FMT ioctl structure +- * +- * Implement the VIDIOC_ENUM_FMT ioctl for the CAPTURE buffer type. +- */ +-static int ioctl_enum_fmt_cap(struct v4l2_int_device *s, +- struct v4l2_fmtdesc *fmt) +-{ +- int index = fmt->index; +- enum v4l2_buf_type type = fmt->type; +- +- memset(fmt, 0, sizeof(*fmt)); +- fmt->index = index; +- fmt->type = type; +- +- switch (fmt->type) { +- case V4L2_BUF_TYPE_VIDEO_CAPTURE: +- if (index >= NUM_CAPTURE_FORMATS) +- return -EINVAL; +- break; +- default: +- return -EINVAL; +- } +- +- fmt->flags = mt9t111_formats[index].flags; +- strlcpy(fmt->description, mt9t111_formats[index].description, +- sizeof(fmt->description)); +- fmt->pixelformat = mt9t111_formats[index].pixelformat; +- +- return 0; +-} +- +-/** +- * ioctl_s_ctrl - V4L2 sensor interface handler for VIDIOC_S_CTRL ioctl +- * @s: pointer to standard V4L2 device structure +- * @vc: standard V4L2 VIDIOC_S_CTRL ioctl structure +- * +- * If the requested control is supported, sets the control's current +- * value in HW (and updates the video_control[] array). Otherwise, +- * returns -EINVAL if the control is not supported. +- */ +-static int ioctl_s_ctrl(struct v4l2_int_device *s, +- struct v4l2_control *vc) +-{ +- debug_dummy("debug_dummy -- s ctrl\n"); +- return 0; +-} +- +-/** +- * ioctl_g_ctrl - V4L2 sensor interface handler for VIDIOC_G_CTRL ioctl +- * @s: pointer to standard V4L2 device structure +- * @vc: standard V4L2 VIDIOC_G_CTRL ioctl structure +- * +- * If the requested control is supported, returns the control's current +- * value from the video_control[] array. Otherwise, returns -EINVAL +- * if the control is not supported. +- */ +-static int ioctl_g_ctrl(struct v4l2_int_device *s, +- struct v4l2_control *vc) +-{ +- debug_dummy("debug_dummy -- g ctrl\n"); +- return 0; +-} +- +-/** +- * ioctl_queryctrl - V4L2 sensor interface handler for VIDIOC_QUERYCTRL ioctl +- * @s: pointer to standard V4L2 device structure +- * @qc: standard V4L2 VIDIOC_QUERYCTRL ioctl structure +- * +- * If the requested control is supported, returns the control information +- * from the video_control[] array. Otherwise, returns -EINVAL if the +- * control is not supported. +- */ +-static int ioctl_queryctrl(struct v4l2_int_device *s, +- struct v4l2_queryctrl *qc) +-{ +- debug_dummy("debug_dummy -- query ctrl\n"); +- return -EINVAL; +-} +- +-/** +- * ioctl_s_routing - V4L2 decoder interface handler for VIDIOC_S_INPUT ioctl +- * @s: pointer to standard V4L2 device structure +- * @index: number of the input +- * +- * If index is valid, selects the requested input. Otherwise, returns -EINVAL if +- * the input is not supported or there is no active signal present in the +- * selected input. +- */ +-static int ioctl_s_routing(struct v4l2_int_device *s, +- struct v4l2_routing *route) +-{ +- return 0; +-} +- +-/** +- * ioctl_g_ifparm - V4L2 decoder interface handler for vidioc_int_g_ifparm_num +- * @s: pointer to standard V4L2 device structure +- * @p: pointer to standard V4L2 vidioc_int_g_ifparm_num ioctl structure +- * +- * Gets slave interface parameters. +- * Calculates the required xclk value to support the requested +- * clock parameters in p. This value is returned in the p +- * parameter. +- */ +-static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p) +-{ +- struct mt9t111_sensor *sensor = s->priv; +- int rval; +- +- if (p == NULL) +- return -EINVAL; +- +- if (NULL == sensor->pdata->ifparm) +- return -EINVAL; +- +- rval = sensor->pdata->ifparm(p); +- if (rval) { +- v4l_err(sensor->i2c_client, "g_ifparm.Err[%d]\n", rval); +- return rval; +- } +- +- p->u.ycbcr.clock_curr = 40 * 1000000; /* temporal value */ +- +- return 0; +-} +- +-static struct v4l2_int_ioctl_desc mt9t111_ioctl_desc[] = { +- { .num = vidioc_int_enum_framesizes_num, +- .func = (v4l2_int_ioctl_func *)ioctl_enum_framesizes }, +- { .num = vidioc_int_enum_frameintervals_num, +- .func = (v4l2_int_ioctl_func *)ioctl_enum_frameintervals }, +- { .num = vidioc_int_dev_init_num, +- .func = (v4l2_int_ioctl_func *)ioctl_dev_init }, +- { .num = vidioc_int_dev_exit_num, +- .func = (v4l2_int_ioctl_func *)ioctl_dev_exit }, +- { .num = vidioc_int_s_power_num, +- .func = (v4l2_int_ioctl_func *)ioctl_s_power }, +- { .num = vidioc_int_g_priv_num, +- .func = (v4l2_int_ioctl_func *)ioctl_g_priv }, +- { .num = vidioc_int_g_ifparm_num, +- .func = (v4l2_int_ioctl_func *)ioctl_g_ifparm }, +- { .num = vidioc_int_init_num, +- .func = (v4l2_int_ioctl_func *)ioctl_init }, +- { .num = vidioc_int_enum_fmt_cap_num, +- .func = (v4l2_int_ioctl_func *)ioctl_enum_fmt_cap }, +- { .num = vidioc_int_try_fmt_cap_num, +- .func = (v4l2_int_ioctl_func *)ioctl_try_fmt_cap }, +- { .num = vidioc_int_g_fmt_cap_num, +- .func = (v4l2_int_ioctl_func *)ioctl_g_fmt_cap }, +- { .num = vidioc_int_s_fmt_cap_num, +- .func = (v4l2_int_ioctl_func *)ioctl_s_fmt_cap }, +- { .num = vidioc_int_g_parm_num, +- .func = (v4l2_int_ioctl_func *)ioctl_g_parm }, +- { .num = vidioc_int_s_parm_num, +- .func = (v4l2_int_ioctl_func *)ioctl_s_parm }, +- { .num = vidioc_int_queryctrl_num, +- .func = (v4l2_int_ioctl_func *)ioctl_queryctrl }, +- { .num = vidioc_int_g_ctrl_num, +- .func = (v4l2_int_ioctl_func *)ioctl_g_ctrl }, +- { .num = vidioc_int_s_ctrl_num, +- .func = (v4l2_int_ioctl_func *)ioctl_s_ctrl }, +- { .num = vidioc_int_s_video_routing_num, +- .func = (v4l2_int_ioctl_func *)ioctl_s_routing }, +-}; +- +-static void mt9t111_refresh(struct i2c_client *client) +-{ +- int i; +- unsigned short value; +- /* MCU_ADDRESS [SEQ_CMD] -- refresh */ +- mt9t111_write_reg(client, 0x098E, 0x8400); +- mt9t111_write_reg(client, 0x0990, 0x0006); +- for (i = 0; i < 100; i++) { +- mt9t111_write_reg(client, 0x098E, 0x8400); +- mt9t111_read_reg(client, 0x0990, &value); +- if (value == 0) +- break; +- mdelay(5); +- } +-} +- +-#ifdef COLOR_BAR +-static void mt9t111_color_bar(struct i2c_client *client) +-{ +- mt9t111_write_reg(client, 0x3210, 0x01B0); /* disable lens correction */ +- +- mt9t111_write_reg(client, 0x098E, 0x6003); +- mt9t111_write_reg(client, 0x0990, 0x0100); +- mt9t111_write_reg(client, 0x098E, 0x6025); +- mt9t111_write_reg(client, 0x0990, 0x0003); +-} +-#endif +- +-static void mt9t111_bayer_format(struct i2c_client *client) +-{ +- mt9t111_write_regs(client, bayer_pattern_regs, +- sizeof(bayer_pattern_regs) / sizeof(mt9t111_regs)); +-} +- +-static void mt9t111_enable_pll(struct i2c_client *client) +-{ +- int i; +- unsigned short value; +- +- mt9t111_write_regs(client, pll_regs1, +- sizeof(pll_regs1) / sizeof(mt9t111_regs)); +- for (i = 0; i < 100; i++) { +- mt9t111_read_reg(client, 0x0014, &value); +- if ((value & 0x8000) != 0) +- break; +- mdelay(2); +- } +- mt9t111_write_regs(client, pll_regs2, +- sizeof(pll_regs2) / sizeof(mt9t111_regs)); +-} +- +- +-static void mt9t111_loaddefault(struct i2c_client *client) +-{ +- mt9t111_write_reg(client, 0x001A, 0x0219); +- mt9t111_write_reg(client, 0x001A, 0x0218); +- +- mt9t111_enable_pll(client); +- mt9t111_write_regs(client, def_regs1, +- sizeof(def_regs1) / sizeof(mt9t111_regs)); +- mt9t111_write_regs(client, patch_rev6, +- sizeof(patch_rev6) / sizeof(mt9t111_regs)); +- mt9t111_write_regs(client, def_regs2, +- sizeof(def_regs2) / sizeof(mt9t111_regs)); +- +-#ifdef USE_RAW +- mt9t111_bayer_format(client); +-#endif +- +-#ifdef COLOR_BAR +- mt9t111_color_bar(client); +-#endif +- +- mt9t111_refresh(client); +-} +- +-static struct v4l2_int_slave mt9t111_slave = { +- .ioctls = mt9t111_ioctl_desc, +- .num_ioctls = ARRAY_SIZE(mt9t111_ioctl_desc), +-}; +- +-static struct v4l2_int_device mt9t111_int_device = { +- .module = THIS_MODULE, +- .name = "mt9t111", +- .priv = &mt9t111, +- .type = v4l2_int_type_slave, +- .u = { +- .slave = &mt9t111_slave, +- }, +-}; +- +-/** +- * mt9t111_probe - sensor driver i2c probe handler +- * @client: i2c driver client device structure +- * +- * Register sensor as an i2c client device and V4L2 +- * device. +- */ +-static int +-mt9t111_probe(struct i2c_client *client, const struct i2c_device_id *id) +-{ +- struct mt9t111_sensor *sensor = &mt9t111; +- int err; +- +- if (i2c_get_clientdata(client)) +- return -EBUSY; +- +- sensor->pdata = client->dev.platform_data; +- +- if (!sensor->pdata) { +- dev_err(&client->dev, "no platform data?\n"); +- return -ENODEV; +- } +- +- sensor->v4l2_int_device = &mt9t111_int_device; +- sensor->i2c_client = client; +- +- i2c_set_clientdata(client, sensor); +- +- sensor->pix.width = 640; +- sensor->pix.height = 480; +-#ifdef USE_RAW +- sensor->pix.pixelformat = V4L2_PIX_FMT_SGRBG10; +-#else +- sensor->pix.pixelformat = V4L2_PIX_FMT_YUYV; +-#endif +- err = v4l2_int_device_register(sensor->v4l2_int_device); +- if (err) +- i2c_set_clientdata(client, NULL); +- return err; +-} +- +-/** +- * mt9t111_remove - sensor driver i2c remove handler +- * @client: i2c driver client device structure +- * +- * Unregister sensor as an i2c client device and V4L2 +- * device. Complement of mt9t111_probe(). +- */ +-static int __exit +-mt9t111_remove(struct i2c_client *client) +-{ +- struct mt9t111_sensor *sensor = i2c_get_clientdata(client); +- +- if (!client->adapter) +- return -ENODEV; /* our client isn't attached */ +- +- v4l2_int_device_unregister(sensor->v4l2_int_device); +- i2c_set_clientdata(client, NULL); +- +- return 0; +-} +- +-static const struct i2c_device_id mt9t111_id[] = { +- { "mt9t111", 0 }, +- { }, +-}; +-MODULE_DEVICE_TABLE(i2c, mt9t111_id); +- +-static struct i2c_driver mt9t111sensor_i2c_driver = { +- .driver = { +- .name = "mt9t111", +- .owner = THIS_MODULE, +- }, +- .probe = mt9t111_probe, +- .remove = __exit_p(mt9t111_remove), +- .id_table = mt9t111_id, +-}; +- +-/** +- * mt9t111sensor_init - sensor driver module_init handler +- * +- * Registers driver as an i2c client driver. Returns 0 on success, +- * error code otherwise. +- */ +-static int __init mt9t111sensor_init(void) +-{ +-printk(KERN_INFO "entering mt9t111sensor_init\n"); +- return i2c_add_driver(&mt9t111sensor_i2c_driver); +-} +-module_init(mt9t111sensor_init); +- +-/** +- * mt9t111sensor_cleanup - sensor driver module_exit handler +- * +- * Unregisters/deletes driver as an i2c client driver. +- * Complement of mt9t111sensor_init. +- */ +-static void __exit mt9t111sensor_cleanup(void) +-{ +- i2c_del_driver(&mt9t111sensor_i2c_driver); +-} +-module_exit(mt9t111sensor_cleanup); +- +-MODULE_LICENSE("GPL"); +-MODULE_DESCRIPTION("mt9t111 camera sensor driver"); +diff --git a/drivers/media/video/mt9t111_reg.h b/drivers/media/video/mt9t111_reg.h +deleted file mode 100644 +index e226c37..0000000 +--- a/drivers/media/video/mt9t111_reg.h ++++ /dev/null +@@ -1,1364 +0,0 @@ +-/* +- * drivers/media/video/mt9t111_reg.h +- * +- * mt9t111 sensor driver header file +- * +- * Copyright (C) 2009 Leopard Imaging +- * +- * This file is licensed under the terms of the GNU General Public License +- * version 2. This program is licensed "as is" without any warranty of any +- * kind, whether express or implied. +- */ +- +-#ifndef MT9T111_REG_H +-#define MT9T111_REG_H +- +-/* register addr */ +-#define MT9T111_CHIP_ID (0x0000) +- +-/* register value */ +-#define MT9T111_CHIP_ID_VALUE (0x2680) +- +-typedef struct { +- u16 delay_time; +- u16 addr; +- u16 data; +-} mt9t111_regs; +- +-mt9t111_regs patch_rev6[] = { +- {0, 0x0982, 0x0}, +- {0, 0x098A, 0xCE7}, +- {0, 0x0990, 0x3C3C}, +- {0, 0x0992, 0x3C3C}, +- {0, 0x0994, 0x3C5F}, +- {0, 0x0996, 0x4F30}, +- {0, 0x0998, 0xED08}, +- {0, 0x099a, 0xBD61}, +- {0, 0x099c, 0xD5CE}, +- {0, 0x099e, 0x4CD}, +- {0, 0x098A, 0xCF7}, +- {0, 0x0990, 0x1F17}, +- {0, 0x0992, 0x211}, +- {0, 0x0994, 0xCC33}, +- {0, 0x0996, 0x2E30}, +- {0, 0x0998, 0xED02}, +- {0, 0x099a, 0xCCFF}, +- {0, 0x099c, 0xFDED}, +- {0, 0x099e, 0xCC}, +- {0, 0x098A, 0xD07}, +- {0, 0x0990, 0x2}, +- {0, 0x0992, 0xBD70}, +- {0, 0x0994, 0x6D18}, +- {0, 0x0996, 0xDE1F}, +- {0, 0x0998, 0x181F}, +- {0, 0x099a, 0x8E01}, +- {0, 0x099c, 0x10CC}, +- {0, 0x099e, 0x3C52}, +- {0, 0x098A, 0xD17}, +- {0, 0x0990, 0x30ED}, +- {0, 0x0992, 0x18}, +- {0, 0x0994, 0xECA0}, +- {0, 0x0996, 0xC4FD}, +- {0, 0x0998, 0xBD70}, +- {0, 0x099a, 0x2120}, +- {0, 0x099c, 0x1ECC}, +- {0, 0x099e, 0x3C52}, +- {0, 0x098A, 0xD27}, +- {0, 0x0990, 0x30ED}, +- {0, 0x0992, 0xDE}, +- {0, 0x0994, 0x1FEC}, +- {0, 0x0996, 0xA0BD}, +- {0, 0x0998, 0x7021}, +- {0, 0x099a, 0xCC3C}, +- {0, 0x099c, 0x5230}, +- {0, 0x099e, 0xED02}, +- {0, 0x098A, 0xD37}, +- {0, 0x0990, 0xCCFF}, +- {0, 0x0992, 0xFCED}, +- {0, 0x0994, 0xCC}, +- {0, 0x0996, 0x2}, +- {0, 0x0998, 0xBD70}, +- {0, 0x099a, 0x6DFC}, +- {0, 0x099c, 0x4E1}, +- {0, 0x099e, 0x1A83}, +- {0, 0x098A, 0xD47}, +- {0, 0x0990, 0x1}, +- {0, 0x0992, 0x2720}, +- {0, 0x0994, 0x1A83}, +- {0, 0x0996, 0x4}, +- {0, 0x0998, 0x271E}, +- {0, 0x099a, 0x1A83}, +- {0, 0x099c, 0x8}, +- {0, 0x099e, 0x271C}, +- {0, 0x098A, 0xD57}, +- {0, 0x0990, 0x1A83}, +- {0, 0x0992, 0x10}, +- {0, 0x0994, 0x271A}, +- {0, 0x0996, 0x1A83}, +- {0, 0x0998, 0x20}, +- {0, 0x099a, 0x2718}, +- {0, 0x099c, 0x1A83}, +- {0, 0x099e, 0x40}, +- {0, 0x098A, 0xD67}, +- {0, 0x0990, 0x2716}, +- {0, 0x0992, 0x2019}, +- {0, 0x0994, 0xC61E}, +- {0, 0x0996, 0x2012}, +- {0, 0x0998, 0xC622}, +- {0, 0x099a, 0x200E}, +- {0, 0x099c, 0xC621}, +- {0, 0x099e, 0x200A}, +- {0, 0x098A, 0xD77}, +- {0, 0x0990, 0xC620}, +- {0, 0x0992, 0x2006}, +- {0, 0x0994, 0xC62A}, +- {0, 0x0996, 0x2002}, +- {0, 0x0998, 0xC62B}, +- {0, 0x099a, 0x30ED}, +- {0, 0x099c, 0x8CC}, +- {0, 0x099e, 0x3400}, +- {0, 0x098A, 0xD87}, +- {0, 0x0990, 0x30ED}, +- {0, 0x0992, 0x34}, +- {0, 0x0994, 0xBD6F}, +- {0, 0x0996, 0xD184}, +- {0, 0x0998, 0x330}, +- {0, 0x099a, 0xED07}, +- {0, 0x099c, 0xA60A}, +- {0, 0x099e, 0x4848}, +- {0, 0x098A, 0xD97}, +- {0, 0x0990, 0x5FED}, +- {0, 0x0992, 0x5EA}, +- {0, 0x0994, 0x8AA}, +- {0, 0x0996, 0x731}, +- {0, 0x0998, 0xBD70}, +- {0, 0x099a, 0x2130}, +- {0, 0x099c, 0xC60A}, +- {0, 0x099e, 0x3A35}, +- {0, 0x098A, 0xDA7}, +- {0, 0x0990, 0x3937}, +- {0, 0x0992, 0x3C3C}, +- {0, 0x0994, 0x3C34}, +- {0, 0x0996, 0xDE2F}, +- {0, 0x0998, 0xEE0E}, +- {0, 0x099a, 0xAD00}, +- {0, 0x099c, 0x7D13}, +- {0, 0x099e, 0xEF27}, +- {0, 0x098A, 0xDB7}, +- {0, 0x0990, 0x7CCE}, +- {0, 0x0992, 0x13E0}, +- {0, 0x0994, 0x1E05}, +- {0, 0x0996, 0x1060}, +- {0, 0x0998, 0xE60E}, +- {0, 0x099a, 0x4FC3}, +- {0, 0x099c, 0x13F0}, +- {0, 0x099e, 0x8FE6}, +- {0, 0x098A, 0xDC7}, +- {0, 0x0990, 0x30}, +- {0, 0x0992, 0xE107}, +- {0, 0x0994, 0x2216}, +- {0, 0x0996, 0xF613}, +- {0, 0x0998, 0xEE4F}, +- {0, 0x099a, 0xC313}, +- {0, 0x099c, 0xF38F}, +- {0, 0x099e, 0xE600}, +- {0, 0x098A, 0xDD7}, +- {0, 0x0990, 0x30E1}, +- {0, 0x0992, 0x725}, +- {0, 0x0994, 0x7F6}, +- {0, 0x0996, 0x13EE}, +- {0, 0x0998, 0xC103}, +- {0, 0x099a, 0x253C}, +- {0, 0x099c, 0x7F13}, +- {0, 0x099e, 0xEEF6}, +- {0, 0x098A, 0xDE7}, +- {0, 0x0990, 0x13EF}, +- {0, 0x0992, 0xE706}, +- {0, 0x0994, 0xCC13}, +- {0, 0x0996, 0xF0ED}, +- {0, 0x0998, 0x4CC}, +- {0, 0x099a, 0x13F3}, +- {0, 0x099c, 0x200F}, +- {0, 0x099e, 0x7C13}, +- {0, 0x098A, 0xDF7}, +- {0, 0x0990, 0xEEEC}, +- {0, 0x0992, 0x4C3}, +- {0, 0x0994, 0x1}, +- {0, 0x0996, 0xED04}, +- {0, 0x0998, 0xEC02}, +- {0, 0x099a, 0xC300}, +- {0, 0x099c, 0x1ED}, +- {0, 0x099e, 0x2F6}, +- {0, 0x098A, 0xE07}, +- {0, 0x0990, 0x13EE}, +- {0, 0x0992, 0xE106}, +- {0, 0x0994, 0x2412}, +- {0, 0x0996, 0xEE04}, +- {0, 0x0998, 0xE600}, +- {0, 0x099a, 0x30E1}, +- {0, 0x099c, 0x722}, +- {0, 0x099e, 0xDFEE}, +- {0, 0x098A, 0xE17}, +- {0, 0x0990, 0x2E6}, +- {0, 0x0992, 0x30}, +- {0, 0x0994, 0xE107}, +- {0, 0x0996, 0x25D6}, +- {0, 0x0998, 0xDE49}, +- {0, 0x099a, 0xEE08}, +- {0, 0x099c, 0xAD00}, +- {0, 0x099e, 0xCC13}, +- {0, 0x098A, 0xE27}, +- {0, 0x0990, 0xF630}, +- {0, 0x0992, 0xED00}, +- {0, 0x0994, 0xDE2F}, +- {0, 0x0996, 0xEE10}, +- {0, 0x0998, 0xCC13}, +- {0, 0x099a, 0xFAAD}, +- {0, 0x099c, 0x38}, +- {0, 0x099e, 0x3838}, +- {0, 0x098A, 0xE37}, +- {0, 0x0990, 0x3839}, +- {0, 0x098A, 0x1000}, +- {0, 0x0990, 0xCC10}, +- {0, 0x0992, 0x9BD}, +- {0, 0x0994, 0x4224}, +- {0, 0x0996, 0x7E10}, +- {0, 0x0998, 0x9C6}, +- {0, 0x099a, 0x1F7}, +- {0, 0x099c, 0x18A}, +- {0, 0x099e, 0xC606}, +- {0, 0x098A, 0x1010}, +- {0, 0x0990, 0xF701}, +- {0, 0x0992, 0x8BDE}, +- {0, 0x0994, 0x3F18}, +- {0, 0x0996, 0xCE0B}, +- {0, 0x0998, 0xF1CC}, +- {0, 0x099a, 0x11}, +- {0, 0x099c, 0xBDD7}, +- {0, 0x099e, 0xCC}, +- {0, 0x098A, 0x1020}, +- {0, 0x0990, 0xBF1}, +- {0, 0x0992, 0xDD3F}, +- {0, 0x0994, 0xDE35}, +- {0, 0x0996, 0x18CE}, +- {0, 0x0998, 0xC03}, +- {0, 0x099a, 0xCC00}, +- {0, 0x099c, 0x3FBD}, +- {0, 0x099e, 0xD700}, +- {0, 0x098A, 0x1030}, +- {0, 0x0990, 0xCC0C}, +- {0, 0x0992, 0x3DD}, +- {0, 0x0994, 0x35DE}, +- {0, 0x0996, 0x4718}, +- {0, 0x0998, 0xCE0C}, +- {0, 0x099a, 0x43CC}, +- {0, 0x099c, 0x15}, +- {0, 0x099e, 0xBDD7}, +- {0, 0x098A, 0x1040}, +- {0, 0x0990, 0xCC}, +- {0, 0x0992, 0xC43}, +- {0, 0x0994, 0xDD47}, +- {0, 0x0996, 0xFE00}, +- {0, 0x0998, 0x3318}, +- {0, 0x099a, 0xCE0C}, +- {0, 0x099c, 0x59CC}, +- {0, 0x099e, 0x9}, +- {0, 0x098A, 0x1050}, +- {0, 0x0990, 0xBDD7}, +- {0, 0x0992, 0xCC}, +- {0, 0x0994, 0xC59}, +- {0, 0x0996, 0xFD00}, +- {0, 0x0998, 0x33DE}, +- {0, 0x099a, 0x4118}, +- {0, 0x099c, 0xCE0C}, +- {0, 0x099e, 0x63CC}, +- {0, 0x098A, 0x1060}, +- {0, 0x0990, 0xD}, +- {0, 0x0992, 0xBDD7}, +- {0, 0x0994, 0xCC}, +- {0, 0x0996, 0xC63}, +- {0, 0x0998, 0xDD41}, +- {0, 0x099a, 0xFE00}, +- {0, 0x099c, 0x3118}, +- {0, 0x099e, 0xCE0C}, +- {0, 0x098A, 0x1070}, +- {0, 0x0990, 0x71CC}, +- {0, 0x0992, 0x29}, +- {0, 0x0994, 0xBDD7}, +- {0, 0x0996, 0xCC}, +- {0, 0x0998, 0xC71}, +- {0, 0x099a, 0xFD00}, +- {0, 0x099c, 0x31DE}, +- {0, 0x099e, 0x3918}, +- {0, 0x098A, 0x1080}, +- {0, 0x0990, 0xCE0C}, +- {0, 0x0992, 0x9BCC}, +- {0, 0x0994, 0x23}, +- {0, 0x0996, 0xBDD7}, +- {0, 0x0998, 0xCC}, +- {0, 0x099a, 0xC9B}, +- {0, 0x099c, 0xDD39}, +- {0, 0x099e, 0xDE49}, +- {0, 0x098A, 0x1090}, +- {0, 0x0990, 0x18CE}, +- {0, 0x0992, 0xCBF}, +- {0, 0x0994, 0xCC00}, +- {0, 0x0996, 0xDBD}, +- {0, 0x0998, 0xD700}, +- {0, 0x099a, 0xCC0C}, +- {0, 0x099c, 0xBFDD}, +- {0, 0x099e, 0x49CC}, +- {0, 0x098A, 0x10A0}, +- {0, 0x0990, 0x1162}, +- {0, 0x0992, 0xFD0B}, +- {0, 0x0994, 0xFDCC}, +- {0, 0x0996, 0xCE7}, +- {0, 0x0998, 0xFD0C}, +- {0, 0x099a, 0x1FCC}, +- {0, 0x099c, 0x1245}, +- {0, 0x099e, 0xFD0C}, +- {0, 0x098A, 0x10B0}, +- {0, 0x0990, 0x51CC}, +- {0, 0x0992, 0x110B}, +- {0, 0x0994, 0xFD0C}, +- {0, 0x0996, 0x5BCC}, +- {0, 0x0998, 0x1108}, +- {0, 0x099a, 0xFD0C}, +- {0, 0x099c, 0x65CC}, +- {0, 0x099e, 0x10D0}, +- {0, 0x098A, 0x10C0}, +- {0, 0x0990, 0xFD0C}, +- {0, 0x0992, 0x7BCC}, +- {0, 0x0994, 0x12DE}, +- {0, 0x0996, 0xFD0C}, +- {0, 0x0998, 0xA7CC}, +- {0, 0x099a, 0xDA8}, +- {0, 0x099c, 0xFD0C}, +- {0, 0x099e, 0xCB39}, +- {0, 0x098A, 0x10D0}, +- {0, 0x0990, 0x37DE}, +- {0, 0x0992, 0x1DEC}, +- {0, 0x0994, 0xC5F}, +- {0, 0x0996, 0x8402}, +- {0, 0x0998, 0x4416}, +- {0, 0x099a, 0x4FF7}, +- {0, 0x099c, 0xCCD}, +- {0, 0x099e, 0xE60B}, +- {0, 0x098A, 0x10E0}, +- {0, 0x0990, 0xC407}, +- {0, 0x0992, 0xF70C}, +- {0, 0x0994, 0xCE7F}, +- {0, 0x0996, 0x30C4}, +- {0, 0x0998, 0xEC25}, +- {0, 0x099a, 0xFD30}, +- {0, 0x099c, 0xC5FC}, +- {0, 0x099e, 0x6D6}, +- {0, 0x098A, 0x10F0}, +- {0, 0x0990, 0xFD30}, +- {0, 0x0992, 0xC701}, +- {0, 0x0994, 0xFC30}, +- {0, 0x0996, 0xC0FD}, +- {0, 0x0998, 0xBED}, +- {0, 0x099a, 0xFC30}, +- {0, 0x099c, 0xC2FD}, +- {0, 0x099e, 0xBEF}, +- {0, 0x098A, 0x1100}, +- {0, 0x0990, 0x30E6}, +- {0, 0x0992, 0xBD}, +- {0, 0x0994, 0x5203}, +- {0, 0x0996, 0x3139}, +- {0, 0x0998, 0x7E9E}, +- {0, 0x099a, 0x143C}, +- {0, 0x099c, 0x3C3C}, +- {0, 0x099e, 0x2101}, +- {0, 0x098A, 0x1110}, +- {0, 0x0990, 0xCC00}, +- {0, 0x0992, 0x18BD}, +- {0, 0x0994, 0x6FD1}, +- {0, 0x0996, 0xC504}, +- {0, 0x0998, 0x26F5}, +- {0, 0x099a, 0xDC25}, +- {0, 0x099c, 0x30ED}, +- {0, 0x099e, 0x420}, +- {0, 0x098A, 0x1120}, +- {0, 0x0990, 0x12EE}, +- {0, 0x0992, 0x43C}, +- {0, 0x0994, 0x1838}, +- {0, 0x0996, 0xE621}, +- {0, 0x0998, 0x18E7}, +- {0, 0x099a, 0xBE30}, +- {0, 0x099c, 0xEE04}, +- {0, 0x099e, 0xEC1D}, +- {0, 0x098A, 0x1130}, +- {0, 0x0990, 0x30ED}, +- {0, 0x0992, 0x4EC}, +- {0, 0x0994, 0x426}, +- {0, 0x0996, 0xEACC}, +- {0, 0x0998, 0x1A}, +- {0, 0x099a, 0xED02}, +- {0, 0x099c, 0xCCFB}, +- {0, 0x099e, 0xFFED}, +- {0, 0x098A, 0x1140}, +- {0, 0x0990, 0xCC}, +- {0, 0x0992, 0x400}, +- {0, 0x0994, 0xBD70}, +- {0, 0x0996, 0x6DCC}, +- {0, 0x0998, 0x1A}, +- {0, 0x099a, 0x30ED}, +- {0, 0x099c, 0x2CC}, +- {0, 0x099e, 0xFBFF}, +- {0, 0x098A, 0x1150}, +- {0, 0x0990, 0xED00}, +- {0, 0x0992, 0x5F4F}, +- {0, 0x0994, 0xBD70}, +- {0, 0x0996, 0x6D5F}, +- {0, 0x0998, 0xBD5B}, +- {0, 0x099a, 0x17BD}, +- {0, 0x099c, 0x558B}, +- {0, 0x099e, 0x3838}, +- {0, 0x098A, 0x1160}, +- {0, 0x0990, 0x3839}, +- {0, 0x0992, 0x3C3C}, +- {0, 0x0994, 0xC640}, +- {0, 0x0996, 0xF730}, +- {0, 0x0998, 0xC4FC}, +- {0, 0x099a, 0xBED}, +- {0, 0x099c, 0xFD30}, +- {0, 0x099e, 0xC0FC}, +- {0, 0x098A, 0x1170}, +- {0, 0x0990, 0xBEF}, +- {0, 0x0992, 0xFD30}, +- {0, 0x0994, 0xC2DE}, +- {0, 0x0996, 0x1DEC}, +- {0, 0x0998, 0x25FD}, +- {0, 0x099a, 0x30C5}, +- {0, 0x099c, 0x101}, +- {0, 0x099e, 0x1FC}, +- {0, 0x098A, 0x1180}, +- {0, 0x0990, 0x30C2}, +- {0, 0x0992, 0xFD06}, +- {0, 0x0994, 0xD6EC}, +- {0, 0x0996, 0xC5F}, +- {0, 0x0998, 0x8402}, +- {0, 0x099a, 0x4416}, +- {0, 0x099c, 0x4F30}, +- {0, 0x099e, 0xE703}, +- {0, 0x098A, 0x1190}, +- {0, 0x0990, 0xF10C}, +- {0, 0x0992, 0xCD27}, +- {0, 0x0994, 0x15F1}, +- {0, 0x0996, 0xCCD}, +- {0, 0x0998, 0x2309}, +- {0, 0x099a, 0xFC06}, +- {0, 0x099c, 0xD604}, +- {0, 0x099e, 0xFD06}, +- {0, 0x098A, 0x11A0}, +- {0, 0x0990, 0xD620}, +- {0, 0x0992, 0x7FC}, +- {0, 0x0994, 0x6D6}, +- {0, 0x0996, 0x5FD}, +- {0, 0x0998, 0x6D6}, +- {0, 0x099a, 0xDE1D}, +- {0, 0x099c, 0xE60B}, +- {0, 0x099e, 0xC407}, +- {0, 0x098A, 0x11B0}, +- {0, 0x0990, 0x30E7}, +- {0, 0x0992, 0x2F1}, +- {0, 0x0994, 0xCCE}, +- {0, 0x0996, 0x272C}, +- {0, 0x0998, 0x7D0C}, +- {0, 0x099a, 0xCE27}, +- {0, 0x099c, 0x275D}, +- {0, 0x099e, 0x2724}, +- {0, 0x098A, 0x11C0}, +- {0, 0x0990, 0x7F30}, +- {0, 0x0992, 0xC4FC}, +- {0, 0x0994, 0x6D6}, +- {0, 0x0996, 0xFD30}, +- {0, 0x0998, 0xC5F6}, +- {0, 0x099a, 0xCCE}, +- {0, 0x099c, 0x4FFD}, +- {0, 0x099e, 0x30C7}, +- {0, 0x098A, 0x11D0}, +- {0, 0x0990, 0xC640}, +- {0, 0x0992, 0xF730}, +- {0, 0x0994, 0xC4E6}, +- {0, 0x0996, 0x24F}, +- {0, 0x0998, 0xFD30}, +- {0, 0x099a, 0xC501}, +- {0, 0x099c, 0x101}, +- {0, 0x099e, 0xFC30}, +- {0, 0x098A, 0x11E0}, +- {0, 0x0990, 0xC2FD}, +- {0, 0x0992, 0x6D6}, +- {0, 0x0994, 0x7D06}, +- {0, 0x0996, 0xCB27}, +- {0, 0x0998, 0x2EC6}, +- {0, 0x099a, 0x40F7}, +- {0, 0x099c, 0x30C4}, +- {0, 0x099e, 0xFC06}, +- {0, 0x098A, 0x11F0}, +- {0, 0x0990, 0xC104}, +- {0, 0x0992, 0xF306}, +- {0, 0x0994, 0xD6ED}, +- {0, 0x0996, 0x5F}, +- {0, 0x0998, 0x6D00}, +- {0, 0x099a, 0x2A01}, +- {0, 0x099c, 0x5317}, +- {0, 0x099e, 0xFD30}, +- {0, 0x098A, 0x1200}, +- {0, 0x0990, 0xC0EC}, +- {0, 0x0992, 0xFD}, +- {0, 0x0994, 0x30C2}, +- {0, 0x0996, 0xFC06}, +- {0, 0x0998, 0xC1FD}, +- {0, 0x099a, 0x30C5}, +- {0, 0x099c, 0x101}, +- {0, 0x099e, 0x1FC}, +- {0, 0x098A, 0x1210}, +- {0, 0x0990, 0x30C2}, +- {0, 0x0992, 0xFD06}, +- {0, 0x0994, 0xC720}, +- {0, 0x0996, 0x227F}, +- {0, 0x0998, 0x30C4}, +- {0, 0x099a, 0xDE1D}, +- {0, 0x099c, 0xEC25}, +- {0, 0x099e, 0xFD30}, +- {0, 0x098A, 0x1220}, +- {0, 0x0990, 0xC5FC}, +- {0, 0x0992, 0x6D6}, +- {0, 0x0994, 0xFD30}, +- {0, 0x0996, 0xC701}, +- {0, 0x0998, 0xFC30}, +- {0, 0x099a, 0xC0FD}, +- {0, 0x099c, 0x6D0}, +- {0, 0x099e, 0xFC30}, +- {0, 0x098A, 0x1230}, +- {0, 0x0990, 0xC2FD}, +- {0, 0x0992, 0x6D2}, +- {0, 0x0994, 0xEC25}, +- {0, 0x0996, 0xFD06}, +- {0, 0x0998, 0xC3BD}, +- {0, 0x099a, 0x953C}, +- {0, 0x099c, 0xDE3F}, +- {0, 0x099e, 0xEE10}, +- {0, 0x098A, 0x1240}, +- {0, 0x0990, 0xAD00}, +- {0, 0x0992, 0x3838}, +- {0, 0x0994, 0x3930}, +- {0, 0x0996, 0x8FC3}, +- {0, 0x0998, 0xFFE9}, +- {0, 0x099a, 0x8F35}, +- {0, 0x099c, 0xBDAD}, +- {0, 0x099e, 0x1530}, +- {0, 0x098A, 0x1250}, +- {0, 0x0990, 0x6F16}, +- {0, 0x0992, 0x18DE}, +- {0, 0x0994, 0x1918}, +- {0, 0x0996, 0x8FC3}, +- {0, 0x0998, 0x14B}, +- {0, 0x099a, 0x188F}, +- {0, 0x099c, 0x18EC}, +- {0, 0x099e, 0xFD}, +- {0, 0x098A, 0x1260}, +- {0, 0x0990, 0x50E}, +- {0, 0x0992, 0x18EC}, +- {0, 0x0994, 0x2FD}, +- {0, 0x0996, 0x510}, +- {0, 0x0998, 0xE616}, +- {0, 0x099a, 0x4FED}, +- {0, 0x099c, 0x418}, +- {0, 0x099e, 0x8FC3}, +- {0, 0x098A, 0x1270}, +- {0, 0x0990, 0xFFCB}, +- {0, 0x0992, 0xE304}, +- {0, 0x0994, 0x8FE6}, +- {0, 0x0996, 0xF7}, +- {0, 0x0998, 0x514}, +- {0, 0x099a, 0x18DE}, +- {0, 0x099c, 0x1930}, +- {0, 0x099e, 0xE616}, +- {0, 0x098A, 0x1280}, +- {0, 0x0990, 0x4FED}, +- {0, 0x0992, 0x418}, +- {0, 0x0994, 0x8FC3}, +- {0, 0x0996, 0x119}, +- {0, 0x0998, 0xE304}, +- {0, 0x099a, 0x8FE6}, +- {0, 0x099c, 0xF7}, +- {0, 0x099e, 0x515}, +- {0, 0x098A, 0x1290}, +- {0, 0x0990, 0xFC05}, +- {0, 0x0992, 0x5BFD}, +- {0, 0x0994, 0x512}, +- {0, 0x0996, 0xDE37}, +- {0, 0x0998, 0xEE08}, +- {0, 0x099a, 0xAD00}, +- {0, 0x099c, 0x30E6}, +- {0, 0x099e, 0x164F}, +- {0, 0x098A, 0x12A0}, +- {0, 0x0990, 0x5ED}, +- {0, 0x0992, 0x48F}, +- {0, 0x0994, 0xC300}, +- {0, 0x0996, 0x630}, +- {0, 0x0998, 0xE304}, +- {0, 0x099a, 0x8FF6}, +- {0, 0x099c, 0x516}, +- {0, 0x099e, 0x4FED}, +- {0, 0x098A, 0x12B0}, +- {0, 0x0990, 0x30}, +- {0, 0x0992, 0x6C16}, +- {0, 0x0994, 0xE616}, +- {0, 0x0996, 0xC103}, +- {0, 0x0998, 0x2598}, +- {0, 0x099a, 0xCC32}, +- {0, 0x099c, 0x8EED}, +- {0, 0x099e, 0xEC}, +- {0, 0x098A, 0x12C0}, +- {0, 0x0990, 0x6BD}, +- {0, 0x0992, 0x7021}, +- {0, 0x0994, 0xCC32}, +- {0, 0x0996, 0x6C30}, +- {0, 0x0998, 0xED02}, +- {0, 0x099a, 0xCCF8}, +- {0, 0x099c, 0xED}, +- {0, 0x099e, 0xA6}, +- {0, 0x098A, 0x12D0}, +- {0, 0x0990, 0x9E3}, +- {0, 0x0992, 0xA84}, +- {0, 0x0994, 0x7BD}, +- {0, 0x0996, 0x706D}, +- {0, 0x0998, 0x30C6}, +- {0, 0x099a, 0x173A}, +- {0, 0x099c, 0x3539}, +- {0, 0x099e, 0x3CBD}, +- {0, 0x098A, 0x12E0}, +- {0, 0x0990, 0x776D}, +- {0, 0x0992, 0xCC32}, +- {0, 0x0994, 0x5C30}, +- {0, 0x0996, 0xED00}, +- {0, 0x0998, 0xFC13}, +- {0, 0x099a, 0x8683}, +- {0, 0x099c, 0x1}, +- {0, 0x099e, 0xBD70}, +- {0, 0x098A, 0x12F0}, +- {0, 0x0990, 0x21CC}, +- {0, 0x0992, 0x325E}, +- {0, 0x0994, 0x30ED}, +- {0, 0x0996, 0xFC}, +- {0, 0x0998, 0x1388}, +- {0, 0x099a, 0x8300}, +- {0, 0x099c, 0x1BD}, +- {0, 0x099e, 0x7021}, +- {0, 0x098A, 0x1300}, +- {0, 0x0990, 0x3839}, +- {0, 0x098E, 0x0010}, +- {0, 0x0990, 0x1000}, +- {0, 0x098E, 0x0003}, +- {100, 0x0990, 0x0004} +-}; +- +-mt9t111_regs def_regs1[] = { +- {0, 0x001A, 0x0218}, +- {0, 0x001E, 0x0777}, +- {0, 0x3084, 0x2409}, +- {0, 0x3092, 0x0A49}, +- {0, 0x3094, 0x4949}, +- {0, 0x3096, 0x4950}, +- {0, 0x0018, 0x402D}, +- {100, 0x0018, 0x402C}, +- {0, 0x098E, 0x6800}, +- {0, 0x0990, 0x0280}, +- {0, 0x098E, 0x6802}, +- {0, 0x0990, 0x01E0}, +- {0, 0x098E, 0xE88E}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0x68A0}, +- {0, 0x0990, 0x082D}, +- {0, 0x098E, 0x4802}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0x4804}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0x4806}, +- {0, 0x0990, 0x060D}, +- {0, 0x098E, 0x4808}, +- {0, 0x0990, 0x080D}, +- {0, 0x098E, 0x480A}, +- {0, 0x0990, 0x0111}, +- {0, 0x098E, 0x480C}, +- {0, 0x0990, 0x046C}, +- {0, 0x098E, 0x480F}, +- {0, 0x0990, 0x00CC}, +- {0, 0x098E, 0x4811}, +- {0, 0x0990, 0x0381}, +- {0, 0x098E, 0x4813}, +- {0, 0x0990, 0x024F}, +- {0, 0x098E, 0x481D}, +- {0, 0x0990, 0x05AE}, +- {0, 0x098E, 0x481F}, +- {0, 0x0990, 0x05D0}, +- {0, 0x098E, 0x4825}, +- {0, 0x0990, 0x07AC}, +- {0, 0x098E, 0x6C00}, +- {0, 0x0990, 0x0800}, +- {0, 0x098E, 0x6C02}, +- {0, 0x0990, 0x0600}, +- {0, 0x098E, 0xEC8E}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0x6CA0}, +- {0, 0x0990, 0x082D}, +- {0, 0x098E, 0x484A}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0x484C}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0x484E}, +- {0, 0x0990, 0x060D}, +- {0, 0x098E, 0x4850}, +- {0, 0x0990, 0x080D}, +- {0, 0x098E, 0x4852}, +- {0, 0x0990, 0x0111}, +- {0, 0x098E, 0x4854}, +- {0, 0x0990, 0x146C}, +- {0, 0x098E, 0x4857}, +- {0, 0x0990, 0x00CC}, +- {0, 0x098E, 0x4859}, +- {0, 0x0990, 0x0381}, +- {0, 0x098E, 0x485B}, +- {0, 0x0990, 0x024F}, +- {0, 0x098E, 0x4865}, +- {0, 0x0990, 0x05AE}, +- {0, 0x098E, 0x4867}, +- {0, 0x0990, 0x05D0}, +- {0, 0x098E, 0x486D}, +- {0, 0x0990, 0x07AC}, +- {0, 0x098E, 0xC8A5}, +- {0, 0x0990, 0x001D}, +- {0, 0x098E, 0xC8A6}, +- {0, 0x0990, 0x0020}, +- {0, 0x098E, 0xC8A7}, +- {0, 0x0990, 0x0023}, +- {0, 0x098E, 0xC8A8}, +- {0, 0x0990, 0x0026}, +- {0, 0x098E, 0xC844}, +- {0, 0x0990, 0x0091}, +- {0, 0x098E, 0xC92F}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xC845}, +- {0, 0x0990, 0x0079}, +- {0, 0x098E, 0xC92D}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xC88C}, +- {0, 0x0990, 0x0091}, +- {0, 0x098E, 0xC930}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xC88D}, +- {0, 0x0990, 0x0079}, +- {0, 0x098E, 0xC92E}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xA002}, +- {0, 0x0990, 0x0010}, +- {0, 0x098E, 0xA009}, +- {0, 0x0990, 0x0002}, +- {0, 0x098E, 0xA00A}, +- {0, 0x0990, 0x0003}, +- {0, 0x098E, 0xA00C}, +- {0, 0x0990, 0x000A}, +- {0, 0x098E, 0x4846}, +- {0, 0x0990, 0x0014}, +- {0, 0x098E, 0x68AA}, +- {0, 0x0990, 0x0278}, +- {0, 0x098E, 0x488E}, +- {0, 0x0990, 0x0014}, +- {0, 0x098E, 0x6CAA}, +- {0, 0x0990, 0x0218}, +- {0, 0x098E, 0x8400}, +- {0, 0x0990, 0x0006}, +- {0, 0x098E, 0x8400}, +- {0, 0x0990, 0x0005}, +- {0, 0x3C20, 0x0001}, +- {0, 0x364A, 0x7D2F}, +- {0, 0x364C, 0x79EB}, +- {0, 0x364E, 0x18D2}, +- {0, 0x3650, 0x9F8F}, +- {0, 0x3652, 0xA7D2}, +- {0, 0x368A, 0x460C}, +- {0, 0x368C, 0x14F0}, +- {0, 0x368E, 0x946F}, +- {0, 0x3690, 0xC471}, +- {0, 0x3692, 0x04B1}, +- {0, 0x36CA, 0x0433}, +- {0, 0x36CC, 0x680D}, +- {0, 0x36CE, 0xEEF3}, +- {0, 0x36D0, 0x4850}, +- {0, 0x36D2, 0xF233}, +- {0, 0x370A, 0xB2AF}, +- {0, 0x370C, 0x2CF0}, +- {0, 0x370E, 0x3F10}, +- {0, 0x3710, 0xC673}, +- {0, 0x3712, 0xA972}, +- {0, 0x374A, 0x0590}, +- {0, 0x374C, 0xAFB3}, +- {0, 0x374E, 0x93D7}, +- {0, 0x3750, 0x8D12}, +- {0, 0x3752, 0x2539}, +- {0, 0x3640, 0x0350}, +- {0, 0x3642, 0x322C}, +- {0, 0x3644, 0x77D1}, +- {0, 0x3646, 0xA26F}, +- {0, 0x3648, 0xC872}, +- {0, 0x3680, 0x0C4C}, +- {0, 0x3682, 0x9510}, +- {0, 0x3684, 0x110E}, +- {0, 0x3686, 0x4331}, +- {0, 0x3688, 0xC1CF}, +- {0, 0x36C0, 0x6152}, +- {0, 0x36C2, 0x038E}, +- {0, 0x36C4, 0x9AF4}, +- {0, 0x36C6, 0xE12F}, +- {0, 0x36C8, 0x09F3}, +- {0, 0x3700, 0xC5AF}, +- {0, 0x3702, 0xCA90}, +- {0, 0x3704, 0x5D0F}, +- {0, 0x3706, 0x3293}, +- {0, 0x3708, 0x2B92}, +- {0, 0x3740, 0xC590}, +- {0, 0x3742, 0x8133}, +- {0, 0x3744, 0xE0F6}, +- {0, 0x3746, 0x0254}, +- {0, 0x3748, 0x10B9}, +- {0, 0x3654, 0x7F8F}, +- {0, 0x3656, 0x6F6C}, +- {0, 0x3658, 0x5971}, +- {0, 0x365A, 0x9A0F}, +- {0, 0x365C, 0xA1B2}, +- {0, 0x3694, 0xB00C}, +- {0, 0x3696, 0xEBCF}, +- {0, 0x3698, 0x06AD}, +- {0, 0x369A, 0x4D31}, +- {0, 0x369C, 0x2A4E}, +- {0, 0x36D4, 0x4752}, +- {0, 0x36D6, 0x724D}, +- {0, 0x36D8, 0xAD34}, +- {0, 0x36DA, 0x1350}, +- {0, 0x36DC, 0x4E94}, +- {0, 0x3714, 0xA06E}, +- {0, 0x3716, 0x9152}, +- {0, 0x3718, 0x1F53}, +- {0, 0x371A, 0x3933}, +- {0, 0x371C, 0xBA94}, +- {0, 0x3754, 0x1233}, +- {0, 0x3756, 0xA032}, +- {0, 0x3758, 0xE936}, +- {0, 0x375A, 0xBE34}, +- {0, 0x375C, 0x02D9}, +- {0, 0x365E, 0x7DEF}, +- {0, 0x3660, 0x434B}, +- {0, 0x3662, 0x69F1}, +- {0, 0x3664, 0x8A0F}, +- {0, 0x3666, 0xBDB2}, +- {0, 0x369E, 0x290D}, +- {0, 0x36A0, 0x42CF}, +- {0, 0x36A2, 0xDC6D}, +- {0, 0x36A4, 0x91B1}, +- {0, 0x36A6, 0x9DE9}, +- {0, 0x36DE, 0x70B2}, +- {0, 0x36E0, 0x02AC}, +- {0, 0x36E2, 0x9714}, +- {0, 0x36E4, 0xF3CF}, +- {0, 0x36E6, 0x6BD1}, +- {0, 0x371E, 0xE42E}, +- {0, 0x3720, 0x1D32}, +- {0, 0x3722, 0xCC31}, +- {0, 0x3724, 0xAE94}, +- {0, 0x3726, 0x6413}, +- {0, 0x375E, 0xE290}, +- {0, 0x3760, 0x8F53}, +- {0, 0x3762, 0xF936}, +- {0, 0x3764, 0x4614}, +- {0, 0x3766, 0x1B59}, +- {0, 0x3784, 0x0404}, +- {0, 0x3782, 0x0304}, +- {0, 0x3210, 0x01B8}, +- {0, 0x098E, 0xC913}, +- {0, 0x0990, 0x000A}, +- {0, 0x098E, 0x686B}, +- {0, 0x0990, 0x05DC}, +- {0, 0x098E, 0x686D}, +- {0, 0x0990, 0x0BB8}, +- {0, 0x098E, 0x6C6B}, +- {0, 0x0990, 0x05DC}, +- {0, 0x098E, 0x6C6D}, +- {0, 0x0990, 0x0BB8}, +- {0, 0x098E, 0x3439}, +- {0, 0x0990, 0x05DC}, +- {0, 0x098E, 0x343B}, +- {0, 0x0990, 0x0BB8}, +- {0, 0x098E, 0x4926}, +- {0, 0x0990, 0x0001}, +- {0, 0x098E, 0x4928}, +- {0, 0x0990, 0x0002}, +- {0, 0x098E, 0x492A}, +- {0, 0x0990, 0x0656}, +- {0, 0x098E, 0x4D26}, +- {0, 0x0990, 0x0001}, +- {0, 0x098E, 0x4D28}, +- {0, 0x0990, 0x0002}, +- {0, 0x098E, 0x4D2A}, +- {0, 0x0990, 0x0656}, +- {0, 0x33F4, 0x040B}, +- {0, 0x098E, 0xC916}, +- {0, 0x0990, 0x0014}, +- {0, 0x098E, 0xC919}, +- {0, 0x0990, 0x0028}, +- {0, 0x098E, 0xC917}, +- {0, 0x0990, 0x0004}, +- {0, 0x098E, 0xC918}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xC91A}, +- {0, 0x0990, 0x0001}, +- {0, 0x098E, 0xC91B}, +- {0, 0x0990, 0x0009}, +- {0, 0x326C, 0x0C00}, +- {0, 0x098E, 0x494B}, +- {0, 0x0990, 0x0042}, +- {0, 0x098E, 0x494D}, +- {0, 0x0990, 0x012C}, +- {0, 0x098E, 0xC91E}, +- {0, 0x0990, 0x0012}, +- {0, 0x098E, 0xC91F}, +- {0, 0x0990, 0x000A}, +- {0, 0x098E, 0xC920}, +- {0, 0x0990, 0x0012}, +- {0, 0x098E, 0xC921}, +- {0, 0x0990, 0x000A}, +- {0, 0x098E, 0xC922}, +- {0, 0x0990, 0x0026}, +- {0, 0x098E, 0xC923}, +- {0, 0x0990, 0x001E}, +- {0, 0x098E, 0xC924}, +- {0, 0x0990, 0x0026}, +- {0, 0x098E, 0xC925}, +- {0, 0x0990, 0x0026}, +- {0, 0x098E, 0xBC02}, +- {0, 0x0990, 0x0003}, +- {0, 0x098E, 0xBC05}, +- {0, 0x0990, 0x000E}, +- {0, 0x098E, 0xC950}, +- {0, 0x0990, 0x0064}, +- {0, 0x098E, 0xC94F}, +- {0, 0x0990, 0x0038}, +- {0, 0x098E, 0xC952}, +- {0, 0x0990, 0x0064}, +- {0, 0x098E, 0xC951}, +- {0, 0x0990, 0x0051}, +- {0, 0x098E, 0xC954}, +- {0, 0x0990, 0x0010}, +- {0, 0x098E, 0xC953}, +- {0, 0x0990, 0x0020}, +- {0, 0x098E, 0xC956}, +- {0, 0x0990, 0x0010}, +- {0, 0x098E, 0xC955}, +- {0, 0x0990, 0x0020}, +- {0, 0x098E, 0xC958}, +- {0, 0x0990, 0x0020}, +- {0, 0x098E, 0xC957}, +- {0, 0x0990, 0x0014}, +- {0, 0x098E, 0xC95A}, +- {0, 0x0990, 0x001D}, +- {0, 0x098E, 0xC959}, +- {0, 0x0990, 0x0020}, +- {0, 0x098E, 0xC95C}, +- {0, 0x0990, 0x000C}, +- {0, 0x098E, 0xC95B}, +- {0, 0x0990, 0x0008}, +- {0, 0x098E, 0xC95E}, +- {0, 0x0990, 0x000C}, +- {0, 0x098E, 0xC95D}, +- {0, 0x0990, 0x0008}, +- {0, 0x098E, 0xC95F}, +- {0, 0x0990, 0x0064}, +- {0, 0x098E, 0x48DC}, +- {0, 0x0990, 0x004D}, +- {0, 0x098E, 0x48DE}, +- {0, 0x0990, 0x0096}, +- {0, 0x098E, 0x48E0}, +- {0, 0x0990, 0x001D}, +- {0, 0x098E, 0x48E2}, +- {0, 0x0990, 0x004D}, +- {0, 0x098E, 0x48E4}, +- {0, 0x0990, 0x0096}, +- {0, 0x098E, 0x48E6}, +- {0, 0x0990, 0x001D}, +- {0, 0x098E, 0x48E8}, +- {0, 0x0990, 0x004D}, +- {0, 0x098E, 0x48EA}, +- {0, 0x0990, 0x0096}, +- {0, 0x098E, 0x48EC}, +- {0, 0x0990, 0x001D}, +- {0, 0x098E, 0xDC2A}, +- {0, 0x0990, 0x000B}, +- {0, 0x098E, 0xDC2B}, +- {0, 0x0990, 0x0017}, +- {0, 0x098E, 0xBC0B}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xBC0C}, +- {0, 0x0990, 0x001B}, +- {0, 0x098E, 0xBC0D}, +- {0, 0x0990, 0x002A}, +- {0, 0x098E, 0xBC0E}, +- {0, 0x0990, 0x003E}, +- {0, 0x098E, 0xBC0F}, +- {0, 0x0990, 0x005A}, +- {0, 0x098E, 0xBC10}, +- {0, 0x0990, 0x0070}, +- {0, 0x098E, 0xBC11}, +- {0, 0x0990, 0x0081}, +- {0, 0x098E, 0xBC12}, +- {0, 0x0990, 0x0090}, +- {0, 0x098E, 0xBC13}, +- {0, 0x0990, 0x009E}, +- {0, 0x098E, 0xBC14}, +- {0, 0x0990, 0x00AB}, +- {0, 0x098E, 0xBC15}, +- {0, 0x0990, 0x00B6}, +- {0, 0x098E, 0xBC16}, +- {0, 0x0990, 0x00C1}, +- {0, 0x098E, 0xBC17}, +- {0, 0x0990, 0x00CB}, +- {0, 0x098E, 0xBC18}, +- {0, 0x0990, 0x00D5}, +- {0, 0x098E, 0xBC19}, +- {0, 0x0990, 0x00DE}, +- {0, 0x098E, 0xBC1A}, +- {0, 0x0990, 0x00E7}, +- {0, 0x098E, 0xBC1B}, +- {0, 0x0990, 0x00EF}, +- {0, 0x098E, 0xBC1C}, +- {0, 0x0990, 0x00F7}, +- {0, 0x098E, 0xBC1D}, +- {0, 0x0990, 0x00FF}, +- {0, 0x098E, 0xBC1E}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xBC1F}, +- {0, 0x0990, 0x001B}, +- {0, 0x098E, 0xBC20}, +- {0, 0x0990, 0x002A}, +- {0, 0x098E, 0xBC21}, +- {0, 0x0990, 0x003E}, +- {0, 0x098E, 0xBC22}, +- {0, 0x0990, 0x005A}, +- {0, 0x098E, 0xBC23}, +- {0, 0x0990, 0x0070}, +- {0, 0x098E, 0xBC24}, +- {0, 0x0990, 0x0081}, +- {0, 0x098E, 0xBC25}, +- {0, 0x0990, 0x0090}, +- {0, 0x098E, 0xBC26}, +- {0, 0x0990, 0x009E}, +- {0, 0x098E, 0xBC27}, +- {0, 0x0990, 0x00AB}, +- {0, 0x098E, 0xBC28}, +- {0, 0x0990, 0x00B6}, +- {0, 0x098E, 0xBC29}, +- {0, 0x0990, 0x00C1}, +- {0, 0x098E, 0xBC2A}, +- {0, 0x0990, 0x00CB}, +- {0, 0x098E, 0xBC2B}, +- {0, 0x0990, 0x00D5}, +- {0, 0x098E, 0xBC2C}, +- {0, 0x0990, 0x00DE}, +- {0, 0x098E, 0xBC2D}, +- {0, 0x0990, 0x00E7}, +- {0, 0x098E, 0xBC2E}, +- {0, 0x0990, 0x00EF}, +- {0, 0x098E, 0xBC2F}, +- {0, 0x0990, 0x00F7}, +- {0, 0x098E, 0xBC30}, +- {0, 0x0990, 0x00FF}, +- {0, 0x098E, 0xBC31}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xBC32}, +- {0, 0x0990, 0x000D}, +- {0, 0x098E, 0xBC33}, +- {0, 0x0990, 0x0019}, +- {0, 0x098E, 0xBC34}, +- {0, 0x0990, 0x0030}, +- {0, 0x098E, 0xBC35}, +- {0, 0x0990, 0x0056}, +- {0, 0x098E, 0xBC36}, +- {0, 0x0990, 0x0070}, +- {0, 0x098E, 0xBC37}, +- {0, 0x0990, 0x0081}, +- {0, 0x098E, 0xBC38}, +- {0, 0x0990, 0x0090}, +- {0, 0x098E, 0xBC39}, +- {0, 0x0990, 0x009E}, +- {0, 0x098E, 0xBC3A}, +- {0, 0x0990, 0x00AB}, +- {0, 0x098E, 0xBC3B}, +- {0, 0x0990, 0x00B6}, +- {0, 0x098E, 0xBC3C}, +- {0, 0x0990, 0x00C1}, +- {0, 0x098E, 0xBC3D}, +- {0, 0x0990, 0x00CB}, +- {0, 0x098E, 0xBC3E}, +- {0, 0x0990, 0x00D5}, +- {0, 0x098E, 0xBC3F}, +- {0, 0x0990, 0x00DE}, +- {0, 0x098E, 0xBC40}, +- {0, 0x0990, 0x00E7}, +- {0, 0x098E, 0xBC41}, +- {0, 0x0990, 0x00EF}, +- {0, 0x098E, 0xBC42}, +- {0, 0x0990, 0x00F7}, +- {0, 0x098E, 0xBC43}, +- {0, 0x0990, 0x00FF}, +- {0, 0x098E, 0x6865}, +- {0, 0x0990, 0x00E0}, +- {0, 0x098E, 0x6867}, +- {0, 0x0990, 0x00F4}, +- {0, 0x098E, 0x8400}, +- {0, 0x0990, 0x0006}, +- {0, 0x098E, 0xBC4A}, +- {0, 0x0990, 0x007F}, +- {0, 0x098E, 0xBC4B}, +- {0, 0x0990, 0x007F}, +- {0, 0x098E, 0xBC4C}, +- {0, 0x0990, 0x007F}, +- {0, 0x3542, 0x0010}, +- {0, 0x3544, 0x0030}, +- {0, 0x3546, 0x0040}, +- {0, 0x3548, 0x0080}, +- {0, 0x354A, 0x0100}, +- {0, 0x354C, 0x0200}, +- {0, 0x354E, 0x0300}, +- {0, 0x3550, 0x0010}, +- {0, 0x3552, 0x0030}, +- {0, 0x3554, 0x0040}, +- {0, 0x3556, 0x0080}, +- {0, 0x3558, 0x012C}, +- {0, 0x355A, 0x0320}, +- {0, 0x355C, 0x03E8}, +- {0, 0x3560, 0x0040}, +- {0, 0x3562, 0x0020}, +- {0, 0x3564, 0x0040}, +- {0, 0x3566, 0x0010}, +- {0, 0x3568, 0x0008}, +- {0, 0x356A, 0x0004}, +- {0, 0x356C, 0x0004}, +- {0, 0x356E, 0x0004}, +- {0, 0x098E, 0x3C4D}, +- {0, 0x0990, 0x0DAC}, +- {0, 0x098E, 0x3C4F}, +- {0, 0x0990, 0x148A}, +- {0, 0x098E, 0xC911}, +- {0, 0x0990, 0x00C8}, +- {0, 0x098E, 0xC8F4}, +- {0, 0x0990, 0x0004}, +- {0, 0x098E, 0xC8F5}, +- {0, 0x0990, 0x0002}, +- {0, 0x098E, 0x48F6}, +- {0, 0x0990, 0x3B4D}, +- {0, 0x098E, 0x48F8}, +- {0, 0x0990, 0x6380}, +- {0, 0x098E, 0x48FA}, +- {0, 0x0990, 0x9B18}, +- {0, 0x098E, 0x48FC}, +- {0, 0x0990, 0x5D51}, +- {0, 0x098E, 0x48FE}, +- {0, 0x0990, 0xEDE8}, +- {0, 0x098E, 0x4900}, +- {0, 0x0990, 0xE515}, +- {0, 0x098E, 0x4902}, +- {0, 0x0990, 0xBFF4}, +- {0, 0x098E, 0x4904}, +- {0, 0x0990, 0x001E}, +- {0, 0x098E, 0x4906}, +- {0, 0x0990, 0x0026}, +- {0, 0x098E, 0x4908}, +- {0, 0x0990, 0x0033}, +- {0, 0x098E, 0xE84A}, +- {0, 0x0990, 0x0083}, +- {0, 0x098E, 0xE84D}, +- {0, 0x0990, 0x0083}, +- {0, 0x098E, 0xE84C}, +- {0, 0x0990, 0x0080}, +- {0, 0x098E, 0xE84F}, +- {0, 0x0990, 0x0080}, +- {0, 0x098E, 0x8400}, +- {0, 0x0990, 0x0006}, +- {0, 0x098E, 0x48B0}, +- {0, 0x0990, 0x0180}, +- {0, 0x098E, 0x48B2}, +- {0, 0x0990, 0xFF7A}, +- {0, 0x098E, 0x48B4}, +- {0, 0x0990, 0x0018}, +- {0, 0x098E, 0x48B6}, +- {0, 0x0990, 0xFFCA}, +- {0, 0x098E, 0x48B8}, +- {0, 0x0990, 0x017C}, +- {0, 0x098E, 0x48BA}, +- {0, 0x0990, 0xFFCC}, +- {0, 0x098E, 0x48BC}, +- {0, 0x0990, 0x000C}, +- {0, 0x098E, 0x48BE}, +- {0, 0x0990, 0xFF1F}, +- {0, 0x098E, 0x48C0}, +- {0, 0x0990, 0x01E8}, +- {0, 0x098E, 0x48C2}, +- {0, 0x0990, 0x0020}, +- {0, 0x098E, 0x48C4}, +- {0, 0x0990, 0x0044}, +- {0, 0x098E, 0x48C6}, +- {0, 0x0990, 0x0079}, +- {0, 0x098E, 0x48C8}, +- {0, 0x0990, 0xFFAD}, +- {0, 0x098E, 0x48CA}, +- {0, 0x0990, 0xFFE2}, +- {0, 0x098E, 0x48CC}, +- {0, 0x0990, 0x0033}, +- {0, 0x098E, 0x48CE}, +- {0, 0x0990, 0x002A}, +- {0, 0x098E, 0x48D0}, +- {0, 0x0990, 0xFFAA}, +- {0, 0x098E, 0x48D2}, +- {0, 0x0990, 0x0017}, +- {0, 0x098E, 0x48D4}, +- {0, 0x0990, 0x004B}, +- {0, 0x098E, 0x48D6}, +- {0, 0x0990, 0xFFA5}, +- {0, 0x098E, 0x48D8}, +- {0, 0x0990, 0x0015}, +- {0, 0x098E, 0x48DA}, +- {0, 0x0990, 0xFFE2}, +- {0, 0x35A2, 0x0014}, +- {0, 0x098E, 0xC949}, +- {0, 0x0990, 0x0024}, +- {0, 0x35A4, 0x0596}, +- {0, 0x098E, 0xC94A}, +- {0, 0x0990, 0x0062}, +- {0, 0x098E, 0xC948}, +- {0, 0x0990, 0x0006}, +- {0, 0x098E, 0xC914}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xC915}, +- {0, 0x0990, 0x00FF}, +- {0, 0x098E, 0xE86F}, +- {0, 0x0990, 0x0060}, +- {0, 0x098E, 0xE870}, +- {0, 0x0990, 0x003C}, +- {0, 0x098E, 0xEC6F}, +- {0, 0x0990, 0x0060}, +- {0, 0x098E, 0xEC70}, +- {0, 0x0990, 0x003C}, +- {0, 0x098E, 0xE883}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xEC83}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0x8400}, +- {0, 0x0990, 0x0006}, +- {0, 0x098E, 0xE885}, +- {0, 0x0990, 0x001E}, +- {0, 0x098E, 0xE886}, +- {0, 0x0990, 0x00D8}, +- {0, 0x098E, 0xEC85}, +- {0, 0x0990, 0x001E}, +- {0, 0x098E, 0xEC86}, +- {0, 0x0990, 0x00D8}, +- {0, 0x098E, 0xE884}, +- {0, 0x0990, 0x005C}, +- {0, 0x098E, 0xEC84}, +- {0, 0x0990, 0x005C}, +- {0, 0x098E, 0x490A}, +- {0, 0x0990, 0x0666}, +- {0, 0x098E, 0x490C}, +- {0, 0x0990, 0x0140}, +- {0, 0x098E, 0x6857}, +- {0, 0x0990, 0x0014}, +- {0, 0x098E, 0x685C}, +- {0, 0x0990, 0x0005}, +- {0, 0x098E, 0x490E}, +- {0, 0x0990, 0x00A4}, +- {0, 0x098E, 0xB43D}, +- {0, 0x0990, 0x0031}, +- {0, 0x098E, 0xB43E}, +- {0, 0x0990, 0x001B}, +- {0, 0x098E, 0xB43F}, +- {0, 0x0990, 0x0028}, +- {0, 0x098E, 0xB440}, +- {0, 0x0990, 0x0003}, +- {0, 0x098E, 0xB441}, +- {0, 0x0990, 0x00CD}, +- {0, 0x098E, 0xB442}, +- {0, 0x0990, 0x0064}, +- {0, 0x098E, 0xB443}, +- {0, 0x0990, 0x000F}, +- {0, 0x098E, 0xB444}, +- {0, 0x0990, 0x0007}, +- {0, 0x098E, 0x300D}, +- {0, 0x0990, 0x000F}, +- {0, 0x098E, 0x3017}, +- {0, 0x0990, 0x0F0F}, +- {0, 0x098E, 0x8400}, +- {0, 0x0990, 0x0006}, +- {0, 0x098E, 0xE81F}, +- {0, 0x0990, 0x0020}, +- {0, 0x098E, 0x68A0}, +- {0, 0x0990, 0x082E}, +- {0, 0x098E, 0x6CA0}, +- {0, 0x0990, 0x082E}, +- {0, 0x098E, 0x70A0}, +- {0, 0x0990, 0x082E}, +- {0, 0x098E, 0x74A0}, +- {0, 0x0990, 0x082E}, +- {0, 0x3C52, 0x082E}, +- {0, 0x098E, 0x488E}, +- {0, 0x0990, 0x0020}, +- {0, 0x098E, 0xECAC}, +- {0, 0x0990, 0x0000} +-}; +- +-mt9t111_regs def_regs2[] = { +- {100, 0x0018, 0x0028}, +- {0, 0x316C, 0x350F}, +- {0, 0x098E, 0x6817}, +- {0, 0x0990, 0x000C}, +- {0, 0x0034, 0x0000} +-}; +- +-mt9t111_regs pll_regs1[] = { +- {0, 0x0014, 0x2425}, +- {0, 0x0014, 0x2425}, +- {0, 0x0014, 0x2145}, +- {0, 0x0010, 0x0219}, +- {0, 0x0012, 0x0090}, +- {0, 0x002A, 0x79DD}, +- {0, 0x0014, 0x2545}, +- {0, 0x0014, 0x2547}, +- {0, 0x0014, 0x3447}, +- {0, 0x0014, 0x3047} +-}; +- +-mt9t111_regs pll_regs2[] = { +- {0, 0x0014, 0x3046}, +- {0, 0x0022, 0x01E0}, +- {0, 0x001E, 0x0707}, +- {0, 0x3B84, 0x011D} +-}; +- +-mt9t111_regs bayer_pattern_regs[] = { +- {0, 0x098E, 0x6807}, +- {0, 0x0990, 0x0100}, +- {0, 0x098E, 0x6809}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xE88E}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0x6C07}, +- {0, 0x0990, 0x0100}, +- {0, 0x098E, 0x6C09}, +- {0, 0x0990, 0x0000}, +- {0, 0x098E, 0xEC8E}, +- {0, 0x0990, 0x0000} +-}; +- +-#endif +diff --git a/include/media/mt9t111.h b/include/media/mt9t111.h +deleted file mode 100644 +index cd34885..0000000 +--- a/include/media/mt9t111.h ++++ /dev/null +@@ -1,79 +0,0 @@ +-/* +- * include/media/mt9t111.h +- * +- * mt9t111 sensor driver +- * +- * Copyright (C) 2009 Leopard Imaging +- * +- * This file is licensed under the terms of the GNU General Public License +- * version 2. This program is licensed "as is" without any warranty of any +- * kind, whether express or implied. +- */ +- +-#ifndef MT9T111_H +-#define MT9T111_H +- +-/********************************* +- * Defines and Macros and globals +- ********************************/ +- +-#ifdef TRUE +-#undef TRUE +-#endif +- +-#ifdef FALSE +-#undef FALSE +-#endif +- +-#define TRUE 1 +-#define FALSE 0 +- +-#ifdef DEBUG +-#undef DEBUG +-#endif +- +-#ifndef TYPES +-#define TYPES +-#endif +- +-#define MT9T111_I2C_REGISTERED (1) +-#define MT9T111_I2C_UNREGISTERED (0) +- +-/*i2c adress for MT9T111*/ +-#define MT9T111_I2C_ADDR (0x78 >> 1) +- +-#define MT9T111_CLK_MAX (54000000) /* 54MHz */ +-#define MT9T111_CLK_MIN (6000000) /* 6Mhz */ +- +-#define MT9T111_I2C_CONFIG (1) +-#define I2C_ONE_BYTE_TRANSFER (1) +-#define I2C_TWO_BYTE_TRANSFER (2) +-#define I2C_THREE_BYTE_TRANSFER (3) +-#define I2C_FOUR_BYTE_TRANSFER (4) +-#define I2C_TXRX_DATA_MASK (0x00FF) +-#define I2C_TXRX_DATA_MASK_UPPER (0xFF00) +-#define I2C_TXRX_DATA_SHIFT (8) +- +-struct mt9t111_platform_data { +- char *master; +- int (*power_set) (struct v4l2_int_device *s, enum v4l2_power on); +- int (*ifparm) (struct v4l2_ifparm *p); +- int (*priv_data_set) (void *); +- /* Interface control params */ +- bool clk_polarity; +- bool hs_polarity; +- bool vs_polarity; +-}; +- +-/** +- * struct capture_size - image capture size information +- * @width: image width in pixels +- * @height: image height in pixels +- */ +-struct capture_size { +- unsigned long width; +- unsigned long height; +-}; +- +-#endif /*for ifndef MT9T111 */ +- +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0049-V4L-DVB-13670-soc-camera-Add-mt9t112-camera-driver.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0049-V4L-DVB-13670-soc-camera-Add-mt9t112-camera-driver.patch new file mode 100644 index 0000000000..b0ff18f03c --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0049-V4L-DVB-13670-soc-camera-Add-mt9t112-camera-driver.patch @@ -0,0 +1,1285 @@ +From f4746ba909482062d5c9ae03ac4b96b6de0c64c6 Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto <morimoto.kuninori@renesas.com> +Date: Fri, 11 Dec 2009 11:53:55 -0300 +Subject: [PATCH 49/71] V4L/DVB (13670): soc-camera: Add mt9t112 camera driver + +create mode 100644 drivers/media/video/mt9t112.c + create mode 100644 include/media/mt9t112.h + +Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> +Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> +Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> +--- + drivers/media/video/Kconfig | 6 + + drivers/media/video/Makefile | 1 + + drivers/media/video/mt9t112.c | 1177 +++++++++++++++++++++++++++++++++++++++ + include/media/mt9t112.h | 30 + + include/media/v4l2-chip-ident.h | 2 + + 5 files changed, 1216 insertions(+), 0 deletions(-) + create mode 100644 drivers/media/video/mt9t112.c + create mode 100644 include/media/mt9t112.h + +diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig +index 780b246..7caade9 100644 +--- a/drivers/media/video/Kconfig ++++ b/drivers/media/video/Kconfig +@@ -832,6 +832,12 @@ config SOC_CAMERA_MT9T031 + help + This driver supports MT9T031 cameras from Micron. + ++config SOC_CAMERA_MT9T112 ++ tristate "mt9t112 support" ++ depends on SOC_CAMERA && I2C ++ help ++ This driver supports MT9T112 cameras from Aptina. ++ + config SOC_CAMERA_MT9V022 + tristate "mt9v022 support" + depends on SOC_CAMERA && I2C +diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile +index 3828723..61ae13f 100644 +--- a/drivers/media/video/Makefile ++++ b/drivers/media/video/Makefile +@@ -80,6 +80,7 @@ obj-$(CONFIG_VIDEO_MT9V113) += mt9v113.o + obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o + obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o + obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o ++obj-$(CONFIG_SOC_CAMERA_MT9T112) += mt9t112.o + obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o + obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o + obj-$(CONFIG_SOC_CAMERA_OV9640) += ov9640.o +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +new file mode 100644 +index 0000000..fc4dd60 +--- /dev/null ++++ b/drivers/media/video/mt9t112.c +@@ -0,0 +1,1177 @@ ++/* ++ * mt9t112 Camera Driver ++ * ++ * Copyright (C) 2009 Renesas Solutions Corp. ++ * Kuninori Morimoto <morimoto.kuninori@renesas.com> ++ * ++ * Based on ov772x driver, mt9m111 driver, ++ * ++ * Copyright (C) 2008 Kuninori Morimoto <morimoto.kuninori@renesas.com> ++ * Copyright (C) 2008, Robert Jarzmik <robert.jarzmik@free.fr> ++ * Copyright 2006-7 Jonathan Corbet <corbet@lwn.net> ++ * Copyright (C) 2008 Magnus Damm ++ * Copyright (C) 2008, Guennadi Liakhovetski <kernel@pengutronix.de> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#include <linux/delay.h> ++#include <linux/i2c.h> ++#include <linux/init.h> ++#include <linux/module.h> ++#include <linux/slab.h> ++#include <linux/videodev2.h> ++ ++#include <media/mt9t112.h> ++#include <media/soc_camera.h> ++#include <media/soc_mediabus.h> ++#include <media/v4l2-chip-ident.h> ++#include <media/v4l2-common.h> ++ ++/* you can check PLL/clock info */ ++/* #define EXT_CLOCK 24000000 */ ++ ++/************************************************************************ ++ ++ ++ macro ++ ++ ++************************************************************************/ ++/* ++ * frame size ++ */ ++#define MAX_WIDTH 2048 ++#define MAX_HEIGHT 1536 ++ ++#define VGA_WIDTH 640 ++#define VGA_HEIGHT 480 ++ ++/* ++ * macro of read/write ++ */ ++#define ECHECKER(ret, x) \ ++ do { \ ++ (ret) = (x); \ ++ if ((ret) < 0) \ ++ return (ret); \ ++ } while (0) ++ ++#define mt9t112_reg_write(ret, client, a, b) \ ++ ECHECKER(ret, __mt9t112_reg_write(client, a, b)) ++#define mt9t112_mcu_write(ret, client, a, b) \ ++ ECHECKER(ret, __mt9t112_mcu_write(client, a, b)) ++ ++#define mt9t112_reg_mask_set(ret, client, a, b, c) \ ++ ECHECKER(ret, __mt9t112_reg_mask_set(client, a, b, c)) ++#define mt9t112_mcu_mask_set(ret, client, a, b, c) \ ++ ECHECKER(ret, __mt9t112_mcu_mask_set(client, a, b, c)) ++ ++#define mt9t112_reg_read(ret, client, a) \ ++ ECHECKER(ret, __mt9t112_reg_read(client, a)) ++ ++/* ++ * Logical address ++ */ ++#define _VAR(id, offset, base) (base | (id & 0x1f) << 10 | (offset & 0x3ff)) ++#define VAR(id, offset) _VAR(id, offset, 0x0000) ++#define VAR8(id, offset) _VAR(id, offset, 0x8000) ++ ++/************************************************************************ ++ ++ ++ struct ++ ++ ++************************************************************************/ ++struct mt9t112_frame_size { ++ u16 width; ++ u16 height; ++}; ++ ++struct mt9t112_format { ++ enum v4l2_mbus_pixelcode code; ++ enum v4l2_colorspace colorspace; ++ u16 fmt; ++ u16 order; ++}; ++ ++struct mt9t112_priv { ++ struct v4l2_subdev subdev; ++ struct mt9t112_camera_info *info; ++ struct i2c_client *client; ++ struct soc_camera_device icd; ++ struct mt9t112_frame_size frame; ++ const struct mt9t112_format *format; ++ int model; ++ u32 flags; ++/* for flags */ ++#define INIT_DONE (1<<0) ++}; ++ ++/************************************************************************ ++ ++ ++ supported format ++ ++ ++************************************************************************/ ++ ++static const struct mt9t112_format mt9t112_cfmts[] = { ++ { ++ .code = V4L2_MBUS_FMT_YUYV8_2X8_BE, ++ .colorspace = V4L2_COLORSPACE_JPEG, ++ .fmt = 1, ++ .order = 0, ++ }, { ++ .code = V4L2_MBUS_FMT_YVYU8_2X8_BE, ++ .colorspace = V4L2_COLORSPACE_JPEG, ++ .fmt = 1, ++ .order = 1, ++ }, { ++ .code = V4L2_MBUS_FMT_YUYV8_2X8_LE, ++ .colorspace = V4L2_COLORSPACE_JPEG, ++ .fmt = 1, ++ .order = 2, ++ }, { ++ .code = V4L2_MBUS_FMT_YVYU8_2X8_LE, ++ .colorspace = V4L2_COLORSPACE_JPEG, ++ .fmt = 1, ++ .order = 3, ++ }, { ++ .code = V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE, ++ .colorspace = V4L2_COLORSPACE_SRGB, ++ .fmt = 8, ++ .order = 2, ++ }, { ++ .code = V4L2_MBUS_FMT_RGB565_2X8_LE, ++ .colorspace = V4L2_COLORSPACE_SRGB, ++ .fmt = 4, ++ .order = 2, ++ }, ++}; ++ ++/************************************************************************ ++ ++ ++ general function ++ ++ ++************************************************************************/ ++static struct mt9t112_priv *to_mt9t112(const struct i2c_client *client) ++{ ++ return container_of(i2c_get_clientdata(client), ++ struct mt9t112_priv, ++ subdev); ++} ++ ++static int __mt9t112_reg_read(const struct i2c_client *client, u16 command) ++{ ++ struct i2c_msg msg[2]; ++ u8 buf[2]; ++ int ret; ++ ++ command = swab16(command); ++ ++ msg[0].addr = client->addr; ++ msg[0].flags = 0; ++ msg[0].len = 2; ++ msg[0].buf = (u8 *)&command; ++ ++ msg[1].addr = client->addr; ++ msg[1].flags = I2C_M_RD; ++ msg[1].len = 2; ++ msg[1].buf = buf; ++ ++ /* ++ * if return value of this function is < 0, ++ * it mean error. ++ * else, under 16bit is valid data. ++ */ ++ ret = i2c_transfer(client->adapter, msg, 2); ++ if (ret < 0) ++ return ret; ++ ++ memcpy(&ret, buf, 2); ++ return swab16(ret); ++} ++ ++static int __mt9t112_reg_write(const struct i2c_client *client, ++ u16 command, u16 data) ++{ ++ struct i2c_msg msg; ++ u8 buf[4]; ++ int ret; ++ ++ command = swab16(command); ++ data = swab16(data); ++ ++ memcpy(buf + 0, &command, 2); ++ memcpy(buf + 2, &data, 2); ++ ++ msg.addr = client->addr; ++ msg.flags = 0; ++ msg.len = 4; ++ msg.buf = buf; ++ ++ /* ++ * i2c_transfer return message length, ++ * but this function should return 0 if correct case ++ */ ++ ret = i2c_transfer(client->adapter, &msg, 1); ++ if (ret >= 0) ++ ret = 0; ++ ++ return ret; ++} ++ ++static int __mt9t112_reg_mask_set(const struct i2c_client *client, ++ u16 command, ++ u16 mask, ++ u16 set) ++{ ++ int val = __mt9t112_reg_read(client, command); ++ if (val < 0) ++ return val; ++ ++ val &= ~mask; ++ val |= set & mask; ++ ++ return __mt9t112_reg_write(client, command, val); ++} ++ ++/* mcu access */ ++static int __mt9t112_mcu_read(const struct i2c_client *client, u16 command) ++{ ++ int ret; ++ ++ ret = __mt9t112_reg_write(client, 0x098E, command); ++ if (ret < 0) ++ return ret; ++ ++ return __mt9t112_reg_read(client, 0x0990); ++} ++ ++static int __mt9t112_mcu_write(const struct i2c_client *client, ++ u16 command, u16 data) ++{ ++ int ret; ++ ++ ret = __mt9t112_reg_write(client, 0x098E, command); ++ if (ret < 0) ++ return ret; ++ ++ return __mt9t112_reg_write(client, 0x0990, data); ++} ++ ++static int __mt9t112_mcu_mask_set(const struct i2c_client *client, ++ u16 command, ++ u16 mask, ++ u16 set) ++{ ++ int val = __mt9t112_mcu_read(client, command); ++ if (val < 0) ++ return val; ++ ++ val &= ~mask; ++ val |= set & mask; ++ ++ return __mt9t112_mcu_write(client, command, val); ++} ++ ++static int mt9t112_reset(const struct i2c_client *client) ++{ ++ int ret; ++ ++ mt9t112_reg_mask_set(ret, client, 0x001a, 0x0001, 0x0001); ++ msleep(1); ++ mt9t112_reg_mask_set(ret, client, 0x001a, 0x0001, 0x0000); ++ ++ return ret; ++} ++ ++#ifndef EXT_CLOCK ++#define CLOCK_INFO(a, b) ++#else ++#define CLOCK_INFO(a, b) mt9t112_clock_info(a, b) ++static int mt9t112_clock_info(const struct i2c_client *client, u32 ext) ++{ ++ int m, n, p1, p2, p3, p4, p5, p6, p7; ++ u32 vco, clk; ++ char *enable; ++ ++ ext /= 1000; /* kbyte order */ ++ ++ mt9t112_reg_read(n, client, 0x0012); ++ p1 = n & 0x000f; ++ n = n >> 4; ++ p2 = n & 0x000f; ++ n = n >> 4; ++ p3 = n & 0x000f; ++ ++ mt9t112_reg_read(n, client, 0x002a); ++ p4 = n & 0x000f; ++ n = n >> 4; ++ p5 = n & 0x000f; ++ n = n >> 4; ++ p6 = n & 0x000f; ++ ++ mt9t112_reg_read(n, client, 0x002c); ++ p7 = n & 0x000f; ++ ++ mt9t112_reg_read(n, client, 0x0010); ++ m = n & 0x00ff; ++ n = (n >> 8) & 0x003f; ++ ++ enable = ((6000 > ext) || (54000 < ext)) ? "X" : ""; ++ dev_info(&client->dev, "EXTCLK : %10u K %s\n", ext, enable); ++ ++ vco = 2 * m * ext / (n+1); ++ enable = ((384000 > vco) || (768000 < vco)) ? "X" : ""; ++ dev_info(&client->dev, "VCO : %10u K %s\n", vco, enable); ++ ++ clk = vco / (p1+1) / (p2+1); ++ enable = (96000 < clk) ? "X" : ""; ++ dev_info(&client->dev, "PIXCLK : %10u K %s\n", clk, enable); ++ ++ clk = vco / (p3+1); ++ enable = (768000 < clk) ? "X" : ""; ++ dev_info(&client->dev, "MIPICLK : %10u K %s\n", clk, enable); ++ ++ clk = vco / (p6+1); ++ enable = (96000 < clk) ? "X" : ""; ++ dev_info(&client->dev, "MCU CLK : %10u K %s\n", clk, enable); ++ ++ clk = vco / (p5+1); ++ enable = (54000 < clk) ? "X" : ""; ++ dev_info(&client->dev, "SOC CLK : %10u K %s\n", clk, enable); ++ ++ clk = vco / (p4+1); ++ enable = (70000 < clk) ? "X" : ""; ++ dev_info(&client->dev, "Sensor CLK : %10u K %s\n", clk, enable); ++ ++ clk = vco / (p7+1); ++ dev_info(&client->dev, "External sensor : %10u K\n", clk); ++ ++ clk = ext / (n+1); ++ enable = ((2000 > clk) || (24000 < clk)) ? "X" : ""; ++ dev_info(&client->dev, "PFD : %10u K %s\n", clk, enable); ++ ++ return 0; ++} ++#endif ++ ++static void mt9t112_frame_check(u32 *width, u32 *height) ++{ ++ if (*width > MAX_WIDTH) ++ *width = MAX_WIDTH; ++ ++ if (*height > MAX_HEIGHT) ++ *height = MAX_HEIGHT; ++} ++ ++static int mt9t112_set_a_frame_size(const struct i2c_client *client, ++ u16 width, ++ u16 height) ++{ ++ int ret; ++ u16 wstart = (MAX_WIDTH - width) / 2; ++ u16 hstart = (MAX_HEIGHT - height) / 2; ++ ++ /* (Context A) Image Width/Height */ ++ mt9t112_mcu_write(ret, client, VAR(26, 0), width); ++ mt9t112_mcu_write(ret, client, VAR(26, 2), height); ++ ++ /* (Context A) Output Width/Height */ ++ mt9t112_mcu_write(ret, client, VAR(18, 43), 8 + width); ++ mt9t112_mcu_write(ret, client, VAR(18, 45), 8 + height); ++ ++ /* (Context A) Start Row/Column */ ++ mt9t112_mcu_write(ret, client, VAR(18, 2), 4 + hstart); ++ mt9t112_mcu_write(ret, client, VAR(18, 4), 4 + wstart); ++ ++ /* (Context A) End Row/Column */ ++ mt9t112_mcu_write(ret, client, VAR(18, 6), 11 + height + hstart); ++ mt9t112_mcu_write(ret, client, VAR(18, 8), 11 + width + wstart); ++ ++ mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06); ++ ++ return ret; ++} ++ ++static int mt9t112_set_pll_dividers(const struct i2c_client *client, ++ u8 m, u8 n, ++ u8 p1, u8 p2, u8 p3, ++ u8 p4, u8 p5, u8 p6, ++ u8 p7) ++{ ++ int ret; ++ u16 val; ++ ++ /* N/M */ ++ val = (n << 8) | ++ (m << 0); ++ mt9t112_reg_mask_set(ret, client, 0x0010, 0x3fff, val); ++ ++ /* P1/P2/P3 */ ++ val = ((p3 & 0x0F) << 8) | ++ ((p2 & 0x0F) << 4) | ++ ((p1 & 0x0F) << 0); ++ mt9t112_reg_mask_set(ret, client, 0x0012, 0x0fff, val); ++ ++ /* P4/P5/P6 */ ++ val = (0x7 << 12) | ++ ((p6 & 0x0F) << 8) | ++ ((p5 & 0x0F) << 4) | ++ ((p4 & 0x0F) << 0); ++ mt9t112_reg_mask_set(ret, client, 0x002A, 0x7fff, val); ++ ++ /* P7 */ ++ val = (0x1 << 12) | ++ ((p7 & 0x0F) << 0); ++ mt9t112_reg_mask_set(ret, client, 0x002C, 0x100f, val); ++ ++ return ret; ++} ++ ++static int mt9t112_init_pll(const struct i2c_client *client) ++{ ++ struct mt9t112_priv *priv = to_mt9t112(client); ++ int data, i, ret; ++ ++ mt9t112_reg_mask_set(ret, client, 0x0014, 0x003, 0x0001); ++ ++ /* PLL control: BYPASS PLL = 8517 */ ++ mt9t112_reg_write(ret, client, 0x0014, 0x2145); ++ ++ /* Replace these registers when new timing parameters are generated */ ++ mt9t112_set_pll_dividers(client, ++ priv->info->divider.m, ++ priv->info->divider.n, ++ priv->info->divider.p1, ++ priv->info->divider.p2, ++ priv->info->divider.p3, ++ priv->info->divider.p4, ++ priv->info->divider.p5, ++ priv->info->divider.p6, ++ priv->info->divider.p7); ++ ++ /* ++ * TEST_BYPASS on ++ * PLL_ENABLE on ++ * SEL_LOCK_DET on ++ * TEST_BYPASS off ++ */ ++ mt9t112_reg_write(ret, client, 0x0014, 0x2525); ++ mt9t112_reg_write(ret, client, 0x0014, 0x2527); ++ mt9t112_reg_write(ret, client, 0x0014, 0x3427); ++ mt9t112_reg_write(ret, client, 0x0014, 0x3027); ++ ++ mdelay(10); ++ ++ /* ++ * PLL_BYPASS off ++ * Reference clock count ++ * I2C Master Clock Divider ++ */ ++ mt9t112_reg_write(ret, client, 0x0014, 0x3046); ++ mt9t112_reg_write(ret, client, 0x0022, 0x0190); ++ mt9t112_reg_write(ret, client, 0x3B84, 0x0212); ++ ++ /* External sensor clock is PLL bypass */ ++ mt9t112_reg_write(ret, client, 0x002E, 0x0500); ++ ++ mt9t112_reg_mask_set(ret, client, 0x0018, 0x0002, 0x0002); ++ mt9t112_reg_mask_set(ret, client, 0x3B82, 0x0004, 0x0004); ++ ++ /* MCU disabled */ ++ mt9t112_reg_mask_set(ret, client, 0x0018, 0x0004, 0x0004); ++ ++ /* out of standby */ ++ mt9t112_reg_mask_set(ret, client, 0x0018, 0x0001, 0); ++ ++ mdelay(50); ++ ++ /* ++ * Standby Workaround ++ * Disable Secondary I2C Pads ++ */ ++ mt9t112_reg_write(ret, client, 0x0614, 0x0001); ++ mdelay(1); ++ mt9t112_reg_write(ret, client, 0x0614, 0x0001); ++ mdelay(1); ++ mt9t112_reg_write(ret, client, 0x0614, 0x0001); ++ mdelay(1); ++ mt9t112_reg_write(ret, client, 0x0614, 0x0001); ++ mdelay(1); ++ mt9t112_reg_write(ret, client, 0x0614, 0x0001); ++ mdelay(1); ++ mt9t112_reg_write(ret, client, 0x0614, 0x0001); ++ mdelay(1); ++ ++ /* poll to verify out of standby. Must Poll this bit */ ++ for (i = 0; i < 100; i++) { ++ mt9t112_reg_read(data, client, 0x0018); ++ if (0x4000 & data) ++ break; ++ ++ mdelay(10); ++ } ++ ++ return ret; ++} ++ ++static int mt9t112_init_setting(const struct i2c_client *client) ++{ ++ ++ int ret; ++ ++ /* Adaptive Output Clock (A) */ ++ mt9t112_mcu_mask_set(ret, client, VAR(26, 160), 0x0040, 0x0000); ++ ++ /* Read Mode (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 12), 0x0024); ++ ++ /* Fine Correction (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 15), 0x00CC); ++ ++ /* Fine IT Min (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 17), 0x01f1); ++ ++ /* Fine IT Max Margin (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 19), 0x00fF); ++ ++ /* Base Frame Lines (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 29), 0x032D); ++ ++ /* Min Line Length (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 31), 0x073a); ++ ++ /* Line Length (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 37), 0x07d0); ++ ++ /* Adaptive Output Clock (B) */ ++ mt9t112_mcu_mask_set(ret, client, VAR(27, 160), 0x0040, 0x0000); ++ ++ /* Row Start (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 74), 0x004); ++ ++ /* Column Start (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 76), 0x004); ++ ++ /* Row End (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 78), 0x60B); ++ ++ /* Column End (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 80), 0x80B); ++ ++ /* Fine Correction (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 87), 0x008C); ++ ++ /* Fine IT Min (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 89), 0x01F1); ++ ++ /* Fine IT Max Margin (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 91), 0x00FF); ++ ++ /* Base Frame Lines (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 101), 0x0668); ++ ++ /* Min Line Length (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 103), 0x0AF0); ++ ++ /* Line Length (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 109), 0x0AF0); ++ ++ /* ++ * Flicker Dectection registers ++ * This section should be replaced whenever new Timing file is generated ++ * All the following registers need to be replaced ++ * Following registers are generated from Register Wizard but user can ++ * modify them. For detail see auto flicker detection tuning ++ */ ++ ++ /* FD_FDPERIOD_SELECT */ ++ mt9t112_mcu_write(ret, client, VAR8(8, 5), 0x01); ++ ++ /* PRI_B_CONFIG_FD_ALGO_RUN */ ++ mt9t112_mcu_write(ret, client, VAR(27, 17), 0x0003); ++ ++ /* PRI_A_CONFIG_FD_ALGO_RUN */ ++ mt9t112_mcu_write(ret, client, VAR(26, 17), 0x0003); ++ ++ /* ++ * AFD range detection tuning registers ++ */ ++ ++ /* search_f1_50 */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 165), 0x25); ++ ++ /* search_f2_50 */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 166), 0x28); ++ ++ /* search_f1_60 */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 167), 0x2C); ++ ++ /* search_f2_60 */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 168), 0x2F); ++ ++ /* period_50Hz (A) */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 68), 0xBA); ++ ++ /* secret register by aptina */ ++ /* period_50Hz (A MSB) */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 303), 0x00); ++ ++ /* period_60Hz (A) */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 69), 0x9B); ++ ++ /* secret register by aptina */ ++ /* period_60Hz (A MSB) */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 301), 0x00); ++ ++ /* period_50Hz (B) */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 140), 0x82); ++ ++ /* secret register by aptina */ ++ /* period_50Hz (B) MSB */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 304), 0x00); ++ ++ /* period_60Hz (B) */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 141), 0x6D); ++ ++ /* secret register by aptina */ ++ /* period_60Hz (B) MSB */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 302), 0x00); ++ ++ /* FD Mode */ ++ mt9t112_mcu_write(ret, client, VAR8(8, 2), 0x10); ++ ++ /* Stat_min */ ++ mt9t112_mcu_write(ret, client, VAR8(8, 9), 0x02); ++ ++ /* Stat_max */ ++ mt9t112_mcu_write(ret, client, VAR8(8, 10), 0x03); ++ ++ /* Min_amplitude */ ++ mt9t112_mcu_write(ret, client, VAR8(8, 12), 0x0A); ++ ++ /* RX FIFO Watermark (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 70), 0x0014); ++ ++ /* RX FIFO Watermark (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 142), 0x0014); ++ ++ /* MCLK: 16MHz ++ * PCLK: 73MHz ++ * CorePixCLK: 36.5 MHz ++ */ ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x0044), 133); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x0045), 110); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x008c), 130); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x008d), 108); ++ ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x00A5), 27); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x00a6), 30); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x00a7), 32); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x00a8), 35); ++ ++ return ret; ++} ++ ++static int mt9t112_auto_focus_setting(const struct i2c_client *client) ++{ ++ int ret; ++ ++ mt9t112_mcu_write(ret, client, VAR(12, 13), 0x000F); ++ mt9t112_mcu_write(ret, client, VAR(12, 23), 0x0F0F); ++ mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06); ++ ++ mt9t112_reg_write(ret, client, 0x0614, 0x0000); ++ ++ mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x05); ++ mt9t112_mcu_write(ret, client, VAR8(12, 2), 0x02); ++ mt9t112_mcu_write(ret, client, VAR(12, 3), 0x0002); ++ mt9t112_mcu_write(ret, client, VAR(17, 3), 0x8001); ++ mt9t112_mcu_write(ret, client, VAR(17, 11), 0x0025); ++ mt9t112_mcu_write(ret, client, VAR(17, 13), 0x0193); ++ mt9t112_mcu_write(ret, client, VAR8(17, 33), 0x18); ++ mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x05); ++ ++ return ret; ++} ++ ++static int mt9t112_auto_focus_trigger(const struct i2c_client *client) ++{ ++ int ret; ++ ++ mt9t112_mcu_write(ret, client, VAR8(12, 25), 0x01); ++ ++ return ret; ++} ++ ++static int mt9t112_init_camera(const struct i2c_client *client) ++{ ++ int ret; ++ ++ ECHECKER(ret, mt9t112_reset(client)); ++ ++ ECHECKER(ret, mt9t112_init_pll(client)); ++ ++ ECHECKER(ret, mt9t112_init_setting(client)); ++ ++ ECHECKER(ret, mt9t112_auto_focus_setting(client)); ++ ++ mt9t112_reg_mask_set(ret, client, 0x0018, 0x0004, 0); ++ ++ /* Analog setting B */ ++ mt9t112_reg_write(ret, client, 0x3084, 0x2409); ++ mt9t112_reg_write(ret, client, 0x3092, 0x0A49); ++ mt9t112_reg_write(ret, client, 0x3094, 0x4949); ++ mt9t112_reg_write(ret, client, 0x3096, 0x4950); ++ ++ /* ++ * Disable adaptive clock ++ * PRI_A_CONFIG_JPEG_OB_TX_CONTROL_VAR ++ * PRI_B_CONFIG_JPEG_OB_TX_CONTROL_VAR ++ */ ++ mt9t112_mcu_write(ret, client, VAR(26, 160), 0x0A2E); ++ mt9t112_mcu_write(ret, client, VAR(27, 160), 0x0A2E); ++ ++ /* Configure STatus in Status_before_length Format and enable header */ ++ /* PRI_B_CONFIG_JPEG_OB_TX_CONTROL_VAR */ ++ mt9t112_mcu_write(ret, client, VAR(27, 144), 0x0CB4); ++ ++ /* Enable JPEG in context B */ ++ /* PRI_B_CONFIG_JPEG_OB_TX_CONTROL_VAR */ ++ mt9t112_mcu_write(ret, client, VAR8(27, 142), 0x01); ++ ++ /* Disable Dac_TXLO */ ++ mt9t112_reg_write(ret, client, 0x316C, 0x350F); ++ ++ /* Set max slew rates */ ++ mt9t112_reg_write(ret, client, 0x1E, 0x777); ++ ++ return ret; ++} ++ ++/************************************************************************ ++ ++ ++ soc_camera_ops ++ ++ ++************************************************************************/ ++static int mt9t112_set_bus_param(struct soc_camera_device *icd, ++ unsigned long flags) ++{ ++ return 0; ++} ++ ++static unsigned long mt9t112_query_bus_param(struct soc_camera_device *icd) ++{ ++ struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd)); ++ struct mt9t112_priv *priv = to_mt9t112(client); ++ struct soc_camera_link *icl = to_soc_camera_link(icd); ++ unsigned long flags = SOCAM_MASTER | SOCAM_VSYNC_ACTIVE_HIGH | ++ SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_HIGH; ++ ++ flags |= (priv->info->flags & MT9T112_FLAG_PCLK_RISING_EDGE) ? ++ SOCAM_PCLK_SAMPLE_RISING : SOCAM_PCLK_SAMPLE_FALLING; ++ ++ if (priv->info->flags & MT9T112_FLAG_DATAWIDTH_8) ++ flags |= SOCAM_DATAWIDTH_8; ++ else ++ flags |= SOCAM_DATAWIDTH_10; ++ ++ return soc_camera_apply_sensor_flags(icl, flags); ++} ++ ++static struct soc_camera_ops mt9t112_ops = { ++ .set_bus_param = mt9t112_set_bus_param, ++ .query_bus_param = mt9t112_query_bus_param, ++}; ++ ++/************************************************************************ ++ ++ ++ v4l2_subdev_core_ops ++ ++ ++************************************************************************/ ++static int mt9t112_g_chip_ident(struct v4l2_subdev *sd, ++ struct v4l2_dbg_chip_ident *id) ++{ ++ struct i2c_client *client = sd->priv; ++ struct mt9t112_priv *priv = to_mt9t112(client); ++ ++ id->ident = priv->model; ++ id->revision = 0; ++ ++ return 0; ++} ++ ++#ifdef CONFIG_VIDEO_ADV_DEBUG ++static int mt9t112_g_register(struct v4l2_subdev *sd, ++ struct v4l2_dbg_register *reg) ++{ ++ struct i2c_client *client = sd->priv; ++ int ret; ++ ++ reg->size = 2; ++ mt9t112_reg_read(ret, client, reg->reg); ++ ++ reg->val = (__u64)ret; ++ ++ return 0; ++} ++ ++static int mt9t112_s_register(struct v4l2_subdev *sd, ++ struct v4l2_dbg_register *reg) ++{ ++ struct i2c_client *client = sd->priv; ++ int ret; ++ ++ mt9t112_reg_write(ret, client, reg->reg, reg->val); ++ ++ return ret; ++} ++#endif ++ ++static struct v4l2_subdev_core_ops mt9t112_subdev_core_ops = { ++ .g_chip_ident = mt9t112_g_chip_ident, ++#ifdef CONFIG_VIDEO_ADV_DEBUG ++ .g_register = mt9t112_g_register, ++ .s_register = mt9t112_s_register, ++#endif ++}; ++ ++ ++/************************************************************************ ++ ++ ++ v4l2_subdev_video_ops ++ ++ ++************************************************************************/ ++static int mt9t112_s_stream(struct v4l2_subdev *sd, int enable) ++{ ++ struct i2c_client *client = sd->priv; ++ struct mt9t112_priv *priv = to_mt9t112(client); ++ int ret = 0; ++ ++ if (!enable) { ++ /* FIXME ++ * ++ * If user selected large output size, ++ * and used it long time, ++ * mt9t112 camera will be very warm. ++ * ++ * But current driver can not stop mt9t112 camera. ++ * So, set small size here to solve this problem. ++ */ ++ mt9t112_set_a_frame_size(client, VGA_WIDTH, VGA_HEIGHT); ++ return ret; ++ } ++ ++ if (!(priv->flags & INIT_DONE)) { ++ u16 param = (MT9T112_FLAG_PCLK_RISING_EDGE & ++ priv->info->flags) ? 0x0001 : 0x0000; ++ ++ ECHECKER(ret, mt9t112_init_camera(client)); ++ ++ /* Invert PCLK (Data sampled on falling edge of pixclk) */ ++ mt9t112_reg_write(ret, client, 0x3C20, param); ++ ++ mdelay(5); ++ ++ priv->flags |= INIT_DONE; ++ } ++ ++ mt9t112_mcu_write(ret, client, VAR(26, 7), priv->format->fmt); ++ mt9t112_mcu_write(ret, client, VAR(26, 9), priv->format->order); ++ mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06); ++ ++ mt9t112_set_a_frame_size(client, ++ priv->frame.width, ++ priv->frame.height); ++ ++ ECHECKER(ret, mt9t112_auto_focus_trigger(client)); ++ ++ dev_dbg(&client->dev, "format : %d\n", priv->format->code); ++ dev_dbg(&client->dev, "size : %d x %d\n", ++ priv->frame.width, ++ priv->frame.height); ++ ++ CLOCK_INFO(client, EXT_CLOCK); ++ ++ return ret; ++} ++ ++static int mt9t112_set_params(struct i2c_client *client, u32 width, u32 height, ++ enum v4l2_mbus_pixelcode code) ++{ ++ struct mt9t112_priv *priv = to_mt9t112(client); ++ int i; ++ ++ priv->format = NULL; ++ ++ /* ++ * frame size check ++ */ ++ mt9t112_frame_check(&width, &height); ++ ++ /* ++ * get color format ++ */ ++ for (i = 0; i < ARRAY_SIZE(mt9t112_cfmts); i++) ++ if (mt9t112_cfmts[i].code == code) ++ break; ++ ++ if (i == ARRAY_SIZE(mt9t112_cfmts)) ++ return -EINVAL; ++ ++ priv->frame.width = (u16)width; ++ priv->frame.height = (u16)height; ++ ++ priv->format = mt9t112_cfmts + i; ++ ++ return 0; ++} ++ ++static int mt9t112_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) ++{ ++ a->bounds.left = 0; ++ a->bounds.top = 0; ++ a->bounds.width = VGA_WIDTH; ++ a->bounds.height = VGA_HEIGHT; ++ a->defrect = a->bounds; ++ a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ a->pixelaspect.numerator = 1; ++ a->pixelaspect.denominator = 1; ++ ++ return 0; ++} ++ ++static int mt9t112_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) ++{ ++ a->c.left = 0; ++ a->c.top = 0; ++ a->c.width = VGA_WIDTH; ++ a->c.height = VGA_HEIGHT; ++ a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ ++ return 0; ++} ++ ++static int mt9t112_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) ++{ ++ struct i2c_client *client = sd->priv; ++ struct v4l2_rect *rect = &a->c; ++ ++ return mt9t112_set_params(client, rect->width, rect->height, ++ V4L2_MBUS_FMT_YUYV8_2X8_BE); ++} ++ ++static int mt9t112_g_fmt(struct v4l2_subdev *sd, ++ struct v4l2_mbus_framefmt *mf) ++{ ++ struct i2c_client *client = sd->priv; ++ struct mt9t112_priv *priv = to_mt9t112(client); ++ ++ if (!priv->format) { ++ int ret = mt9t112_set_params(client, VGA_WIDTH, VGA_HEIGHT, ++ V4L2_MBUS_FMT_YUYV8_2X8_BE); ++ if (ret < 0) ++ return ret; ++ } ++ ++ mf->width = priv->frame.width; ++ mf->height = priv->frame.height; ++ /* TODO: set colorspace */ ++ mf->code = priv->format->code; ++ mf->field = V4L2_FIELD_NONE; ++ ++ return 0; ++} ++ ++static int mt9t112_s_fmt(struct v4l2_subdev *sd, ++ struct v4l2_mbus_framefmt *mf) ++{ ++ struct i2c_client *client = sd->priv; ++ ++ /* TODO: set colorspace */ ++ return mt9t112_set_params(client, mf->width, mf->height, mf->code); ++} ++ ++static int mt9t112_try_fmt(struct v4l2_subdev *sd, ++ struct v4l2_mbus_framefmt *mf) ++{ ++ mt9t112_frame_check(&mf->width, &mf->height); ++ ++ /* TODO: set colorspace */ ++ mf->field = V4L2_FIELD_NONE; ++ ++ return 0; ++} ++ ++static int mt9t112_enum_fmt(struct v4l2_subdev *sd, int index, ++ enum v4l2_mbus_pixelcode *code) ++{ ++ if ((unsigned int)index >= ARRAY_SIZE(mt9t112_cfmts)) ++ return -EINVAL; ++ ++ *code = mt9t112_cfmts[index].code; ++ return 0; ++} ++ ++static struct v4l2_subdev_video_ops mt9t112_subdev_video_ops = { ++ .s_stream = mt9t112_s_stream, ++ .g_mbus_fmt = mt9t112_g_fmt, ++ .s_mbus_fmt = mt9t112_s_fmt, ++ .try_mbus_fmt = mt9t112_try_fmt, ++ .cropcap = mt9t112_cropcap, ++ .g_crop = mt9t112_g_crop, ++ .s_crop = mt9t112_s_crop, ++ .enum_mbus_fmt = mt9t112_enum_fmt, ++}; ++ ++/************************************************************************ ++ ++ ++ i2c driver ++ ++ ++************************************************************************/ ++static struct v4l2_subdev_ops mt9t112_subdev_ops = { ++ .core = &mt9t112_subdev_core_ops, ++ .video = &mt9t112_subdev_video_ops, ++}; ++ ++static int mt9t112_camera_probe(struct soc_camera_device *icd, ++ struct i2c_client *client) ++{ ++ struct mt9t112_priv *priv = to_mt9t112(client); ++ const char *devname; ++ int chipid; ++ ++ /* ++ * We must have a parent by now. And it cannot be a wrong one. ++ * So this entire test is completely redundant. ++ */ ++ if (!icd->dev.parent || ++ to_soc_camera_host(icd->dev.parent)->nr != icd->iface) ++ return -ENODEV; ++ ++ /* ++ * check and show chip ID ++ */ ++ mt9t112_reg_read(chipid, client, 0x0000); ++ ++ switch (chipid) { ++ case 0x2680: ++ devname = "mt9t111"; ++ priv->model = V4L2_IDENT_MT9T111; ++ break; ++ case 0x2682: ++ devname = "mt9t112"; ++ priv->model = V4L2_IDENT_MT9T112; ++ break; ++ default: ++ dev_err(&client->dev, "Product ID error %04x\n", chipid); ++ return -ENODEV; ++ } ++ ++ dev_info(&client->dev, "%s chip ID %04x\n", devname, chipid); ++ ++ return 0; ++} ++ ++static int mt9t112_probe(struct i2c_client *client, ++ const struct i2c_device_id *did) ++{ ++ struct mt9t112_priv *priv; ++ struct soc_camera_device *icd = client->dev.platform_data; ++ struct soc_camera_link *icl; ++ int ret; ++ ++ if (!icd) { ++ dev_err(&client->dev, "mt9t112: missing soc-camera data!\n"); ++ return -EINVAL; ++ } ++ ++ icl = to_soc_camera_link(icd); ++ if (!icl || !icl->priv) ++ return -EINVAL; ++ ++ priv = kzalloc(sizeof(*priv), GFP_KERNEL); ++ if (!priv) ++ return -ENOMEM; ++ ++ priv->info = icl->priv; ++ ++ v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops); ++ ++ icd->ops = &mt9t112_ops; ++ ++ ret = mt9t112_camera_probe(icd, client); ++ if (ret) { ++ icd->ops = NULL; ++ i2c_set_clientdata(client, NULL); ++ kfree(priv); ++ } ++ ++ return ret; ++} ++ ++static int mt9t112_remove(struct i2c_client *client) ++{ ++ struct mt9t112_priv *priv = to_mt9t112(client); ++ struct soc_camera_device *icd = client->dev.platform_data; ++ ++ icd->ops = NULL; ++ i2c_set_clientdata(client, NULL); ++ kfree(priv); ++ return 0; ++} ++ ++static const struct i2c_device_id mt9t112_id[] = { ++ { "mt9t112", 0 }, ++ { } ++}; ++MODULE_DEVICE_TABLE(i2c, mt9t112_id); ++ ++static struct i2c_driver mt9t112_i2c_driver = { ++ .driver = { ++ .name = "mt9t112", ++ }, ++ .probe = mt9t112_probe, ++ .remove = mt9t112_remove, ++ .id_table = mt9t112_id, ++}; ++ ++/************************************************************************ ++ ++ ++ module function ++ ++ ++************************************************************************/ ++static int __init mt9t112_module_init(void) ++{ ++ return i2c_add_driver(&mt9t112_i2c_driver); ++} ++ ++static void __exit mt9t112_module_exit(void) ++{ ++ i2c_del_driver(&mt9t112_i2c_driver); ++} ++ ++module_init(mt9t112_module_init); ++module_exit(mt9t112_module_exit); ++ ++MODULE_DESCRIPTION("SoC Camera driver for mt9t112"); ++MODULE_AUTHOR("Kuninori Morimoto"); ++MODULE_LICENSE("GPL v2"); +diff --git a/include/media/mt9t112.h b/include/media/mt9t112.h +new file mode 100644 +index 0000000..a43c74a +--- /dev/null ++++ b/include/media/mt9t112.h +@@ -0,0 +1,30 @@ ++/* mt9t112 Camera ++ * ++ * Copyright (C) 2009 Renesas Solutions Corp. ++ * Kuninori Morimoto <morimoto.kuninori@renesas.com> ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License version 2 as ++ * published by the Free Software Foundation. ++ */ ++ ++#ifndef __MT9T112_H__ ++#define __MT9T112_H__ ++ ++#define MT9T112_FLAG_PCLK_RISING_EDGE (1 << 0) ++#define MT9T112_FLAG_DATAWIDTH_8 (1 << 1) /* default width is 10 */ ++ ++struct mt9t112_pll_divider { ++ u8 m, n; ++ u8 p1, p2, p3, p4, p5, p6, p7; ++}; ++ ++/* ++ * mt9t112 camera info ++ */ ++struct mt9t112_camera_info { ++ u32 flags; ++ struct mt9t112_pll_divider divider; ++}; ++ ++#endif /* __MT9T112_H__ */ +diff --git a/include/media/v4l2-chip-ident.h b/include/media/v4l2-chip-ident.h +index 91942db..6cc107d 100644 +--- a/include/media/v4l2-chip-ident.h ++++ b/include/media/v4l2-chip-ident.h +@@ -267,6 +267,8 @@ enum { + V4L2_IDENT_MT9V022IX7ATC = 45010, /* No way to detect "normal" I77ATx */ + V4L2_IDENT_MT9V022IX7ATM = 45015, /* and "lead free" IA7ATx chips */ + V4L2_IDENT_MT9T031 = 45020, ++ V4L2_IDENT_MT9T111 = 45021, ++ V4L2_IDENT_MT9T112 = 45022, + V4L2_IDENT_MT9V111 = 45031, + V4L2_IDENT_MT9V112 = 45032, + +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0050-soc-camera-mt9t112-modify-exiting-conditions-from-st.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0050-soc-camera-mt9t112-modify-exiting-conditions-from-st.patch new file mode 100644 index 0000000000..4bfc3aec18 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0050-soc-camera-mt9t112-modify-exiting-conditions-from-st.patch @@ -0,0 +1,31 @@ +From c56b16bf7ee83b17d6aefa30f84fb50417fde28b Mon Sep 17 00:00:00 2001 +From: Kuninori Morimoto <morimoto.kuninori@renesas.com> +Date: Tue, 2 Feb 2010 13:17:54 +0900 +Subject: [PATCH 50/71] soc-camera: mt9t112: modify exiting conditions from standby mode + +This polling is needed if camera is in standby mode, but current exiting +condition is inverted. + +Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> +Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de> +Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> +--- + drivers/media/video/mt9t112.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index fc4dd60..7438f8d 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -514,7 +514,7 @@ static int mt9t112_init_pll(const struct i2c_client *client) + /* poll to verify out of standby. Must Poll this bit */ + for (i = 0; i < 100; i++) { + mt9t112_reg_read(data, client, 0x0018); +- if (0x4000 & data) ++ if (!(0x4000 & data)) + break; + + mdelay(10); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0051-mt9t112-Migrate-from-soc_camera-to-v4l2-int-device.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0051-mt9t112-Migrate-from-soc_camera-to-v4l2-int-device.patch new file mode 100644 index 0000000000..1d1e4065f6 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0051-mt9t112-Migrate-from-soc_camera-to-v4l2-int-device.patch @@ -0,0 +1,934 @@ +From 8b94a264c58f26b5877a79fb86f55f70e54cd25a Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 1 Jul 2010 07:26:38 -0500 +Subject: [PATCH 51/71] mt9t112: Migrate from soc_camera to v4l2-int-device + +This is to use the driver with the old OMAP3 Camera-ISP platform. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/Kconfig | 12 +- + drivers/media/video/Makefile | 2 +- + drivers/media/video/mt9t112.c | 658 +++++++++++++++++++++++------------------ + include/media/mt9t112.h | 13 + + 4 files changed, 391 insertions(+), 294 deletions(-) + +diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig +index 7caade9..4c1fb0f 100644 +--- a/drivers/media/video/Kconfig ++++ b/drivers/media/video/Kconfig +@@ -354,6 +354,12 @@ config VIDEO_MT9P012 + MT9P012 camera. It is currently working with the TI OMAP3 + camera controller. + ++config VIDEO_MT9T112 ++ tristate "mt9t112 support" ++ depends on I2C && VIDEO_V4L2 ++ help ++ This driver supports MT9T112 cameras from Aptina. ++ + config VIDEO_DW9710 + tristate "Lens driver for DW9710" + depends on I2C && VIDEO_V4L2 +@@ -832,12 +838,6 @@ config SOC_CAMERA_MT9T031 + help + This driver supports MT9T031 cameras from Micron. + +-config SOC_CAMERA_MT9T112 +- tristate "mt9t112 support" +- depends on SOC_CAMERA && I2C +- help +- This driver supports MT9T112 cameras from Aptina. +- + config SOC_CAMERA_MT9V022 + tristate "mt9v022 support" + depends on SOC_CAMERA && I2C +diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile +index 61ae13f..fb7e46c 100644 +--- a/drivers/media/video/Makefile ++++ b/drivers/media/video/Makefile +@@ -80,7 +80,6 @@ obj-$(CONFIG_VIDEO_MT9V113) += mt9v113.o + obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o + obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o + obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o +-obj-$(CONFIG_SOC_CAMERA_MT9T112) += mt9t112.o + obj-$(CONFIG_SOC_CAMERA_MT9V022) += mt9v022.o + obj-$(CONFIG_SOC_CAMERA_OV772X) += ov772x.o + obj-$(CONFIG_SOC_CAMERA_OV9640) += ov9640.o +@@ -129,6 +128,7 @@ obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o + obj-y += isp/ + obj-$(CONFIG_VIDEO_OMAP3) += omap34xxcam.o + obj-$(CONFIG_VIDEO_MT9P012) += mt9p012.o ++obj-$(CONFIG_VIDEO_MT9T112) += mt9t112.o + obj-$(CONFIG_VIDEO_DW9710) += dw9710.o + obj-$(CONFIG_VIDEO_TPS61059) += tps61059.o + obj-$(CONFIG_VIDEO_OV3640) += ov3640.o +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index 7438f8d..6f54394 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -25,10 +25,8 @@ + #include <linux/videodev2.h> + + #include <media/mt9t112.h> +-#include <media/soc_camera.h> +-#include <media/soc_mediabus.h> ++#include <media/v4l2-int-device.h> + #include <media/v4l2-chip-ident.h> +-#include <media/v4l2-common.h> + + /* you can check PLL/clock info */ + /* #define EXT_CLOCK 24000000 */ +@@ -43,8 +41,8 @@ + /* + * frame size + */ +-#define MAX_WIDTH 2048 +-#define MAX_HEIGHT 1536 ++#define MAX_WIDTH 640 /* 2048 */ ++#define MAX_HEIGHT 480 /* 1536 */ + + #define VGA_WIDTH 640 + #define VGA_HEIGHT 480 +@@ -91,20 +89,12 @@ struct mt9t112_frame_size { + u16 height; + }; + +-struct mt9t112_format { +- enum v4l2_mbus_pixelcode code; +- enum v4l2_colorspace colorspace; +- u16 fmt; +- u16 order; +-}; +- + struct mt9t112_priv { +- struct v4l2_subdev subdev; ++ struct mt9t112_platform_data *pdata; ++ struct v4l2_int_device *v4l2_int_device; + struct mt9t112_camera_info *info; + struct i2c_client *client; +- struct soc_camera_device icd; +- struct mt9t112_frame_size frame; +- const struct mt9t112_format *format; ++ struct v4l2_pix_format pix; + int model; + u32 flags; + /* for flags */ +@@ -119,38 +109,42 @@ struct mt9t112_priv { + + ************************************************************************/ + +-static const struct mt9t112_format mt9t112_cfmts[] = { ++const static struct v4l2_fmtdesc mt9t112_formats[] = { ++ { ++ .description = "YUYV (YUV 4:2:2), packed", ++ .pixelformat = V4L2_PIX_FMT_YUYV, ++ }, + { +- .code = V4L2_MBUS_FMT_YUYV8_2X8_BE, +- .colorspace = V4L2_COLORSPACE_JPEG, +- .fmt = 1, +- .order = 0, +- }, { +- .code = V4L2_MBUS_FMT_YVYU8_2X8_BE, +- .colorspace = V4L2_COLORSPACE_JPEG, +- .fmt = 1, +- .order = 1, +- }, { +- .code = V4L2_MBUS_FMT_YUYV8_2X8_LE, +- .colorspace = V4L2_COLORSPACE_JPEG, +- .fmt = 1, +- .order = 2, +- }, { +- .code = V4L2_MBUS_FMT_YVYU8_2X8_LE, +- .colorspace = V4L2_COLORSPACE_JPEG, +- .fmt = 1, +- .order = 3, +- }, { +- .code = V4L2_MBUS_FMT_RGB555_2X8_PADHI_LE, +- .colorspace = V4L2_COLORSPACE_SRGB, +- .fmt = 8, +- .order = 2, +- }, { +- .code = V4L2_MBUS_FMT_RGB565_2X8_LE, +- .colorspace = V4L2_COLORSPACE_SRGB, +- .fmt = 4, +- .order = 2, ++ .description = "RGB555, le", ++ .pixelformat = V4L2_PIX_FMT_RGB555, + }, ++ { ++ .description = "RGB565, le", ++ .pixelformat = V4L2_PIX_FMT_RGB565, ++ }, ++}; ++ ++/************************************************************************ ++ ++ ++ supported sizes ++ ++ ++************************************************************************/ ++const static struct mt9t112_frame_size mt9t112_sizes[] = { ++ { 640, 480 }, ++ /* { 2048, 1536} */ ++}; ++ ++/************************************************************************ ++ ++ ++ supported sizes ++ ++ ++************************************************************************/ ++const struct v4l2_fract mt9t112_frameintervals[] = { ++ { .numerator = 1, .denominator = 10 } + }; + + /************************************************************************ +@@ -160,11 +154,32 @@ static const struct mt9t112_format mt9t112_cfmts[] = { + + + ************************************************************************/ +-static struct mt9t112_priv *to_mt9t112(const struct i2c_client *client) ++static u16 mt9t112_pixfmt_to_fmt(u32 pixelformat) + { +- return container_of(i2c_get_clientdata(client), +- struct mt9t112_priv, +- subdev); ++ switch (pixelformat) { ++ case V4L2_PIX_FMT_RGB555: ++ return 8; ++ case V4L2_PIX_FMT_RGB565: ++ return 4; ++ case V4L2_PIX_FMT_YUYV: ++ /* FALLTHROUGH */ ++ default: ++ return 1; ++ } ++} ++ ++static u16 mt9t112_pixfmt_to_order(u32 pixelformat) ++{ ++ switch (pixelformat) { ++ case V4L2_PIX_FMT_RGB555: ++ /* FALLTHROUGH */ ++ case V4L2_PIX_FMT_RGB565: ++ return 2; ++ case V4L2_PIX_FMT_YUYV: ++ /* FALLTHROUGH */ ++ default: ++ return 0; ++ } + } + + static int __mt9t112_reg_read(const struct i2c_client *client, u16 command) +@@ -438,7 +453,7 @@ static int mt9t112_set_pll_dividers(const struct i2c_client *client, + + static int mt9t112_init_pll(const struct i2c_client *client) + { +- struct mt9t112_priv *priv = to_mt9t112(client); ++ struct mt9t112_priv *priv = i2c_get_clientdata(client); + int data, i, ret; + + mt9t112_reg_mask_set(ret, client, 0x0014, 0x003, 0x0001); +@@ -757,167 +772,12 @@ static int mt9t112_init_camera(const struct i2c_client *client) + return ret; + } + +-/************************************************************************ +- +- +- soc_camera_ops +- +- +-************************************************************************/ +-static int mt9t112_set_bus_param(struct soc_camera_device *icd, +- unsigned long flags) +-{ +- return 0; +-} +- +-static unsigned long mt9t112_query_bus_param(struct soc_camera_device *icd) +-{ +- struct i2c_client *client = to_i2c_client(to_soc_camera_control(icd)); +- struct mt9t112_priv *priv = to_mt9t112(client); +- struct soc_camera_link *icl = to_soc_camera_link(icd); +- unsigned long flags = SOCAM_MASTER | SOCAM_VSYNC_ACTIVE_HIGH | +- SOCAM_HSYNC_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_HIGH; +- +- flags |= (priv->info->flags & MT9T112_FLAG_PCLK_RISING_EDGE) ? +- SOCAM_PCLK_SAMPLE_RISING : SOCAM_PCLK_SAMPLE_FALLING; +- +- if (priv->info->flags & MT9T112_FLAG_DATAWIDTH_8) +- flags |= SOCAM_DATAWIDTH_8; +- else +- flags |= SOCAM_DATAWIDTH_10; +- +- return soc_camera_apply_sensor_flags(icl, flags); +-} +- +-static struct soc_camera_ops mt9t112_ops = { +- .set_bus_param = mt9t112_set_bus_param, +- .query_bus_param = mt9t112_query_bus_param, +-}; +- +-/************************************************************************ +- +- +- v4l2_subdev_core_ops +- +- +-************************************************************************/ +-static int mt9t112_g_chip_ident(struct v4l2_subdev *sd, +- struct v4l2_dbg_chip_ident *id) +-{ +- struct i2c_client *client = sd->priv; +- struct mt9t112_priv *priv = to_mt9t112(client); +- +- id->ident = priv->model; +- id->revision = 0; +- +- return 0; +-} +- +-#ifdef CONFIG_VIDEO_ADV_DEBUG +-static int mt9t112_g_register(struct v4l2_subdev *sd, +- struct v4l2_dbg_register *reg) +-{ +- struct i2c_client *client = sd->priv; +- int ret; +- +- reg->size = 2; +- mt9t112_reg_read(ret, client, reg->reg); +- +- reg->val = (__u64)ret; +- +- return 0; +-} +- +-static int mt9t112_s_register(struct v4l2_subdev *sd, +- struct v4l2_dbg_register *reg) +-{ +- struct i2c_client *client = sd->priv; +- int ret; +- +- mt9t112_reg_write(ret, client, reg->reg, reg->val); +- +- return ret; +-} +-#endif +- +-static struct v4l2_subdev_core_ops mt9t112_subdev_core_ops = { +- .g_chip_ident = mt9t112_g_chip_ident, +-#ifdef CONFIG_VIDEO_ADV_DEBUG +- .g_register = mt9t112_g_register, +- .s_register = mt9t112_s_register, +-#endif +-}; +- +- +-/************************************************************************ +- +- +- v4l2_subdev_video_ops +- +- +-************************************************************************/ +-static int mt9t112_s_stream(struct v4l2_subdev *sd, int enable) +-{ +- struct i2c_client *client = sd->priv; +- struct mt9t112_priv *priv = to_mt9t112(client); +- int ret = 0; +- +- if (!enable) { +- /* FIXME +- * +- * If user selected large output size, +- * and used it long time, +- * mt9t112 camera will be very warm. +- * +- * But current driver can not stop mt9t112 camera. +- * So, set small size here to solve this problem. +- */ +- mt9t112_set_a_frame_size(client, VGA_WIDTH, VGA_HEIGHT); +- return ret; +- } +- +- if (!(priv->flags & INIT_DONE)) { +- u16 param = (MT9T112_FLAG_PCLK_RISING_EDGE & +- priv->info->flags) ? 0x0001 : 0x0000; +- +- ECHECKER(ret, mt9t112_init_camera(client)); +- +- /* Invert PCLK (Data sampled on falling edge of pixclk) */ +- mt9t112_reg_write(ret, client, 0x3C20, param); +- +- mdelay(5); +- +- priv->flags |= INIT_DONE; +- } +- +- mt9t112_mcu_write(ret, client, VAR(26, 7), priv->format->fmt); +- mt9t112_mcu_write(ret, client, VAR(26, 9), priv->format->order); +- mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06); +- +- mt9t112_set_a_frame_size(client, +- priv->frame.width, +- priv->frame.height); +- +- ECHECKER(ret, mt9t112_auto_focus_trigger(client)); +- +- dev_dbg(&client->dev, "format : %d\n", priv->format->code); +- dev_dbg(&client->dev, "size : %d x %d\n", +- priv->frame.width, +- priv->frame.height); +- +- CLOCK_INFO(client, EXT_CLOCK); +- +- return ret; +-} +- + static int mt9t112_set_params(struct i2c_client *client, u32 width, u32 height, +- enum v4l2_mbus_pixelcode code) ++ u32 pixelformat) + { +- struct mt9t112_priv *priv = to_mt9t112(client); ++ struct mt9t112_priv *priv = i2c_get_clientdata(client); + int i; + +- priv->format = NULL; +- + /* + * frame size check + */ +@@ -926,22 +786,23 @@ static int mt9t112_set_params(struct i2c_client *client, u32 width, u32 height, + /* + * get color format + */ +- for (i = 0; i < ARRAY_SIZE(mt9t112_cfmts); i++) +- if (mt9t112_cfmts[i].code == code) ++ for (i = 0; i < ARRAY_SIZE(mt9t112_formats); i++) ++ if (mt9t112_formats[i].pixelformat == pixelformat) + break; + +- if (i == ARRAY_SIZE(mt9t112_cfmts)) ++ if (i == ARRAY_SIZE(mt9t112_formats)) + return -EINVAL; + +- priv->frame.width = (u16)width; +- priv->frame.height = (u16)height; ++ priv->pix.width = (u16)width; ++ priv->pix.height = (u16)height; + +- priv->format = mt9t112_cfmts + i; ++ priv->pix.pixelformat = pixelformat; + + return 0; + } + +-static int mt9t112_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) ++static int mt9t112_v4l2_int_cropcap(struct v4l2_int_device *s, ++ struct v4l2_cropcap *a) + { + a->bounds.left = 0; + a->bounds.top = 0; +@@ -955,7 +816,8 @@ static int mt9t112_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a) + return 0; + } + +-static int mt9t112_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) ++static int mt9t112_v4l2_int_g_crop(struct v4l2_int_device *s, ++ struct v4l2_crop *a) + { + a->c.left = 0; + a->c.top = 0; +@@ -966,77 +828,116 @@ static int mt9t112_g_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) + return 0; + } + +-static int mt9t112_s_crop(struct v4l2_subdev *sd, struct v4l2_crop *a) ++static int mt9t112_v4l2_int_s_crop(struct v4l2_int_device *s, ++ struct v4l2_crop *a) + { +- struct i2c_client *client = sd->priv; +- struct v4l2_rect *rect = &a->c; +- +- return mt9t112_set_params(client, rect->width, rect->height, +- V4L2_MBUS_FMT_YUYV8_2X8_BE); ++ if ((a->c.left != 0) || ++ (a->c.top != 0) || ++ (a->c.width != VGA_WIDTH) || ++ (a->c.height != VGA_HEIGHT)) { ++ return -EINVAL; ++ } ++ return 0; + } + +-static int mt9t112_g_fmt(struct v4l2_subdev *sd, +- struct v4l2_mbus_framefmt *mf) ++static int mt9t112_v4l2_int_g_fmt_cap(struct v4l2_int_device *s, ++ struct v4l2_format *f) + { +- struct i2c_client *client = sd->priv; +- struct mt9t112_priv *priv = to_mt9t112(client); ++ struct mt9t112_priv *priv = s->priv; ++ struct i2c_client *client = priv->client; + +- if (!priv->format) { ++ if ((priv->pix.pixelformat == 0) || ++ (priv->pix.width == 0) || ++ (priv->pix.height == 0)) { + int ret = mt9t112_set_params(client, VGA_WIDTH, VGA_HEIGHT, +- V4L2_MBUS_FMT_YUYV8_2X8_BE); ++ V4L2_PIX_FMT_YUYV); + if (ret < 0) + return ret; + } + +- mf->width = priv->frame.width; +- mf->height = priv->frame.height; ++ f->fmt.pix.width = priv->pix.width; ++ f->fmt.pix.height = priv->pix.height; + /* TODO: set colorspace */ +- mf->code = priv->format->code; +- mf->field = V4L2_FIELD_NONE; ++ f->fmt.pix.pixelformat = priv->pix.pixelformat; ++ f->fmt.pix.field = V4L2_FIELD_NONE; + + return 0; + } + +-static int mt9t112_s_fmt(struct v4l2_subdev *sd, +- struct v4l2_mbus_framefmt *mf) ++ ++static int mt9t112_v4l2_int_s_fmt_cap(struct v4l2_int_device *s, ++ struct v4l2_format *f) + { +- struct i2c_client *client = sd->priv; ++ struct mt9t112_priv *priv = s->priv; ++ struct i2c_client *client = priv->client; + + /* TODO: set colorspace */ +- return mt9t112_set_params(client, mf->width, mf->height, mf->code); ++ return mt9t112_set_params(client, f->fmt.pix.width, f->fmt.pix.height, ++ f->fmt.pix.pixelformat); + } + +-static int mt9t112_try_fmt(struct v4l2_subdev *sd, +- struct v4l2_mbus_framefmt *mf) ++static int mt9t112_v4l2_int_try_fmt_cap(struct v4l2_int_device *s, ++ struct v4l2_format *f) + { +- mt9t112_frame_check(&mf->width, &mf->height); ++ mt9t112_frame_check(&f->fmt.pix.width, &f->fmt.pix.height); + + /* TODO: set colorspace */ +- mf->field = V4L2_FIELD_NONE; ++ f->fmt.pix.field = V4L2_FIELD_NONE; + + return 0; + } + +-static int mt9t112_enum_fmt(struct v4l2_subdev *sd, int index, +- enum v4l2_mbus_pixelcode *code) ++static int mt9t112_v4l2_int_enum_fmt_cap(struct v4l2_int_device *s, ++ struct v4l2_fmtdesc *fmt) + { +- if ((unsigned int)index >= ARRAY_SIZE(mt9t112_cfmts)) ++ int index = fmt->index; ++ enum v4l2_buf_type type = fmt->type; ++ ++ memset(fmt, 0, sizeof(*fmt)); ++ fmt->index = index; ++ fmt->type = type; ++ ++ switch (fmt->type) { ++ case V4L2_BUF_TYPE_VIDEO_CAPTURE: ++ if (index >= ARRAY_SIZE(mt9t112_formats)) ++ return -EINVAL; ++ break; ++ default: + return -EINVAL; ++ } + +- *code = mt9t112_cfmts[index].code; ++ fmt->flags = mt9t112_formats[index].flags; ++ strlcpy(fmt->description, mt9t112_formats[index].description, ++ sizeof(fmt->description)); ++ fmt->pixelformat = mt9t112_formats[index].pixelformat; + return 0; + } + +-static struct v4l2_subdev_video_ops mt9t112_subdev_video_ops = { +- .s_stream = mt9t112_s_stream, +- .g_mbus_fmt = mt9t112_g_fmt, +- .s_mbus_fmt = mt9t112_s_fmt, +- .try_mbus_fmt = mt9t112_try_fmt, +- .cropcap = mt9t112_cropcap, +- .g_crop = mt9t112_g_crop, +- .s_crop = mt9t112_s_crop, +- .enum_mbus_fmt = mt9t112_enum_fmt, +-}; ++static int mt9t112_v4l2_int_s_parm(struct v4l2_int_device *s, ++ struct v4l2_streamparm *a) ++{ ++ /* TODO: set paramters */ ++ return 0; ++} ++ ++static int mt9t112_v4l2_int_g_parm(struct v4l2_int_device *s, ++ struct v4l2_streamparm *a) ++{ ++ struct v4l2_captureparm *cparm = &a->parm.capture; ++ ++ if (a->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) ++ return -EINVAL; ++ ++ memset(a, 0, sizeof(*a)); ++ a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; ++ ++ cparm->capability = V4L2_CAP_TIMEPERFRAME; ++ /* FIXME: Is 10 fps really the only option? */ ++ cparm->timeperframe.numerator = 1; ++ cparm->timeperframe.denominator = 10; ++ ++ return 0; ++} + + /************************************************************************ + +@@ -1045,27 +946,14 @@ static struct v4l2_subdev_video_ops mt9t112_subdev_video_ops = { + + + ************************************************************************/ +-static struct v4l2_subdev_ops mt9t112_subdev_ops = { +- .core = &mt9t112_subdev_core_ops, +- .video = &mt9t112_subdev_video_ops, +-}; + +-static int mt9t112_camera_probe(struct soc_camera_device *icd, +- struct i2c_client *client) ++static int mt9t112_detect(struct i2c_client *client) + { +- struct mt9t112_priv *priv = to_mt9t112(client); ++ struct mt9t112_priv *priv = i2c_get_clientdata(client); + const char *devname; + int chipid; + + /* +- * We must have a parent by now. And it cannot be a wrong one. +- * So this entire test is completely redundant. +- */ +- if (!icd->dev.parent || +- to_soc_camera_host(icd->dev.parent)->nr != icd->iface) +- return -ENODEV; +- +- /* + * check and show chip ID + */ + mt9t112_reg_read(chipid, client, 0x0000); +@@ -1089,37 +977,232 @@ static int mt9t112_camera_probe(struct soc_camera_device *icd, + return 0; + } + ++static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s, ++ enum v4l2_power power) ++{ ++ struct mt9t112_priv *priv = s->priv; ++ struct i2c_client *client = priv->client; ++ int ret; ++ ++ switch (power) { ++ case V4L2_POWER_STANDBY: ++ /* FALLTHROUGH */ ++ case V4L2_POWER_OFF: ++ /* FIXME ++ * ++ * If user selected large output size, ++ * and used it long time, ++ * mt9t112 camera will be very warm. ++ * ++ * But current driver can not stop mt9t112 camera. ++ * So, set small size here to solve this problem. ++ */ ++ mt9t112_set_a_frame_size(client, VGA_WIDTH, VGA_HEIGHT); ++ ++ ret = priv->pdata->power_set(s, power); ++ if (ret < 0) { ++ dev_err(&client->dev, "Unable to set target board power " ++ "state (OFF/STANDBY)\n"); ++ return ret; ++ } ++ break; ++ case V4L2_POWER_ON: ++ ret = priv->pdata->power_set(s, power); ++ if (ret < 0) { ++ dev_err(&client->dev, "Unable to set target board power " ++ "state (ON)\n"); ++ return ret; ++ } ++ if (!(priv->flags & INIT_DONE)) { ++ u16 param = (MT9T112_FLAG_PCLK_RISING_EDGE & ++ priv->info->flags) ? 0x0001 : 0x0000; ++ ++ ECHECKER(ret, mt9t112_detect(client)); ++ ECHECKER(ret, mt9t112_init_camera(client)); ++ ++ /* Invert PCLK (Data sampled on falling edge of pixclk) */ ++ mt9t112_reg_write(ret, client, 0x3C20, param); ++ ++ mdelay(5); ++ ++ priv->flags |= INIT_DONE; ++ } ++ ++ mt9t112_mcu_write(ret, client, VAR(26, 7), ++ mt9t112_pixfmt_to_fmt(priv->pix.pixelformat)); ++ mt9t112_mcu_write(ret, client, VAR(26, 9), ++ mt9t112_pixfmt_to_order(priv->pix.pixelformat)); ++ mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06); ++ ++ mt9t112_set_a_frame_size(client, ++ priv->pix.width, ++ priv->pix.height); ++ ++ ECHECKER(ret, mt9t112_auto_focus_trigger(client)); ++ ++ dev_dbg(&client->dev, "format : %d\n", priv->pix.pixelformat); ++ dev_dbg(&client->dev, "size : %d x %d\n", ++ priv->pix.width, ++ priv->pix.height); ++ ++ CLOCK_INFO(client, EXT_CLOCK); ++ } ++ return 0; ++} ++ ++static int mt9t112_v4l2_int_g_priv(struct v4l2_int_device *s, void *p) ++{ ++ struct mt9t112_priv *priv = s->priv; ++ ++ return priv->pdata->priv_data_set(p); ++} ++ ++static int mt9t112_v4l2_int_g_ifparm(struct v4l2_int_device *s, ++ struct v4l2_ifparm *p) ++{ ++ struct mt9t112_priv *priv = s->priv; ++ int rval; ++ ++ if (p == NULL) ++ return -EINVAL; ++ ++ if (!priv->pdata->ifparm) ++ return -EINVAL; ++ ++ rval = priv->pdata->ifparm(p); ++ if (rval) { ++ v4l_err(priv->client, "g_ifparm.Err[%d]\n", rval); ++ return rval; ++ } ++ ++ p->u.ycbcr.clock_curr = 40 * 1000000; /* temporal value */ ++ ++ return 0; ++} ++ ++static int mt9t112_v4l2_int_enum_framesizes(struct v4l2_int_device *s, ++ struct v4l2_frmsizeenum *frms) ++{ ++ int ifmt; ++ ++ for (ifmt = 0; ifmt < ARRAY_SIZE(mt9t112_formats); ifmt++) ++ if (mt9t112_formats[ifmt].pixelformat == frms->pixel_format) ++ break; ++ ++ if (ifmt == ARRAY_SIZE(mt9t112_formats)) ++ return -EINVAL; ++ ++ /* Do we already reached all discrete framesizes? */ ++ if (frms->index >= ARRAY_SIZE(mt9t112_sizes)) ++ return -EINVAL; ++ ++ frms->type = V4L2_FRMSIZE_TYPE_DISCRETE; ++ frms->discrete.width = mt9t112_sizes[frms->index].width; ++ frms->discrete.height = mt9t112_sizes[frms->index].height; ++ ++ return 0; ++ ++} ++ ++static int mt9t112_v4l2_int_enum_frameintervals(struct v4l2_int_device *s, ++ struct v4l2_frmivalenum *frmi) ++{ ++ int ifmt; ++ ++ for (ifmt = 0; ifmt < ARRAY_SIZE(mt9t112_formats); ifmt++) ++ if (mt9t112_formats[ifmt].pixelformat == frmi->pixel_format) ++ break; ++ ++ if (ifmt == ARRAY_SIZE(mt9t112_formats)) ++ return -EINVAL; ++ ++ if (frmi->index >= ARRAY_SIZE(mt9t112_frameintervals)) ++ return -EINVAL; ++ ++ frmi->type = V4L2_FRMSIZE_TYPE_DISCRETE; ++ frmi->discrete.numerator = ++ mt9t112_frameintervals[frmi->index].numerator; ++ frmi->discrete.denominator = ++ mt9t112_frameintervals[frmi->index].denominator; ++ return 0; ++} ++ ++static struct v4l2_int_ioctl_desc mt9t112_ioctl_desc[] = { ++ { .num = vidioc_int_enum_framesizes_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_enum_framesizes }, ++ { .num = vidioc_int_enum_frameintervals_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_enum_frameintervals }, ++ { .num = vidioc_int_s_power_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_s_power }, ++ { .num = vidioc_int_g_priv_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_g_priv }, ++ { .num = vidioc_int_g_ifparm_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_g_ifparm }, ++ { .num = vidioc_int_enum_fmt_cap_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_enum_fmt_cap }, ++ { .num = vidioc_int_try_fmt_cap_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_try_fmt_cap }, ++ { .num = vidioc_int_g_fmt_cap_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_g_fmt_cap }, ++ { .num = vidioc_int_s_fmt_cap_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_s_fmt_cap }, ++ { .num = vidioc_int_g_parm_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_g_parm }, ++ { .num = vidioc_int_s_parm_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_s_parm }, ++ { .num = vidioc_int_cropcap_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_cropcap }, ++ { .num = vidioc_int_g_crop_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_g_crop }, ++ { .num = vidioc_int_s_crop_num, ++ .func = (v4l2_int_ioctl_func *)mt9t112_v4l2_int_s_crop }, ++}; ++ ++static struct v4l2_int_slave mt9t112_slave = { ++ .ioctls = mt9t112_ioctl_desc, ++ .num_ioctls = ARRAY_SIZE(mt9t112_ioctl_desc), ++}; ++ + static int mt9t112_probe(struct i2c_client *client, + const struct i2c_device_id *did) + { + struct mt9t112_priv *priv; +- struct soc_camera_device *icd = client->dev.platform_data; +- struct soc_camera_link *icl; ++ struct v4l2_int_device *v4l2_int_device; + int ret; + +- if (!icd) { +- dev_err(&client->dev, "mt9t112: missing soc-camera data!\n"); +- return -EINVAL; ++ if (!client->dev.platform_data) { ++ dev_err(&client->dev, "no platform data?\n"); ++ return -ENODEV; + } + +- icl = to_soc_camera_link(icd); +- if (!icl || !icl->priv) +- return -EINVAL; +- + priv = kzalloc(sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + +- priv->info = icl->priv; ++ v4l2_int_device = kzalloc(sizeof(*v4l2_int_device), GFP_KERNEL); ++ if (!v4l2_int_device) { ++ kfree(priv); ++ return -ENOMEM; ++ } + +- v4l2_i2c_subdev_init(&priv->subdev, client, &mt9t112_subdev_ops); ++ v4l2_int_device->module = THIS_MODULE; ++ strncpy(v4l2_int_device->name, "mt9t112", sizeof(v4l2_int_device->name)); ++ v4l2_int_device->type = v4l2_int_type_slave; ++ v4l2_int_device->u.slave = &mt9t112_slave; ++ v4l2_int_device->priv = priv; + +- icd->ops = &mt9t112_ops; ++ priv->v4l2_int_device = v4l2_int_device; ++ priv->client = client; ++ priv->pdata = client->dev.platform_data; + +- ret = mt9t112_camera_probe(icd, client); ++ i2c_set_clientdata(client, priv); ++ ++ //ret = mt9t112_detect(client); ++ ++ ret = v4l2_int_device_register(priv->v4l2_int_device); + if (ret) { +- icd->ops = NULL; + i2c_set_clientdata(client, NULL); ++ kfree(v4l2_int_device); + kfree(priv); + } + +@@ -1128,11 +1211,12 @@ static int mt9t112_probe(struct i2c_client *client, + + static int mt9t112_remove(struct i2c_client *client) + { +- struct mt9t112_priv *priv = to_mt9t112(client); +- struct soc_camera_device *icd = client->dev.platform_data; ++ struct mt9t112_priv *priv = i2c_get_clientdata(client); + +- icd->ops = NULL; ++ v4l2_int_device_unregister(priv->v4l2_int_device); + i2c_set_clientdata(client, NULL); ++ ++ kfree(priv->v4l2_int_device); + kfree(priv); + return 0; + } +@@ -1172,6 +1256,6 @@ static void __exit mt9t112_module_exit(void) + module_init(mt9t112_module_init); + module_exit(mt9t112_module_exit); + +-MODULE_DESCRIPTION("SoC Camera driver for mt9t112"); ++MODULE_DESCRIPTION("mt9t112 sensor driver"); + MODULE_AUTHOR("Kuninori Morimoto"); + MODULE_LICENSE("GPL v2"); +diff --git a/include/media/mt9t112.h b/include/media/mt9t112.h +index a43c74a..62caaf5 100644 +--- a/include/media/mt9t112.h ++++ b/include/media/mt9t112.h +@@ -11,6 +11,8 @@ + #ifndef __MT9T112_H__ + #define __MT9T112_H__ + ++#include <media/v4l2-int-device.h> ++ + #define MT9T112_FLAG_PCLK_RISING_EDGE (1 << 0) + #define MT9T112_FLAG_DATAWIDTH_8 (1 << 1) /* default width is 10 */ + +@@ -27,4 +29,15 @@ struct mt9t112_camera_info { + struct mt9t112_pll_divider divider; + }; + ++struct mt9t112_platform_data { ++ char *master; ++ int (*power_set) (struct v4l2_int_device *s, enum v4l2_power on); ++ int (*ifparm) (struct v4l2_ifparm *p); ++ int (*priv_data_set) (void *); ++ /* Interface control params */ ++ bool clk_polarity; ++ bool hs_polarity; ++ bool vs_polarity; ++}; ++ + #endif /* __MT9T112_H__ */ +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0052-mt9t112-Add-more-info-to-public-header.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0052-mt9t112-Add-more-info-to-public-header.patch new file mode 100644 index 0000000000..6956ce64ee --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0052-mt9t112-Add-more-info-to-public-header.patch @@ -0,0 +1,29 @@ +From 0c96e072dd20fbf998ec2bfe9d9002994ec595fa Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 1 Jul 2010 07:33:49 -0500 +Subject: [PATCH 52/71] mt9t112: Add more info to public header + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + include/media/mt9t112.h | 5 +++++ + 1 files changed, 5 insertions(+), 0 deletions(-) + +diff --git a/include/media/mt9t112.h b/include/media/mt9t112.h +index 62caaf5..49fa042 100644 +--- a/include/media/mt9t112.h ++++ b/include/media/mt9t112.h +@@ -13,6 +13,11 @@ + + #include <media/v4l2-int-device.h> + ++#define MT9T112_I2C_ADDR (0x78 >> 1) ++ ++#define MT9T112_CLK_MAX (54000000) /* 54MHz */ ++#define MT9T112_CLK_MIN (6000000) /* 6Mhz */ ++ + #define MT9T112_FLAG_PCLK_RISING_EDGE (1 << 0) + #define MT9T112_FLAG_DATAWIDTH_8 (1 << 1) /* default width is 10 */ + +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0053-mt9t112-Fix-null-pointer-kernel-bug.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0053-mt9t112-Fix-null-pointer-kernel-bug.patch new file mode 100644 index 0000000000..47c35bddcc --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0053-mt9t112-Fix-null-pointer-kernel-bug.patch @@ -0,0 +1,84 @@ +From fe7df74595c449a47a7a86cab9d35ab7320faf16 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 1 Jul 2010 09:12:37 -0500 +Subject: [PATCH 53/71] mt9t112: Fix null pointer kernel bug + +We were trying to access a null pointer (info) which we weren't +initializing anywhere. + +Fix this. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 34 +++++++++++++++++++++++----------- + 1 files changed, 23 insertions(+), 11 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index 6f54394..98a4ea9 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -92,7 +92,7 @@ struct mt9t112_frame_size { + struct mt9t112_priv { + struct mt9t112_platform_data *pdata; + struct v4l2_int_device *v4l2_int_device; +- struct mt9t112_camera_info *info; ++ struct mt9t112_camera_info info; + struct i2c_client *client; + struct v4l2_pix_format pix; + int model; +@@ -463,15 +463,15 @@ static int mt9t112_init_pll(const struct i2c_client *client) + + /* Replace these registers when new timing parameters are generated */ + mt9t112_set_pll_dividers(client, +- priv->info->divider.m, +- priv->info->divider.n, +- priv->info->divider.p1, +- priv->info->divider.p2, +- priv->info->divider.p3, +- priv->info->divider.p4, +- priv->info->divider.p5, +- priv->info->divider.p6, +- priv->info->divider.p7); ++ priv->info.divider.m, ++ priv->info.divider.n, ++ priv->info.divider.p1, ++ priv->info.divider.p2, ++ priv->info.divider.p3, ++ priv->info.divider.p4, ++ priv->info.divider.p5, ++ priv->info.divider.p6, ++ priv->info.divider.p7); + + /* + * TEST_BYPASS on +@@ -1015,7 +1015,7 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s, + } + if (!(priv->flags & INIT_DONE)) { + u16 param = (MT9T112_FLAG_PCLK_RISING_EDGE & +- priv->info->flags) ? 0x0001 : 0x0000; ++ priv->info.flags) ? 0x0001 : 0x0000; + + ECHECKER(ret, mt9t112_detect(client)); + ECHECKER(ret, mt9t112_init_camera(client)); +@@ -1195,6 +1195,18 @@ static int mt9t112_probe(struct i2c_client *client, + priv->client = client; + priv->pdata = client->dev.platform_data; + ++ /* Revisit: Init Sensor info settings */ ++ priv->info.divider.m = 25; ++ priv->info.divider.n = 2; ++ priv->info.divider.p1 = 0; ++ priv->info.divider.p2 = 9; ++ priv->info.divider.p3 = 0; ++ priv->info.divider.p4 = 13; ++ priv->info.divider.p5 = 13; ++ priv->info.divider.p6 = 9; ++ priv->info.divider.p7 = 0; ++ priv->info.flags = MT9T112_FLAG_PCLK_RISING_EDGE; ++ + i2c_set_clientdata(client, priv); + + //ret = mt9t112_detect(client); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0054-DEBUG-omap3beagle-Add-MT9T112-to-defconfig.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0054-DEBUG-omap3beagle-Add-MT9T112-to-defconfig.patch new file mode 100644 index 0000000000..fd5b038ef9 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0054-DEBUG-omap3beagle-Add-MT9T112-to-defconfig.patch @@ -0,0 +1,26 @@ +From d42fdae2330c191e3f06bd692650cc944c60e3eb Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 15 Jul 2010 00:55:43 -0500 +Subject: [PATCH 54/71] DEBUG: omap3beagle: Add MT9T112 to defconfig + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + arch/arm/configs/omap3_beagle_cam_defconfig | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/arch/arm/configs/omap3_beagle_cam_defconfig b/arch/arm/configs/omap3_beagle_cam_defconfig +index 0ea8300..80b64db 100644 +--- a/arch/arm/configs/omap3_beagle_cam_defconfig ++++ b/arch/arm/configs/omap3_beagle_cam_defconfig +@@ -1737,7 +1737,7 @@ CONFIG_VIDEO_WM8775=m + CONFIG_VIDEO_MT9V011=m + # CONFIG_VIDEO_TCM825X is not set + CONFIG_VIDEO_MT9P012=m +-CONFIG_VIDEO_MT9T111=y ++CONFIG_VIDEO_MT9T112=y + # CONFIG_VIDEO_DW9710 is not set + # CONFIG_VIDEO_OV3640 is not set + # CONFIG_VIDEO_IMX046 is not set +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0055-omap3beagle-camera-Change-MT9T111-references-to-new-.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0055-omap3beagle-camera-Change-MT9T111-references-to-new-.patch new file mode 100644 index 0000000000..6083cd1fb6 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0055-omap3beagle-camera-Change-MT9T111-references-to-new-.patch @@ -0,0 +1,207 @@ +From f7b09cb5f7037445ccd5b3b0062d5d6f56164b58 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 15 Jul 2010 15:47:23 -0500 +Subject: [PATCH 55/71] omap3beagle: camera: Change MT9T111 references to new MT9T112 driver + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 52 ++++++++++++------------ + arch/arm/mach-omap2/board-omap3beagle.c | 12 +++--- + 2 files changed, 32 insertions(+), 32 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index 2e49158..0b4dff7 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -203,29 +203,29 @@ struct mt9v113_platform_data mt9v113_pdata = { + + #endif /* #ifdef CONFIG_VIDEO_MT9V113 */ + +-#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) +-#include <media/mt9t111.h> ++#if defined(CONFIG_VIDEO_MT9T112) || defined(CONFIG_VIDEO_MT9T112_MODULE) ++#include <media/mt9t112.h> + +-#define ISP_MT9T111_MCLK 216000000 ++#define ISP_MT9T112_MCLK 216000000 + + /* Arbitrary memory handling limit */ +-#define MT9T111_BIGGEST_FRAME_BYTE_SIZE PAGE_ALIGN((2048 * 2) * 1536 * 4) ++#define MT9T112_BIGGEST_FRAME_BYTE_SIZE PAGE_ALIGN((2048 * 2) * 1536 * 4) + +-static struct isp_interface_config mt9t111_if_config = { ++static struct isp_interface_config mt9t112_if_config = { + .ccdc_par_ser = ISP_PARLL, + .dataline_shift = 0x2, + .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE, + .strobe = 0x0, + .prestrobe = 0x0, + .shutter = 0x0, +- .cam_mclk = ISP_MT9T111_MCLK, ++ .cam_mclk = ISP_MT9T112_MCLK, + .wenlog = ISPCCDC_CFG_WENLOG_AND, + .wait_hs_vs = 2, + .u.par.par_bridge = 0x3, + .u.par.par_clk_pol = 0x0, + }; + +-static struct v4l2_ifparm mt9t111_ifparm_s = { ++static struct v4l2_ifparm mt9t112_ifparm_s = { + .if_type = V4L2_IF_TYPE_RAW, + .u = { + .raw = { +@@ -235,47 +235,47 @@ static struct v4l2_ifparm mt9t111_ifparm_s = { + .latch_clk_inv = 0, + .nobt_hs_inv = 0, /* active high */ + .nobt_vs_inv = 0, /* active high */ +- .clock_min = MT9T111_CLK_MIN, +- .clock_max = MT9T111_CLK_MAX, ++ .clock_min = MT9T112_CLK_MIN, ++ .clock_max = MT9T112_CLK_MAX, + }, + }, + }; + + /** +- * @brief mt9t111_ifparm - Returns the mt9t111 interface parameters ++ * @brief mt9t112_ifparm - Returns the mt9t112 interface parameters + * + * @param p - pointer to v4l2_ifparm structure + * + * @return result of operation - 0 is success + */ +-static int mt9t111_ifparm(struct v4l2_ifparm *p) ++static int mt9t112_ifparm(struct v4l2_ifparm *p) + { + if (p == NULL) + return -EINVAL; + +- *p = mt9t111_ifparm_s; ++ *p = mt9t112_ifparm_s; + return 0; + } + + #if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) +-static struct omap34xxcam_hw_config mt9t111_hwc = { ++static struct omap34xxcam_hw_config mt9t112_hwc = { + .dev_index = 0, + .dev_minor = 0, + .dev_type = OMAP34XXCAM_SLAVE_SENSOR, + .u.sensor.sensor_isp = 0, +- .u.sensor.capture_mem = MT9T111_BIGGEST_FRAME_BYTE_SIZE, ++ .u.sensor.capture_mem = MT9T112_BIGGEST_FRAME_BYTE_SIZE, + .u.sensor.ival_default = { 1, 10 }, + }; + #endif + + /** +- * @brief mt9t111_set_prv_data - Returns mt9t111 omap34xx driver private data ++ * @brief mt9t112_set_prv_data - Returns mt9t112 omap34xx driver private data + * + * @param priv - pointer to omap34xxcam_hw_config structure + * + * @return result of operation - 0 is success + */ +-static int mt9t111_set_prv_data(void *priv) ++static int mt9t112_set_prv_data(void *priv) + { + #if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) + struct omap34xxcam_hw_config *hwc = priv; +@@ -283,7 +283,7 @@ static int mt9t111_set_prv_data(void *priv) + if (priv == NULL) + return -EINVAL; + +- *hwc = mt9t111_hwc; ++ *hwc = mt9t112_hwc; + return 0; + #else + return -EINVAL; +@@ -291,13 +291,13 @@ static int mt9t111_set_prv_data(void *priv) + } + + /** +- * @brief mt9t111_power_set - Power-on or power-off TVP5146 device ++ * @brief mt9t112_power_set - Power-on or power-off TVP5146 device + * + * @param power - enum, Power on/off, resume/standby + * + * @return result of operation - 0 is success + */ +-static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power) ++static int mt9t112_power_set(struct v4l2_int_device *s, enum v4l2_power power) + { + struct omap34xxcam_videodev *vdev = s->u.slave->master->priv; + +@@ -314,7 +314,7 @@ static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power) + + case V4L2_POWER_ON: + #if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) +- isp_configure_interface(vdev->cam->isp, &mt9t111_if_config); ++ isp_configure_interface(vdev->cam->isp, &mt9t112_if_config); + #endif + + /* Set RESET_BAR to 0 */ +@@ -331,7 +331,7 @@ static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power) + mdelay(50); + + /* Enable EXTCLK */ +- isp_set_xclk(vdev->cam->isp, MT9T111_CLK_MIN, CAM_USE_XCLKA); ++ isp_set_xclk(vdev->cam->isp, MT9T112_CLK_MIN, CAM_USE_XCLKA); + + /* + * Wait at least 70 CLK cycles (w/EXTCLK = 6MHz, or CLK_MIN): +@@ -359,14 +359,14 @@ static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power) + return 0; + } + +-struct mt9t111_platform_data mt9t111_pdata = { ++struct mt9t112_platform_data mt9t112_pdata = { + .master = "omap34xxcam", +- .power_set = mt9t111_power_set, +- .priv_data_set = mt9t111_set_prv_data, +- .ifparm = mt9t111_ifparm, ++ .power_set = mt9t112_power_set, ++ .priv_data_set = mt9t112_set_prv_data, ++ .ifparm = mt9t112_ifparm, + }; + +-#endif /* #ifdef CONFIG_VIDEO_MT9T111 */ ++#endif /* #ifdef CONFIG_VIDEO_MT9T112 */ + + static int beagle_cam_probe(struct platform_device *pdev) + { +diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c +index 0e7e8b2..7c9e40a 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle.c ++++ b/arch/arm/mach-omap2/board-omap3beagle.c +@@ -77,10 +77,10 @@ static struct omap_opp * _omap37x_l3_rate_table = NULL; + extern struct mt9v113_platform_data mt9v113_pdata; + #endif + +-#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) ++#if defined(CONFIG_VIDEO_MT9T112) || defined(CONFIG_VIDEO_MT9T112_MODULE) + #include <media/v4l2-int-device.h> +-#include <media/mt9t111.h> +-extern struct mt9t111_platform_data mt9t111_pdata; ++#include <media/mt9t112.h> ++extern struct mt9t112_platform_data mt9t112_pdata; + #endif + + #define GPMC_CS0_BASE 0x60 +@@ -602,10 +602,10 @@ static struct i2c_board_info __initdata beagle_i2c2_boardinfo[] = { + .platform_data = &mt9v113_pdata, + }, + #endif +-#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) ++#if defined(CONFIG_VIDEO_MT9T112) || defined(CONFIG_VIDEO_MT9T112_MODULE) + { +- I2C_BOARD_INFO("mt9t111", MT9T111_I2C_ADDR), +- .platform_data = &mt9t111_pdata, ++ I2C_BOARD_INFO("mt9t112", MT9T112_I2C_ADDR), ++ .platform_data = &mt9t112_pdata, + }, + #endif + }; +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0056-omap34xxcam-Fix-multi-pixel-format-negotiation.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0056-omap34xxcam-Fix-multi-pixel-format-negotiation.patch new file mode 100644 index 0000000000..b8a11509b2 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0056-omap34xxcam-Fix-multi-pixel-format-negotiation.patch @@ -0,0 +1,26 @@ +From d1b23a6a7e9c92877c21a1325c699176e1e0be8f Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 1 Jul 2010 13:57:26 -0500 +Subject: [PATCH 56/71] omap34xxcam: Fix multi pixel format negotiation + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/omap34xxcam.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/drivers/media/video/omap34xxcam.c b/drivers/media/video/omap34xxcam.c +index 2e8153b..051c6a7 100644 +--- a/drivers/media/video/omap34xxcam.c ++++ b/drivers/media/video/omap34xxcam.c +@@ -544,7 +544,7 @@ static int try_pix_parm(struct omap34xxcam_videodev *vdev, + pix_tmp_out.height = pix_tmp_in.height; + rval = isp_try_fmt_cap(isp, &pix_tmp_in, &pix_tmp_out); + if (rval) +- return rval; ++ break; + + dev_dbg(&vdev->vfd->dev, "this w %d\th %d\tfmt %8.8x\t" + "-> w %d\th %d\t fmt %8.8x" +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0057-SQUASH-omap3beagle-camera-Bring-back-mt9t111-support.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0057-SQUASH-omap3beagle-camera-Bring-back-mt9t111-support.patch new file mode 100644 index 0000000000..599f013f7d --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0057-SQUASH-omap3beagle-camera-Bring-back-mt9t111-support.patch @@ -0,0 +1,43 @@ +From 1f47f621038372fe698921b5469dadf5446f73a8 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 15 Jul 2010 17:53:07 -0500 +Subject: [PATCH 57/71] SQUASH: omap3beagle: camera: Bring back mt9t111 support + +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 8 ++++---- + 1 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index 0b4dff7..3118026 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -221,14 +221,14 @@ static struct isp_interface_config mt9t112_if_config = { + .cam_mclk = ISP_MT9T112_MCLK, + .wenlog = ISPCCDC_CFG_WENLOG_AND, + .wait_hs_vs = 2, +- .u.par.par_bridge = 0x3, ++ .u.par.par_bridge = 0x2, + .u.par.par_clk_pol = 0x0, + }; + + static struct v4l2_ifparm mt9t112_ifparm_s = { +- .if_type = V4L2_IF_TYPE_RAW, ++ .if_type = V4L2_IF_TYPE_YCbCr, + .u = { +- .raw = { ++ .ycbcr = { + .frame_start_on_rising_vs = 1, + .bt_sync_correct = 0, + .swap = 0, +@@ -262,7 +262,7 @@ static struct omap34xxcam_hw_config mt9t112_hwc = { + .dev_index = 0, + .dev_minor = 0, + .dev_type = OMAP34XXCAM_SLAVE_SENSOR, +- .u.sensor.sensor_isp = 0, ++ .u.sensor.sensor_isp = 1, + .u.sensor.capture_mem = MT9T112_BIGGEST_FRAME_BYTE_SIZE, + .u.sensor.ival_default = { 1, 10 }, + }; +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0058-mt9t112-Do-init_camera-every-powerup.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0058-mt9t112-Do-init_camera-every-powerup.patch new file mode 100644 index 0000000000..87f936b34e --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0058-mt9t112-Do-init_camera-every-powerup.patch @@ -0,0 +1,57 @@ +From b62a517b3a1600fa491840223feb11fc99a76e0f Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 15 Jul 2010 17:53:44 -0500 +Subject: [PATCH 58/71] mt9t112: Do init_camera every powerup + +This is because we want to ensure we always come from a known state. + +Probably this could be revisited later for optimization. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 17 ++++++++--------- + 1 files changed, 8 insertions(+), 9 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index 98a4ea9..eebc2b5 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -982,6 +982,8 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s, + { + struct mt9t112_priv *priv = s->priv; + struct i2c_client *client = priv->client; ++ u16 param = (MT9T112_FLAG_PCLK_RISING_EDGE & ++ priv->info.flags) ? 0x0001 : 0x0000; + int ret; + + switch (power) { +@@ -1014,20 +1016,17 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s, + return ret; + } + if (!(priv->flags & INIT_DONE)) { +- u16 param = (MT9T112_FLAG_PCLK_RISING_EDGE & +- priv->info.flags) ? 0x0001 : 0x0000; +- + ECHECKER(ret, mt9t112_detect(client)); +- ECHECKER(ret, mt9t112_init_camera(client)); +- +- /* Invert PCLK (Data sampled on falling edge of pixclk) */ +- mt9t112_reg_write(ret, client, 0x3C20, param); +- +- mdelay(5); + + priv->flags |= INIT_DONE; + } + ++ ECHECKER(ret, mt9t112_init_camera(client)); ++ ++ /* Invert PCLK (Data sampled on falling edge of pixclk) */ ++ mt9t112_reg_write(ret, client, 0x3C20, param); ++ ++ mdelay(5); + mt9t112_mcu_write(ret, client, VAR(26, 7), + mt9t112_pixfmt_to_fmt(priv->pix.pixelformat)); + mt9t112_mcu_write(ret, client, VAR(26, 9), +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0059-omap3beagle-camera-Switch-flag-for-no-sensor-ISP.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0059-omap3beagle-camera-Switch-flag-for-no-sensor-ISP.patch new file mode 100644 index 0000000000..4f739946e4 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0059-omap3beagle-camera-Switch-flag-for-no-sensor-ISP.patch @@ -0,0 +1,26 @@ +From bb29d0713a991471b0d1a7cbb5194fc8e6a41ddb Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 15 Jul 2010 18:15:32 -0500 +Subject: [PATCH 59/71] omap3beagle: camera: Switch flag for no sensor ISP + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 2 +- + 1 files changed, 1 insertions(+), 1 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index 3118026..75622bf 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -262,7 +262,7 @@ static struct omap34xxcam_hw_config mt9t112_hwc = { + .dev_index = 0, + .dev_minor = 0, + .dev_type = OMAP34XXCAM_SLAVE_SENSOR, +- .u.sensor.sensor_isp = 1, ++ .u.sensor.sensor_isp = 0, + .u.sensor.capture_mem = MT9T112_BIGGEST_FRAME_BYTE_SIZE, + .u.sensor.ival_default = { 1, 10 }, + }; +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0060-mt9t112-Add-back-3MP-basesize.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0060-mt9t112-Add-back-3MP-basesize.patch new file mode 100644 index 0000000000..01e5e55f98 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0060-mt9t112-Add-back-3MP-basesize.patch @@ -0,0 +1,37 @@ +From cb36a121a4a73d6c9080f6648258317abb787f4c Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 15 Jul 2010 18:33:00 -0500 +Subject: [PATCH 60/71] mt9t112: Add back 3MP basesize + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 6 +++--- + 1 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index eebc2b5..46d1bd6 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -41,8 +41,8 @@ + /* + * frame size + */ +-#define MAX_WIDTH 640 /* 2048 */ +-#define MAX_HEIGHT 480 /* 1536 */ ++#define MAX_WIDTH 2048 ++#define MAX_HEIGHT 1536 + + #define VGA_WIDTH 640 + #define VGA_HEIGHT 480 +@@ -133,7 +133,7 @@ const static struct v4l2_fmtdesc mt9t112_formats[] = { + ************************************************************************/ + const static struct mt9t112_frame_size mt9t112_sizes[] = { + { 640, 480 }, +- /* { 2048, 1536} */ ++ { 2048, 1536} + }; + + /************************************************************************ +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0061-mt9t112-Prepare-for-24MHz-EXTCLK-and-30-fps.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0061-mt9t112-Prepare-for-24MHz-EXTCLK-and-30-fps.patch new file mode 100644 index 0000000000..4a17542b9b --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0061-mt9t112-Prepare-for-24MHz-EXTCLK-and-30-fps.patch @@ -0,0 +1,63 @@ +From 5c6d1392f4781e7b86bb0335461ef2fda0349fdf Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 15 Jul 2010 23:41:32 -0500 +Subject: [PATCH 61/71] mt9t112: Prepare for 24MHz EXTCLK and 30 fps + +Set Aptina recommended values to get 30 FPS with VGA, which +are achievable given the new PLL divider settings, considering +an input of 24MHz in the master clock. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 18 +++++++++--------- + 1 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index 46d1bd6..44234e4 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -144,7 +144,7 @@ const static struct mt9t112_frame_size mt9t112_sizes[] = { + + ************************************************************************/ + const struct v4l2_fract mt9t112_frameintervals[] = { +- { .numerator = 1, .denominator = 10 } ++ { .numerator = 1, .denominator = 30 } + }; + + /************************************************************************ +@@ -932,9 +932,9 @@ static int mt9t112_v4l2_int_g_parm(struct v4l2_int_device *s, + a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + + cparm->capability = V4L2_CAP_TIMEPERFRAME; +- /* FIXME: Is 10 fps really the only option? */ ++ /* FIXME: Is 30 fps really the only option? */ + cparm->timeperframe.numerator = 1; +- cparm->timeperframe.denominator = 10; ++ cparm->timeperframe.denominator = 30; + + return 0; + } +@@ -1195,14 +1195,14 @@ static int mt9t112_probe(struct i2c_client *client, + priv->pdata = client->dev.platform_data; + + /* Revisit: Init Sensor info settings */ +- priv->info.divider.m = 25; +- priv->info.divider.n = 2; ++ priv->info.divider.m = 24; ++ priv->info.divider.n = 1; + priv->info.divider.p1 = 0; +- priv->info.divider.p2 = 9; ++ priv->info.divider.p2 = 8; + priv->info.divider.p3 = 0; +- priv->info.divider.p4 = 13; +- priv->info.divider.p5 = 13; +- priv->info.divider.p6 = 9; ++ priv->info.divider.p4 = 11; ++ priv->info.divider.p5 = 11; ++ priv->info.divider.p6 = 8; + priv->info.divider.p7 = 0; + priv->info.flags = MT9T112_FLAG_PCLK_RISING_EDGE; + +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0062-omap3beagle-camera-Prepare-24MHz-xclk-for-mt9t112.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0062-omap3beagle-camera-Prepare-24MHz-xclk-for-mt9t112.patch new file mode 100644 index 0000000000..0f0af7546d --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0062-omap3beagle-camera-Prepare-24MHz-xclk-for-mt9t112.patch @@ -0,0 +1,62 @@ +From b16f10756ac1aeeab5c636fcaa2837b2ffec43f2 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Thu, 15 Jul 2010 23:43:20 -0500 +Subject: [PATCH 62/71] omap3beagle: camera: Prepare 24MHz xclk for mt9t112 + +Adjust calculations of timings based on # of EXTCLK cycles. + +Also, set default requested framerate to 30 fps. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + arch/arm/mach-omap2/board-omap3beagle-camera.c | 16 ++++++++-------- + 1 files changed, 8 insertions(+), 8 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c +index 75622bf..520e1d8 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c ++++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c +@@ -264,7 +264,7 @@ static struct omap34xxcam_hw_config mt9t112_hwc = { + .dev_type = OMAP34XXCAM_SLAVE_SENSOR, + .u.sensor.sensor_isp = 0, + .u.sensor.capture_mem = MT9T112_BIGGEST_FRAME_BYTE_SIZE, +- .u.sensor.ival_default = { 1, 10 }, ++ .u.sensor.ival_default = { 1, 30 }, + }; + #endif + +@@ -331,24 +331,24 @@ static int mt9t112_power_set(struct v4l2_int_device *s, enum v4l2_power power) + mdelay(50); + + /* Enable EXTCLK */ +- isp_set_xclk(vdev->cam->isp, MT9T112_CLK_MIN, CAM_USE_XCLKA); ++ isp_set_xclk(vdev->cam->isp, 24000000, CAM_USE_XCLKA); + + /* +- * Wait at least 70 CLK cycles (w/EXTCLK = 6MHz, or CLK_MIN): +- * ((1000000 * 70) / 6000000) = aprox 12 us. ++ * Wait at least 70 CLK cycles (w/EXTCLK = 24MHz): ++ * ((1000000 * 70) / 24000000) = aprox 2.91 us. + */ + +- udelay(12); ++ udelay(3); + + /* Set RESET_BAR to 1 */ + gpio_set_value(LEOPARD_RESET_GPIO, 1); + + /* +- * Wait at least 100 CLK cycles (w/EXTCLK = 6MHz, or CLK_MIN): +- * ((1000000 * 100) / 6000000) = aprox 17 us. ++ * Wait at least 100 CLK cycles (w/EXTCLK = 24MHz): ++ * ((1000000 * 100) / 24000000) = aprox 4.16 us. + */ + +- udelay(17); ++ udelay(5); + + break; + +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0063-mt9t112-Correct-register-settings-for-mt9t111-sensor.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0063-mt9t112-Correct-register-settings-for-mt9t111-sensor.patch new file mode 100644 index 0000000000..a11580c09b --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0063-mt9t112-Correct-register-settings-for-mt9t111-sensor.patch @@ -0,0 +1,109 @@ +From 78cb5d13faa2b29e33c6a820435dbd82ad3effa5 Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Fri, 16 Jul 2010 07:52:06 -0500 +Subject: [PATCH 63/71] mt9t112: Correct register settings for mt9t111 sensor + +This now matches with Aptina's recommended values. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 46 ++++++++++++++++++++++++++++------------ + 1 files changed, 32 insertions(+), 14 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index 44234e4..ac295dd 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -44,6 +44,9 @@ + #define MAX_WIDTH 2048 + #define MAX_HEIGHT 1536 + ++#define MAX_WIDTH_PREV 1024 ++#define MAX_HEIGHT_PREV 768 ++ + #define VGA_WIDTH 640 + #define VGA_HEIGHT 480 + +@@ -392,24 +395,39 @@ static int mt9t112_set_a_frame_size(const struct i2c_client *client, + u16 height) + { + int ret; +- u16 wstart = (MAX_WIDTH - width) / 2; +- u16 hstart = (MAX_HEIGHT - height) / 2; ++ u16 wstart, hstart, wend, hend; ++ u16 max_width = MAX_WIDTH_PREV, max_height = MAX_HEIGHT_PREV; ++ ++ if ((width > max_width) || (height > max_height)) { ++ /* Capture case */ ++ max_width = MAX_WIDTH; ++ max_height = MAX_HEIGHT; ++ hstart = 4; ++ wstart = 4; ++ hend = 1547; ++ wend = 2059; ++ } else { ++ hstart = 0; ++ wstart = 0; ++ hend = 1549; ++ wend = 2061; ++ } + + /* (Context A) Image Width/Height */ + mt9t112_mcu_write(ret, client, VAR(26, 0), width); + mt9t112_mcu_write(ret, client, VAR(26, 2), height); + + /* (Context A) Output Width/Height */ +- mt9t112_mcu_write(ret, client, VAR(18, 43), 8 + width); +- mt9t112_mcu_write(ret, client, VAR(18, 45), 8 + height); ++ mt9t112_mcu_write(ret, client, VAR(18, 43), 8 + max_width); ++ mt9t112_mcu_write(ret, client, VAR(18, 45), 8 + max_height); + + /* (Context A) Start Row/Column */ +- mt9t112_mcu_write(ret, client, VAR(18, 2), 4 + hstart); +- mt9t112_mcu_write(ret, client, VAR(18, 4), 4 + wstart); ++ mt9t112_mcu_write(ret, client, VAR(18, 2), hstart); ++ mt9t112_mcu_write(ret, client, VAR(18, 4), wstart); + + /* (Context A) End Row/Column */ +- mt9t112_mcu_write(ret, client, VAR(18, 6), 11 + height + hstart); +- mt9t112_mcu_write(ret, client, VAR(18, 8), 11 + width + wstart); ++ mt9t112_mcu_write(ret, client, VAR(18, 6), hend); ++ mt9t112_mcu_write(ret, client, VAR(18, 8), wend); + + mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06); + +@@ -547,25 +565,25 @@ static int mt9t112_init_setting(const struct i2c_client *client) + mt9t112_mcu_mask_set(ret, client, VAR(26, 160), 0x0040, 0x0000); + + /* Read Mode (A) */ +- mt9t112_mcu_write(ret, client, VAR(18, 12), 0x0024); ++ mt9t112_mcu_write(ret, client, VAR(18, 12), 0x046C); + + /* Fine Correction (A) */ + mt9t112_mcu_write(ret, client, VAR(18, 15), 0x00CC); + + /* Fine IT Min (A) */ +- mt9t112_mcu_write(ret, client, VAR(18, 17), 0x01f1); ++ mt9t112_mcu_write(ret, client, VAR(18, 17), 0x0381); + + /* Fine IT Max Margin (A) */ +- mt9t112_mcu_write(ret, client, VAR(18, 19), 0x00fF); ++ mt9t112_mcu_write(ret, client, VAR(18, 19), 0x024F); + + /* Base Frame Lines (A) */ +- mt9t112_mcu_write(ret, client, VAR(18, 29), 0x032D); ++ mt9t112_mcu_write(ret, client, VAR(18, 29), 0x0378); + + /* Min Line Length (A) */ +- mt9t112_mcu_write(ret, client, VAR(18, 31), 0x073a); ++ mt9t112_mcu_write(ret, client, VAR(18, 31), 0x05D0); + + /* Line Length (A) */ +- mt9t112_mcu_write(ret, client, VAR(18, 37), 0x07d0); ++ mt9t112_mcu_write(ret, client, VAR(18, 37), 0x07AC); + + /* Adaptive Output Clock (B) */ + mt9t112_mcu_mask_set(ret, client, VAR(27, 160), 0x0040, 0x0000); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0064-mt9t112-Remove-smart-size-selection.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0064-mt9t112-Remove-smart-size-selection.patch new file mode 100644 index 0000000000..766ba10ccb --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0064-mt9t112-Remove-smart-size-selection.patch @@ -0,0 +1,188 @@ +From 50c7b176efb764ff4f4e3d5e847cd44396d692dc Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Fri, 16 Jul 2010 17:09:10 -0500 +Subject: [PATCH 64/71] mt9t112: Remove "smart" size selection + +This code is broken, as it doesn't really adjust all other +settings, but output size to desired size. It isn't really +toggling everything that needs, and giving the false impression +of good size flexibility. + +So, meanwhile, let's put fixed init settings for the contexts, +and toggle between them (implemented in other patch). + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 105 ++++++++++++++++------------------------- + 1 files changed, 41 insertions(+), 64 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index ac295dd..ee991ef 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -390,50 +390,6 @@ static void mt9t112_frame_check(u32 *width, u32 *height) + *height = MAX_HEIGHT; + } + +-static int mt9t112_set_a_frame_size(const struct i2c_client *client, +- u16 width, +- u16 height) +-{ +- int ret; +- u16 wstart, hstart, wend, hend; +- u16 max_width = MAX_WIDTH_PREV, max_height = MAX_HEIGHT_PREV; +- +- if ((width > max_width) || (height > max_height)) { +- /* Capture case */ +- max_width = MAX_WIDTH; +- max_height = MAX_HEIGHT; +- hstart = 4; +- wstart = 4; +- hend = 1547; +- wend = 2059; +- } else { +- hstart = 0; +- wstart = 0; +- hend = 1549; +- wend = 2061; +- } +- +- /* (Context A) Image Width/Height */ +- mt9t112_mcu_write(ret, client, VAR(26, 0), width); +- mt9t112_mcu_write(ret, client, VAR(26, 2), height); +- +- /* (Context A) Output Width/Height */ +- mt9t112_mcu_write(ret, client, VAR(18, 43), 8 + max_width); +- mt9t112_mcu_write(ret, client, VAR(18, 45), 8 + max_height); +- +- /* (Context A) Start Row/Column */ +- mt9t112_mcu_write(ret, client, VAR(18, 2), hstart); +- mt9t112_mcu_write(ret, client, VAR(18, 4), wstart); +- +- /* (Context A) End Row/Column */ +- mt9t112_mcu_write(ret, client, VAR(18, 6), hend); +- mt9t112_mcu_write(ret, client, VAR(18, 8), wend); +- +- mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06); +- +- return ret; +-} +- + static int mt9t112_set_pll_dividers(const struct i2c_client *client, + u8 m, u8 n, + u8 p1, u8 p2, u8 p3, +@@ -561,9 +517,27 @@ static int mt9t112_init_setting(const struct i2c_client *client) + + int ret; + ++ /* Output Width (A) */ ++ mt9t112_mcu_write(ret, client, VAR(26, 0), 640); ++ ++ /* Output Height (A) */ ++ mt9t112_mcu_write(ret, client, VAR(26, 2), 480); ++ + /* Adaptive Output Clock (A) */ + mt9t112_mcu_mask_set(ret, client, VAR(26, 160), 0x0040, 0x0000); + ++ /* Row Start (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 2), 0); ++ ++ /* Column Start (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 4), 0); ++ ++ /* Row End (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 6), 1549); ++ ++ /* Column End (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 8), 2061); ++ + /* Read Mode (A) */ + mt9t112_mcu_write(ret, client, VAR(18, 12), 0x046C); + +@@ -585,6 +559,18 @@ static int mt9t112_init_setting(const struct i2c_client *client) + /* Line Length (A) */ + mt9t112_mcu_write(ret, client, VAR(18, 37), 0x07AC); + ++ /* Context Width (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 43), 8 + 1024); ++ ++ /* Context Height (A) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 45), 8 + 768); ++ ++ /* Output Width (B) */ ++ mt9t112_mcu_write(ret, client, VAR(27, 0), 2048); ++ ++ /* Output Hieght (B) */ ++ mt9t112_mcu_write(ret, client, VAR(27, 2), 1536); ++ + /* Adaptive Output Clock (B) */ + mt9t112_mcu_mask_set(ret, client, VAR(27, 160), 0x0040, 0x0000); + +@@ -610,13 +596,19 @@ static int mt9t112_init_setting(const struct i2c_client *client) + mt9t112_mcu_write(ret, client, VAR(18, 91), 0x00FF); + + /* Base Frame Lines (B) */ +- mt9t112_mcu_write(ret, client, VAR(18, 101), 0x0668); ++ mt9t112_mcu_write(ret, client, VAR(18, 101), 0x066C); + + /* Min Line Length (B) */ +- mt9t112_mcu_write(ret, client, VAR(18, 103), 0x0AF0); ++ mt9t112_mcu_write(ret, client, VAR(18, 103), 0x0378); + + /* Line Length (B) */ +- mt9t112_mcu_write(ret, client, VAR(18, 109), 0x0AF0); ++ mt9t112_mcu_write(ret, client, VAR(18, 109), 0x0CB1); ++ ++ /* Context Width (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 115), 8 + 2048); ++ ++ /* Context Height (B) */ ++ mt9t112_mcu_write(ret, client, VAR(18, 117), 8 + 1536); + + /* + * Flicker Dectection registers +@@ -692,10 +684,10 @@ static int mt9t112_init_setting(const struct i2c_client *client) + mt9t112_mcu_write(ret, client, VAR8(8, 12), 0x0A); + + /* RX FIFO Watermark (A) */ +- mt9t112_mcu_write(ret, client, VAR(18, 70), 0x0014); ++ mt9t112_mcu_write(ret, client, VAR(18, 70), 0x0080); + + /* RX FIFO Watermark (B) */ +- mt9t112_mcu_write(ret, client, VAR(18, 142), 0x0014); ++ mt9t112_mcu_write(ret, client, VAR(18, 142), 0x0080); + + /* MCLK: 16MHz + * PCLK: 73MHz +@@ -1008,17 +1000,6 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s, + case V4L2_POWER_STANDBY: + /* FALLTHROUGH */ + case V4L2_POWER_OFF: +- /* FIXME +- * +- * If user selected large output size, +- * and used it long time, +- * mt9t112 camera will be very warm. +- * +- * But current driver can not stop mt9t112 camera. +- * So, set small size here to solve this problem. +- */ +- mt9t112_set_a_frame_size(client, VGA_WIDTH, VGA_HEIGHT); +- + ret = priv->pdata->power_set(s, power); + if (ret < 0) { + dev_err(&client->dev, "Unable to set target board power " +@@ -1051,10 +1032,6 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s, + mt9t112_pixfmt_to_order(priv->pix.pixelformat)); + mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06); + +- mt9t112_set_a_frame_size(client, +- priv->pix.width, +- priv->pix.height); +- + ECHECKER(ret, mt9t112_auto_focus_trigger(client)); + + dev_dbg(&client->dev, "format : %d\n", priv->pix.pixelformat); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0065-rtl8192su-remove-bogus-Kconfig-depend-on-PCI-and-add.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0065-rtl8192su-remove-bogus-Kconfig-depend-on-PCI-and-add.patch new file mode 100644 index 0000000000..2fb7c7b388 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0065-rtl8192su-remove-bogus-Kconfig-depend-on-PCI-and-add.patch @@ -0,0 +1,38 @@ +From aa46956935fdee7636a66b023c521643c982208c Mon Sep 17 00:00:00 2001 +From: Koen Kooi <koen@dominion.thruhere.net> +Date: Sun, 18 Jul 2010 11:25:12 +0200 +Subject: [PATCH 65/71] rtl8192su: remove bogus Kconfig depend on PCI and add another product ID + +Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> +--- + drivers/staging/rtl8192su/Kconfig | 2 +- + drivers/staging/rtl8192su/r8192U_core.c | 1 + + 2 files changed, 2 insertions(+), 1 deletions(-) + +diff --git a/drivers/staging/rtl8192su/Kconfig b/drivers/staging/rtl8192su/Kconfig +index 123fa6d..9888927 100644 +--- a/drivers/staging/rtl8192su/Kconfig ++++ b/drivers/staging/rtl8192su/Kconfig +@@ -1,6 +1,6 @@ + config RTL8192SU + tristate "RealTek RTL8192SU Wireless LAN NIC driver" +- depends on PCI && WLAN && USB ++ depends on WLAN && USB + depends on WIRELESS_EXT + default N + ---help--- +diff --git a/drivers/staging/rtl8192su/r8192U_core.c b/drivers/staging/rtl8192su/r8192U_core.c +index 66274d7..48e4c29 100644 +--- a/drivers/staging/rtl8192su/r8192U_core.c ++++ b/drivers/staging/rtl8192su/r8192U_core.c +@@ -112,6 +112,7 @@ u32 rt_global_debug_component = \ + + static struct usb_device_id rtl8192_usb_id_tbl[] = { + /* Realtek */ ++ {USB_DEVICE(0x0bda, 0x8171)}, + {USB_DEVICE(0x0bda, 0x8192)}, + {USB_DEVICE(0x0bda, 0x8709)}, + /* Corega */ +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch new file mode 100644 index 0000000000..adda004db0 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0066-mt9t112-Add-Context-selection-to-configuration.patch @@ -0,0 +1,96 @@ +From d53224070b960f08989a50f1786adeecfca227eb Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Sun, 18 Jul 2010 01:12:41 -0500 +Subject: [PATCH 66/71] mt9t112: Add Context selection to configuration + +Thsi makes always start at least with preview mode +(context A), and then, if needed, transition to capture +mode (context B) + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 54 +++++++++++++++++++++++++++++++++++++++++ + 1 files changed, 54 insertions(+), 0 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index ee991ef..ec7514f 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -73,6 +73,9 @@ + #define mt9t112_reg_read(ret, client, a) \ + ECHECKER(ret, __mt9t112_reg_read(client, a)) + ++#define mt9t112_mcu_read(ret, client, a) \ ++ ECHECKER(ret, __mt9t112_mcu_read(client, a)) ++ + /* + * Logical address + */ +@@ -737,6 +740,50 @@ static int mt9t112_auto_focus_trigger(const struct i2c_client *client) + return ret; + } + ++static int mt9t112_goto_preview(const struct i2c_client *client) ++{ ++ int ret, trycount = 0; ++ ++ /* Is it already in preview mode? */ ++ mt9t112_mcu_read(ret, client, VAR8(1, 1)); ++ if (ret == 0x3) ++ return 0; ++ ++ /* Go to preview mode */ ++ mt9t112_mcu_write(ret, client, VAR8(1, 0), 1); ++ do { ++ mt9t112_mcu_read(ret, client, VAR8(1, 1)); ++ mdelay(1); ++ } while ((ret != 0x3) && (++trycount < 100)); ++ ++ if (trycount >= 100) ++ return -EBUSY; ++ ++ return 0; ++} ++ ++static int mt9t112_goto_capture(const struct i2c_client *client) ++{ ++ int ret, trycount = 0; ++ ++ /* Is it already in capture mode? */ ++ mt9t112_mcu_read(ret, client, VAR8(1, 1)); ++ if (ret == 0x7) ++ return 0; ++ ++ /* Go to capture mode */ ++ mt9t112_mcu_write(ret, client, VAR8(1, 0), 2); ++ do { ++ mt9t112_mcu_read(ret, client, VAR8(1, 1)); ++ mdelay(1); ++ } while ((ret != 0x7) && (++trycount < 100)); ++ ++ if (trycount >= 100) ++ return -EBUSY; ++ ++ return 0; ++} ++ + static int mt9t112_init_camera(const struct i2c_client *client) + { + int ret; +@@ -1034,6 +1081,13 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s, + + ECHECKER(ret, mt9t112_auto_focus_trigger(client)); + ++ ECHECKER(ret, mt9t112_goto_preview(client)); ++ ++ if ((priv->pix.width == MAX_WIDTH) && ++ (priv->pix.height == MAX_HEIGHT)) { ++ ECHECKER(ret, mt9t112_goto_capture(client)); ++ } ++ + dev_dbg(&client->dev, "format : %d\n", priv->pix.pixelformat); + dev_dbg(&client->dev, "size : %d x %d\n", + priv->pix.width, +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0067-mt9t112-Disable-JPEG-in-Context-B.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0067-mt9t112-Disable-JPEG-in-Context-B.patch new file mode 100644 index 0000000000..14f33b6b19 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0067-mt9t112-Disable-JPEG-in-Context-B.patch @@ -0,0 +1,32 @@ +From d098c75d211e3affc0a67ac98edce6494521faad Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Sun, 18 Jul 2010 01:45:29 -0500 +Subject: [PATCH 67/71] mt9t112: Disable JPEG in Context B + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 8 -------- + 1 files changed, 0 insertions(+), 8 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index ec7514f..18d7ce5 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -812,14 +812,6 @@ static int mt9t112_init_camera(const struct i2c_client *client) + mt9t112_mcu_write(ret, client, VAR(26, 160), 0x0A2E); + mt9t112_mcu_write(ret, client, VAR(27, 160), 0x0A2E); + +- /* Configure STatus in Status_before_length Format and enable header */ +- /* PRI_B_CONFIG_JPEG_OB_TX_CONTROL_VAR */ +- mt9t112_mcu_write(ret, client, VAR(27, 144), 0x0CB4); +- +- /* Enable JPEG in context B */ +- /* PRI_B_CONFIG_JPEG_OB_TX_CONTROL_VAR */ +- mt9t112_mcu_write(ret, client, VAR8(27, 142), 0x01); +- + /* Disable Dac_TXLO */ + mt9t112_reg_write(ret, client, 0x316C, 0x350F); + +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0068-mt9t112-Make-context-B-stream-unlimited-frames.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0068-mt9t112-Make-context-B-stream-unlimited-frames.patch new file mode 100644 index 0000000000..540de6a123 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0068-mt9t112-Make-context-B-stream-unlimited-frames.patch @@ -0,0 +1,30 @@ +From 49fbfdfd756f126edc16fe04c55ce238e22815fc Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Sun, 18 Jul 2010 01:47:41 -0500 +Subject: [PATCH 68/71] mt9t112: Make context B stream unlimited frames + +Context A does this by default, so, only context B needs +to be configured like this. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 3 +++ + 1 files changed, 3 insertions(+), 0 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index 18d7ce5..3c516b4 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -771,6 +771,9 @@ static int mt9t112_goto_capture(const struct i2c_client *client) + if (ret == 0x7) + return 0; + ++ /* Num Frames Run (B) */ ++ mt9t112_mcu_write(ret, client, VAR(27, 5), 0); ++ + /* Go to capture mode */ + mt9t112_mcu_write(ret, client, VAR8(1, 0), 2); + do { +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0069-mt9t112-Fix-pll-p-dividers-abstraction.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0069-mt9t112-Fix-pll-p-dividers-abstraction.patch new file mode 100644 index 0000000000..e5159984ef --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0069-mt9t112-Fix-pll-p-dividers-abstraction.patch @@ -0,0 +1,58 @@ +From fd5fc55fe4ffedb3bf865f54b2648f77bcf0aa2e Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Mon, 19 Jul 2010 12:31:47 -0500 +Subject: [PATCH 69/71] mt9t112: Fix pll p-dividers abstraction + +Previously, it wasn't clear that the values needed to be filled +were (val - 1). Fix that. + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 16 +++++++++------- + 1 files changed, 9 insertions(+), 7 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index 3c516b4..c1a9b41 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -393,6 +393,8 @@ static void mt9t112_frame_check(u32 *width, u32 *height) + *height = MAX_HEIGHT; + } + ++#define PLL_ADJ(x) ((x != 0) ? x - 1 : 0) ++ + static int mt9t112_set_pll_dividers(const struct i2c_client *client, + u8 m, u8 n, + u8 p1, u8 p2, u8 p3, +@@ -408,21 +410,21 @@ static int mt9t112_set_pll_dividers(const struct i2c_client *client, + mt9t112_reg_mask_set(ret, client, 0x0010, 0x3fff, val); + + /* P1/P2/P3 */ +- val = ((p3 & 0x0F) << 8) | +- ((p2 & 0x0F) << 4) | +- ((p1 & 0x0F) << 0); ++ val = ((PLL_ADJ(p3) & 0x0F) << 8) | ++ ((PLL_ADJ(p2) & 0x0F) << 4) | ++ ((PLL_ADJ(p1) & 0x0F) << 0); + mt9t112_reg_mask_set(ret, client, 0x0012, 0x0fff, val); + + /* P4/P5/P6 */ + val = (0x7 << 12) | +- ((p6 & 0x0F) << 8) | +- ((p5 & 0x0F) << 4) | +- ((p4 & 0x0F) << 0); ++ ((PLL_ADJ(p6) & 0x0F) << 8) | ++ ((PLL_ADJ(p5) & 0x0F) << 4) | ++ ((PLL_ADJ(p4) & 0x0F) << 0); + mt9t112_reg_mask_set(ret, client, 0x002A, 0x7fff, val); + + /* P7 */ + val = (0x1 << 12) | +- ((p7 & 0x0F) << 0); ++ ((PLL_ADJ(p7) & 0x0F) << 0); + mt9t112_reg_mask_set(ret, client, 0x002C, 0x100f, val); + + return ret; +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0070-mt9t112-Adjust-50-60Hz-flickering-settings.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0070-mt9t112-Adjust-50-60Hz-flickering-settings.patch new file mode 100644 index 0000000000..c9e9f8aa1d --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0070-mt9t112-Adjust-50-60Hz-flickering-settings.patch @@ -0,0 +1,51 @@ +From e1df34acacf936ec2d8f2822fed88d78d29449ad Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Mon, 19 Jul 2010 17:30:29 -0500 +Subject: [PATCH 70/71] mt9t112: Adjust 50/60Hz flickering settings + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 24 ++++++++++++++---------- + 1 files changed, 14 insertions(+), 10 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index c1a9b41..8528417 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -694,19 +694,23 @@ static int mt9t112_init_setting(const struct i2c_client *client) + /* RX FIFO Watermark (B) */ + mt9t112_mcu_write(ret, client, VAR(18, 142), 0x0080); + +- /* MCLK: 16MHz ++ /* MCLK: 24MHz + * PCLK: 73MHz + * CorePixCLK: 36.5 MHz + */ +- mt9t112_mcu_write(ret, client, VAR8(18, 0x0044), 133); +- mt9t112_mcu_write(ret, client, VAR8(18, 0x0045), 110); +- mt9t112_mcu_write(ret, client, VAR8(18, 0x008c), 130); +- mt9t112_mcu_write(ret, client, VAR8(18, 0x008d), 108); +- +- mt9t112_mcu_write(ret, client, VAR8(18, 0x00A5), 27); +- mt9t112_mcu_write(ret, client, VAR8(18, 0x00a6), 30); +- mt9t112_mcu_write(ret, client, VAR8(18, 0x00a7), 32); +- mt9t112_mcu_write(ret, client, VAR8(18, 0x00a8), 35); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x0044), 11); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x012F), 1); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x0045), 222); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x012D), 0); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x008c), 161); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x0130), 0); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x008d), 134); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x012E), 0); ++ ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x00A5), 36); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x00a6), 38); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x00a7), 43); ++ mt9t112_mcu_write(ret, client, VAR8(18, 0x00a8), 45); + + return ret; + } +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/cam/0071-mt9t112-Trigger-autofocus-at-the-end-of-context-swit.patch b/recipes/linux/linux-omap-psp-2.6.32/cam/0071-mt9t112-Trigger-autofocus-at-the-end-of-context-swit.patch new file mode 100644 index 0000000000..f9ab37ba28 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/cam/0071-mt9t112-Trigger-autofocus-at-the-end-of-context-swit.patch @@ -0,0 +1,35 @@ +From afb4dbf5c3633692ca5cdc052ec1c7c473a8020b Mon Sep 17 00:00:00 2001 +From: Sergio Aguirre <saaguirre@ti.com> +Date: Mon, 19 Jul 2010 17:45:38 -0500 +Subject: [PATCH 71/71] mt9t112: Trigger autofocus at the end of context switch + +Signed-off-by: Sergio Aguirre <saaguirre@ti.com> +--- + drivers/media/video/mt9t112.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c +index 8528417..0769f66 100644 +--- a/drivers/media/video/mt9t112.c ++++ b/drivers/media/video/mt9t112.c +@@ -1080,8 +1080,6 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s, + mt9t112_pixfmt_to_order(priv->pix.pixelformat)); + mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06); + +- ECHECKER(ret, mt9t112_auto_focus_trigger(client)); +- + ECHECKER(ret, mt9t112_goto_preview(client)); + + if ((priv->pix.width == MAX_WIDTH) && +@@ -1089,6 +1087,8 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s, + ECHECKER(ret, mt9t112_goto_capture(client)); + } + ++ ECHECKER(ret, mt9t112_auto_focus_trigger(client)); ++ + dev_dbg(&client->dev, "format : %d\n", priv->pix.pixelformat); + dev_dbg(&client->dev, "size : %d x %d\n", + priv->pix.width, +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp_2.6.32.bb b/recipes/linux/linux-omap-psp_2.6.32.bb index ae7429fb5d..0388baffda 100644 --- a/recipes/linux/linux-omap-psp_2.6.32.bb +++ b/recipes/linux/linux-omap-psp_2.6.32.bb @@ -65,14 +65,14 @@ SRC_URI = "git://arago-project.org/git/people/sriram/ti-psp-omap.git;protocol=gi file://cam/0006-omap3beagle-camera-Add-support-for-regulators.patch \ file://cam/0007-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch \ file://cam/0008-omap3beagle-camera-Fix-null-pointer-dereference.patch \ - file://cam/0009-Revert-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch \ - file://cam/0010-omap3beagle-camera-Change-arch-late_initcall.patch \ + file://cam/0009-Revert-TEMP-omap3beagle-cam-Enable-OMAP_MUX.patch \ + file://cam/0010-omap3beagle-camera-Change-arch-late_initcall.patch \ file://cam/0011-omap3beagle-camera-Move-i2c-registration-to-the-main.patch \ file://cam/0012-ARM-OMAP3-make-camera-code-build-if-MT9T111-is-built.patch \ file://cam/0013-DEBUG-omap3beagle-camera-Force-mode0-in-cam_xclka.patch \ file://cam/0014-OMAP3-CLOCK-Add-capability-to-change-rate-of-dpll4_m.patch \ file://cam/0015-Revert-DEBUG-omap3beagle-camera-Force-mode0-in-cam_x.patch \ - file://cam/0016-omap3beagle-camera-Fix-wrong-XCLKA-selection.patch \ + file://cam/0016-omap3beagle-camera-Fix-wrong-XCLKA-selection.patch \ file://cam/0017-omap3isp-set-CAM_MCLK-to-172.8-MHz-allows-exact-9.6-.patch \ file://cam/0018-Fix-Moved-MCLK-setting-to-the-board-file.patch \ file://cam/0019-omap3isp-core-Do-smarter-MCLK-setting.patch \ @@ -85,6 +85,49 @@ SRC_URI = "git://arago-project.org/git/people/sriram/ti-psp-omap.git;protocol=gi file://cam/0026-omap3beagle-camera-Complement-remainig-sensor-hw-con.patch \ file://cam/0027-mt9t111-Fix-detect-function-retval-and-cleanup-print.patch \ file://cam/0028-omap3beagle-camera-Set-padconf-settings-in-cam-init.patch \ + file://cam/0029-omap3beagle-camera-only-register-camera-driver-for-3.patch \ + file://cam/0030-WIP-mt9t111-Work-in-progress-for-camera-enablement.patch \ + file://cam/0031-BeagleXM-Cam-Add-support-for-MT9V113-VGA-Sensor.patch \ + file://cam/0032-MT9V113-Fixed-sensor-nitialization-issues.patch \ + file://cam/0033-mt9v113-Fix-wrong-active-widths.patch \ + file://cam/0034-omap3isp-Fix-Wrong-check-on-non-interlaced-sensor-on.patch \ + file://cam/0035-omap3isp-Fix-bad-YUV_BT-checks-in-datapath_config.patch \ + file://cam/0036-omap3isp-Set-vd_pol-to-0-by-default-on-all-cases.patch \ + file://cam/0037-omap3isp-ccdc-Set-datalines-to-10-for-YUV_SYNC.patch \ + file://cam/0038-omap3beagle-camera-Fix-parallel-i-f-settings.patch \ + file://cam/0039-omap3beagle-camera-Clean-up-Remove-unneccessary-code.patch \ + file://cam/0040-mt9v113-Clean-Up-Remove-unneccessary-code-printf.patch \ + file://cam/0041-MT9V113-Min-Max-clk-input-changed-as-per-the-spec.patch \ + file://cam/0042-omap3beagle-camera-Further-clode-cleanup.patch \ + file://cam/0043-mt9v113-Settings-from-Aptima-used-to-increase-FPS.patch \ + file://cam/0044-mt9v113-AE-param-tuned-to-get-28-30FPS.patch \ + file://cam/0045-omap3beagle-camera-Cleanup-of-boardfile.patch \ + file://cam/0046-omap3beagle-camera-Cleanup-regulator-usage.patch \ + file://cam/0047-omap3beagle-camera-Bring-back-mt9t111-support.patch \ + file://cam/0048-REMOVE-v4l2-Delete-MT9T111-sensor-driver.patch \ + file://cam/0049-V4L-DVB-13670-soc-camera-Add-mt9t112-camera-driver.patch \ + file://cam/0050-soc-camera-mt9t112-modify-exiting-conditions-from-st.patch \ + file://cam/0051-mt9t112-Migrate-from-soc_camera-to-v4l2-int-device.patch \ + file://cam/0052-mt9t112-Add-more-info-to-public-header.patch \ + file://cam/0053-mt9t112-Fix-null-pointer-kernel-bug.patch \ + file://cam/0054-DEBUG-omap3beagle-Add-MT9T112-to-defconfig.patch \ + file://cam/0055-omap3beagle-camera-Change-MT9T111-references-to-new-.patch \ + file://cam/0056-omap34xxcam-Fix-multi-pixel-format-negotiation.patch \ + file://cam/0057-SQUASH-omap3beagle-camera-Bring-back-mt9t111-support.patch \ + file://cam/0058-mt9t112-Do-init_camera-every-powerup.patch \ + file://cam/0059-omap3beagle-camera-Switch-flag-for-no-sensor-ISP.patch \ + file://cam/0060-mt9t112-Add-back-3MP-basesize.patch \ + file://cam/0061-mt9t112-Prepare-for-24MHz-EXTCLK-and-30-fps.patch \ + file://cam/0062-omap3beagle-camera-Prepare-24MHz-xclk-for-mt9t112.patch \ + file://cam/0063-mt9t112-Correct-register-settings-for-mt9t111-sensor.patch \ + file://cam/0064-mt9t112-Remove-smart-size-selection.patch \ + file://cam/0065-rtl8192su-remove-bogus-Kconfig-depend-on-PCI-and-add.patch \ + file://cam/0066-mt9t112-Add-Context-selection-to-configuration.patch \ + file://cam/0067-mt9t112-Disable-JPEG-in-Context-B.patch \ + file://cam/0068-mt9t112-Make-context-B-stream-unlimited-frames.patch \ + file://cam/0069-mt9t112-Fix-pll-p-dividers-abstraction.patch \ + file://cam/0070-mt9t112-Adjust-50-60Hz-flickering-settings.patch \ + file://cam/0071-mt9t112-Trigger-autofocus-at-the-end-of-context-swit.patch \ file://defconfig" SRC_URI_append_beagleboard = " file://logo_linux_clut224.ppm \ |