1 /* 2 * include/media/i2c/lm3560.h 3 * 4 * Copyright (C) 2013 Texas Instruments 5 * 6 * Contact: Daniel Jeong <gshark.jeong@gmail.com> 7 * Ldd-Mlp <ldd-mlp@list.ti.com> 8 * 9 * This program is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU General Public License 11 * version 2 as published by the Free Software Foundation. 12 * 13 * This program is distributed in the hope that it will be useful, but 14 * WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * General Public License for more details. 17 * 18 */ 19 20 #ifndef __LM3560_H__ 21 #define __LM3560_H__ 22 23 #include <media/v4l2-subdev.h> 24 25 #define LM3560_NAME "lm3560" 26 #define LM3560_I2C_ADDR (0x53) 27 28 /* FLASH Brightness 29 * min 62500uA, step 62500uA, max 1000000uA 30 */ 31 #define LM3560_FLASH_BRT_MIN 62500 32 #define LM3560_FLASH_BRT_STEP 62500 33 #define LM3560_FLASH_BRT_MAX 1000000 34 #define LM3560_FLASH_BRT_uA_TO_REG(a) \ 35 ((a) < LM3560_FLASH_BRT_MIN ? 0 : \ 36 (((a) - LM3560_FLASH_BRT_MIN) / LM3560_FLASH_BRT_STEP)) 37 #define LM3560_FLASH_BRT_REG_TO_uA(a) \ 38 ((a) * LM3560_FLASH_BRT_STEP + LM3560_FLASH_BRT_MIN) 39 40 /* FLASH TIMEOUT DURATION 41 * min 32ms, step 32ms, max 1024ms 42 */ 43 #define LM3560_FLASH_TOUT_MIN 32 44 #define LM3560_FLASH_TOUT_STEP 32 45 #define LM3560_FLASH_TOUT_MAX 1024 46 #define LM3560_FLASH_TOUT_ms_TO_REG(a) \ 47 ((a) < LM3560_FLASH_TOUT_MIN ? 0 : \ 48 (((a) - LM3560_FLASH_TOUT_MIN) / LM3560_FLASH_TOUT_STEP)) 49 #define LM3560_FLASH_TOUT_REG_TO_ms(a) \ 50 ((a) * LM3560_FLASH_TOUT_STEP + LM3560_FLASH_TOUT_MIN) 51 52 /* TORCH BRT 53 * min 31250uA, step 31250uA, max 250000uA 54 */ 55 #define LM3560_TORCH_BRT_MIN 31250 56 #define LM3560_TORCH_BRT_STEP 31250 57 #define LM3560_TORCH_BRT_MAX 250000 58 #define LM3560_TORCH_BRT_uA_TO_REG(a) \ 59 ((a) < LM3560_TORCH_BRT_MIN ? 0 : \ 60 (((a) - LM3560_TORCH_BRT_MIN) / LM3560_TORCH_BRT_STEP)) 61 #define LM3560_TORCH_BRT_REG_TO_uA(a) \ 62 ((a) * LM3560_TORCH_BRT_STEP + LM3560_TORCH_BRT_MIN) 63 64 enum lm3560_led_id { 65 LM3560_LED0 = 0, 66 LM3560_LED1, 67 LM3560_LED_MAX 68 }; 69 70 enum lm3560_peak_current { 71 LM3560_PEAK_1600mA = 0x00, 72 LM3560_PEAK_2300mA = 0x20, 73 LM3560_PEAK_3000mA = 0x40, 74 LM3560_PEAK_3600mA = 0x60 75 }; 76 77 /* struct lm3560_platform_data 78 * 79 * @peak : peak current 80 * @max_flash_timeout: flash timeout 81 * @max_flash_brt: flash mode led brightness 82 * @max_torch_brt: torch mode led brightness 83 */ 84 struct lm3560_platform_data { 85 enum lm3560_peak_current peak; 86 87 u32 max_flash_timeout; 88 u32 max_flash_brt[LM3560_LED_MAX]; 89 u32 max_torch_brt[LM3560_LED_MAX]; 90 }; 91 92 #endif /* __LM3560_H__ */ 93