1 /* 2 * (C) Copyright 2017 Rockchip Electronics Co., Ltd 3 * 4 * SPDX-License-Identifier: GPL-2.0+ 5 */ 6 7 #ifndef _KEY_H_ 8 #define _KEY_H_ 9 10 #define KEY_LONG_DOWN_MS 2000 11 12 enum key_state { 13 KEY_PRESS_NONE, 14 KEY_PRESS_UP, 15 KEY_PRESS_DOWN, 16 KEY_PRESS_LONG_DOWN, 17 KEY_NOT_EXIST, 18 }; 19 20 struct dm_key_ops { 21 int type; 22 const char *name; 23 int (*read)(struct udevice *dev, int code); 24 int (*exist)(struct udevice *dev, int code); 25 }; 26 27 struct input_key { 28 const char *name; 29 u32 code; 30 u32 channel; 31 u32 value; 32 u32 margin; 33 u32 vref; 34 int flag; 35 36 u32 irq; 37 u64 up_t; 38 u64 down_t; 39 }; 40 41 uint64_t key_get_timer(uint64_t base); 42 int platform_key_read(int code); 43 44 #endif 45