Signed-off-by: Charles Wang <charles.goodix@xxxxxxxxx>
---
drivers/input/touchscreen/goodix_berlin.h | 2 +
.../input/touchscreen/goodix_berlin_core.c | 52 +++++++++++++++++++
drivers/input/touchscreen/goodix_berlin_i2c.c | 6 +++
drivers/input/touchscreen/goodix_berlin_spi.c | 6 +++
4 files changed, 66 insertions(+)
diff --git a/drivers/input/touchscreen/goodix_berlin.h b/drivers/input/touchscreen/goodix_berlin.h
index 1fd77eb69..1741f2d15 100644
--- a/drivers/input/touchscreen/goodix_berlin.h
+++ b/drivers/input/touchscreen/goodix_berlin.h
@@ -19,6 +19,8 @@ struct regmap;
int goodix_berlin_probe(struct device *dev, int irq, const struct input_id *id,
struct regmap *regmap);
+void goodix_berlin_remove(struct device *dev);
+
extern const struct dev_pm_ops goodix_berlin_pm_ops;
#endif
diff --git a/drivers/input/touchscreen/goodix_berlin_core.c b/drivers/input/touchscreen/goodix_berlin_core.c
index e7b41a926..e02160841 100644
--- a/drivers/input/touchscreen/goodix_berlin_core.c
+++ b/drivers/input/touchscreen/goodix_berlin_core.c
@@ -672,6 +672,44 @@ static void goodix_berlin_power_off_act(void *data)
goodix_berlin_power_off(cd);
}
+static ssize_t goodix_berlin_registers_read(struct file *filp, struct kobject *kobj,
+ struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
+{
+ struct goodix_berlin_core *cd;
+ struct device *dev;
+ int error;
+
+ dev = kobj_to_dev(kobj);
+ cd = dev_get_drvdata(dev);
+
+ error = regmap_raw_read(cd->regmap, (unsigned int)off,
+ buf, count);
+
+ return error ? error : count;
+}
+
+static ssize_t goodix_berlin_registers_write(struct file *filp, struct kobject *kobj,
+ struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
+{
+ struct goodix_berlin_core *cd;
+ struct device *dev;
+ int error;
+
+ dev = kobj_to_dev(kobj);
+ cd = dev_get_drvdata(dev);
+
+ error = regmap_raw_write(cd->regmap, (unsigned int)off,
+ buf, count);
+
+ return error ? error : count;
+}
+
+static struct bin_attribute goodix_berlin_registers_attr = {
+ .attr = {.name = "registers", .mode = 0600},
+ .read = goodix_berlin_registers_read,
+ .write = goodix_berlin_registers_write,
+};
+
int goodix_berlin_probe(struct device *dev, int irq, const struct input_id *id,
struct regmap *regmap)
{
@@ -743,6 +781,14 @@ int goodix_berlin_probe(struct device *dev, int irq, const struct input_id *id,
dev_set_drvdata(dev, cd);
+ error = sysfs_create_bin_file(&cd->dev->kobj,
+ &goodix_berlin_registers_attr);