1 /* 2 * Copyright (C) 2010 Motorola, Inc. 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 as 6 * published by the Free Software Foundation. 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 * You should have received a copy of the GNU General Public License 14 * along with this program; if not, write to the Free Software 15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 16 * 02111-1307, USA 17 */ 18 19 #ifndef __SOC2030_H__ 20 #define __SOC2030_H__ 21 22 #include <linux/ioctl.h> /* For IOCTL macros */ 23 24 #define SOC2030_IOCTL_SET_MODE _IOWR('o', 1, struct soc2030_mode) 25 #define SOC2030_IOCTL_GET_STATUS _IOC(_IOC_READ, 'o', 2, 10) 26 #define SOC2030_IOCTL_SET_PRIVATE _IOWR('o', 3, struct soc2030_regs) 27 #define SOC2030_IOCTL_GET_MODES _IO('o', 4) 28 #define SOC2030_IOCTL_GET_NUM_MODES _IOR('o', 5, unsigned int) 29 #define SOC2030_IOCTL_SET_EFFECT _IOWR('o', 6, unsigned int) 30 #define SOC2030_IOCTL_SET_WHITEBALANCE _IOWR('o', 7, unsigned int) 31 #define SOC2030_IOCTL_SET_EXP_COMP _IOWR('o', 8, int) 32 #define SOC2030_IOCTL_SET_LOCK _IOWR('o', 9, struct soc2030_lock) 33 34 #define SOC2030_POLL_WAITMS 50 35 #define SOC2030_MAX_RETRIES 3 36 #define SOC2030_POLL_RETRIES 7 37 38 #define SOC2030_MAX_PRIVATE_SIZE 1024 39 #define SOC2030_MAX_NUM_MODES 6 40 41 #define SOC_EV_MAX 2 42 #define SOC_EV_MIN -2 43 #define EXP_TARGET 0x32 44 45 enum { 46 REG_TABLE_END, 47 WRITE_REG_DATA, 48 WRITE_REG_BIT_H, 49 WRITE_REG_BIT_L, 50 POLL_REG_DATA, 51 POLL_REG_BIT_H, 52 POLL_REG_BIT_L, 53 WRITE_VAR_DATA, 54 POLL_VAR_DATA, 55 DELAY_MS, 56 WRITE_REG_VAR1, 57 WRITE_REG_VAR2, 58 WRITE_REG_VAR3, 59 WRITE_REG_VAR4, 60 READ_REG_VAR1, 61 READ_REG_VAR2, 62 READ_REG_VAR3, 63 READ_REG_VAR4, 64 }; 65 66 #define REG_VAR1 (READ_REG_VAR1 - READ_REG_VAR1) 67 #define REG_VAR2 (READ_REG_VAR2 - READ_REG_VAR1) 68 #define REG_VAR3 (READ_REG_VAR3 - READ_REG_VAR1) 69 #define REG_VAR4 (READ_REG_VAR4 - READ_REG_VAR1) 70 71 enum { 72 EFFECT_NONE, 73 EFFECT_BW, 74 EFFECT_NEGATIVE, 75 EFFECT_POSTERIZE, 76 EFFECT_SEPIA, 77 EFFECT_SOLARIZE, 78 EFFECT_AQUA, 79 EFFECT_MAX, 80 }; 81 82 enum { 83 WB_AUTO, 84 WB_INCANDESCENT, 85 WB_FLUORESCENT, 86 WB_DAYLIGHT, 87 WB_CLOUDYDAYLIGHT, 88 WB_NIGHT, 89 WB_MAX, 90 }; 91 92 struct soc2030_regs { 93 __u8 op; 94 __u16 addr; 95 __u16 val; 96 }; 97 98 struct soc2030_lock { 99 __u8 aelock; 100 __u8 aerelock; 101 __u8 awblock; 102 __u8 awbrelock; 103 __u8 previewactive; 104 }; 105 106 struct soc2030_mode { 107 int xres; 108 int yres; 109 int fps; 110 struct soc2030_regs *regset; 111 }; 112 113 #ifdef __KERNEL__ 114 struct soc2030_platform_data { 115 int (*power_on)(void); 116 int (*power_off)(void); 117 118 }; 119 #endif /* __KERNEL__ */ 120 121 #endif /* __SOC2030_H__ */ 122