Tai-hwa Liang | fc69f4a | 2009-05-10 18:15:39 -0700 | [diff] [blame] | 1 | /*- |
| 2 | * Finger Sensing Pad PS/2 mouse driver. |
| 3 | * |
| 4 | * Copyright (C) 2005-2007 Asia Vital Components Co., Ltd. |
Tai-hwa Liang | a4c8507 | 2012-03-25 17:16:36 -0700 | [diff] [blame^] | 5 | * Copyright (C) 2005-2012 Tai-hwa Liang, Sentelic Corporation. |
Tai-hwa Liang | fc69f4a | 2009-05-10 18:15:39 -0700 | [diff] [blame] | 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 |
| 9 | * as published by the Free Software Foundation; either version 2 |
| 10 | * of 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., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 20 | */ |
| 21 | |
| 22 | #ifndef __SENTELIC_H |
| 23 | #define __SENTELIC_H |
| 24 | |
| 25 | /* Finger-sensing Pad information registers */ |
| 26 | #define FSP_REG_DEVICE_ID 0x00 |
| 27 | #define FSP_REG_VERSION 0x01 |
| 28 | #define FSP_REG_REVISION 0x04 |
| 29 | #define FSP_REG_TMOD_STATUS1 0x0B |
| 30 | #define FSP_BIT_NO_ROTATION BIT(3) |
| 31 | #define FSP_REG_PAGE_CTRL 0x0F |
| 32 | |
| 33 | /* Finger-sensing Pad control registers */ |
| 34 | #define FSP_REG_SYSCTL1 0x10 |
| 35 | #define FSP_BIT_EN_REG_CLK BIT(5) |
Tai-hwa Liang | 6ccbcf2 | 2011-12-29 09:47:36 -0800 | [diff] [blame] | 36 | #define FSP_REG_TMOD_STATUS 0x20 |
Tai-hwa Liang | fc69f4a | 2009-05-10 18:15:39 -0700 | [diff] [blame] | 37 | #define FSP_REG_OPC_QDOWN 0x31 |
| 38 | #define FSP_BIT_EN_OPC_TAG BIT(7) |
| 39 | #define FSP_REG_OPTZ_XLO 0x34 |
| 40 | #define FSP_REG_OPTZ_XHI 0x35 |
| 41 | #define FSP_REG_OPTZ_YLO 0x36 |
| 42 | #define FSP_REG_OPTZ_YHI 0x37 |
| 43 | #define FSP_REG_SYSCTL5 0x40 |
| 44 | #define FSP_BIT_90_DEGREE BIT(0) |
| 45 | #define FSP_BIT_EN_MSID6 BIT(1) |
| 46 | #define FSP_BIT_EN_MSID7 BIT(2) |
| 47 | #define FSP_BIT_EN_MSID8 BIT(3) |
| 48 | #define FSP_BIT_EN_AUTO_MSID8 BIT(5) |
| 49 | #define FSP_BIT_EN_PKT_G0 BIT(6) |
| 50 | |
| 51 | #define FSP_REG_ONPAD_CTL 0x43 |
| 52 | #define FSP_BIT_ONPAD_ENABLE BIT(0) |
| 53 | #define FSP_BIT_ONPAD_FBBB BIT(1) |
| 54 | #define FSP_BIT_FIX_VSCR BIT(3) |
| 55 | #define FSP_BIT_FIX_HSCR BIT(5) |
| 56 | #define FSP_BIT_DRAG_LOCK BIT(6) |
| 57 | |
Tai-hwa Liang | a4c8507 | 2012-03-25 17:16:36 -0700 | [diff] [blame^] | 58 | #define FSP_REG_SWC1 (0x90) |
| 59 | #define FSP_BIT_SWC1_EN_ABS_1F BIT(0) |
| 60 | #define FSP_BIT_SWC1_EN_GID BIT(1) |
| 61 | #define FSP_BIT_SWC1_EN_ABS_2F BIT(2) |
| 62 | #define FSP_BIT_SWC1_EN_FUP_OUT BIT(3) |
| 63 | #define FSP_BIT_SWC1_EN_ABS_CON BIT(4) |
| 64 | #define FSP_BIT_SWC1_GST_GRP0 BIT(5) |
| 65 | #define FSP_BIT_SWC1_GST_GRP1 BIT(6) |
| 66 | #define FSP_BIT_SWC1_BX_COMPAT BIT(7) |
| 67 | |
Tai-hwa Liang | fc69f4a | 2009-05-10 18:15:39 -0700 | [diff] [blame] | 68 | /* Finger-sensing Pad packet formating related definitions */ |
| 69 | |
| 70 | /* absolute packet type */ |
| 71 | #define FSP_PKT_TYPE_NORMAL (0x00) |
| 72 | #define FSP_PKT_TYPE_ABS (0x01) |
| 73 | #define FSP_PKT_TYPE_NOTIFY (0x02) |
| 74 | #define FSP_PKT_TYPE_NORMAL_OPC (0x03) |
| 75 | #define FSP_PKT_TYPE_SHIFT (6) |
| 76 | |
Tai-hwa Liang | a4c8507 | 2012-03-25 17:16:36 -0700 | [diff] [blame^] | 77 | /* bit definitions for the first byte of report packet */ |
| 78 | #define FSP_PB0_LBTN BIT(0) |
| 79 | #define FSP_PB0_RBTN BIT(1) |
| 80 | #define FSP_PB0_MBTN BIT(2) |
| 81 | #define FSP_PB0_MFMC_FGR2 FSP_PB0_MBTN |
| 82 | #define FSP_PB0_MUST_SET BIT(3) |
| 83 | #define FSP_PB0_PHY_BTN BIT(4) |
| 84 | #define FSP_PB0_MFMC BIT(5) |
| 85 | |
Tai-hwa Liang | 3ac1780 | 2012-03-25 17:15:03 -0700 | [diff] [blame] | 86 | /* hardware revisions */ |
| 87 | #define FSP_VER_STL3888_A4 (0xC1) |
| 88 | #define FSP_VER_STL3888_B0 (0xD0) |
| 89 | #define FSP_VER_STL3888_B1 (0xD1) |
| 90 | #define FSP_VER_STL3888_B2 (0xD2) |
| 91 | #define FSP_VER_STL3888_C0 (0xE0) |
| 92 | #define FSP_VER_STL3888_C1 (0xE1) |
| 93 | #define FSP_VER_STL3888_D0 (0xE2) |
| 94 | #define FSP_VER_STL3888_D1 (0xE3) |
| 95 | #define FSP_VER_STL3888_E0 (0xE4) |
| 96 | |
Tai-hwa Liang | fc69f4a | 2009-05-10 18:15:39 -0700 | [diff] [blame] | 97 | #ifdef __KERNEL__ |
| 98 | |
| 99 | struct fsp_data { |
| 100 | unsigned char ver; /* hardware version */ |
| 101 | unsigned char rev; /* hardware revison */ |
Tai-hwa Liang | 3ac1780 | 2012-03-25 17:15:03 -0700 | [diff] [blame] | 102 | unsigned int buttons; /* Number of buttons */ |
Tai-hwa Liang | fc69f4a | 2009-05-10 18:15:39 -0700 | [diff] [blame] | 103 | unsigned int flags; |
| 104 | #define FSPDRV_FLAG_EN_OPC (0x001) /* enable on-pad clicking */ |
| 105 | |
| 106 | bool vscroll; /* Vertical scroll zone enabled */ |
| 107 | bool hscroll; /* Horizontal scroll zone enabled */ |
| 108 | |
| 109 | unsigned char last_reg; /* Last register we requested read from */ |
| 110 | unsigned char last_val; |
Tai-hwa Liang | a4c8507 | 2012-03-25 17:16:36 -0700 | [diff] [blame^] | 111 | unsigned int last_mt_fgr; /* Last seen finger(multitouch) */ |
Tai-hwa Liang | fc69f4a | 2009-05-10 18:15:39 -0700 | [diff] [blame] | 112 | }; |
| 113 | |
| 114 | #ifdef CONFIG_MOUSE_PS2_SENTELIC |
Dmitry Torokhov | b7802c5 | 2009-09-09 19:13:20 -0700 | [diff] [blame] | 115 | extern int fsp_detect(struct psmouse *psmouse, bool set_properties); |
Tai-hwa Liang | fc69f4a | 2009-05-10 18:15:39 -0700 | [diff] [blame] | 116 | extern int fsp_init(struct psmouse *psmouse); |
| 117 | #else |
Dmitry Torokhov | b7802c5 | 2009-09-09 19:13:20 -0700 | [diff] [blame] | 118 | inline int fsp_detect(struct psmouse *psmouse, bool set_properties) |
Tai-hwa Liang | fc69f4a | 2009-05-10 18:15:39 -0700 | [diff] [blame] | 119 | { |
| 120 | return -ENOSYS; |
| 121 | } |
| 122 | inline int fsp_init(struct psmouse *psmouse) |
| 123 | { |
| 124 | return -ENOSYS; |
| 125 | } |
| 126 | #endif |
| 127 | |
| 128 | #endif /* __KERNEL__ */ |
| 129 | |
| 130 | #endif /* !__SENTELIC_H */ |