summaryrefslogtreecommitdiff
path: root/include/media
diff options
context:
space:
mode:
authorCharlie Huang <chahuang@nvidia.com>2012-09-12 12:25:59 -0700
committerMrutyunjay Sawant <msawant@nvidia.com>2012-10-19 06:44:27 -0700
commitf20a0e6d19c27bc763bd5320feefa3249d693235 (patch)
treeaffe279a38885a4755bf043d327c5b45dfa70744 /include/media
parente0beae60ae6f82f5300369204f122cd5f74e2960 (diff)
media: video: tegra: max77665 flash driver support
This flash is a sub-device of the maxim 77665a chip. It supports dual led output, with the features of torch/flash modes, timer out, and over-voltage protection, etc. bug 1035551 (cherry picked from commit 3d3341d2c3a693a00aa9fc9f123d8d9b51129513) Reviewed-on: http://git-master/r/139111 Change-Id: I299502c4f4fdce751d760d6796492f0e7342606e Signed-off-by: Charlie Huang <chahuang@nvidia.com> Reviewed-on: http://git-master/r/141859 Reviewed-by: Thomas Cherry <tcherry@nvidia.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/max77665-flash.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/include/media/max77665-flash.h b/include/media/max77665-flash.h
new file mode 100644
index 000000000000..0913e2e589de
--- /dev/null
+++ b/include/media/max77665-flash.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2012 NVIDIA Corporation.
+ *
+ * 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.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA
+ * 02111-1307, USA
+ */
+
+#ifndef __MAX77665_H__
+#define __MAX77665_H__
+
+#include <media/nvc_torch.h>
+
+struct max77665_f_power_rail {
+ /* to enable the module power */
+ struct regulator *vbus;
+ /* to enable the host interface power */
+ struct regulator *vio;
+ /* to enable the power on i2c bus */
+ struct regulator *i2c;
+};
+
+struct max77665_f_config {
+ u32 led_mask; /* led(s) enabled, 1/2/3 - left/right/both */
+ bool torch_on_flash_en; /* true=high level on the flash_en pin will
+ turn on torch */
+ u16 flash_mode; /* 1=one_shot_mode, flash is triggerred on the
+ rising edge of FLASHEN/TORCHEN/I2C_bit, and
+ terminated based on the flash safety timer
+ value.
+ 0, 2=run for MAX timer, flash is triggerred
+ on the rising edge of FLASHEN/TORCHEN/I2C,
+ and terminated based on the falling edge of
+ FLASHEN/TORCHEN/I2C_bit and flash safety
+ timer value, whichever comes first.*/
+ u16 torch_mode; /* 0, 1=torch safety timer disabled, torch is
+ controlled solely by the FLASHEN/TORCHEN/I2C.
+ 2=one_shot_mode, torch is triggerred on the
+ rising edge of FLASHEN/TORCHEN/I2C_bit, and
+ terminated based on the torch safety timer
+ setting.
+ 3=run for MAX timer, torch is triggerred on
+ he rising edge of FLASHEN/TORCHEN/I2C_bit,
+ and terminated based on the falling edge of
+ FLASHEN/TORCHEN/ I2C_bit and torch safety
+ timer setting, whichever comes first.*/
+ u16 adaptive_mode; /* 1=fix mode, 2=adaptive mode
+ The BYP starts from BOOST_VOUT_FLASH value.
+ Then increment by 100mV steps until there is
+ full programmed current across the LED(s).
+ Fixed mode otherwise: the BYP stays at
+ BOOST_VOUT_FLASH value */
+ u16 boost_vout_flash_mV; /* BOOST_VOUT_FLASH value */
+ /* LED configuration, two identical leds must be connected. */
+ u16 max_total_current_mA; /* Both leds' maximum peak current in mA */
+ u16 max_peak_current_mA; /* This led's maximum peak current in mA */
+ u16 max_torch_current_mA; /* This leds maximum torch current in mA */
+ u16 max_peak_duration_ms; /* the maximum duration max_peak_current_mA
+ can be applied */
+ u16 max_flash_threshold_mV; /* low battery detection threshold.
+ 2400mV ~ 3400mV. */
+ u16 max_flash_hysteresis_mV; /* low battery detection hysteresis.
+ 100mV ~ 300mV */
+ u16 max_flash_lbdly_f_uS; /* Low battery delay timer for falling edge
+ detection. Adjustable from 256uS to
+ 2048uS in 256uS steps. */
+ u16 max_flash_lbdly_r_uS; /* Low battery delay timer for raising edge
+ detection. Adjustable from 256uS to
+ 2048uS in 256uS steps. */
+};
+
+struct max77665_f_platform_data {
+ struct max77665_f_config config;
+ unsigned cfg; /* use the NVC_CFG_ defines */
+ unsigned num; /* see implementation notes in driver */
+ unsigned sync; /* see implementation notes in driver */
+ const char *dev_name; /* see implementation notes in driver */
+ struct nvc_torch_pin_state pinstate; /* see notes in driver */
+ unsigned gpio_strobe; /* GPIO connected to the ACT signal */
+
+ int (*power_get)(struct max77665_f_power_rail *pw);
+ int (*power_put)(struct max77665_f_power_rail *pw);
+ int (*poweron_callback)(struct max77665_f_power_rail *pw);
+ int (*poweroff_callback)(struct max77665_f_power_rail *pw);
+};
+
+#endif
+/* __MAX77665_H__ */