Skip to content

Commit 7842087

Browse files
stephan-ghdtor
authored andcommitted
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: Stephan Gerhold <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent 86d1ee0 commit 7842087

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

drivers/input/touchscreen/mms114.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
enum mms_type {
5555
TYPE_MMS114 = 114,
5656
TYPE_MMS152 = 152,
57+
TYPE_MMS345L = 345,
5758
};
5859

5960
struct mms114_data {
@@ -250,6 +251,15 @@ static int mms114_get_version(struct mms114_data *data)
250251
int error;
251252

252253
switch (data->type) {
254+
case TYPE_MMS345L:
255+
error = __mms114_read_reg(data, MMS152_FW_REV, 3, buf);
256+
if (error)
257+
return error;
258+
259+
dev_info(dev, "TSP FW Rev: bootloader 0x%x / core 0x%x / config 0x%x\n",
260+
buf[0], buf[1], buf[2]);
261+
break;
262+
253263
case TYPE_MMS152:
254264
error = __mms114_read_reg(data, MMS152_FW_REV, 3, buf);
255265
if (error)
@@ -287,8 +297,8 @@ static int mms114_setup_regs(struct mms114_data *data)
287297
if (error < 0)
288298
return error;
289299

290-
/* MMS152 has no configuration or power on registers */
291-
if (data->type == TYPE_MMS152)
300+
/* Only MMS114 has configuration and power on registers */
301+
if (data->type != TYPE_MMS114)
292302
return 0;
293303

294304
error = mms114_set_active(data, true);
@@ -599,6 +609,9 @@ static const struct of_device_id mms114_dt_match[] = {
599609
}, {
600610
.compatible = "melfas,mms152",
601611
.data = (void *)TYPE_MMS152,
612+
}, {
613+
.compatible = "melfas,mms345l",
614+
.data = (void *)TYPE_MMS345L,
602615
},
603616
{ }
604617
};

0 commit comments

Comments
 (0)