Commit 7842087b authored by Stephan Gerhold's avatar Stephan Gerhold Committed by Dmitry Torokhov

Input: mms114 - add extra compatible for mms345l

MMS345L is another first generation touch screen from Melfas,
which uses mostly the same registers as MMS152.

However, there is some garbage printed during initialization.
Apparently MMS345L does not have the MMS152_COMPAT_GROUP register
that is read+printed during initialization.

  TSP FW Rev: bootloader 0x6 / core 0x26 / config 0x26, Compat group: \x06

On earlier kernel versions the compat group was actually printed as
an ASCII control character, seems like it gets escaped now.

But we probably shouldn't print something from a random register.

Add a separate "melfas,mms345l" compatible that avoids reading
from the MMS152_COMPAT_GROUP register. This might also help in case
there is some other device-specific quirk in the future.
Signed-off-by: default avatarStephan Gerhold <stephan@gerhold.net>
Reviewed-by: default avatarAndi Shyti <andi@etezian.org>
Link: https://lore.kernel.org/r/20200423102431.2715-1-stephan@gerhold.netSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent 86d1ee00
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
enum mms_type { enum mms_type {
TYPE_MMS114 = 114, TYPE_MMS114 = 114,
TYPE_MMS152 = 152, TYPE_MMS152 = 152,
TYPE_MMS345L = 345,
}; };
struct mms114_data { struct mms114_data {
...@@ -250,6 +251,15 @@ static int mms114_get_version(struct mms114_data *data) ...@@ -250,6 +251,15 @@ static int mms114_get_version(struct mms114_data *data)
int error; int error;
switch (data->type) { switch (data->type) {
case TYPE_MMS345L:
error = __mms114_read_reg(data, MMS152_FW_REV, 3, buf);
if (error)
return error;
dev_info(dev, "TSP FW Rev: bootloader 0x%x / core 0x%x / config 0x%x\n",
buf[0], buf[1], buf[2]);
break;
case TYPE_MMS152: case TYPE_MMS152:
error = __mms114_read_reg(data, MMS152_FW_REV, 3, buf); error = __mms114_read_reg(data, MMS152_FW_REV, 3, buf);
if (error) if (error)
...@@ -287,8 +297,8 @@ static int mms114_setup_regs(struct mms114_data *data) ...@@ -287,8 +297,8 @@ static int mms114_setup_regs(struct mms114_data *data)
if (error < 0) if (error < 0)
return error; return error;
/* MMS152 has no configuration or power on registers */ /* Only MMS114 has configuration and power on registers */
if (data->type == TYPE_MMS152) if (data->type != TYPE_MMS114)
return 0; return 0;
error = mms114_set_active(data, true); error = mms114_set_active(data, true);
...@@ -599,6 +609,9 @@ static const struct of_device_id mms114_dt_match[] = { ...@@ -599,6 +609,9 @@ static const struct of_device_id mms114_dt_match[] = {
}, { }, {
.compatible = "melfas,mms152", .compatible = "melfas,mms152",
.data = (void *)TYPE_MMS152, .data = (void *)TYPE_MMS152,
}, {
.compatible = "melfas,mms345l",
.data = (void *)TYPE_MMS345L,
}, },
{ } { }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment