luckfox-pico-sdk/sysdrv/source/uboot/u-boot/include/key.h
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

75 lines
1.3 KiB
C

/*
* (C) Copyright 2017 Rockchip Electronics Co., Ltd
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef _KEY_H_
#define _KEY_H_
#include <asm-generic/gpio.h>
#include <dt-bindings/input/linux-event-codes.h>
#define KEY_LONG_DOWN_MS 2000
enum {
INVAL_KEY = 0x0,
ADC_KEY = 0x1,
GPIO_KEY = 0x2,
};
enum key_event {
KEY_PRESS_NONE, /* press without release */
KEY_PRESS_DOWN, /* press -> release */
KEY_PRESS_LONG_DOWN,
KEY_NOT_EXIST,
};
struct dm_key_uclass_platdata {
const char *name;
bool pre_reloc;
u32 code;
u8 type;
/* ADC key */
u8 channel;
int in_volt;
int center;
int min;
int max;
/* GPIO key */
u32 irq;
u32 gpios[2]; /* gpios[0]: gpio controller phandle, gpios[1]: pin */
struct gpio_desc gpio;
u64 rise_ms;
u64 fall_ms;
u32 trig_cnt;
int skip_irq_init;
/* Only for pwrkey gpio irq */
void (*irq_thread)(int irq, struct udevice *dev);
};
/* Use it instead of get_timer() in key interrupt handler */
uint64_t key_timer(uint64_t base);
/* Confirm if your key value is a press event */
int key_is_pressed(int keyval);
/* Pwrkey download mode init */
int pwrkey_download_init(void);
/* Read key */
int key_read(int code);
/* Check whether the key is exist or not, 1: exist, 0: not exist */
int key_exist(int code);
int key_bind_children(struct udevice *dev, const char *drv_name);
#endif