ebook img

MT6573 YuSu Keypad Customer Document PDF

11 Pages·2011·0.31 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview MT6573 YuSu Keypad Customer Document

Y L N L O A I E T S N U E m D I o YuSu Keypad CusFtomcer Document . N e l O i b C o m K o E n T n A i t Version:I 0.3 @ ReleasDe date: 2011-01-26 E i l . M u y ©2008-2011MediaTek Inc. This docume nt contains information that is proprietary to MediaTek Inc. R Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited. O Specifications are subject to change without notice. F MT65XX Y YuSu Confidential B L N L Document Revision History O A I E Revision Date Author Description T 0.1 2010-04-27 Terry Chang Initial Draft S 0.2 2010-06-18 Terry Chang Add one note in seNction 1.4 0.3 2011-01-26 Wenjun Gao Update customization configuraUtion related with MT6573 E m D I o F c . N e l O i b C o m K o E n T n A i t I @ D E i l . M u y R O F MediaTek Confidential ©2010-2011MediaTek Inc. Page 2of 11 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited. MT65XX Y YuSu Confidential B L N L Table of Contents O A Document Revision History..................................................................I................................................2 E Table of Contents...............................................................................T....................................................3 1 Introduction................................................................................................S...................................4 N 1.1 Software/Hardware Environment..........................................................................................4 U 1.1.1 Software Environment..........................................................................................4 E 1.1.2 Hardware Environment.........................................................................................4 1.2 Functionality.........................................................................m.................................................4 D 1.3 Hardware Background..........................................................................................................4 1.4 Hardware Component Used in This Driver...........................................................................4 I o 2 Design............................................................................................................................................6 F c 2.1 Architecture...........................................................................................................................6 . N 2.2 Procedure & Flow.............................................e....................................................................6 3 Interface.........................................................................................................................................8 l O 3.1 Data Structures..........................................i...........................................................................8 b 3.2 Functions..............................................................................................................................8 C 3.2.1 kpd_backlight_handler......o...................................................................................8 3.2.2 kpd_dev_ioctl.......................................................................................................8 m 4 Customization................K...............................................................................................................9 4.1 DCT (Driver Customization Tool).........................................................................................9 o 4.2 Other Compile EOptions.......................................................................................................10 n 5 Build.............................................................................................................................................11 T 5.1 Source Code Structuren & File Description..........................................................................11 5.2 Build Option........................................................................................................................11 A i t I @ D E i l . M u y R O F MediaTek Confidential ©2010-2011MediaTek Inc. Page 3of 11 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited. MT65XX Y YuSu Confidential B L N L 1 Introduction O A 1.1 Software/Hardware Environment I E T Platform Software Environment Hardware Environment S MT6516 Linux Kernel 2.6.29 and Android 2.1 MNT6516 U MT6573 Linux Kernel 2.6.35and Android 2.3 MT6573 E m 1.1.1 Software Environment D For MT6516 Platform: I o Keypaddriver discussed in this document is designed based on Linux Kernel 2.6.29 and Android 2.1. F c For MT6573Platform: Keypad driver discussed in this document isN designed b.ased on Linux Linux Kernel 2.6.35 and e Android 2.3. l O i 1.1.2 Hardware Environment b Keypaddriver discussed inthis documCent can run on the devices with MT6516or MT6573. o m K 1.2 Functionality o Keypad driver’s main functiEonality: (1) Report the key event based on a kney mapping table when thekey is pressed or released. (2) Report the key evenTt when Power key is pressed or released. n (3) Report the switch event when Slide QWERTY keypad is slid inor out. A i t 1.3 HardIware Bac kground @ D When the key is pressed or released, there is a keypad interrupt issued. When Power key is pressed /released orSlide QWERTY keypad is slid in/out, there is a EINT (External Interrupt) issued. E i l . M 1.4 Hardwuare Component Used in This Driver y Keypad matrix shown in Figure 1has 8 rows and (8 + 1) columns(HW keycode are0 to 71). Column 8 (HW key code are 8, 17, 26, 35, 44, 53, 62, 71) is dedicated for Power key, so we can have 8 * 8 = R 64 keys detected through Keypad matrix. Each time the key is pressed or released, i.e., when something is different in Keypad matrix, the key detection block in Keypad Scanner senses the O changeand recognizesif a key has been pressed or released. Whenever the key status changes and is stable, a keypad interruptis issued. F MediaTek Confidential ©2010-2011MediaTek Inc. Page 4of 11 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited. MT65XX Y YuSu Confidential B L N Note: Due to HW limitation, simultaneously pressing more than two keys mayL not function correctly. For example, there are four keys: key1 (row6, col0), key2 (row6, col1), key3 (row7, col0), key4 (row7, O col1). If we press key1, key2 and key4 at the same time, key3 may be deteActed as pressed. I E T S N U E m D I o F c . N e l O i b C o m K Figure 1: Keypad Matrix o E n T n A i t I @ D E i l . M u Figure 2: HW Keycode Table y R O F MediaTek Confidential ©2010-2011MediaTek Inc. Page 5of 11 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited. MT65XX Y YuSu Confidential B L N L 2 Design O A 2.1 Architecture I E T The architecture of Keypad driver is shown in Figure 3. There are four main tasks in Keypad driver: S 1. If the key is pressed or released, recognize which key and report the key event based on a key N mapping tableto Input subsystem through Keypadinput device. U 2. Use PWR_KEY EINTto detect whetherPower key is pressed or released and report the key event E to Input subsystem through Keypadinput device. m 3. If the device has Slide QWERTY keypad, use SLIDED EINT to detect whether QWERTY keypad is slidin oroutand report the switch eventto Input subsystem through Keypadinput device. 4. For META tool, usePMIC KPLED to show the bacIklight effect.o F c . N e l O i b C o m K o E n T n A Fiigure 3: Keypad Driver Architecture t I @ 2.2 ProDcedure & Flow When the key is pressed or released, Keypad Scanner will issue a interrupt, then Keypad driver E i recognizes this key’s keycode and state from Keypad Scanner registers. This kind of keycode is l called HW keycod.e(0 to 71). The responsibility of Keypad driver is to translate HW keycode to Linux M u keycode based on a pre-defined key mapping table. After Keypad driver gets the Linux keycode, it will report this Linux keycode to upper layer Input subsystem. And then, Android EventHub can get y this Linux keycode from Input subsystem and translates it to Android keycode. So from this layer Android EventHub, the key pressingor releasing is represented as a key event with Android keycode. R The keycode translationflow is shown in Figure 4. O F MediaTek Confidential ©2010-2011MediaTek Inc. Page 6of 11 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited. MT65XX Y YuSu Confidential B L N L O A I E T S N U E m D I o F c . N e l O i b FigurCe 4: Keycode Translation Flow o Note-1: The detection of Power k ey may use PmWR_KEY EINT not through Keypad Scanner, so in this case,wearenotgoing togetPoKwer key’s HW keycodefrom Keypad Scanner registers. o Note-2: The language suEpport needs to rely on IME (Input Method Engine) not Keypad driver. Keypad driver’s main task is to repornt the key event with the correct “Linux keycode” and state to upper layer when the keTy is pressed or released. n A i t I @ D E i l . M u y R O F MediaTek Confidential ©2010-2011MediaTek Inc. Page 7of 11 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited. MT65XX Y YuSu Confidential B L N L 3 Interface O A This section discusses the data structuresand functionsused by other Ikernel modules. E T 3.1 Data Structures S N This structure is used for SET_KPD_BACKLIGHTcommand in kpd_dev_iocUtl(). struct kpd_ledctl { E u8 onoff; u8 div; /* 0 ~ 15 */ m D u8 duty; /* 0 ~ 31 */ }; I o F c 3.2 Functions . N e l 3.2.1 kpd_backlight_handler O i b Prototype C void kpd_backlight_handler(bool pressed, u16 linoux_keycode) Parameters m in pressed The key isK pressed or released in linux_keycode The key’s Linux keycode o Return Value E None n T n 3.2.2 kpd_deAv_ioctl i t Prototype I @ long kpd_dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) D Parameters in Efile Filei pointer in cmd IOlCTL command . in/ouMt arg The command’s argumentandit could be input or output u Return Value The return vaylue depends on IOCTL command The suppRorted IOCTL commandsare: CMD SET_KPD_BACKLIGHT O ARG The address of kpd_ledctl structure passed by the caller Return 0: the operation succeeds; otherwise: the operation fails F MediaTek Confidential ©2010-2011MediaTek Inc. Page 8of 11 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited. MT65XX Y YuSu Confidential B L N L 4 Customization O A This section discusseshow to customize Keypad driver. I E T S 4.1 DCT (Driver Customization Tool) N U DCT is used to customize the key mapping, de-bounce time and Power key setting in Keypad driver. E The screen snapshot is shown inFigure 5(“2 Step Key”options are unused). m D I o F c . N e l O i b C o m K o E n T n A i t I Figure 5: Keypad Setting in DCT @ D 1. Key Mapping This is cEorrespondinig to Keypad matrix. If you want to map MENU key in (row1, column1) (HW l keycode is 10) in Keypad matrix, you can choose “MENU” in [Row1, Column1]. DCT will generate . M “[10] = KEY_MEuNU,”in cust_kpd.hso that Keypad driver can use this mapping to report the key event when (row1, column1) is pressed or released. y Note:DCT will skip “NONE”in [RowX, ColumnX]when generating cust_kpd.h. R 2. De-Bounce Time The Onumber in “Keypress_Period” divided by 32 means the Keypad’s de-bounce time (millisecond). For example, the number 1024 in “Keypress_Period”means the de-bounce time is 1024 / 32 = 32 ms. F MediaTek Confidential ©2010-2011MediaTek Inc. Page 9of 11 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited. MT65XX Y YuSu Confidential B L N L 3. PowerKey Setting O If you want to use EINT to detect Power key’s pressing and releasingA, you can check the box “PowerKey use EINT” and choose “POWER” or “ENDCALL” in “Power Key definition” so that Keypad driver can use this mapping to report the key event when EINT is issuedI. E T Note-1:Although there is a dedicatedcolumn8 in Keypad matrix for Power key,S we usually use EINT4 to detect Power key’s pressing and releasing. N U Note-2: If you want to use EINT to detect Power key’s pressEing and releasing, you have to configure EINT related setting by using DCT. m D 4.2 Other Compile Options I o F c In addition to cust_kpd.h generated by DCT, there is mt6516_kpd.hor mt6573_kpd.h in Keypad driver . to centralize other compile options. We can uNse this header file to enable/disable some functionality e of Keypad driver. l O i 1. KPD_DRV_CTRL_BACKLIGHT b This compile option is used to enableC the backlight control function in Keypad driver. However, this o compile option will retire soon because the keypad backlight related implementation will move into LED driver and the keypad backli ght will be comntrolled by Android Frameworkthrough LED driver. Sub-Options: K #define KPD_BACKLIGHT_TIME 8 /* sec */ o /* the keys can wake up theE system and we should enable backlight */ #define KPD_BACKLIGHT_WAKE_KEnY\ { T \ n KEY_ENDCALL, KEY_POWER,\ A } i t I 2. KPD_HAS_SLIDE_QWERTY @ If the deviceD has Slide QWERTY keypad, you can turn on this compile option to enable the sliding support function in Keypad driver. E i l Note: We use EINT to detect QWERTY keypad’s sliding in and sliding out, so you have to configure . M EINT related setting by usingDCT. u y R O F MediaTek Confidential ©2010-2011MediaTek Inc. Page 10of 11 This document contains information that is proprietary to MediaTek Inc. Unauthorized reproduction or disclosure of this information in whole or in part is strictly prohibited.

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.