提交 5bcee83a 编写于 作者: D Dario Binacchi 提交者: Dmitry Torokhov

Input: edt-ft5x06 - set report rate by dts property

It allows to change the M06/M12 default scan rate on driver probing.
Co-developed-by: NMichael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: NMichael Trimarchi <michael@amarulasolutions.com>
Signed-off-by: NDario Binacchi <dario.binacchi@amarulasolutions.com>
Link: https://lore.kernel.org/r/20220621123937.1330389-4-dario.binacchi@amarulasolutions.comSigned-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
上级 23ea98f4
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/irq.h> #include <linux/irq.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/property.h>
#include <linux/ratelimit.h> #include <linux/ratelimit.h>
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -1084,6 +1085,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, ...@@ -1084,6 +1085,7 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
struct input_dev *input; struct input_dev *input;
unsigned long irq_flags; unsigned long irq_flags;
int error; int error;
u32 report_rate;
char fw_version[EDT_NAME_LEN]; char fw_version[EDT_NAME_LEN];
dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n"); dev_dbg(&client->dev, "probing for EDT FT5x06 I2C\n");
...@@ -1213,6 +1215,27 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client, ...@@ -1213,6 +1215,27 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client,
edt_ft5x06_ts_get_defaults(&client->dev, tsdata); edt_ft5x06_ts_get_defaults(&client->dev, tsdata);
edt_ft5x06_ts_get_parameters(tsdata); edt_ft5x06_ts_get_parameters(tsdata);
if (tsdata->reg_addr.reg_report_rate != NO_REGISTER &&
!device_property_read_u32(&client->dev,
"report-rate-hz", &report_rate)) {
if (tsdata->version == EDT_M06)
tsdata->report_rate = clamp_val(report_rate, 30, 140);
else
tsdata->report_rate = clamp_val(report_rate, 1, 255);
if (report_rate != tsdata->report_rate)
dev_warn(&client->dev,
"report-rate %dHz is unsupported, use %dHz\n",
report_rate, tsdata->report_rate);
if (tsdata->version == EDT_M06)
tsdata->report_rate /= 10;
edt_ft5x06_register_write(tsdata,
tsdata->reg_addr.reg_report_rate,
tsdata->report_rate);
}
dev_dbg(&client->dev, dev_dbg(&client->dev,
"Model \"%s\", Rev. \"%s\", %dx%d sensors\n", "Model \"%s\", Rev. \"%s\", %dx%d sensors\n",
tsdata->name, fw_version, tsdata->num_x, tsdata->num_y); tsdata->name, fw_version, tsdata->num_x, tsdata->num_y);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册