2 * drivers/media/video/omap/h4_sensor_power.c
4 * H4 sensor powerup/down functions.
6 * Author: Andy Lowe (source@mvista.com)
8 * Copyright (C) 2004 MontaVista Software, Inc.
9 * Copyright (C) 2004 Texas Instruments.
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
16 #include <linux/module.h>
17 #include <linux/types.h>
19 #include <asm/arch/gpioexpander.h>
21 int h4_sensor_powerup(void);
22 int h4_sensor_powerdown(void);
25 h4_sensor_powerup(void)
30 /* read current state of GPIO EXPA outputs */
31 if ((err = read_gpio_expa(&expa, 0x20))) {
32 printk(KERN_ERR "Error reading GPIO EXPA\n");
35 /* Set GPIO EXPA P3 (CAMERA_MODULE_EN) to power-up sensor */
36 if ((err = write_gpio_expa(expa | 0x08, 0x20))) {
37 printk(KERN_ERR "Error writing to GPIO EXPA\n");
41 /* read current state of GPIO EXPA outputs */
42 if ((err = read_gpio_expa(&expa, 0x22))) {
43 printk(KERN_ERR "Error reading GPIO EXPA\n");
46 /* Clear GPIO EXPA P7 (CAM_RST) */
47 if ((err = write_gpio_expa(expa & ~0x80, 0x22))) {
48 printk(KERN_ERR "Error writing to GPIO EXPA\n");
56 h4_sensor_powerdown(void)
61 /* read current state of GPIO EXPA outputs */
62 if ((err = read_gpio_expa(&expa, 0x20))) {
63 printk(KERN_ERR "Error reading GPIO EXPA\n");
66 /* Clear GPIO EXPA P3 (CAMERA_MODULE_EN) to power-down sensor */
67 if ((err = write_gpio_expa(expa & ~0x08, 0x20))) {
68 printk(KERN_ERR "Error writing to GPIO EXPA\n");
75 EXPORT_SYMBOL(h4_sensor_powerup);
76 EXPORT_SYMBOL(h4_sensor_powerdown);