Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/: Add support for CM Test and Jitter test with their respective APIs #6690

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion os/drivers/input/ist415.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ static int ist415_cmd(struct touchscreen_s *upper, int argc, char **argv)
ist415_selftest(dev);
} else if (strncmp(argv[1], "rec", 4) == 0) {
ret = ist415_rec_mode(dev, argc, argv);
} else if (strncmp(argv[1], "cm_test", 8) == 0) {
ret = ist415_cmtest(dev);
} else if(strncmp(argv[1], "jitter_test", 12) == 0) {
ret = ist415_jittertest(dev);
} else {
ret = -EINVAL;
}
Expand All @@ -454,7 +458,6 @@ static int ist415_cmd(struct touchscreen_s *upper, int argc, char **argv)
return ret;
}


/****************************************************************************
* Name: ist415_power_on
****************************************************************************/
Expand Down
46 changes: 46 additions & 0 deletions os/drivers/input/ist415_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,52 @@ int ist415_selftest(struct ist415_dev_s *dev)
return ret;
}

int ist415_cmtest(struct ist415_dev_s *dev)
{
int16_t *buf16;
int ret = 0;
buf16 = (int16_t *)kmm_malloc(dev->mtl_node_len * sizeof(int16_t));
if (!buf16) {
return -ENOMEM;
}
ist415_disable(dev);
ist415_sensor(dev, false);
ret = ist415_run_selftest(dev, CMCS_FLAG_CM, (int16_t *)buf16);
kmm_free(buf16);
ist415_reset(dev, false);
ist415_start(dev);
ist415_enable(dev);
if (!ret && !dev->cm_result) {
return OK;
} else if (!ret && dev->cm_result) {
return ERROR;
}
return ret;
}

int ist415_jittertest(struct ist415_dev_s *dev)
{
int16_t *buf16;
int ret = 0;
buf16 = (int16_t *)kmm_malloc(dev->mtl_node_len * sizeof(int16_t));
if (!buf16) {
return -ENOMEM;
}
ist415_disable(dev);
ist415_sensor(dev, false);
ret = ist415_run_selftest(dev, CMCS_FLAG_JITTER, (int16_t *)buf16);
kmm_free(buf16);
ist415_reset(dev, false);
ist415_start(dev);
ist415_enable(dev);
if (!ret && !dev->jitter_result) {
return OK;
} else if (!ret && dev->jitter_result) {
return ERROR;
}
return ret;
}

/****************************************************************************
* Name: ist415_rec_mode
*
Expand Down
2 changes: 2 additions & 0 deletions os/drivers/input/ist415_misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ void ist415_run_intr_debug(struct ist415_dev_s *dev);
void ist415_display_cpc(struct ist415_dev_s *dev);
void ist415_display_rawdata(struct ist415_dev_s *dev);
int ist415_selftest(struct ist415_dev_s *dev);
int ist415_cmtest(struct ist415_dev_s *dev);
int ist415_jittertest(struct ist415_dev_s *dev);
int ist415_rec_mode(struct ist415_dev_s *dev, int argc, char **argv);
void ist415_recording(struct ist415_dev_s *dev);

Expand Down