Skip to content

Commit

Permalink
driver/input: Update ist415 touchscreen IC
Browse files Browse the repository at this point in the history
Update ist415 touchscreen.

- Apply audo calibration
- Recive debugging data
- Recive IC ready
- Update firmware

Signed-off-by: eunwoo.nam <[email protected]>
  • Loading branch information
ewoodev committed Dec 23, 2024
1 parent e79c0be commit 9a0e6f9
Show file tree
Hide file tree
Showing 14 changed files with 2,866 additions and 440 deletions.
2 changes: 1 addition & 1 deletion apps/examples/touchscreen/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ include $(APPDIR)/Make.defs
# Power Daemon built-in application info
APPNAME = touchscreen
PRIORITY = 100
STACKSIZE = 1024
STACKSIZE = 4096
FUNCNAME = $(APPNAME)_main
THREADEXEC = TASH_EXECMD_ASYNC

Expand Down
18 changes: 14 additions & 4 deletions build/configs/rtl8730e/loadable_ext_ddr/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ CONFIG_SECOND_FLASH_START_ADDR=0x0A000000
CONFIG_RTL8730E_BOARD_REVISION=8
CONFIG_RAM_DDR=y
# CONFIG_RAM_PSRAM is not set
CONFIG_USERFS_MNTPT="/mnt0"
CONFIG_USERFS_EXT_MNTPT="/mnt"
CONFIG_USERFS_MNTPT="/mnt"
CONFIG_USERFS_EXT_MNTPT="/ext"

#
# SPI Flash driver
Expand Down Expand Up @@ -356,6 +356,7 @@ CONFIG_FLASH_PART_SIZE="60,40,12,400,1844,8476,4780,1844,8476,4780,2048,8,"
CONFIG_FLASH_PART_TYPE="none,none,none,none,kernel,bin,bin,kernel,bin,bin,smartfs,bootparam,"
CONFIG_FLASH_PART_NAME="bl1,reserved,ftl,ss,kernel,common,app1,kernel,common,app1,userfs,bootparam,"
CONFIG_ARCH_BOARD_HAVE_SECOND_FLASH=y
CONFIG_SECOND_FLASH_START_ADDR=0x0A000000

#
# Second Flash Partition Options
Expand Down Expand Up @@ -1451,12 +1452,18 @@ CONFIG_MEMSET_OPTSPEED=y
# CONFIG_LIB_ENVPATH is not set
CONFIG_LIB_HASHMAP=y

CONFIG_EXAMPLES_TOUCHSCREEN=y
#
# Program Execution Options
#
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_SYMTAB=y

CONFIG_DEBUG_TOUCH=y
CONFIG_DEBUG_TOUCH_ERROR=y
CONFIG_DEBUG_TOUCH_WARN=y
CONFIG_DEBUG_TOUCH_INFO=y

#
# Basic CXX Support
#
Expand Down Expand Up @@ -1655,7 +1662,7 @@ CONFIG_EXAMPLES_POWER_TIMEDWAKEUP=y
# CONFIG_EXAMPLES_SELECT_TEST is not set
# CONFIG_EXAMPLES_SENSORBOARD is not set
# CONFIG_EXAMPLES_SETJMP_TEST is not set
# CONFIG_EXAMPLES_SIMPLE_FILE_TRANSFER is not set
CONFIG_EXAMPLES_SIMPLE_FILE_TRANSFER=y

#
# SmartFs Test Applications
Expand Down Expand Up @@ -1687,7 +1694,10 @@ CONFIG_EXAMPLES_UART_LOOPBACK_PORT=2
# Wifi Manager
#
# CONFIG_EXAMPLES_TAHI is not set
# CONFIG_EXAMPLES_WIFIMANAGER_TEST is not set
CONFIG_EXAMPLES_WIFIMANAGER_TEST=y
CONFIG_WIFIMANAGER_TEST_TRIAL=5
CONFIG_EXAMPLES_WIFIMANAGER_AP_LIST_ITEMS_COUNT=10


#
# Platform-specific Support
Expand Down
80 changes: 42 additions & 38 deletions os/board/rtl8730e/src/rtl8730e_ist415.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
#define IST415_I2C_PORT 1
#endif

#define IST415_I2C_FREQ 100000
#define IST415_I2C_ADDRLEN 7
#define IST415_I2C_ADDR (0xA0 >> 1)

/* pin config */
#define IST415_GPIO_RESET_PIN PA_5
#if CONFIG_RTL8730E_BOARD_REVISION >= 6
Expand All @@ -63,32 +59,32 @@
****************************************************************************/
struct rtl8730e_ist415_s {
gpio_irq_t data_ready;
struct i2c_dev_s *i2c; /* Workaround: IC20 write hang issue */
};

struct rtl8730e_ist415_s g_rtl8730e_ist415_priv0;
/****************************************************************************
* Private Function Prototypes
****************************************************************************/

static void rtl8730e_ist415_enable_irq(void);
static void rtl8730e_ist415_disable_irq(void);
static void rtl8730e_ist415_enable_irq(struct ist415_config_s *dev);
static void rtl8730e_ist415_disable_irq(struct ist415_config_s *dev);
static void rtl8730e_ist415_power_off(struct ist415_config_s *dev);
static void rtl8730e_ist415_power_on(struct ist415_config_s *dev);

/****************************************************************************
* Private Data
****************************************************************************/
struct rtl8730e_ist415_s g_rtl8730e_ist415_priv0;

