From 630498e052cac481ba616b8ef0338b59d8cdee76 Mon Sep 17 00:00:00 2001 From: davidycchen Date: Wed, 21 Aug 2019 15:45:57 +0800 Subject: touchscreen:fts: add heatmap config Add heatmap config for no heatmap driver situation. Bug: 138816997 Change-Id: I6f018aefd6751cd57f271c782f165e947bef91f9 Signed-off-by: davidycchen --- fts.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'fts.c') diff --git a/fts.c b/fts.c index c4b373e..0f57e71 100644 --- a/fts.c +++ b/fts.c @@ -1516,7 +1516,9 @@ static void touchsim_work(struct work_struct *work) input_sync(info->input_dev); +#ifdef CONFIG_TOUCHSCREEN_HEATMAP heatmap_read(&info->v4l2, ktime_to_ns(timestamp)); +#endif pm_qos_update_request(&info->pm_qos_req, PM_QOS_DEFAULT_VALUE); } @@ -2643,6 +2645,7 @@ END: * 1 = FTS_HEATMAP_PARTIAL * 2 = FTS_HEATMAP_FULL */ +#ifdef CONFIG_TOUCHSCREEN_HEATMAP static ssize_t fts_heatmap_mode_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) @@ -2670,6 +2673,7 @@ static ssize_t fts_heatmap_mode_show(struct device *dev, return scnprintf(buf, PAGE_SIZE, "%d\n", info->heatmap_mode); } +#endif static DEVICE_ATTR(infoblock_getdata, (0444), fts_infoblock_getdata_show, NULL); @@ -2681,8 +2685,10 @@ static DEVICE_ATTR(fw_file_test, 0444, fts_fw_test_show, NULL); static DEVICE_ATTR(status, 0444, fts_status_show, NULL); static DEVICE_ATTR(stm_fts_cmd, 0664, stm_fts_cmd_show, stm_fts_cmd_store); +#ifdef CONFIG_TOUCHSCREEN_HEATMAP static DEVICE_ATTR(heatmap_mode, 0664, fts_heatmap_mode_show, fts_heatmap_mode_store); +#endif #ifdef USE_ONE_FILE_NODE static DEVICE_ATTR(feature_enable, 0664, fts_feature_enable_show, fts_feature_enable_store); @@ -2741,7 +2747,9 @@ static struct attribute *fts_attr_group[] = { &dev_attr_fw_file_test.attr, &dev_attr_status.attr, &dev_attr_stm_fts_cmd.attr, +#ifdef CONFIG_TOUCHSCREEN_HEATMAP &dev_attr_heatmap_mode.attr, +#endif #ifdef USE_ONE_FILE_NODE &dev_attr_feature_enable.attr, #else @@ -3644,6 +3652,7 @@ static bool fts_user_report_event_handler(struct fts_ts_info *info, unsigned return false; } +#ifdef CONFIG_TOUCHSCREEN_HEATMAP static void heatmap_enable(void) { u8 command[] = {FTS_CMD_SYSTEM, SYS_CMD_LOAD_DATA, @@ -3776,6 +3785,7 @@ static bool read_heatmap_raw(struct v4l2_heatmap *v4l2, strength_t *data) return true; } +#endif /* Update a state machine used to toggle control of the touch IC's motion * filter. @@ -3906,8 +3916,10 @@ static irqreturn_t fts_interrupt_handler(int irq, void *handle) input_sync(info->input_dev); +#ifdef CONFIG_TOUCHSCREEN_HEATMAP if (processed_pointer_event) heatmap_read(&info->v4l2, ktime_to_ns(info->timestamp)); +#endif /* Disable the firmware motion filter during single touch */ update_motion_filter(info); @@ -4581,7 +4593,9 @@ static int fts_init_sensing(struct fts_ts_info *info) pr_err("%s Init after Probe error (ERROR = %08X)\n", __func__, error); +#ifdef CONFIG_TOUCHSCREEN_HEATMAP heatmap_enable(); +#endif return error; } @@ -4823,8 +4837,10 @@ static void fts_resume_work(struct work_struct *work) info->sensor_sleep = false; +#ifdef CONFIG_TOUCHSCREEN_HEATMAP /* heatmap must be enabled after every chip reset (fts_system_reset) */ heatmap_enable(); +#endif fts_enableInterrupt(true); @@ -5279,11 +5295,13 @@ static int parse_dt(struct device *dev, struct fts_hw_platform_data *bdata) pr_info("Automatic firmware update disabled\n"); } +#ifdef CONFIG_TOUCHSCREEN_HEATMAP bdata->heatmap_mode_full_init = false; if (of_property_read_bool(np, "st,heatmap_mode_full")) { bdata->heatmap_mode_full_init = true; pr_info("Full heatmap enabled\n"); } +#endif if (panel && panel->funcs && panel->funcs->get_timings && panel->funcs->get_timings(panel, 1, &timing) > 0) { @@ -5559,10 +5577,12 @@ static int fts_probe(struct spi_device *client) /* Set initial heatmap mode based on the device tree configuration. * Default is partial heatmap mode. */ +#ifdef CONFIG_TOUCHSCREEN_HEATMAP if (info->board->heatmap_mode_full_init) info->heatmap_mode = FTS_HEATMAP_FULL; else info->heatmap_mode = FTS_HEATMAP_PARTIAL; +#endif /* init motion filter mode */ info->use_default_mf = false; @@ -5587,6 +5607,7 @@ static int fts_probe(struct spi_device *client) goto ProbeErrorExit_6; } +#ifdef CONFIG_TOUCHSCREEN_HEATMAP /* * Heatmap_probe must be called before irq routine is registered, * because heatmap_read is called from interrupt context. @@ -5606,6 +5627,7 @@ static int fts_probe(struct spi_device *client) error = heatmap_probe(&info->v4l2); if (error < OK) goto ProbeErrorExit_6; +#endif #if defined(FW_UPDATE_ON_PROBE) && defined(FW_H_FILE) pr_info("FW Update and Sensing Initialization:\n"); @@ -5669,7 +5691,9 @@ ProbeErrorExit_7: msm_drm_unregister_client(&info->notifier); #endif +#ifdef CONFIG_TOUCHSCREEN_HEATMAP heatmap_remove(&info->v4l2); +#endif ProbeErrorExit_6: pm_qos_remove_request(&info->pm_qos_req); @@ -5733,7 +5757,9 @@ static int fts_remove(struct spi_device *client) /* remove interrupt and event handlers */ fts_interrupt_uninstall(info); +#ifdef CONFIG_TOUCHSCREEN_HEATMAP heatmap_remove(&info->v4l2); +#endif pm_qos_remove_request(&info->pm_qos_req); -- cgit v1.2.3