drivers: input: input_chsc5x: configurable ic type verification
Add Kconfig option to skip or execute the verification of the ic type. This adds a delay of 100ms to the initialization. Signed-off-by: Matthias Alleman <matthias.alleman@basalte.be>
This commit is contained in:
committed by
Anas Nashif
parent
7a662cac8b
commit
158ec0384b
@@ -10,3 +10,11 @@ config INPUT_CHSC5X
|
||||
select INPUT_TOUCH
|
||||
help
|
||||
Enable CHSC5X driver for Chipsemi capacitive touch panel controller.
|
||||
|
||||
config INPUT_CHSC5X_VERIFY_IC_TYPE
|
||||
bool "IC type verification"
|
||||
default y
|
||||
depends on INPUT_CHSC5X
|
||||
help
|
||||
This option enables the verification of the IC type which implies an
|
||||
additional delay of 100ms during initialization.
|
||||
|
||||
@@ -100,7 +100,8 @@ static void chsc5x_isr_handler(const struct device *dev, struct gpio_callback *c
|
||||
k_work_submit(&data->work);
|
||||
}
|
||||
|
||||
static int chsc5x_chip_init(const struct device *dev)
|
||||
#if defined(CONFIG_INPUT_CHSC5X_VERIFY_IC_TYPE)
|
||||
static int chsc5x_verify_ic(const struct device *dev)
|
||||
{
|
||||
const struct chsc5x_config *cfg = dev->config;
|
||||
int ret;
|
||||
@@ -141,6 +142,7 @@ static int chsc5x_chip_init(const struct device *dev)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_INPUT_CHSC5X_VERIFY_IC_TYPE */
|
||||
|
||||
static int chsc5x_reset(const struct device *dev)
|
||||
{
|
||||
@@ -252,10 +254,17 @@ static int chsc5x_init(const struct device *dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_INPUT_CHSC5X_VERIFY_IC_TYPE)
|
||||
/* It takes about 94ms until chip is ready after reset. */
|
||||
k_msleep(100);
|
||||
|
||||
return chsc5x_chip_init(dev);
|
||||
ret = chsc5x_verify_ic(dev);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Failed to verify ic: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_INPUT_CHSC5X_VERIFY_IC_TYPE */
|
||||
return ret;
|
||||
};
|
||||
|
||||
#define CHSC5X_DEFINE(index) \
|
||||
|
||||
Reference in New Issue
Block a user