static struct ist415_dev_s g_ist415_dev0 = {
.i2c = NULL,
.i2c_config = {
.frequency = IST415_I2C_FREQ,
.address = IST415_I2C_ADDR,
.addrlen = IST415_I2C_ADDRLEN,
},
.int_pending = false,
.ops = &(struct ist415_ops_s){
.irq_enable = rtl8730e_ist415_enable_irq,
.irq_disable = rtl8730e_ist415_disable_irq,
},
struct ist415_ops_s g_rtl8730e_ist415_ops = {
.irq_enable = rtl8730e_ist415_enable_irq,
.irq_disable = rtl8730e_ist415_disable_irq,
.power_off = rtl8730e_ist415_power_off,
.power_on = rtl8730e_ist415_power_on,
};

struct ist415_config_s g_rtl8730e_ist415_0 = {
.ops = &g_rtl8730e_ist415_ops,
.priv = &g_rtl8730e_ist415_priv0,
};

Expand All @@ -103,33 +99,41 @@ static void rtl8730e_ist415_irq_handler(uint32_t id, gpio_irq_event event)
* until we finish this particular interrupt related work
* in the HPWORK thread
*/
struct ist415_dev_s *dev;
struct ist415_config_s *dev;
if (id == 0) {
dev = &g_ist415_dev0;
dev = &g_rtl8730e_ist415_0;
}
struct rtl8730e_ist415_s *priv = dev->priv;

if (dev->handler != NULL) {
dev->handler(dev);
}
}

static void rtl8730e_ist415_enable_irq(void)
static void rtl8730e_ist415_enable_irq(struct ist415_config_s *dev)
{
gpio_irq_enable(&g_rtl8730e_ist415_priv0.data_ready);
struct rtl8730e_ist415_s *priv = (struct rtl8730e_ist415_s *)dev->priv;
gpio_irq_enable(&priv->data_ready);
}

static void rtl8730e_ist415_disable_irq(void)
static void rtl8730e_ist415_disable_irq(struct ist415_config_s *dev)
{
gpio_irq_disable(&g_rtl8730e_ist415_priv0.data_ready);
struct rtl8730e_ist415_s *priv = (struct rtl8730e_ist415_s *)dev->priv;
gpio_irq_disable(&priv->data_ready);
}

static void rtl8730e_ist415_gpio_reset(void)
static void rtl8730e_ist415_power_off(struct ist415_config_s *dev)
{
struct rtl8730e_ist415_s *priv = (struct rtl8730e_ist415_s *)dev->priv;
up_i2cuninitialize(priv->i2c); /* Workaround: IC20 write hang issue */
GPIO_WriteBit(IST415_GPIO_RESET_PIN, PIN_LOW);
DelayMs(300);
}

static void rtl8730e_ist415_power_on(struct ist415_config_s *dev)
{
struct rtl8730e_ist415_s *priv = (struct rtl8730e_ist415_s *)dev->priv;
GPIO_WriteBit(IST415_GPIO_RESET_PIN, PIN_HIGH);
DelayMs(1); /* Wait for stable voltage before i2c commands issued */
priv->i2c = up_i2cinitialize(IST415_I2C_PORT); /* Workaround: IC20 write hang issue */
}

static void rtl8730e_ist415_gpio_init(void)
Expand Down Expand Up @@ -163,25 +167,25 @@ static void rtl8730e_ist415_gpio_init(void)
****************************************************************************/
void rtl8730e_ist415_initialize(void)
{
FAR struct i2c_dev_s *i2c;
struct i2c_dev_s *i2c;
struct ist415_config_s *dev = &g_rtl8730e_ist415_0;
struct rtl8730e_ist415_s *priv = dev->priv;

rtl8730e_ist415_gpio_init();
rtl8730e_ist415_gpio_reset();

i2c = up_i2cinitialize(IST415_I2C_PORT);
if (!i2c) {
touchdbg("ERROR: Failed to initialize I2C\n");
return;
}
g_ist415_dev0.i2c = i2c;
gpio_irq_init(&g_rtl8730e_ist415_priv0.data_ready, IST415_GPIO_I2C_PIN, rtl8730e_ist415_irq_handler, (uint32_t)0);
gpio_irq_set(&g_rtl8730e_ist415_priv0.data_ready, IRQ_FALL_RISE, 1);
gpio_irq_enable(&g_rtl8730e_ist415_priv0.data_ready);
priv->i2c = i2c; /* Workaround: IC20 write hang issue */

int ret= ist415_initialize(TOUCH_DEV_PATH, &g_ist415_dev0);
gpio_irq_init(&priv->data_ready, IST415_GPIO_I2C_PIN, rtl8730e_ist415_irq_handler, (uint32_t)0);
gpio_irq_set(&priv->data_ready, IRQ_FALL, 1);

if (ret < 0) {
if (ist415_initialize(TOUCH_DEV_PATH, i2c, dev) < 0) {
touchdbg("ERROR: Touch driver register fail\n");
return;
up_i2cuninitialize(i2c);
}
touchvdbg("Touch driver register success\n");
touchdbg("Touch driver register success\n");
}
2 changes: 2 additions & 0 deletions os/drivers/input/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ ifeq ($(CONFIG_TOUCH),y)
CSRCS += touchscreen.c
ifeq ($(CONFIG_TOUCH_IST415),y)
CSRCS += ist415.c
CSRCS += ist415_misc.c
CSRCS += ist415_update.c
endif

DEPPATH += --dep-path input
Expand Down
Loading

0 comments on commit 9a0e6f9

Please sign in to comment.