Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0d71ac3f authored by Harshit Jain's avatar Harshit Jain
Browse files

input: nt36523: add a workaroud for forcing fw

parent b866a087
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ struct kobject *touchpanel_kobj;
TS_ENABLE_FOPS(double_tap)
TS_ENABLE_FOPS(fod_status)
TS_ENABLE_FOPS(pen)
TS_ENABLE_FOPS(pen_gen2_force)

static int __init tp_common_init(void)
{
+32 −0
Original line number Diff line number Diff line
@@ -2127,6 +2127,32 @@ static struct tp_common_ops pen_ops = {
	.show = pen_show,
	.store = pen_store,
};

static ssize_t pen_gen2_force_show(struct kobject *kobj, struct kobj_attribute *attr,
			char *buf)
{
	return sprintf(buf, "%d\n", ts->pen_gen2_force);
}

static ssize_t pen_gen2_force_store(struct kobject *kobj, struct kobj_attribute *attr,
			 const char *buf, size_t count)
{
	int rc, val;

	rc = kstrtoint(buf, 10, &val);
	if (rc)
		return -EINVAL;

	ts->pen_gen2_force = !!val;

	return count;
}

static struct tp_common_ops pen_gen2_force_ops = {
	.show = pen_gen2_force_show,
	.store = pen_gen2_force_store,
};

#endif

#ifdef CONFIG_TOUCHSCREEN_XIAOMI_TOUCHFEATURE
@@ -3170,6 +3196,12 @@ static int32_t nvt_ts_probe(struct spi_device *client)
			NVT_ERR("%s: Failed to create pen node err=%d\n",
				__func__, ret);
		}

		ret = tp_common_set_pen_gen2_force_ops(&pen_gen2_force_ops);
		if (ret < 0) {
			NVT_ERR("%s: Failed to create pen gen2 force node err=%d\n",
				__func__, ret);
		}
#endif
	} /* if (ts->pen_support) */

+1 −0
Original line number Diff line number Diff line
@@ -223,6 +223,7 @@ struct nvt_ts_data {
#ifndef NVT_SAVE_TESTDATA_IN_FILE
	void *testdata;
#endif
	bool pen_gen2_force;
};

#if NVT_TOUCH_PROC
+7 −0
Original line number Diff line number Diff line
@@ -363,6 +363,13 @@ static int32_t update_firmware_request(const char *filename)
	uint8_t retry = 0;
	int32_t ret = 0;

	if (ts->pen_gen2_force) {
		NVT_LOG("pen_gen2_force is enabled, force new pen fw.\n");
		// clear the file name
		filename = "novatek_nt36523_k82_fw01_pen.bin";
		NVT_LOG("filename was changed to %s\n", filename);
	}

	if (NULL == filename) {
		return -ENOENT;
	}
+1 −0
Original line number Diff line number Diff line
@@ -12,3 +12,4 @@ struct tp_common_ops {
int tp_common_set_double_tap_ops(struct tp_common_ops *ops);
int tp_common_set_fod_status_ops(struct tp_common_ops *ops);
int tp_common_set_pen_ops(struct tp_common_ops *ops);
int tp_common_set_pen_gen2_force_ops(struct tp_common_ops *ops);