berlNA: support usb detection of novatek TP.

TP:
Add USB detection based on touchscreen class.

Change-Id: I17228951a5974a21cabb9985caa7ec1c308f3016
Reviewed-on: https://gerrit.mot.com/1932115
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jichao Zou <zoujc@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
litong20 2021-04-26 11:14:19 +08:00 • committed by litong
commit 1cd7f94b4f
3 changed files with 17 additions and 2 deletions

View file

@ -167,7 +167,6 @@ uint32_t ENG_RST_ADDR = 0x7FFF80;
uint32_t SWRST_N8_ADDR = 0; //read from dtsi
uint32_t SPI_RD_FAST_ADDR = 0; //read from dtsi
static int charger_notifier_callback(struct notifier_block *nb, unsigned long val, void *v);
static int nvt_set_charger(uint8_t charger_on_off);
static void nvt_charger_notify_work(struct work_struct *work);
static int usb_detect_flag = 0;
@ -3315,7 +3314,7 @@ static const struct spi_device_id nvt_ts_id[] = {
{ }
};
static int nvt_set_charger(uint8_t charger_on_off)
int nvt_set_charger(uint8_t charger_on_off)
{
uint8_t buf[8] = {0};
int32_t ret = 0;

View file

@ -330,6 +330,7 @@ int32_t nvt_set_page(uint32_t addr);
int32_t nvt_write_addr(uint32_t addr, uint8_t data);
int32_t nvt_ts_suspend(struct device *dev);
int32_t nvt_ts_resume(struct device *dev);
int nvt_set_charger(uint8_t charger_on_off);
#ifdef NVT_SET_TOUCH_STATE
int touch_set_state(int state, int panel_idx);
int check_touch_state(int *state, int panel_idx);

View file

@ -139,6 +139,20 @@ static int nvt_mmi_methods_drv_irq(struct device *dev, int state)
return ret;
}
static int nvt_mmi_charger_mode(struct device *dev, int mode)
{
if (mutex_lock_interruptible(&ts->lock)) {
NVT_ERR("Failed to lock in mutex_lock_interruptible(&ts->lock).\n");
return -EINVAL;
}
nvt_set_charger(mode);
NVT_LOG("Charger mode %s!\n", !!mode ? "Enabled" : "Disabled");
mutex_unlock(&ts->lock);
return 0;
}
static int nvt_mmi_methods_reset(struct device *dev, int type)
{
nvt_sw_reset();
@ -211,6 +225,7 @@ static struct ts_mmi_methods nvt_mmi_methods = {
/* SET methods */
.reset = nvt_mmi_methods_reset,
.drv_irq = nvt_mmi_methods_drv_irq,
.charger_mode = nvt_mmi_charger_mode,
/* Firmware */
.firmware_update = nvt_mmi_firmware_update,
/* PM callback */