^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * dm355evm_keys.c - support buttons and IR remote on DM355 EVM board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2008 by David Brownell
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #include <linux/input.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/input/sparse-keymap.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) #include <linux/mfd/dm355evm_msp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) * The MSP430 firmware on the DM355 EVM monitors on-board pushbuttons
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) * and an IR receptor used for the remote control. When any key is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) * pressed, or its autorepeat kicks in, an event is sent. This driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) * read those events from the small (32 event) queue and reports them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) * Note that physically there can only be one of these devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) * This driver was tested with firmware revision A4.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) struct dm355evm_keys {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) struct input_dev *input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) /* These initial keycodes can be remapped */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) static const struct key_entry dm355evm_keys[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) * Pushbuttons on the EVM board ... note that the labels for these
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) * are SW10/SW11/etc on the PC board. The left/right orientation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) * comes only from the firmware's documentation, and presumes the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) * power connector is immediately in front of you and the IR sensor
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) * is to the right. (That is, rotate the board counter-clockwise
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) * by 90 degrees from the SW10/etc and "DM355 EVM" labels.)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) { KE_KEY, 0x00d8, { KEY_OK } }, /* SW12 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) { KE_KEY, 0x00b8, { KEY_UP } }, /* SW13 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) { KE_KEY, 0x00e8, { KEY_DOWN } }, /* SW11 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) { KE_KEY, 0x0078, { KEY_LEFT } }, /* SW14 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) { KE_KEY, 0x00f0, { KEY_RIGHT } }, /* SW10 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) * IR buttons ... codes assigned to match the universal remote
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) * provided with the EVM (Philips PM4S) using DVD code 0020.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) * These event codes match firmware documentation, but other
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) * remote controls could easily send more RC5-encoded events.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) * The PM4S manual was used in several cases to help select
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) * a keycode reflecting the intended usage.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) * RC5 codes are 14 bits, with two start bits (0x3 prefix)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) * and a toggle bit (masked out below).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) { KE_KEY, 0x300c, { KEY_POWER } }, /* NOTE: docs omit this */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) { KE_KEY, 0x3000, { KEY_NUMERIC_0 } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) { KE_KEY, 0x3001, { KEY_NUMERIC_1 } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) { KE_KEY, 0x3002, { KEY_NUMERIC_2 } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) { KE_KEY, 0x3003, { KEY_NUMERIC_3 } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) { KE_KEY, 0x3004, { KEY_NUMERIC_4 } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) { KE_KEY, 0x3005, { KEY_NUMERIC_5 } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) { KE_KEY, 0x3006, { KEY_NUMERIC_6 } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) { KE_KEY, 0x3007, { KEY_NUMERIC_7 } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) { KE_KEY, 0x3008, { KEY_NUMERIC_8 } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) { KE_KEY, 0x3009, { KEY_NUMERIC_9 } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) { KE_KEY, 0x3022, { KEY_ENTER } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) { KE_KEY, 0x30ec, { KEY_MODE } }, /* "tv/vcr/..." */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) { KE_KEY, 0x300f, { KEY_SELECT } }, /* "info" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) { KE_KEY, 0x3020, { KEY_CHANNELUP } }, /* "up" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) { KE_KEY, 0x302e, { KEY_MENU } }, /* "in/out" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) { KE_KEY, 0x3011, { KEY_VOLUMEDOWN } }, /* "left" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) { KE_KEY, 0x300d, { KEY_MUTE } }, /* "ok" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) { KE_KEY, 0x3010, { KEY_VOLUMEUP } }, /* "right" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) { KE_KEY, 0x301e, { KEY_SUBTITLE } }, /* "cc" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) { KE_KEY, 0x3021, { KEY_CHANNELDOWN } },/* "down" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) { KE_KEY, 0x3022, { KEY_PREVIOUS } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) { KE_KEY, 0x3026, { KEY_SLEEP } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) { KE_KEY, 0x3172, { KEY_REWIND } }, /* NOTE: docs wrongly say 0x30ca */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) { KE_KEY, 0x3175, { KEY_PLAY } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) { KE_KEY, 0x3174, { KEY_FASTFORWARD } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) { KE_KEY, 0x3177, { KEY_RECORD } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) { KE_KEY, 0x3176, { KEY_STOP } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) { KE_KEY, 0x3169, { KEY_PAUSE } },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) * Because we communicate with the MSP430 using I2C, and all I2C calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * in Linux sleep, we use a threaded IRQ handler. The IRQ itself is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * active low, but we go through the GPIO controller so we can trigger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) * on falling edges and not worry about enabling/disabling the IRQ in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * the keypress handling path.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) static irqreturn_t dm355evm_keys_irq(int irq, void *_keys)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) static u16 last_event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) struct dm355evm_keys *keys = _keys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) const struct key_entry *ke;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) unsigned int keycode;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) int status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) u16 event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) /* For simplicity we ignore INPUT_COUNT and just read
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) * events until we get the "queue empty" indicator.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) * Reading INPUT_LOW decrements the count.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) for (;;) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) status = dm355evm_msp_read(DM355EVM_MSP_INPUT_HIGH);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) if (status < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) dev_dbg(keys->dev, "input high err %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) event = status << 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) status = dm355evm_msp_read(DM355EVM_MSP_INPUT_LOW);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) if (status < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) dev_dbg(keys->dev, "input low err %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) status);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) event |= status;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) if (event == 0xdead)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) /* Press and release a button: two events, same code.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) * Press and hold (autorepeat), then release: N events
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) * (N > 2), same code. For RC5 buttons the toggle bits
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) * distinguish (for example) "1-autorepeat" from "1 1";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) * but PCB buttons don't support that bit.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) * So we must synthesize release events. We do that by
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) * mapping events to a press/release event pair; then
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) * to avoid adding extra events, skip the second event
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * of each pair.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) if (event == last_event) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) last_event = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) continue;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) last_event = event;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) /* ignore the RC5 toggle bit */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) event &= ~0x0800;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) /* find the key, or report it as unknown */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) ke = sparse_keymap_entry_from_scancode(keys->input, event);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) keycode = ke ? ke->keycode : KEY_UNKNOWN;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) dev_dbg(keys->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) "input event 0x%04x--> keycode %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) event, keycode);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) /* report press + release */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) input_report_key(keys->input, keycode, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) input_sync(keys->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) input_report_key(keys->input, keycode, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) input_sync(keys->input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) /*----------------------------------------------------------------------*/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) static int dm355evm_keys_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) struct dm355evm_keys *keys;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) struct input_dev *input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) int irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) int error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) keys = devm_kzalloc(&pdev->dev, sizeof (*keys), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) if (!keys)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) input = devm_input_allocate_device(&pdev->dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) if (!input)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) keys->dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) keys->input = input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) input->name = "DM355 EVM Controls";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) input->phys = "dm355evm/input0";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) input->id.bustype = BUS_I2C;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) input->id.product = 0x0355;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) input->id.version = dm355evm_msp_read(DM355EVM_MSP_FIRMREV);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) error = sparse_keymap_setup(input, dm355evm_keys, NULL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) /* REVISIT: flush the event queue? */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) /* set up "threaded IRQ handler" */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) irq = platform_get_irq(pdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) if (irq < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) return irq;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) error = devm_request_threaded_irq(&pdev->dev, irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) NULL, dm355evm_keys_irq,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) dev_name(&pdev->dev), keys);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /* register */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) error = input_register_device(input);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) if (error)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) return error;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) /* REVISIT: add suspend/resume when DaVinci supports it. The IRQ should
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) * be able to wake up the system. When device_may_wakeup(&pdev->dev), call
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) * enable_irq_wake() on suspend, and disable_irq_wake() on resume.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) * I2C is used to talk to the MSP430, but this platform device is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) * exposed by an MFD driver that manages I2C communications.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) static struct platform_driver dm355evm_keys_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) .probe = dm355evm_keys_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) .name = "dm355evm_keys",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) module_platform_driver(dm355evm_keys_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) MODULE_LICENSE("GPL");