Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * drivers/usb/input/yealink.h
0004  *
0005  * Copyright (c) 2005 Henk Vergonet <Henk.Vergonet@gmail.com>
0006  */
0007 #ifndef INPUT_YEALINK_H
0008 #define INPUT_YEALINK_H
0009 
0010 /* Using the control channel on interface 3 various aspects of the phone
0011  * can be controlled like LCD, LED, dialtone and the ringtone.
0012  */
0013 
0014 struct yld_ctl_packet {
0015     u8  cmd;        /* command code, see below */
0016     u8  size;       /* 1-11, size of used data bytes. */
0017     __be16  offset;     /* internal packet offset */
0018     u8  data[11];
0019     s8  sum;        /* negative sum of 15 preceding bytes */
0020 } __attribute__ ((packed));
0021 
0022 #define USB_PKT_LEN sizeof(struct yld_ctl_packet)
0023 
0024 /* The following yld_ctl_packet's are available: */
0025 
0026 /* Init registers
0027  *
0028  * cmd      0x8e
0029  * size     10
0030  * offset   0
0031  * data     0,0,0,0....
0032  */
0033 #define CMD_INIT        0x8e
0034 
0035 /* Request key scan
0036  *
0037  * cmd      0x80
0038  * size     1
0039  * offset   0
0040  * data[0]  on return returns the key number, if it changes there's a new
0041  *      key pressed.
0042  */
0043 #define CMD_KEYPRESS        0x80
0044 
0045 /* Request scancode
0046  *
0047  * cmd      0x81
0048  * size     1
0049  * offset   key number [0-1f]
0050  * data[0]  on return returns the scancode
0051  */
0052 #define CMD_SCANCODE        0x81
0053 
0054 /* Set LCD
0055  *
0056  * cmd      0x04
0057  * size     1-11
0058  * offset   0-23
0059  * data     segment bits
0060  */
0061 #define CMD_LCD         0x04
0062 
0063 /* Set led
0064  *
0065  * cmd      0x05
0066  * size     1
0067  * offset   0
0068  * data[0]  0 OFF / 1 ON
0069  */
0070 #define CMD_LED         0x05
0071 
0072 /* Set ringtone volume
0073  *
0074  * cmd      0x11
0075  * size     1
0076  * offset   0
0077  * data[0]  0-0xff  volume
0078  */
0079 #define CMD_RING_VOLUME     0x11
0080 
0081 /* Set ringtone notes
0082  *
0083  * cmd      0x02
0084  * size     1-11
0085  * offset   0->
0086  * data     binary representation LE16(-freq), LE16(duration) ....
0087  */
0088 #define CMD_RING_NOTE       0x02
0089 
0090 /* Sound ringtone via the speaker on the back
0091  *
0092  * cmd      0x03
0093  * size     1
0094  * offset   0
0095  * data[0]  0 OFF / 0x24 ON
0096  */
0097 #define CMD_RINGTONE        0x03
0098 
0099 /* Sound dial tone via the ear speaker
0100  *
0101  * cmd      0x09
0102  * size     1
0103  * offset   0
0104  * data[0]  0 OFF / 1 ON
0105  */
0106 #define CMD_DIALTONE        0x09
0107 
0108 #endif /* INPUT_YEALINK_H */
0109 
0110 
0111 #if defined(_SEG) && defined(_PIC)
0112 /* This table maps the LCD segments onto individual bit positions in the
0113  * yld_status struct.
0114  */
0115 
0116 /* LCD, each segment must be driven separately.
0117  *
0118  * Layout:
0119  *
0120  *   |[]   [][]   [][]   [][]   in   |[][]
0121  *   |[] M [][] D [][] : [][]   out  |[][]
0122  *                             store
0123  *
0124  *    NEW REP         SU MO TU WE TH FR SA
0125  *
0126  *    [] [] [] [] [] [] [] [] [] [] [] []
0127  *    [] [] [] [] [] [] [] [] [] [] [] []
0128  */
0129 
0130 /* Line 1
0131  *  Format      : 18.e8.M8.88...188
0132  *  Icon names  : M D : IN OUT STORE
0133  */
0134 #define LCD_LINE1_OFFSET    0
0135 #define LCD_LINE1_SIZE      17
0136 
0137 /* Note: first g then f =>                 !      !      */
0138 /* _SEG(    type    a      b      c      d      e      g      f   )  */
0139     _SEG('1',  0,0 , 22,2 , 22,2 ,  0,0 ,  0,0 ,  0,0 ,  0,0    ),
0140     _SEG('8', 20,1 , 20,2 , 20,4 , 20,8 , 21,4 , 21,2 , 21,1    ),
0141     _PIC('.', 22,1 , "M"                        ),
0142     _SEG('e', 18,1 , 18,2 , 18,4 , 18,1 , 19,2 , 18,1 , 19,1    ),
0143     _SEG('8', 16,1 , 16,2 , 16,4 , 16,8 , 17,4 , 17,2 , 17,1    ),
0144     _PIC('.', 15,8 , "D"                        ),
0145     _SEG('M', 14,1 , 14,2 , 14,4 , 14,1 , 15,4 , 15,2 , 15,1    ),
0146     _SEG('8', 12,1 , 12,2 , 12,4 , 12,8 , 13,4 , 13,2 , 13,1    ),
0147     _PIC('.', 11,8 , ":"                        ),
0148     _SEG('8', 10,1 , 10,2 , 10,4 , 10,8 , 11,4 , 11,2 , 11,1    ),
0149     _SEG('8',  8,1 ,  8,2 ,  8,4 ,  8,8 ,  9,4 ,  9,2 ,  9,1    ),
0150     _PIC('.',  7,1 , "IN"                       ),
0151     _PIC('.',  7,2 , "OUT"                      ),
0152     _PIC('.',  7,4 , "STORE"                    ),
0153     _SEG('1',  0,0 ,  5,1 ,  5,1 ,  0,0 ,  0,0 ,  0,0 ,  0,0    ),
0154     _SEG('8',  4,1 ,  4,2 ,  4,4 ,  4,8 ,  5,8 ,  5,4 ,  5,2    ),
0155     _SEG('8',  2,1 ,  2,2 ,  2,4 ,  2,8 ,  3,4 ,  3,2 ,  3,1    ),
0156 
0157 /* Line 2
0158  *  Format      : .........
0159  *  Pict. name  : NEW REP SU MO TU WE TH FR SA
0160  */
0161 #define LCD_LINE2_OFFSET    LCD_LINE1_OFFSET + LCD_LINE1_SIZE
0162 #define LCD_LINE2_SIZE      9
0163 
0164     _PIC('.', 23,2 , "NEW"  ),
0165     _PIC('.', 23,4 , "REP"  ),
0166     _PIC('.',  1,8 , "SU"   ),
0167     _PIC('.',  1,4 , "MO"   ),
0168     _PIC('.',  1,2 , "TU"   ),
0169     _PIC('.',  1,1 , "WE"   ),
0170     _PIC('.',  0,1 , "TH"   ),
0171     _PIC('.',  0,2 , "FR"   ),
0172     _PIC('.',  0,4 , "SA"   ),
0173 
0174 /* Line 3
0175  *  Format      : 888888888888
0176  */
0177 #define LCD_LINE3_OFFSET    LCD_LINE2_OFFSET + LCD_LINE2_SIZE
0178 #define LCD_LINE3_SIZE      12
0179 
0180     _SEG('8', 22,16, 22,32, 22,64, 22,128, 23,128, 23,64, 23,32  ),
0181     _SEG('8', 20,16, 20,32, 20,64, 20,128, 21,128, 21,64, 21,32  ),
0182     _SEG('8', 18,16, 18,32, 18,64, 18,128, 19,128, 19,64, 19,32  ),
0183     _SEG('8', 16,16, 16,32, 16,64, 16,128, 17,128, 17,64, 17,32  ),
0184     _SEG('8', 14,16, 14,32, 14,64, 14,128, 15,128, 15,64, 15,32  ),
0185     _SEG('8', 12,16, 12,32, 12,64, 12,128, 13,128, 13,64, 13,32  ),
0186     _SEG('8', 10,16, 10,32, 10,64, 10,128, 11,128, 11,64, 11,32  ),
0187     _SEG('8',  8,16,  8,32,  8,64,  8,128,  9,128,  9,64,  9,32  ),
0188     _SEG('8',  6,16,  6,32,  6,64,  6,128,  7,128,  7,64,  7,32  ),
0189     _SEG('8',  4,16,  4,32,  4,64,  4,128,  5,128,  5,64,  5,32  ),
0190     _SEG('8',  2,16,  2,32,  2,64,  2,128,  3,128,  3,64,  3,32  ),
0191     _SEG('8',  0,16,  0,32,  0,64,  0,128,  1,128,  1,64,  1,32  ),
0192 
0193 /* Line 4
0194  *
0195  * The LED, DIALTONE and RINGTONE are implemented as icons and use the same
0196  * sysfs interface.
0197  */
0198 #define LCD_LINE4_OFFSET    LCD_LINE3_OFFSET + LCD_LINE3_SIZE
0199 
0200     _PIC('.', offsetof(struct yld_status, led)  , 0x01, "LED" ),
0201     _PIC('.', offsetof(struct yld_status, dialtone) , 0x01, "DIALTONE" ),
0202     _PIC('.', offsetof(struct yld_status, ringtone) , 0x24, "RINGTONE" ),
0203 
0204 #undef _SEG
0205 #undef _PIC
0206 #endif /* _SEG && _PIC */