Subject: PERSONA HPW-50PAD keyboard diff
To: None <port-hpcsh@netbsd.org>
From: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
List: port-hpcsh
Date: 01/15/2005 14:50:03
----Next_Part(Sat_Jan_15_14:50:03_2005_253)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
hi!
I did the following change.
1. Equal processing to pfckbd_callout_hp().
2. The problem was cleared, when two keys were pushed.
e.x. Shift + L pushing, however not responded...
3. Keymap cleanup.
I'm very happy. :)
Thanks.
--
kiyohara
----Next_Part(Sat_Jan_15_14:50:03_2005_253)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="persona_kbd.diff"
--- /sys/arch/hpcsh/dev/pfckbd.c.orig 2005-01-15 14:31:00.000000000 +0900
+++ /sys/arch/hpcsh/dev/pfckbd.c 2005-01-15 14:09:04.000000000 +0900
@@ -319,45 +319,103 @@
void
pfckbd_callout_hitachi(void *arg)
{
+#define PFCKBD_HITACHI_PCCR_MASK 0xfffc
+#define PFCKBD_HITACHI_PDCR_MASK 0x000c
+#define PFCKBD_HITACHI_PECR_MASK 0x30cf
+
+#define PFCKBD_HITACHI_PCDR_SCN_MASK 0xfe
+#define PFCKBD_HITACHI_PDDR_SCN_MASK 0xf7
+#define PFCKBD_HITACHI_PEDR_SCN_MASK 0xff
+
+#define PFCKBD_HITACHI_PCDR_SNS_MASK 0x01
+#define PFCKBD_HITACHI_PFDR_SNS_MASK 0xfe
+
+ /*
+ * Disable output on all lines but the n'th line in C.
+ * Pull the n'th scan line in C low.
+ */
+#define PC(n) \
+ { (u_int16_t)(PFCKBD_HITACHI_PCCR_MASK & (~(1 << (2*(n)+1)))), \
+ (u_int16_t)(PFCKBD_HITACHI_PDCR_MASK & 0xffff), \
+ (u_int16_t)(PFCKBD_HITACHI_PECR_MASK & 0xffff), \
+ (u_int8_t)(PFCKBD_HITACHI_PCDR_SCN_MASK & ~(1 << (n))), \
+ PFCKBD_HITACHI_PDDR_SCN_MASK, \
+ PFCKBD_HITACHI_PEDR_SCN_MASK }
+
+ /* Ditto for D */
+#define PD(n) \
+ { (u_int16_t)(PFCKBD_HITACHI_PCCR_MASK & 0xffff), \
+ (u_int16_t)(PFCKBD_HITACHI_PDCR_MASK & (~(1 << (2*(n)+1)))), \
+ (u_int16_t)(PFCKBD_HITACHI_PECR_MASK & 0xffff), \
+ PFCKBD_HITACHI_PCDR_SCN_MASK, \
+ (u_int8_t)(PFCKBD_HITACHI_PDDR_SCN_MASK & ~(1 << (n))), \
+ PFCKBD_HITACHI_PEDR_SCN_MASK }
+
+ /* Ditto for E */
+#define PE(n) \
+ { (u_int16_t)(PFCKBD_HITACHI_PCCR_MASK & 0xffff), \
+ (u_int16_t)(PFCKBD_HITACHI_PDCR_MASK & 0xffff), \
+ (u_int16_t)(PFCKBD_HITACHI_PECR_MASK & (~(1 << (2*(n)+1)))), \
+ PFCKBD_HITACHI_PCDR_SCN_MASK, \
+ PFCKBD_HITACHI_PDDR_SCN_MASK, \
+ (u_int8_t)(PFCKBD_HITACHI_PEDR_SCN_MASK & ~(1 << (n))) }
+
static const struct {
- u_int8_t d, e;
+ u_int16_t cc, dc, ec; u_int8_t c, d, e;
} scan[] = {
- { 0xf5, 0xff },
- { 0xd7, 0xff },
- { 0xf7, 0xfd },
- { 0xf7, 0xbf },
- { 0xf7, 0x7f },
- { 0xf7, 0xf7 },
- { 0xf7, 0xfe },
- { 0x77, 0xff },
+ PE(6), PE(3), PE(1), PE(0), PC(7), PC(6), PC(5), PC(4),
+ PC(3), PC(2), PD(1), PC(1)
};
+
+#undef PC
+#undef PD
+#undef PE
+
struct pfckbd_core *pc = arg;
- u_int16_t data;
- int column;
+ u_int16_t cc, dc, ec;
+ uint8_t data[2];
+ int i;
if (!pc->pc_enabled)
goto reinstall;
- for (column = 0; column < 8; column++) {
- _reg_write_1(SH7709_PCDR, ~(1 << column));
- delay(50);
- data = ((_reg_read_1(SH7709_PFDR) & 0xfe) |
- (_reg_read_1(SH7709_PCDR) & 0x01)) << 8;
- _reg_write_1(SH7709_PCDR, 0xff);
- _reg_write_1(SH7709_PDDR, scan[column].d);
- _reg_write_1(SH7709_PEDR, scan[column].e);
+ /* bits in C/D/E control regs we do not touch (XXX: can they change?) */
+ cc = _reg_read_2(SH7709_PCCR) & ~PFCKBD_HITACHI_PCCR_MASK;
+ dc = _reg_read_2(SH7709_PDCR) & ~PFCKBD_HITACHI_PDCR_MASK;
+ ec = _reg_read_2(SH7709_PECR) & ~PFCKBD_HITACHI_PECR_MASK;
+
+ for (i = 0; i < 12; i ++) {
+ /* disable output to all lines except the one we scan */
+ _reg_write_2(SH7709_PDCR, cc | scan[i].cc);
+ _reg_write_2(SH7709_PDCR, dc | scan[i].dc);
+ _reg_write_2(SH7709_PECR, ec | scan[i].ec);
+ delay(5);
+
+ /* pull the scan line low */
+ _reg_write_1(SH7709_PCDR, scan[i].c);
+ _reg_write_1(SH7709_PDDR, scan[i].d);
+ _reg_write_1(SH7709_PEDR, scan[i].e);
delay(50);
- data |= (_reg_read_1(SH7709_PFDR) & 0xfe) |
- (_reg_read_1(SH7709_PCDR) & 0x01);
- _reg_write_1(SH7709_PDDR, 0xf7);
- _reg_write_1(SH7709_PEDR, 0xff);
- pfckbd_input(pc->pc_hpckbd, pc->pc_column, data, column);
+ /* read sense */
+ data[i & 0x1] =
+ ((_reg_read_1(SH7709_PCDR) & PFCKBD_HITACHI_PCDR_SNS_MASK) |
+ (_reg_read_1(SH7709_PFDR) & PFCKBD_HITACHI_PFDR_SNS_MASK));
+
+ if (i & 0x1)
+ pfckbd_input(pc->pc_hpckbd, pc->pc_column,
+ (data[0] | (data[1] << 8)), (i >> 1));
}
- _reg_write_1(SH7709_PDDR, 0xf7);
- _reg_write_1(SH7709_PEDR, 0xff);
- data = _reg_read_1(SH7709_PGDR) | (_reg_read_1(SH7709_PHDR) << 8);
+ /* scan no lines */
+ _reg_write_1(SH7709_PCDR, PFCKBD_HITACHI_PCDR_SCN_MASK);
+ _reg_write_1(SH7709_PDDR, PFCKBD_HITACHI_PDDR_SCN_MASK);
+ _reg_write_1(SH7709_PEDR, PFCKBD_HITACHI_PEDR_SCN_MASK);
+
+ /* enable all scan lines */
+ _reg_write_2(SH7709_PCCR, cc | (0x5555 & PFCKBD_HITACHI_PCCR_MASK));
+ _reg_write_2(SH7709_PDCR, dc | (0x5555 & PFCKBD_HITACHI_PDCR_MASK));
+ _reg_write_2(SH7709_PECR, ec | (0x5555 & PFCKBD_HITACHI_PECR_MASK));
reinstall:
callout_schedule(&pc->pc_soft_ch, 1);
--- /sys/dev/hpc/hpckbdkeymap.h.orig 2005-01-15 14:30:23.000000000 +0900
+++ /sys/dev/hpc/hpckbdkeymap.h 2005-01-15 05:30:25.000000000 +0900
@@ -775,22 +775,22 @@
/* Japanese */
const u_int8_t persona_hpw50pad_jp_keytrans[] = {
/* 0 1 2 3 4 5 6 7 */
-/* 0 */ SPL, UNK, 61 , 59 , UNK, 60 , 62 , UNK,
-/* 1 */ UNK, UNK, UNK, 29 , UNK, UNK, 123, UNK,
-/* 2 */ UNK, UNK, UNK, 1 , UNK, 56 , 46 , UNK,
-/* 3 */ UNK, UNK, 221, 41 , UNK, 15 , 33 , UNK,
-/* 4 */ 42 , UNK, 58 , 45 , UNK, 44 , 20 , UNK,
-/* 5 */ 54 , UNK, 16 , 30 , UNK, 2 , 6 , UNK,
-/* 6 */ 205, UNK, 4 , 17 , UNK, 3 , 5 , UNK,
-/* 7 */ 14 , UNK, 18 , 31 , UNK, 32 , 19 , UNK,
-/* 8 */ UNK, UNK, 68 , 67 , 66 , 65 , 64 , 63 ,
-/* 9 */ UNK, UNK, 203, 121, 53 , 48 , 49 , 47 ,
-/*10 */ UNK, UNK, 208, 112, 57 , 51 , 50 , 34 ,
-/*11 */ UNK, UNK, 43 , 52 , 39 , 37 , 36 , 35 ,
-/*12 */ UNK, UNK, 27 , 40 , 26 , 38 , 23 , 22 ,
-/*13 */ UNK, UNK, 200, 28 , 115, 24 , 9 , 21 ,
-/*14 */ UNK, UNK, 125, 12 , UNK, 10 , UNK, UNK,
-/*15 */ UNK, UNK, 14 , 13 , 11 , 25 , 8 , 7 ,
+/* 0 */ 59 , 61 , 63 , 65 , 67 , SPL, UNK, UNK, /* ON button */
+/* 1 */ 29 , UNK, 47 , 48 , 121, UNK, UNK, UNK,
+/* 2 */ 1 , UNK, 34 , 51 , 112, UNK, UNK, UNK,
+/* 3 */ 41 , 221, 35 , 37 , 52 , UNK, UNK, UNK,
+/* 4 */ 45 , 58 , 22 , 38 , 40 , 42 , UNK, UNK,
+/* 5 */ 30 , 16 , 21 , 24 , 28 , 54 , UNK, UNK,
+/* 6 */ 17 , 4 , UNK, 10 , 12 , 205, UNK, UNK,
+/* 7 */ 31 , 18 , 7 , 25 , 13 , 83 , UNK, UNK,
+/* 8 */ 60 , 62 , 64 , 66 , 68 , IGN, UNK, UNK, /* REC button */
+/* 9 */ UNK, 123, 49 , 53 , 203, UNK, UNK, UNK,
+/*10 */ 56 , 46 , 50 , 57 , 208, UNK, UNK, UNK,
+/*11 */ 15 , 33 , 36 , 39 , 43 , UNK, UNK, UNK,
+/*12 */ 44 , 20 , 23 , 26 , 27 , UNK, UNK, UNK,
+/*13 */ 2 , 6 , 9 , 115, 200, UNK, UNK, UNK,
+/*14 */ 3 , 5 , UNK, UNK, 125, UNK, UNK, UNK,
+/*15 */ 32 , 19 , 8 , 11 , 14 , UNK, UNK, UNK,
};
const int persona_hpw50pad_special_keymap[] = {
----Next_Part(Sat_Jan_15_14:50:03_2005_253)----