tizen 2.4 release
[profile/mobile/platform/kernel/linux-3.10-sc7730.git] / drivers / media / sprd_dcam / flash / flash_gpio.c
1 /*
2  * Copyright (C) 2012 Spreadtrum Communications Inc.
3  *
4  * This software is licensed under the terms of the GNU General Public
5  * License version 2, as published by the Free Software Foundation, and
6  * may be copied, distributed, and modified under those terms.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  */
13 #include <linux/module.h>
14 #include <linux/kernel.h>
15 #include <linux/init.h>
16
17 #ifndef CONFIG_64BIT
18 #include <soc/sprd/hardware.h>
19 #include <soc/sprd/board.h>
20 #include <soc/sprd/adi.h>
21 #endif
22
23 #include <asm/gpio.h>
24
25 #define SPRD_FLASH_ON           1
26 #define SPRD_FLASH_OFF          0
27
28 #undef GPIO_CAM_FLASH_EN
29 #define GPIO_CAM_FLASH_EN   131
30
31 int sprd_flash_on(void)
32 {
33         printk("sprd_flash_on \n");
34         gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
35         gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_ON);
36         gpio_free(GPIO_CAM_FLASH_EN);
37         return 0;
38 }
39
40 int sprd_flash_high_light(void)
41 {
42         printk("sprd_flash_high_light \n");
43         gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
44         gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_ON);
45         gpio_free(GPIO_CAM_FLASH_EN);
46         return 0;
47 }
48
49 int sprd_flash_close(void)
50 {
51         printk("sprd_flash_close \n");
52         gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
53         gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_OFF);
54         gpio_free(GPIO_CAM_FLASH_EN);
55         return 0;
56 }