summaryrefslogtreecommitdiff
path: root/drivers/media/sprd_dcam/flash
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2017-08-30 08:25:59 +0000
committerYuval Adam <_@yuv.al>2017-08-30 08:25:59 +0000
commit8e4bff4cab0ddac6060645b0715210484d02ff40 (patch)
tree3a5c3024371a04692a3a6d9974d001cdff8ebf84 /drivers/media/sprd_dcam/flash
Initial file dump from open source releaseHEADmaster
Diffstat (limited to 'drivers/media/sprd_dcam/flash')
-rwxr-xr-xdrivers/media/sprd_dcam/flash/Makefile82
-rw-r--r--drivers/media/sprd_dcam/flash/flash.h22
-rw-r--r--drivers/media/sprd_dcam/flash/flash_common.c44
-rw-r--r--drivers/media/sprd_dcam/flash/flash_gpio.c56
-rw-r--r--drivers/media/sprd_dcam/flash/flash_kanas_w.c66
-rw-r--r--drivers/media/sprd_dcam/flash/flash_parallel_connect_bg.c103
-rw-r--r--drivers/media/sprd_dcam/flash/flash_sgm3140.c64
-rw-r--r--drivers/media/sprd_dcam/flash/flash_sm5701.c48
-rw-r--r--drivers/media/sprd_dcam/flash/flash_sprd_sm5701.c48
-rw-r--r--drivers/media/sprd_dcam/flash/flash_vivalto.c53
10 files changed, 586 insertions, 0 deletions
diff --git a/drivers/media/sprd_dcam/flash/Makefile b/drivers/media/sprd_dcam/flash/Makefile
new file mode 100755
index 00000000..5c1bbbd8
--- /dev/null
+++ b/drivers/media/sprd_dcam/flash/Makefile
@@ -0,0 +1,82 @@
+
+ifeq ($(CONFIG_MACH_VIVALTO),y)
+obj-y += flash_vivalto.o
+else
+ifeq ($(CONFIG_MACH_KANAS_W),y)
+obj-y += flash_kanas_w.o
+else
+ifeq ($(CONFIG_MACH_SP8730SEA),y)
+obj-y += flash_sgm3140.o
+else
+ifeq ($(CONFIG_MACH_SP9836AEA_4MOD),y)
+obj-y += flash_parallel_connect_bg.o
+else
+ifeq ($(CONFIG_MACH_SP9838AEA_5MOD),y)
+obj-y += flash_gpio.o
+else
+ifeq ($(CONFIG_MACH_SP9838AEA_POWER_DEBUG),y)
+obj-y += flash_gpio.o
+else
+ifeq ($(CONFIG_MACH_SP9838AEA_8CORE_LIGHT_SLEEP),y)
+obj-y += flash_gpio.o
+else
+ifeq ($(CONFIG_MACH_SP9838AEA_FHD),y)
+obj-y += flash_gpio.o
+else
+ifeq ($(CONFIG_MACH_SP9630EA4MN),y)
+obj-y += flash_parallel_connect_bg.o
+else
+ifeq ($(CONFIG_MACH_SP9836AEA_3MOD), y)
+obj-y += flash_parallel_connect_bg.o
+else
+ifeq ($(CONFIG_MACH_SP9830AEA_5M_H100), y)
+obj-y += flash_parallel_connect_bg.o
+else
+ifeq ($(CONFIG_MACH_SP9830IEB_5M_H100), y)
+obj-y += flash_parallel_connect_bg.o
+else
+ifeq ($(CONFIG_MACH_SP7720EA), y)
+obj-y += flash_parallel_connect_bg.o
+else
+ifeq ($(CONFIG_MACH_COREPRIMELITE),y)
+obj-y += flash_sm5701.o
+else
+ifeq ($(CONFIG_MACH_SP8730SEEA),y)
+obj-y += flash_sgm3140.o
+else
+ifeq ($(CONFIG_MACH_SP8730SEEA_QHD),y)
+obj-y += flash_sgm3140.o
+else
+ifeq ($(CONFIG_MACH_SP9830IEA_5M_H100),y)
+obj-y += flash_sprd_sm5701.o
+else
+ifeq ($(CONFIG_MACH_GRANDPRIME3G_VE),y)
+obj-y += flash_sm5701.o
+else
+ifeq ($(CONFIG_MACH_GRANDPRIME_DTV),y)
+obj-y += flash_sm5701.o
+else
+ifeq ($(CONFIG_MACH_COREPRIME3G_VE),y)
+obj-y += flash_sm5701.o
+else
+obj-y += flash_common.o
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
diff --git a/drivers/media/sprd_dcam/flash/flash.h b/drivers/media/sprd_dcam/flash/flash.h
new file mode 100644
index 00000000..ee686332
--- /dev/null
+++ b/drivers/media/sprd_dcam/flash/flash.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+
+#ifndef _DCAM_DRV_FLASH_H_
+#define _DCAM_DRV_FLASH_H_
+
+#include <linux/types.h>
+
+int sprd_flash_on(void);
+int sprd_flash_high_light(void);
+int sprd_flash_close(void);
+#endif
diff --git a/drivers/media/sprd_dcam/flash/flash_common.c b/drivers/media/sprd_dcam/flash/flash_common.c
new file mode 100644
index 00000000..492a823d
--- /dev/null
+++ b/drivers/media/sprd_dcam/flash/flash_common.c
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#ifndef CONFIG_64BIT
+#include <soc/sprd/hardware.h>
+#include <soc/sprd/board.h>
+#endif
+#include <soc/sprd/adi.h>
+#include "../common/parse_hwinfo.h"
+
+int sprd_flash_on(void)
+{
+ printk("sprd_flash_on \n");
+ sci_adi_clr(SPRD_ADISLAVE_BASE + SPRD_FLASH_OFST, SPRD_FLASH_HIGH_VAL);
+ sci_adi_set(SPRD_ADISLAVE_BASE + SPRD_FLASH_OFST, SPRD_FLASH_CTRL_BIT | SPRD_FLASH_LOW_VAL); /*0x3 = 110ma*/
+ return 0;
+}
+
+int sprd_flash_high_light(void)
+{
+ printk("sprd_flash_high_light \n");
+ sci_adi_clr(SPRD_ADISLAVE_BASE + SPRD_FLASH_OFST, SPRD_FLASH_HIGH_VAL);
+ sci_adi_set(SPRD_ADISLAVE_BASE + SPRD_FLASH_OFST, SPRD_FLASH_CTRL_BIT | ZTEHZ_FLASH_HIGH_VAL); /*0xB = 350ma*/
+ return 0;
+}
+
+int sprd_flash_close(void)
+{
+ printk("sprd_flash_close \n");
+ sci_adi_clr(SPRD_ADISLAVE_BASE + SPRD_FLASH_OFST, SPRD_FLASH_CTRL_BIT | SPRD_FLASH_HIGH_VAL);
+ return 0;
+}
diff --git a/drivers/media/sprd_dcam/flash/flash_gpio.c b/drivers/media/sprd_dcam/flash/flash_gpio.c
new file mode 100644
index 00000000..acbfc0f4
--- /dev/null
+++ b/drivers/media/sprd_dcam/flash/flash_gpio.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#ifndef CONFIG_64BIT
+#include <soc/sprd/hardware.h>
+#include <soc/sprd/board.h>
+#include <soc/sprd/adi.h>
+#endif
+
+#include <asm/gpio.h>
+
+#define SPRD_FLASH_ON 1
+#define SPRD_FLASH_OFF 0
+
+#undef GPIO_CAM_FLASH_EN
+#define GPIO_CAM_FLASH_EN 131
+
+int sprd_flash_on(void)
+{
+ printk("sprd_flash_on \n");
+ gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
+ gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_ON);
+ gpio_free(GPIO_CAM_FLASH_EN);
+ return 0;
+}
+
+int sprd_flash_high_light(void)
+{
+ printk("sprd_flash_high_light \n");
+ gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
+ gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_ON);
+ gpio_free(GPIO_CAM_FLASH_EN);
+ return 0;
+}
+
+int sprd_flash_close(void)
+{
+ printk("sprd_flash_close \n");
+ gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
+ gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_OFF);
+ gpio_free(GPIO_CAM_FLASH_EN);
+ return 0;
+}
diff --git a/drivers/media/sprd_dcam/flash/flash_kanas_w.c b/drivers/media/sprd_dcam/flash/flash_kanas_w.c
new file mode 100644
index 00000000..de606207
--- /dev/null
+++ b/drivers/media/sprd_dcam/flash/flash_kanas_w.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#ifndef CONFIG_64BIT
+#include <mach/hardware.h>
+#include <mach/board.h>
+#include <mach/adi.h>
+#endif
+
+#include <linux/leds/flashlight.h>
+
+struct flashlight_device* sprd_get_flashlight_by_name(void)
+{
+ struct flashlight_device* flash_ptr = NULL;
+
+ flash_ptr = find_flashlight_by_name("rt-flash-led");
+ if (NULL == flash_ptr) {
+ printk("sprd_get_flashlight_by_name: flash_ptr is PNULL \n");
+ return NULL;
+ }
+ flashlight_set_mode(flash_ptr, FLASHLIGHT_MODE_FLASH);
+ return flash_ptr;
+}
+
+int sprd_flash_on(void)
+{
+ struct flashlight_device* flash_ptr = NULL;
+
+ flash_ptr = sprd_get_flashlight_by_name();
+ printk("sprd_flash_on kanas w \n");
+ flashlight_strobe(flash_ptr);
+ return 0;
+}
+
+int sprd_flash_high_light(void)
+{
+ struct flashlight_device* flash_ptr = NULL;
+
+ flash_ptr = sprd_get_flashlight_by_name();
+ printk("sprd_flash_high_light kanas w \n");
+ flashlight_strobe(flash_ptr);
+ return 0;
+}
+
+int sprd_flash_close(void)
+{
+ struct flashlight_device* flash_ptr = NULL;
+
+ flash_ptr = sprd_get_flashlight_by_name();
+ printk("sprd_flash_close kanas w \n");
+ flashlight_set_mode(flash_ptr, FLASHLIGHT_MODE_OFF);
+ return 0;
+}
diff --git a/drivers/media/sprd_dcam/flash/flash_parallel_connect_bg.c b/drivers/media/sprd_dcam/flash/flash_parallel_connect_bg.c
new file mode 100644
index 00000000..340a87c1
--- /dev/null
+++ b/drivers/media/sprd_dcam/flash/flash_parallel_connect_bg.c
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#ifndef CONFIG_64BIT
+#include <soc/sprd/hardware.h>
+#include <soc/sprd/board.h>
+#endif
+#include <soc/sprd/adi.h>
+#include "../common/parse_hwinfo.h"
+
+#define SPRD_PWM0_CTRL_OFST 0xEC
+#define SPRD_PWM0_PATTERN_HIGHT_OFST 0x10
+#define SPRD_PWM0_PATTERT_LOW_OFST 0xC
+#define SPRD_PWM0_TONE_OFST 0x8
+#define SPRD_PWM0_RATION_OFST 0x4
+#define SPRD_WHTLED_CTRL_OFST 0xF0
+
+extern int sci_efuse_ib_trim_get(unsigned int *p_cal_data);
+
+unsigned int ib_trim_cal_data = 0;
+static int init_flag = 1;
+
+int sprd_flash_on(void)
+{
+ if (init_flag && sci_efuse_ib_trim_get(&ib_trim_cal_data)) {
+ /*
+ 1. set ib_trim_cal_data to WHTLED_CTRL的IB_TRIM(0x400388F0 [15:9])
+ 2. set IB_TRIM_EM_SEL of RGB_CTRL to 0(0x400388EC [11])
+ */
+ sci_adi_clr(ANA_CTL_GLB_BASE + SPRD_WHTLED_CTRL_OFST, 0x7F << 9);
+ sci_adi_set(ANA_CTL_GLB_BASE + SPRD_WHTLED_CTRL_OFST, (ib_trim_cal_data & 0x7F) << 9);
+ sci_adi_clr(ANA_CTL_GLB_BASE + SPRD_PWM0_CTRL_OFST, (0x1 << 11));
+ init_flag = 0;
+ printk("parallel sprd_flash_on trim = %d\n", ib_trim_cal_data);
+ }
+
+ printk("parallel sprd_flash_on \n");
+ /*ENABLE THE PWM0 CONTROLLTER: RTC_PWM0_EN=1 & PWM0_EN=1*/
+ sci_adi_clr(ANA_CTL_GLB_BASE + SPRD_PWM0_CTRL_OFST, 0xFFFF);
+ sci_adi_set(ANA_CTL_GLB_BASE + SPRD_PWM0_CTRL_OFST, 0xC805);
+
+ /*SET PWM0 PATTERN HIGH*/
+ sci_adi_set(ANA_PWM_BASE + SPRD_PWM0_PATTERN_HIGHT_OFST, 0xFFFF);
+
+ /*SET PWM0 PATTERN LOW*/
+ sci_adi_set(ANA_PWM_BASE + SPRD_PWM0_PATTERT_LOW_OFST, 0xFFFF);
+
+ /*TONE DIV USE DEFAULT VALUE*/
+ sci_adi_clr(ANA_PWM_BASE + SPRD_PWM0_TONE_OFST, 0x0100);
+
+ /*SET PWM0 DUTY RATIO = 100%: MOD=FF & DUTY=FF*/
+ sci_adi_set(ANA_PWM_BASE + SPRD_PWM0_RATION_OFST, 0x0100);
+
+ /*ENABLE PWM0 OUTPUT: PWM0_EN=1*/
+ sci_adi_set(ANA_PWM_BASE, 0x100);
+
+ /*SET LOW LIGHT */
+ sci_adi_clr(ANA_CTL_GLB_BASE + SPRD_WHTLED_CTRL_OFST, 0xFFFF);
+ sci_adi_set(ANA_CTL_GLB_BASE + SPRD_WHTLED_CTRL_OFST, 0x1e);
+
+ /*ENABLE WHTLED*/
+ sci_adi_clr(ANA_CTL_GLB_BASE + SPRD_WHTLED_CTRL_OFST, 0x1);
+ return 0;
+}
+
+int sprd_flash_high_light(void)
+{
+ printk("parallel sprd_flash_high_light \n");
+ /*SET HIGH LIGHT*/
+ sci_adi_clr(ANA_CTL_GLB_BASE + SPRD_WHTLED_CTRL_OFST, 0xFFFF);
+ sci_adi_set(ANA_CTL_GLB_BASE + SPRD_WHTLED_CTRL_OFST, 0x40);
+ /*ENABLE WHTLED*/
+ sci_adi_clr(ANA_CTL_GLB_BASE + SPRD_WHTLED_CTRL_OFST, 0x1);
+ return 0;
+}
+
+int sprd_flash_close(void)
+{
+ printk("parallel sprd_flash_close \n");
+
+ /*DISABLE WHTLED*/
+ sci_adi_clr(ANA_CTL_GLB_BASE + SPRD_WHTLED_CTRL_OFST, 0xFFFF);
+ sci_adi_set(ANA_CTL_GLB_BASE + SPRD_WHTLED_CTRL_OFST, 0x1);
+
+ /*DISABLE THE PWM0 CONTROLLTER: RTC_PWM0_EN=0 & PWM0_EN=0*/
+ sci_adi_clr(ANA_CTL_GLB_BASE + SPRD_PWM0_CTRL_OFST, 0xC000);
+
+ /*ENABLE PWM0 OUTPUT: PWM0_EN=0*/
+ sci_adi_clr(ANA_PWM_BASE, 0x100);
+ return 0;
+}
diff --git a/drivers/media/sprd_dcam/flash/flash_sgm3140.c b/drivers/media/sprd_dcam/flash/flash_sgm3140.c
new file mode 100644
index 00000000..81490416
--- /dev/null
+++ b/drivers/media/sprd_dcam/flash/flash_sgm3140.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#ifndef CONFIG_64BIT
+#include <soc/sprd/board.h>
+#include <soc/sprd/hardware.h>
+#include <soc/sprd/adi.h>
+#endif
+
+#include <asm/gpio.h>
+
+#define SPRD_FLASH_ON 1
+#define SPRD_FLASH_OFF 0
+
+int sprd_flash_on(void)
+{
+ printk("sprd_flash_on \n");
+ gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
+ gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_ON);
+ gpio_free(GPIO_CAM_FLASH_EN);
+
+ gpio_request(GPIO_CAM_FLASH_MODE,"cam_flash_mode");
+ gpio_direction_output(GPIO_CAM_FLASH_MODE, SPRD_FLASH_OFF);
+ gpio_free(GPIO_CAM_FLASH_MODE);
+ return 0;
+}
+
+int sprd_flash_high_light(void)
+{
+ printk("sprd_flash_high_light \n");
+ gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
+ gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_ON);
+ gpio_free(GPIO_CAM_FLASH_EN);
+
+ gpio_request(GPIO_CAM_FLASH_MODE,"cam_flash_mode");
+ gpio_direction_output(GPIO_CAM_FLASH_MODE, SPRD_FLASH_ON);
+ gpio_free(GPIO_CAM_FLASH_MODE);
+ return 0;
+}
+
+int sprd_flash_close(void)
+{
+ printk("sprd_flash_close \n");
+ gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
+ gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_OFF);
+ gpio_free(GPIO_CAM_FLASH_EN);
+
+ gpio_request(GPIO_CAM_FLASH_MODE,"cam_flash_mode");
+ gpio_direction_output(GPIO_CAM_FLASH_MODE, SPRD_FLASH_OFF);
+ gpio_free(GPIO_CAM_FLASH_MODE);
+ return 0;
+}
diff --git a/drivers/media/sprd_dcam/flash/flash_sm5701.c b/drivers/media/sprd_dcam/flash/flash_sm5701.c
new file mode 100644
index 00000000..81354ec1
--- /dev/null
+++ b/drivers/media/sprd_dcam/flash/flash_sm5701.c
@@ -0,0 +1,48 @@
+/*
+* * Copyright (C) 2012 Spreadtrum Communications Inc.
+* *
+* * This software is licensed under the terms of the GNU General Public
+* * License version 2, as published by the Free Software Foundation, and
+* * may be copied, distributed, and modified under those terms.
+* *
+* * 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.
+* */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <soc/sprd/hardware.h>
+#include <soc/sprd/board.h>
+#include <soc/sprd/adi.h>
+#include <linux/leds.h>
+#include <linux/mfd/sm5701_core.h>
+
+int sprd_flash_on(void)
+{
+ printk("sprd_flash_on\n");
+ sm5701_led_ready(MOVIE_MODE);
+ sm5701_set_fleden(SM5701_FLEDEN_ON_MOVIE);
+
+ return 0;
+}
+
+int sprd_flash_high_light(void)
+{
+ printk("sprd_flash_high_light\n");
+ sm5701_led_ready(FLASH_MODE);
+ sm5701_set_fleden(SM5701_FLEDEN_ON_FLASH);
+
+ return 0;
+}
+
+int sprd_flash_close(void)
+{
+ printk("sprd_flash_close\n");
+ sm5701_set_fleden(SM5701_FLEDEN_DISABLED);
+ sm5701_led_ready(LED_DISABLE);
+
+ return 0;
+}
+
diff --git a/drivers/media/sprd_dcam/flash/flash_sprd_sm5701.c b/drivers/media/sprd_dcam/flash/flash_sprd_sm5701.c
new file mode 100644
index 00000000..746495ab
--- /dev/null
+++ b/drivers/media/sprd_dcam/flash/flash_sprd_sm5701.c
@@ -0,0 +1,48 @@
+/*
+* * Copyright (C) 2012 Spreadtrum Communications Inc.
+* *
+* * This software is licensed under the terms of the GNU General Public
+* * License version 2, as published by the Free Software Foundation, and
+* * may be copied, distributed, and modified under those terms.
+* *
+* * 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.
+* */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <soc/sprd/hardware.h>
+#include <soc/sprd/board.h>
+#include <soc/sprd/adi.h>
+#include <linux/leds.h>
+#include <linux/mfd/sprd_sm5701_core.h>
+
+int sprd_flash_on(void)
+{
+
+ sm5701_led_ready(MOVIE_MODE);
+ sm5701_set_fleden(SM5701_FLEDEN_ON_MOVIE);
+
+ return 0;
+}
+
+int sprd_flash_high_light(void)
+{
+
+ sm5701_led_ready(FLASH_MODE);
+ sm5701_set_fleden(SM5701_FLEDEN_ON_FLASH);
+
+ return 0;
+}
+
+int sprd_flash_close(void)
+{
+
+ sm5701_set_fleden(SM5701_FLEDEN_DISABLED);
+ sm5701_led_ready(LED_DISABLE);
+
+ return 0;
+}
+
diff --git a/drivers/media/sprd_dcam/flash/flash_vivalto.c b/drivers/media/sprd_dcam/flash/flash_vivalto.c
new file mode 100644
index 00000000..e020933c
--- /dev/null
+++ b/drivers/media/sprd_dcam/flash/flash_vivalto.c
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2012 Spreadtrum Communications Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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.
+ */
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#ifndef CONFIG_64BIT
+#include <mach/hardware.h>
+#include <mach/board.h>
+#include <mach/adi.h>
+#endif
+
+#include <asm/gpio.h>
+
+#define SPRD_FLASH_ON 1
+#define SPRD_FLASH_OFF 0
+
+int sprd_flash_on(void)
+{
+ printk("sprd_flash_on \n");
+ gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
+ gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_ON);
+ gpio_free(GPIO_CAM_FLASH_EN);
+ return 0;
+}
+
+int sprd_flash_high_light(void)
+{
+ printk("sprd_flash_high_light \n");
+ gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
+ gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_ON);
+ gpio_free(GPIO_CAM_FLASH_EN);
+ return 0;
+}
+
+int sprd_flash_close(void)
+{
+ printk("sprd_flash_close \n");
+ gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
+ gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_OFF);
+ gpio_free(GPIO_CAM_FLASH_EN);
+ return 0;
+}