feat: touch: bring up novatek nt38350 touch panel

CHAMPION-95

bring up novatek nt38350 touch panel

Change-Id: Ia890518620a00df0bd9e51aface1bb019034ec94
Signed-off-by: futerigele <futerigele@xiaomi.com>
This commit is contained in:
futerigele
2021-07-05 10:47:12 +08:00
parent 69463373a4
commit 5a62cff0e5
4 changed files with 3734 additions and 0 deletions
+32
View File
@@ -81,6 +81,38 @@ config INPUT_FT5X06
Enable support for the FocalTech FT5x06 multi-touch, capacitive
touch panel controller
config INPUT_NT38350
bool "NovaTek NT38350 multi-touch, capacitive touch panel controller"
default n
select I2C
select INPUT_TOUCHSCREEN
depends on SCHED_WORKQUEUE
---help---
Enable support for the Novatek NT38350 multi-touch, capacitive
touch panel controller
if INPUT_NT38350
config NT38350_FW_PATH
string "NovaTek NT38350 Firmware path"
default "/mnt/data/nt38350_fw.bin"
---help---
Set up the NT38350 Firmare path
config NT38350_NEED_UPGRADE_FW
bool "NovaTek NT38350 Firmware Need Upgrade"
default n
---help---
Say yes here to enable firmware upgrade
config nt38350_NPOLLWAITERS
int "Number NT38350 poll waiters"
default 4
---help---
Maximum number of threads that can be waiting on poll()
endif # INPUT_NT38350
config INPUT_FT5336
bool "FocalTech FT5336 multi-touch, capacitive touch panel controller"
default n
+4
View File
@@ -32,6 +32,10 @@ ifeq ($(CONFIG_INPUT_FT5X06),y)
CSRCS += ft5x06.c
endif
ifeq ($(CONFIG_INPUT_NT38350),y)
CSRCS += nt38350.c
endif
ifeq ($(CONFIG_INPUT_ADS7843E),y)
CSRCS += ads7843e.c
endif
File diff suppressed because it is too large Load Diff
+139
View File
@@ -0,0 +1,139 @@
/****************************************************************************
* include/nuttx/input/nt38350.h
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership. The
* ASF licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
****************************************************************************/
#ifndef __INCLUDE_NUTTX_INPUT_NT38350_H
#define __INCLUDE_NUTTX_INPUT_NT38350_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <nuttx/irq.h>
#include <nuttx/i2c/i2c_master.h>
#include <nuttx/fs/ioctl.h>
#include <nuttx/ioexpander/ioexpander.h>
#ifdef CONFIG_INPUT_NT38350
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Specific IOCTL commands for NT38350 */
#define TSIOC_GETNVTDIFF _TSIOC(0x0006) /* arg: Pointer to get struct nvt_diff_s */
#define TSIOC_SELFTEST _TSIOC(0x0007) /* arg: Pointer to int self test value */
/****************************************************************************
* Public Types
****************************************************************************/
/* A reference to a structure of this type must be passed to the NT38350
* driver. This structure provides information about the configuration
* of the NT38350 and provides some board-specific hooks.
*
* Memory for this structure is provided by the caller. It is not copied
* by the driver and is presumed to persist while the driver is active. The
* memory must be writeable because, under certain circumstances, the driver
* may modify frequency or X plate resistance values.
*/
struct nt38350_config_s
{
/* Device characterization */
uint8_t address; /* 7-bit I2C address (only bits 0-6 used) */
uint16_t rxplate; /* Calibrated X plate resistance */
uint32_t frequency; /* Default I2C frequency */
int gpio_irq_pin; /* IRQ pin */
int gpio_rst_pin; /* Reset pin */
ioe_callback_t handler; /* The nt38350 interrupt handler */
FAR void *arg; /* Interrupt handler argument */
FAR struct ioexpander_dev_s *ioe_dev; /* Ioexpander device. */
FAR struct i2c_master_s *i2c;
/* IRQ/GPIO access callbacks. These operations all hidden behind
* callbacks to isolate the NT38350 driver from differences in GPIO
* interrupt handling by varying boards and MCUs.
*
* attach - Attach an NT38350 interrupt handler to a GPIO interrupt
* enable - Enable or disable a GPIO interrupt
* clear - Acknowledge/clear any pending GPIO interrupt
* wakeup - Issue WAKE interrupt to NT38350 to change the NT38350 from
* Hibernate to Active mode.
* nreset - Control the chip reset pin (active low)
*/
#ifndef CONFIG_NT38350_POLLMODE
int (*attach)(FAR struct nt38350_config_s *config,
ioe_callback_t isr, FAR void *arg);
void (*enable)(FAR const struct nt38350_config_s *config, bool enable);
void (*clear)(FAR const struct nt38350_config_s *config);
int (*detach)(FAR struct nt38350_config_s *config,
ioe_callback_t isr);
#endif
void (*wakeup)(FAR const struct nt38350_config_s *config);
void (*nreset)(FAR const struct nt38350_config_s *config,
bool state);
};
/****************************************************************************
* Public Function Prototypes
****************************************************************************/
#ifdef __cplusplus
#define EXTERN extern "C"
extern "C"
{
#else
#define EXTERN extern
#endif
/****************************************************************************
* Name: nt38350_register
*
* Description:
* Configure the nt38350 to use the provided I2C device instance. This
* will register the driver as /dev/inputN where N is the minor device
* number
*
* Input Parameters:
* config - Persistent board configuration data
* minor - The input device minor number
*
* Returned Value:
* Zero is returned on success. Otherwise, a negated errno value is
* returned to indicate the nature of the failure.
*
****************************************************************************/
int nt38350_register(FAR struct nt38350_config_s *config,
FAR const char *devname);
#undef EXTERN
#ifdef __cplusplus
}
#endif
#endif /* CONFIG_INPUT_NT38350 */
#endif /* __INCLUDE_NUTTX_INPUT_NT38350_H */