diff options
Diffstat (limited to 'drivers/usb/input/yealink.h')
| -rw-r--r-- | drivers/usb/input/yealink.h | 220 |
1 files changed, 220 insertions, 0 deletions
diff --git a/drivers/usb/input/yealink.h b/drivers/usb/input/yealink.h new file mode 100644 index 000000000000..48af0be9cbdf --- /dev/null +++ b/drivers/usb/input/yealink.h | |||
| @@ -0,0 +1,220 @@ | |||
| 1 | /* | ||
| 2 | * drivers/usb/input/yealink.h | ||
| 3 | * | ||
| 4 | * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com> | ||
| 5 | * | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License as | ||
| 9 | * published by the Free Software Foundation; either version 2 of | ||
| 10 | * the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 20 | */ | ||
| 21 | #ifndef INPUT_YEALINK_H | ||
| 22 | #define INPUT_YEALINK_H | ||
| 23 | |||
| 24 | /* Using the control channel on interface 3 various aspects of the phone | ||
| 25 | * can be controlled like LCD, LED, dialtone and the ringtone. | ||
| 26 | */ | ||
| 27 | |||
| 28 | struct yld_ctl_packet { | ||
| 29 | u8 cmd; /* command code, see below */ | ||
| 30 | u8 size; /* 1-11, size of used data bytes. */ | ||
| 31 | u16 offset; /* internal packet offset */ | ||
| 32 | u8 data[11]; | ||
| 33 | s8 sum; /* negative sum of 15 preceding bytes */ | ||
| 34 | } __attribute__ ((packed)); | ||
| 35 | |||
| 36 | #define USB_PKT_LEN sizeof(struct yld_ctl_packet) | ||
| 37 | |||
| 38 | /* The following yld_ctl_packet's are available: */ | ||
| 39 | |||
| 40 | /* Init registers | ||
| 41 | * | ||
| 42 | * cmd 0x8e | ||
| 43 | * size 10 | ||
| 44 | * offset 0 | ||
| 45 | * data 0,0,0,0.... | ||
| 46 | */ | ||
| 47 | #define CMD_INIT 0x8e | ||
| 48 | |||
| 49 | /* Request key scan | ||
| 50 | * | ||
| 51 | * cmd 0x80 | ||
| 52 | * size 1 | ||
| 53 | * offset 0 | ||
| 54 | * data[0] on return returns the key number, if it changes there's a new | ||
| 55 | * key pressed. | ||
| 56 | */ | ||
| 57 | #define CMD_KEYPRESS 0x80 | ||
| 58 | |||
| 59 | /* Request scancode | ||
| 60 | * | ||
| 61 | * cmd 0x81 | ||
| 62 | * size 1 | ||
| 63 | * offset key number [0-1f] | ||
| 64 | * data[0] on return returns the scancode | ||
| 65 | */ | ||
| 66 | #define CMD_SCANCODE 0x81 | ||
| 67 | |||
| 68 | /* Set LCD | ||
| 69 | * | ||
| 70 | * cmd 0x04 | ||
| 71 | * size 1-11 | ||
| 72 | * offset 0-23 | ||
| 73 | * data segment bits | ||
| 74 | */ | ||
| 75 | #define CMD_LCD 0x04 | ||
| 76 | |||
| 77 | /* Set led | ||
| 78 | * | ||
| 79 | * cmd 0x05 | ||
| 80 | * size 1 | ||
| 81 | * offset 0 | ||
| 82 | * data[0] 0 OFF / 1 ON | ||
| 83 | */ | ||
| 84 | #define CMD_LED 0x05 | ||
| 85 | |||
| 86 | /* Set ringtone volume | ||
| 87 | * | ||
| 88 | * cmd 0x11 | ||
| 89 | * size 1 | ||
| 90 | * offset 0 | ||
| 91 | * data[0] 0-0xff volume | ||
| 92 | */ | ||
| 93 | #define CMD_RING_VOLUME 0x11 | ||
| 94 | |||
| 95 | /* Set ringtone notes | ||
| 96 | * | ||
| 97 | * cmd 0x02 | ||
| 98 | * size 1-11 | ||
| 99 | * offset 0-> | ||
| 100 | * data binary representation LE16(-freq), LE16(duration) .... | ||
| 101 | */ | ||
| 102 | #define CMD_RING_NOTE 0x02 | ||
| 103 | |||
| 104 | /* Sound ringtone via the speaker on the back | ||
| 105 | * | ||
| 106 | * cmd 0x03 | ||
| 107 | * size 1 | ||
| 108 | * offset 0 | ||
| 109 | * data[0] 0 OFF / 0x24 ON | ||
| 110 | */ | ||
| 111 | #define CMD_RINGTONE 0x03 | ||
| 112 | |||
| 113 | /* Sound dial tone via the ear speaker | ||
| 114 | * | ||
| 115 | * cmd 0x09 | ||
| 116 | * size 1 | ||
| 117 | * offset 0 | ||
| 118 | * data[0] 0 OFF / 1 ON | ||
| 119 | */ | ||
| 120 | #define CMD_DIALTONE 0x09 | ||
| 121 | |||
| 122 | #endif /* INPUT_YEALINK_H */ | ||
| 123 | |||
| 124 | |||
| 125 | #if defined(_SEG) && defined(_PIC) | ||
| 126 | /* This table maps the LCD segments onto individual bit positions in the | ||
| 127 | * yld_status struct. | ||
| 128 | */ | ||
| 129 | |||
| 130 | /* LCD, each segment must be driven seperately. | ||
| 131 | * | ||
| 132 | * Layout: | ||
| 133 | * | ||
| 134 | * |[] [][] [][] [][] in |[][] | ||
| 135 | * |[] M [][] D [][] : [][] out |[][] | ||
| 136 | * store | ||
| 137 | * | ||
| 138 | * NEW REP SU MO TU WE TH FR SA | ||
| 139 | * | ||
| 140 | * [] [] [] [] [] [] [] [] [] [] [] [] | ||
| 141 | * [] [] [] [] [] [] [] [] [] [] [] [] | ||
| 142 | */ | ||
| 143 | |||
| 144 | /* Line 1 | ||
| 145 | * Format : 18.e8.M8.88...188 | ||
| 146 | * Icon names : M D : IN OUT STORE | ||
| 147 | */ | ||
| 148 | #define LCD_LINE1_OFFSET 0 | ||
| 149 | #define LCD_LINE1_SIZE 17 | ||
| 150 | |||
| 151 | /* Note: first g then f => ! ! */ | ||
| 152 | /* _SEG( type a b c d e g f ) */ | ||
| 153 | _SEG('1', 0,0 , 22,2 , 22,2 , 0,0 , 0,0 , 0,0 , 0,0 ), | ||
| 154 | _SEG('8', 20,1 , 20,2 , 20,4 , 20,8 , 21,4 , 21,2 , 21,1 ), | ||
| 155 | _PIC('.', 22,1 , "M" ), | ||
| 156 | _SEG('e', 18,1 , 18,2 , 18,4 , 18,1 , 19,2 , 18,1 , 19,1 ), | ||
| 157 | _SEG('8', 16,1 , 16,2 , 16,4 , 16,8 , 17,4 , 17,2 , 17,1 ), | ||
| 158 | _PIC('.', 15,8 , "D" ), | ||
| 159 | _SEG('M', 14,1 , 14,2 , 14,4 , 14,1 , 15,4 , 15,2 , 15,1 ), | ||
| 160 | _SEG('8', 12,1 , 12,2 , 12,4 , 12,8 , 13,4 , 13,2 , 13,1 ), | ||
| 161 | _PIC('.', 11,8 , ":" ), | ||
| 162 | _SEG('8', 10,1 , 10,2 , 10,4 , 10,8 , 11,4 , 11,2 , 11,1 ), | ||
| 163 | _SEG('8', 8,1 , 8,2 , 8,4 , 8,8 , 9,4 , 9,2 , 9,1 ), | ||
| 164 | _PIC('.', 7,1 , "IN" ), | ||
| 165 | _PIC('.', 7,2 , "OUT" ), | ||
| 166 | _PIC('.', 7,4 , "STORE" ), | ||
| 167 | _SEG('1', 0,0 , 5,1 , 5,1 , 0,0 , 0,0 , 0,0 , 0,0 ), | ||
| 168 | _SEG('8', 4,1 , 4,2 , 4,4 , 4,8 , 5,8 , 5,4 , 5,2 ), | ||
| 169 | _SEG('8', 2,1 , 2,2 , 2,4 , 2,8 , 3,4 , 3,2 , 3,1 ), | ||
| 170 | |||
| 171 | /* Line 2 | ||
| 172 | * Format : ......... | ||
| 173 | * Pict. name : NEW REP SU MO TU WE TH FR SA | ||
| 174 | */ | ||
| 175 | #define LCD_LINE2_OFFSET LCD_LINE1_OFFSET + LCD_LINE1_SIZE | ||
| 176 | #define LCD_LINE2_SIZE 9 | ||
| 177 | |||
| 178 | _PIC('.', 23,2 , "NEW" ), | ||
| 179 | _PIC('.', 23,4 , "REP" ), | ||
| 180 | _PIC('.', 1,8 , "SU" ), | ||
| 181 | _PIC('.', 1,4 , "MO" ), | ||
| 182 | _PIC('.', 1,2 , "TU" ), | ||
| 183 | _PIC('.', 1,1 , "WE" ), | ||
| 184 | _PIC('.', 0,1 , "TH" ), | ||
| 185 | _PIC('.', 0,2 , "FR" ), | ||
| 186 | _PIC('.', 0,4 , "SA" ), | ||
| 187 | |||
| 188 | /* Line 3 | ||
| 189 | * Format : 888888888888 | ||
| 190 | */ | ||
| 191 | #define LCD_LINE3_OFFSET LCD_LINE2_OFFSET + LCD_LINE2_SIZE | ||
| 192 | #define LCD_LINE3_SIZE 12 | ||
| 193 | |||
| 194 | _SEG('8', 22,16, 22,32, 22,64, 22,128, 23,128, 23,64, 23,32 ), | ||
| 195 | _SEG('8', 20,16, 20,32, 20,64, 20,128, 21,128, 21,64, 21,32 ), | ||
| 196 | _SEG('8', 18,16, 18,32, 18,64, 18,128, 19,128, 19,64, 19,32 ), | ||
| 197 | _SEG('8', 16,16, 16,32, 16,64, 16,128, 17,128, 17,64, 17,32 ), | ||
| 198 | _SEG('8', 14,16, 14,32, 14,64, 14,128, 15,128, 15,64, 15,32 ), | ||
| 199 | _SEG('8', 12,16, 12,32, 12,64, 12,128, 13,128, 13,64, 13,32 ), | ||
| 200 | _SEG('8', 10,16, 10,32, 10,64, 10,128, 11,128, 11,64, 11,32 ), | ||
| 201 | _SEG('8', 8,16, 8,32, 8,64, 8,128, 9,128, 9,64, 9,32 ), | ||
| 202 | _SEG('8', 6,16, 6,32, 6,64, 6,128, 7,128, 7,64, 7,32 ), | ||
| 203 | _SEG('8', 4,16, 4,32, 4,64, 4,128, 5,128, 5,64, 5,32 ), | ||
| 204 | _SEG('8', 2,16, 2,32, 2,64, 2,128, 3,128, 3,64, 3,32 ), | ||
| 205 | _SEG('8', 0,16, 0,32, 0,64, 0,128, 1,128, 1,64, 1,32 ), | ||
| 206 | |||
| 207 | /* Line 4 | ||
| 208 | * | ||
| 209 | * The LED, DIALTONE and RINGTONE are implemented as icons and use the same | ||
| 210 | * sysfs interface. | ||
| 211 | */ | ||
| 212 | #define LCD_LINE4_OFFSET LCD_LINE3_OFFSET + LCD_LINE3_SIZE | ||
| 213 | |||
| 214 | _PIC('.', offsetof(struct yld_status, led) , 0x01, "LED" ), | ||
| 215 | _PIC('.', offsetof(struct yld_status, dialtone) , 0x01, "DIALTONE" ), | ||
| 216 | _PIC('.', offsetof(struct yld_status, ringtone) , 0x24, "RINGTONE" ), | ||
| 217 | |||
| 218 | #undef _SEG | ||
| 219 | #undef _PIC | ||
| 220 | #endif /* _SEG && _PIC */ | ||
