/*1* drivers/usb/input/yealink.h2*3* Copyright (c) 2005 Henk Vergonet <[email protected]>4*5*6* This program is free software; you can redistribute it and/or7* modify it under the terms of the GNU General Public License as8* published by the Free Software Foundation; either version 2 of9* the License, or (at your option) any later version.10*11* This program is distributed in the hope that it will be useful,12* but WITHOUT ANY WARRANTY; without even the implied warranty of13* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14* GNU General Public License for more details.15*16* You should have received a copy of the GNU General Public License17* along with this program; if not, write to the Free Software18* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19*/20#ifndef INPUT_YEALINK_H21#define INPUT_YEALINK_H2223/* Using the control channel on interface 3 various aspects of the phone24* can be controlled like LCD, LED, dialtone and the ringtone.25*/2627struct yld_ctl_packet {28u8 cmd; /* command code, see below */29u8 size; /* 1-11, size of used data bytes. */30u16 offset; /* internal packet offset */31u8 data[11];32s8 sum; /* negative sum of 15 preceding bytes */33} __attribute__ ((packed));3435#define USB_PKT_LEN sizeof(struct yld_ctl_packet)3637/* The following yld_ctl_packet's are available: */3839/* Init registers40*41* cmd 0x8e42* size 1043* offset 044* data 0,0,0,0....45*/46#define CMD_INIT 0x8e4748/* Request key scan49*50* cmd 0x8051* size 152* offset 053* data[0] on return returns the key number, if it changes there's a new54* key pressed.55*/56#define CMD_KEYPRESS 0x805758/* Request scancode59*60* cmd 0x8161* size 162* offset key number [0-1f]63* data[0] on return returns the scancode64*/65#define CMD_SCANCODE 0x816667/* Set LCD68*69* cmd 0x0470* size 1-1171* offset 0-2372* data segment bits73*/74#define CMD_LCD 0x047576/* Set led77*78* cmd 0x0579* size 180* offset 081* data[0] 0 OFF / 1 ON82*/83#define CMD_LED 0x058485/* Set ringtone volume86*87* cmd 0x1188* size 189* offset 090* data[0] 0-0xff volume91*/92#define CMD_RING_VOLUME 0x119394/* Set ringtone notes95*96* cmd 0x0297* size 1-1198* offset 0->99* data binary representation LE16(-freq), LE16(duration) ....100*/101#define CMD_RING_NOTE 0x02102103/* Sound ringtone via the speaker on the back104*105* cmd 0x03106* size 1107* offset 0108* data[0] 0 OFF / 0x24 ON109*/110#define CMD_RINGTONE 0x03111112/* Sound dial tone via the ear speaker113*114* cmd 0x09115* size 1116* offset 0117* data[0] 0 OFF / 1 ON118*/119#define CMD_DIALTONE 0x09120121#endif /* INPUT_YEALINK_H */122123124#if defined(_SEG) && defined(_PIC)125/* This table maps the LCD segments onto individual bit positions in the126* yld_status struct.127*/128129/* LCD, each segment must be driven separately.130*131* Layout:132*133* |[] [][] [][] [][] in |[][]134* |[] M [][] D [][] : [][] out |[][]135* store136*137* NEW REP SU MO TU WE TH FR SA138*139* [] [] [] [] [] [] [] [] [] [] [] []140* [] [] [] [] [] [] [] [] [] [] [] []141*/142143/* Line 1144* Format : 18.e8.M8.88...188145* Icon names : M D : IN OUT STORE146*/147#define LCD_LINE1_OFFSET 0148#define LCD_LINE1_SIZE 17149150/* Note: first g then f => ! ! */151/* _SEG( type a b c d e g f ) */152_SEG('1', 0,0 , 22,2 , 22,2 , 0,0 , 0,0 , 0,0 , 0,0 ),153_SEG('8', 20,1 , 20,2 , 20,4 , 20,8 , 21,4 , 21,2 , 21,1 ),154_PIC('.', 22,1 , "M" ),155_SEG('e', 18,1 , 18,2 , 18,4 , 18,1 , 19,2 , 18,1 , 19,1 ),156_SEG('8', 16,1 , 16,2 , 16,4 , 16,8 , 17,4 , 17,2 , 17,1 ),157_PIC('.', 15,8 , "D" ),158_SEG('M', 14,1 , 14,2 , 14,4 , 14,1 , 15,4 , 15,2 , 15,1 ),159_SEG('8', 12,1 , 12,2 , 12,4 , 12,8 , 13,4 , 13,2 , 13,1 ),160_PIC('.', 11,8 , ":" ),161_SEG('8', 10,1 , 10,2 , 10,4 , 10,8 , 11,4 , 11,2 , 11,1 ),162_SEG('8', 8,1 , 8,2 , 8,4 , 8,8 , 9,4 , 9,2 , 9,1 ),163_PIC('.', 7,1 , "IN" ),164_PIC('.', 7,2 , "OUT" ),165_PIC('.', 7,4 , "STORE" ),166_SEG('1', 0,0 , 5,1 , 5,1 , 0,0 , 0,0 , 0,0 , 0,0 ),167_SEG('8', 4,1 , 4,2 , 4,4 , 4,8 , 5,8 , 5,4 , 5,2 ),168_SEG('8', 2,1 , 2,2 , 2,4 , 2,8 , 3,4 , 3,2 , 3,1 ),169170/* Line 2171* Format : .........172* Pict. name : NEW REP SU MO TU WE TH FR SA173*/174#define LCD_LINE2_OFFSET LCD_LINE1_OFFSET + LCD_LINE1_SIZE175#define LCD_LINE2_SIZE 9176177_PIC('.', 23,2 , "NEW" ),178_PIC('.', 23,4 , "REP" ),179_PIC('.', 1,8 , "SU" ),180_PIC('.', 1,4 , "MO" ),181_PIC('.', 1,2 , "TU" ),182_PIC('.', 1,1 , "WE" ),183_PIC('.', 0,1 , "TH" ),184_PIC('.', 0,2 , "FR" ),185_PIC('.', 0,4 , "SA" ),186187/* Line 3188* Format : 888888888888189*/190#define LCD_LINE3_OFFSET LCD_LINE2_OFFSET + LCD_LINE2_SIZE191#define LCD_LINE3_SIZE 12192193_SEG('8', 22,16, 22,32, 22,64, 22,128, 23,128, 23,64, 23,32 ),194_SEG('8', 20,16, 20,32, 20,64, 20,128, 21,128, 21,64, 21,32 ),195_SEG('8', 18,16, 18,32, 18,64, 18,128, 19,128, 19,64, 19,32 ),196_SEG('8', 16,16, 16,32, 16,64, 16,128, 17,128, 17,64, 17,32 ),197_SEG('8', 14,16, 14,32, 14,64, 14,128, 15,128, 15,64, 15,32 ),198_SEG('8', 12,16, 12,32, 12,64, 12,128, 13,128, 13,64, 13,32 ),199_SEG('8', 10,16, 10,32, 10,64, 10,128, 11,128, 11,64, 11,32 ),200_SEG('8', 8,16, 8,32, 8,64, 8,128, 9,128, 9,64, 9,32 ),201_SEG('8', 6,16, 6,32, 6,64, 6,128, 7,128, 7,64, 7,32 ),202_SEG('8', 4,16, 4,32, 4,64, 4,128, 5,128, 5,64, 5,32 ),203_SEG('8', 2,16, 2,32, 2,64, 2,128, 3,128, 3,64, 3,32 ),204_SEG('8', 0,16, 0,32, 0,64, 0,128, 1,128, 1,64, 1,32 ),205206/* Line 4207*208* The LED, DIALTONE and RINGTONE are implemented as icons and use the same209* sysfs interface.210*/211#define LCD_LINE4_OFFSET LCD_LINE3_OFFSET + LCD_LINE3_SIZE212213_PIC('.', offsetof(struct yld_status, led) , 0x01, "LED" ),214_PIC('.', offsetof(struct yld_status, dialtone) , 0x01, "DIALTONE" ),215_PIC('.', offsetof(struct yld_status, ringtone) , 0x24, "RINGTONE" ),216217#undef _SEG218#undef _PIC219#endif /* _SEG && _PIC */220221222