diff options
Diffstat (limited to 'recipes')
43 files changed, 4667 insertions, 647 deletions
diff --git a/recipes/linux/linux-omap-psp-2.6.32/0001-board-omap3touchbook-make-it-build-against-TI-linux.patch b/recipes/linux/linux-omap-psp-2.6.32/0001-board-omap3touchbook-make-it-build-against-TI-linux-.patch index 89c385bbbb..4bdef668a5 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/0001-board-omap3touchbook-make-it-build-against-TI-linux.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/0001-board-omap3touchbook-make-it-build-against-TI-linux-.patch @@ -1,7 +1,7 @@ -From 51b0bee0036aa6168a2bb7b1df1b5b84bc645840 Mon Sep 17 00:00:00 2001 -From: OpenEmbedded User <oe@OE-builder.(none)> +From 8ba613504c9e73c704c70ffb960affda91c8fadc Mon Sep 17 00:00:00 2001 +From: Koen Kooi <k-kooi@ti.com> Date: Sat, 30 Jan 2010 15:49:15 +0100 -Subject: [PATCH] board-omap3touchbook: make it build against TI linux-omap 2.6.32-PSP +Subject: [PATCH 01/30] board-omap3touchbook: make it build against TI linux-omap 2.6.32-PSP --- arch/arm/mach-omap2/board-omap3touchbook.c | 11 +++++++++-- @@ -57,5 +57,5 @@ index fe3d22c..fc3e03c 100644 #ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer(12); -- -1.5.4.3 +1.6.6.1 diff --git a/recipes/linux/linux-omap-psp-2.6.32/0005-ARM-OMAP-add-support-for-TCT-Zippy-to-Beagle-board.patch b/recipes/linux/linux-omap-psp-2.6.32/0002-ARM-OMAP-add-support-for-TCT-Zippy-to-Beagle-board-f.patch index 1c51552792..2432c8c7c8 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/0005-ARM-OMAP-add-support-for-TCT-Zippy-to-Beagle-board.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/0002-ARM-OMAP-add-support-for-TCT-Zippy-to-Beagle-board-f.patch @@ -1,7 +1,7 @@ -From 334eef94045c93957cad3477522086492dd19b06 Mon Sep 17 00:00:00 2001 +From 01f6596202c485e52037518398caa47e7f137dd8 Mon Sep 17 00:00:00 2001 From: Steve Sakoman <sakoman@gmail.com> Date: Tue, 15 Dec 2009 15:34:29 -0800 -Subject: [PATCH 05/16] ARM: OMAP: add support for TCT Zippy to Beagle board file +Subject: [PATCH 02/30] ARM: OMAP: add support for TCT Zippy to Beagle board file Signed-off-by: Steve Sakoman <sakoman@gmail.com> --- @@ -9,7 +9,7 @@ Signed-off-by: Steve Sakoman <sakoman@gmail.com> 1 files changed, 71 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c -index 41480bd..f3df638 100644 +index 330fb25..ddfb9c0 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -21,6 +21,7 @@ @@ -20,7 +20,7 @@ index 41480bd..f3df638 100644 #include <linux/input.h> #include <linux/gpio_keys.h> -@@ -52,6 +53,49 @@ +@@ -56,6 +57,49 @@ #define NAND_BLOCK_SIZE SZ_128K @@ -70,7 +70,7 @@ index 41480bd..f3df638 100644 static struct mtd_partition omap3beagle_nand_partitions[] = { /* All the partition sizes are listed in terms of NAND block size */ { -@@ -114,6 +158,14 @@ static struct twl4030_hsmmc_info mmc[] = { +@@ -118,6 +162,14 @@ static struct twl4030_hsmmc_info mmc[] = { .wires = 8, .gpio_wp = 29, }, @@ -85,7 +85,7 @@ index 41480bd..f3df638 100644 {} /* Terminator */ }; -@@ -277,7 +329,7 @@ static struct twl4030_platform_data beagle_twldata = { +@@ -281,7 +333,7 @@ static struct twl4030_platform_data beagle_twldata = { .vpll2 = &beagle_vpll2, }; @@ -94,7 +94,7 @@ index 41480bd..f3df638 100644 { I2C_BOARD_INFO("twl4030", 0x48), .flags = I2C_CLIENT_WAKE, -@@ -286,10 +338,24 @@ static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { +@@ -290,10 +342,24 @@ static struct i2c_board_info __initdata beagle_i2c_boardinfo[] = { }, }; @@ -121,7 +121,7 @@ index 41480bd..f3df638 100644 /* Bus 3 is attached to the DVI port where devices like the pico DLP * projector don't work reliably with 400kHz */ omap_register_i2c_bus(3, 100, NULL, 0); -@@ -434,6 +500,8 @@ static void __init omap3_beagle_init(void) +@@ -448,6 +514,8 @@ static void __init omap3_beagle_init(void) /* REVISIT leave DVI powered down until it's needed ... */ gpio_direction_output(170, true); @@ -131,5 +131,5 @@ index 41480bd..f3df638 100644 usb_ehci_init(&ehci_pdata); omap3beagle_flash_init(); -- -1.6.2.4 +1.6.6.1 diff --git a/recipes/linux/linux-omap-psp-2.6.32/0002-ARM-OMAP-ehci-omap-use-new-location-for-usb.h-inc.patch b/recipes/linux/linux-omap-psp-2.6.32/0002-ARM-OMAP-ehci-omap-use-new-location-for-usb.h-inc.patch deleted file mode 100644 index 7add534bc7..0000000000 --- a/recipes/linux/linux-omap-psp-2.6.32/0002-ARM-OMAP-ehci-omap-use-new-location-for-usb.h-inc.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 06e97c7ea488e350b7aae5f3864a1bbe0666db87 Mon Sep 17 00:00:00 2001 -From: Steve Sakoman <steve@sakoman.com> -Date: Tue, 15 Dec 2009 15:12:54 -0800 -Subject: [PATCH 02/16] ARM: OMAP: ehci-omap: use new location for usb.h include - ---- - drivers/usb/host/ehci-omap.c | 2 +- - 1 files changed, 1 insertions(+), 1 deletions(-) - -diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c -index 7ba8df3..5cfed78 100644 ---- a/drivers/usb/host/ehci-omap.c -+++ b/drivers/usb/host/ehci-omap.c -@@ -37,7 +37,7 @@ - #include <linux/platform_device.h> - #include <linux/clk.h> - #include <linux/gpio.h> --#include <mach/usb.h> -+#include <plat/usb.h> - - /* - * OMAP USBHOST Register addresses: VIRTUAL ADDRESSES --- -1.6.2.4 - diff --git a/recipes/linux/linux-omap-psp-2.6.32/0006-ARM-OMAP-Make-beagle-u-boot-partition-writable.patch b/recipes/linux/linux-omap-psp-2.6.32/0003-ARM-OMAP-Make-beagle-u-boot-partition-writable.patch index 3ad1853e3f..12eb5f4583 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/0006-ARM-OMAP-Make-beagle-u-boot-partition-writable.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/0003-ARM-OMAP-Make-beagle-u-boot-partition-writable.patch @@ -1,17 +1,17 @@ -From 2607d201fb202499533aa4a7fc788b4fa5fd1fcf Mon Sep 17 00:00:00 2001 +From 82cf37dd0850ede2122e1723118eb6ec3a4a7945 Mon Sep 17 00:00:00 2001 From: Steve Sakoman <steve@sakoman.com> Date: Thu, 17 Dec 2009 12:40:24 -0800 -Subject: [PATCH 06/16] ARM: OMAP: Make beagle u-boot partition writable +Subject: [PATCH 03/30] ARM: OMAP: Make beagle u-boot partition writable --- arch/arm/mach-omap2/board-omap3beagle.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c -index f3df638..d00b089 100644 +index ddfb9c0..9f72c7a 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c -@@ -108,7 +108,6 @@ static struct mtd_partition omap3beagle_nand_partitions[] = { +@@ -112,7 +112,6 @@ static struct mtd_partition omap3beagle_nand_partitions[] = { .name = "U-Boot", .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */ .size = 15 * NAND_BLOCK_SIZE, @@ -20,5 +20,5 @@ index f3df638..d00b089 100644 { .name = "U-Boot Env", -- -1.6.2.4 +1.6.6.1 diff --git a/recipes/linux/linux-omap-psp-2.6.32/dss2/0015-OMAP-DSS-Add-DSS2-support-for-Beagle.patch b/recipes/linux/linux-omap-psp-2.6.32/0004-board-omap3-beagle-add-DSS2-support.patch index ca5cd9fde7..40e1c0f82b 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/dss2/0015-OMAP-DSS-Add-DSS2-support-for-Beagle.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/0004-board-omap3-beagle-add-DSS2-support.patch @@ -1,5 +1,16 @@ ---- /tmp/board-omap3beagle.c 2009-12-22 10:47:35.000000000 +0100 -+++ git/arch/arm/mach-omap2/board-omap3beagle.c 2009-12-22 10:59:53.000000000 +0100 +From 98c074253ee9ca49b145b81843cceedbf7aebc55 Mon Sep 17 00:00:00 2001 +From: Koen Kooi <koen@dominion.thruhere.net> +Date: Wed, 10 Feb 2010 15:07:36 +0100 +Subject: [PATCH 04/30] board-omap3-beagle: add DSS2 support + +--- + arch/arm/mach-omap2/board-omap3beagle.c | 130 ++++++++++++++++++++++++------- + 1 files changed, 103 insertions(+), 27 deletions(-) + +diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c +index 9f72c7a..3b7f6ec 100644 +--- a/arch/arm/mach-omap2/board-omap3beagle.c ++++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -40,6 +40,7 @@ #include <plat/board.h> @@ -8,7 +19,7 @@ #include <plat/gpmc.h> #include <plat/nand.h> #include <plat/usb.h> -@@ -149,6 +150,105 @@ +@@ -153,6 +154,105 @@ static struct platform_device omap3beagle_nand_device = { .resource = &omap3beagle_nand_resource, }; @@ -114,7 +125,7 @@ #include "sdram-micron-mt46h32m32lf-6.h" static struct twl4030_hsmmc_info mmc[] = { -@@ -168,15 +268,6 @@ +@@ -172,15 +272,6 @@ static struct twl4030_hsmmc_info mmc[] = { {} /* Terminator */ }; @@ -130,7 +141,7 @@ static struct regulator_consumer_supply beagle_vmmc1_supply = { .supply = "vmmc", }; -@@ -232,16 +323,6 @@ +@@ -236,16 +327,6 @@ static struct twl4030_gpio_platform_data beagle_gpio_data = { .setup = beagle_twl_gpio_setup, }; @@ -147,7 +158,7 @@ /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ static struct regulator_init_data beagle_vmmc1 = { .constraints = { -@@ -419,14 +500,8 @@ +@@ -418,14 +499,8 @@ static struct platform_device keys_gpio = { }, }; @@ -160,9 +171,9 @@ - omap_board_config = omap3_beagle_config; - omap_board_config_size = ARRAY_SIZE(omap3_beagle_config); omap2_init_common_hw(mt46h32m32lf6_sdrc_params, - mt46h32m32lf6_sdrc_params); - omap_init_irq(); -@@ -437,9 +512,9 @@ + mt46h32m32lf6_sdrc_params, omap3_mpu_rate_table, + omap3_dsp_rate_table, omap3_l3_rate_table); +@@ -437,9 +512,9 @@ static void __init omap3_beagle_init_irq(void) } static struct platform_device *omap3_beagle_devices[] __initdata = { @@ -173,7 +184,7 @@ }; static void __init omap3beagle_flash_init(void) -@@ -522,8 +597,9 @@ +@@ -522,8 +597,9 @@ static void __init omap3_beagle_init(void) /* Ensure SDRC pins are mux'd for self-refresh */ omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); @@ -184,3 +195,6 @@ static void __init omap3_beagle_map_io(void) { omap2_set_globals_343x(); +-- +1.6.6.1 + diff --git a/recipes/linux/linux-omap-psp-2.6.32/beagleboard/0001-beagleboard-omap3_-foo-_rate_table-omap35x_-foo.patch b/recipes/linux/linux-omap-psp-2.6.32/0005-beagleboard-omap3_-foo-_rate_table-omap35x_-foo-_rat.patch index 9079185618..b4636315a1 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/beagleboard/0001-beagleboard-omap3_-foo-_rate_table-omap35x_-foo.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/0005-beagleboard-omap3_-foo-_rate_table-omap35x_-foo-_rat.patch @@ -1,7 +1,7 @@ -From 3f0c5ac9e0724a77adc7cd8f9ef058d8d7973ff6 Mon Sep 17 00:00:00 2001 -From: OpenEmbedded User <oe@OE-builder.(none)> +From 04dc08419ca56f03dd01e54a064cb17342165e02 Mon Sep 17 00:00:00 2001 +From: Koen Kooi <k-kooi@ti.com> Date: Wed, 27 Jan 2010 21:57:13 +0100 -Subject: [PATCH] beagleboard: omap3_<foo>_rate_table -> omap35x_<foo>_rate_table +Subject: [PATCH 05/30] beagleboard: omap3_<foo>_rate_table -> omap35x_<foo>_rate_table --- arch/arm/mach-omap2/board-omap3beagle.c | 4 ++-- @@ -23,5 +23,5 @@ index 3b7f6ec..1caaa01 100644 #ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer(12); -- -1.5.4.3 +1.6.6.1 diff --git a/recipes/linux/linux-omap-psp-2.6.32/beagleboard/0001-board-omap3beagle-prepare-for-DM3730-based-Beaglebo.patch b/recipes/linux/linux-omap-psp-2.6.32/0006-board-omap3beagle-prepare-for-DM3730-based-Beagleboa.patch index 4d2ca54583..c0af143b14 100644 --- a/recipes/linux/linux-omap-psp-2.6.32/beagleboard/0001-board-omap3beagle-prepare-for-DM3730-based-Beaglebo.patch +++ b/recipes/linux/linux-omap-psp-2.6.32/0006-board-omap3beagle-prepare-for-DM3730-based-Beagleboa.patch @@ -1,9 +1,9 @@ -From 99669461e2ddd9947c30bbd5e49561609cee1367 Mon Sep 17 00:00:00 2001 -From: OpenEmbedded User <oe@OE-builder.(none)> +From d9a0bb7553b59a0ecdd2cfdc8f26666492f298a9 Mon Sep 17 00:00:00 2001 +From: Koen Kooi <k-kooi@ti.com> Date: Mon, 8 Feb 2010 16:30:59 +0100 -Subject: [PATCH] board-omap3beagle: prepare for DM3730 based BeagleboardXM +Subject: [PATCH 06/30] board-omap3beagle: prepare for DM3730 based BeagleboardXM - * OPP changes copy/pasted from board-omap3evm.c +* OPP changes copy/pasted from board-omap3evm.c * EHCI changes copy/pasted from Steve Kipisz' 2.6.33rcX work --- arch/arm/mach-omap2/board-omap3beagle.c | 57 ++++++++++++++++++++++++++---- @@ -93,5 +93,5 @@ index 1caaa01..accf80d 100644 #ifdef CONFIG_OMAP_32K_TIMER omap2_gp_clockevent_set_gptimer(12); -- -1.5.4.3 +1.6.6.1 diff --git a/recipes/linux/linux-omap-psp-2.6.32/0007-mt9t111-first-stab-at-merging-sensor-driver-based-on.patch b/recipes/linux/linux-omap-psp-2.6.32/0007-mt9t111-first-stab-at-merging-sensor-driver-based-on.patch new file mode 100644 index 0000000000..8df955c617 --- /dev/null +++ b/recipes/linux/linux-omap-psp-2.6.32/0007-mt9t111-first-stab-at-merging-sensor-driver-based-on.patch @@ -0,0 +1,2394 @@ +From 0ea3408a0fb0cedddeea2c8f7dc887e559b1da5b Mon Sep 17 00:00:00 2001 +From: Koen Kooi <k-kooi@ti.com> +Date: Tue, 9 Feb 2010 17:16:13 +0100 +Subject: [PATCH 07/30] mt9t111: first stab at merging sensor driver based on a patch by Leopard Imaging + +--- + drivers/media/video/Kconfig | 8 + + drivers/media/video/Makefile | 1 + + drivers/media/video/mt9t111.c | 883 ++++++++++++++++++++++++ + drivers/media/video/mt9t111_reg.h | 1364 +++++++++++++++++++++++++++++++++++++ + include/media/mt9t111.h | 79 +++ + 5 files changed, 2335 insertions(+), 0 deletions(-) + create mode 100644 drivers/media/video/mt9t111.c + create mode 100644 drivers/media/video/mt9t111_reg.h + create mode 100644 include/media/mt9t111.h + +diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig +index 41e39a7..f67ed46 100644 +--- a/drivers/media/video/Kconfig ++++ b/drivers/media/video/Kconfig +@@ -344,6 +344,14 @@ 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 88e8ec1..31688bf 100644 +--- a/drivers/media/video/Makefile ++++ b/drivers/media/video/Makefile +@@ -127,6 +127,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_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 +new file mode 100644 +index 0000000..ecc5115 +--- /dev/null ++++ b/drivers/media/video/mt9t111.c +@@ -0,0 +1,883 @@ ++/* ++ * 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" ++ ++#define USE_RAW // YCbCr mode does not work yet ++//#define COLOR_BAR // Create a Color bar test pattern, Blue, Green, Red, Grey ++ ++#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 er |
