mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 22:23:14 -04:00
sec_mmi: debug read registers interface
Adding debug interface to read arbitrary touch IC registers. Change-Id: Id70d1d8d85608947c4c2663444471cac44cff212 Signed-off-by: Konstantin Makariev <hcv867@motorola.com> Reviewed-on: https://gerrit.mot.com/1398906 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Konstantin Makariev <kmakariev@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
fc1db9d9fe
commit
d98327444c
1 changed files with 69 additions and 0 deletions
|
|
@ -54,18 +54,32 @@ static ssize_t sec_ts_gesture_status_show(struct device *dev,
|
|||
static inline ssize_t sec_ts_show_error(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
|
||||
static ssize_t sec_ts_address_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size);
|
||||
static ssize_t sec_ts_size_store(struct device *dev,
|
||||
struct device_attribute *attr, const char *buf, size_t size);
|
||||
static ssize_t sec_ts_data_show(struct device *dev,
|
||||
struct device_attribute *attr, char *buf);
|
||||
|
||||
static DEVICE_ATTR(sec_ts_reg, (S_IWUSR | S_IWGRP), NULL, sec_ts_reg_store);
|
||||
static DEVICE_ATTR(sec_ts_regreadsize, (S_IWUSR | S_IWGRP), NULL, sec_ts_regreadsize_store);
|
||||
static DEVICE_ATTR(sec_ts_enter_recovery, (S_IWUSR | S_IWGRP), NULL, sec_ts_enter_recovery_store);
|
||||
static DEVICE_ATTR(sec_ts_regread, S_IRUGO, sec_ts_regread_show, NULL);
|
||||
static DEVICE_ATTR(sec_ts_gesture_status, S_IRUGO, sec_ts_gesture_status_show, NULL);
|
||||
|
||||
static DEVICE_ATTR(address, (S_IWUSR | S_IWGRP), NULL, sec_ts_address_store);
|
||||
static DEVICE_ATTR(size, (S_IWUSR | S_IWGRP), NULL, sec_ts_size_store);
|
||||
static DEVICE_ATTR(data, S_IRUGO, sec_ts_data_show, NULL);
|
||||
|
||||
static struct attribute *cmd_attributes[] = {
|
||||
&dev_attr_sec_ts_reg.attr,
|
||||
&dev_attr_sec_ts_regreadsize.attr,
|
||||
&dev_attr_sec_ts_enter_recovery.attr,
|
||||
&dev_attr_sec_ts_regread.attr,
|
||||
&dev_attr_sec_ts_gesture_status.attr,
|
||||
&dev_attr_address.attr,
|
||||
&dev_attr_size.attr,
|
||||
&dev_attr_data.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
|
@ -178,6 +192,61 @@ static ssize_t sec_ts_regreadsize_store(struct device *dev, struct device_attrib
|
|||
return size;
|
||||
}
|
||||
|
||||
#define MAX_DATA_SZ 1024
|
||||
|
||||
static ssize_t sec_ts_address_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
struct sec_ts_data *ts = dev_get_drvdata(dev);
|
||||
int error;
|
||||
long value;
|
||||
|
||||
error = kstrtol(buf, 0, &value);
|
||||
if (error || value > MAX_DATA_SZ)
|
||||
return -EINVAL;
|
||||
|
||||
lv1cmd = (u8)value;
|
||||
input_info(true, &ts->client->dev, "%s: read address 0x%02X\n", __func__, lv1cmd);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static ssize_t sec_ts_size_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
struct sec_ts_data *ts = dev_get_drvdata(dev);
|
||||
int error;
|
||||
long value;
|
||||
|
||||
error = kstrtol(buf, 0, &value);
|
||||
if (error)
|
||||
return -EINVAL;
|
||||
|
||||
lv1_readsize = (unsigned int)value;
|
||||
lv1_readoffset = 0;
|
||||
lv1_readremain = 0;
|
||||
input_info(true, &ts->client->dev, "%s: read size %u\n", __func__, lv1_readsize);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
static ssize_t sec_ts_data_show(struct device *dev, struct device_attribute *attr, char *buf)
|
||||
{
|
||||
struct sec_ts_data *ts = dev_get_drvdata(dev);
|
||||
u8 buffer[MAX_DATA_SZ];
|
||||
ssize_t length, blen = 0;
|
||||
int i;
|
||||
|
||||
length = sec_ts_regread_show(dev, attr, buffer);
|
||||
if (length != lv1_readsize)
|
||||
return sprintf(buf, "error %zu reading %u bytes from reg addr=0x%02X\n", length, lv1_readsize, lv1cmd);
|
||||
|
||||
input_info(true, &ts->client->dev, "%s: %u bytes from reg addr=0x%02X\n", __func__, lv1_readsize, lv1cmd);
|
||||
for (i = 0; i < length; i++)
|
||||
blen += scnprintf(buf + blen, PAGE_SIZE - blen, "%02X ", buffer[i]);
|
||||
blen += scnprintf(buf + blen, PAGE_SIZE - blen, "\n");
|
||||
|
||||
return blen;
|
||||
}
|
||||
|
||||
static ssize_t sec_ts_enter_recovery_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t size)
|
||||
{
|
||||
struct sec_ts_data *ts = dev_get_drvdata(dev);
|
||||
|
|
|
|||
Loading…
Reference in a new issue