From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: mcc45tr Date: Tue, 15 Sep 2026 19:31:47 +0300 Subject: [PATCH 150/150] Input: nt36523: keep routine lifecycle logging at debug level NVT_LOG is routed to pr_err whenever the downstream NVT_DEBUG switch is set, so every successful panel blank, system suspend, firmware reload and pen state transition is recorded as a kernel error. A normal Nabu suspend/resume cycle therefore emits dozens of false-positive error records and obscures genuine SPI, firmware and ESD failures. Route routine lifecycle diagnostics through pr_debug, keep a small probe and wake-action summary at informational level, and retain NVT_ERR for real fault paths. Also correct the successful TX auto-copy message while keeping firmware history dumps at error level when recovery actually fails. Signed-off-by: mcc45tr --- drivers/input/touchscreen/nt36523/nt36xxx.c | 21 +++++++++++---------- drivers/input/touchscreen/nt36523/nt36xxx.h | 17 +++++++++-------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/drivers/input/touchscreen/nt36523/nt36xxx.c b/drivers/input/touchscreen/nt36523/nt36xxx.c index 798e4891d..7cf25b427 100644 --- a/drivers/input/touchscreen/nt36523/nt36xxx.c +++ b/drivers/input/touchscreen/nt36523/nt36xxx.c @@ -136,8 +136,8 @@ static ssize_t double_tap_to_wake_store(struct device *dev, ts->gesture_command_delayed = enabled; mutex_unlock(&ts->lock); - NVT_LOG("set double tap wakeup %d%s\n", enabled, - deferred ? " after resume" : ""); + NVT_INFO("set double tap wakeup %d%s\n", enabled, + deferred ? " after resume" : ""); return count; } static DEVICE_ATTR_RW(double_tap_to_wake); @@ -425,7 +425,7 @@ void nvt_tx_auto_copy_mode(void) //---write TX_AUTO_COPY_EN cmds--- nvt_write_addr(ts->mmap->TX_AUTO_COPY_EN, 0x69); - NVT_ERR("tx auto copy mode enable\n"); + NVT_LOG("tx auto copy mode enable\n"); } /******************************************************* @@ -801,8 +801,8 @@ static int32_t nvt_parse_dt(struct device *dev) NVT_ERR("double tap requested without wakeup-source; disabling\n"); ts->db_wakeup = 0; } - NVT_LOG("double-tap-to-wake=%d, wakeup-source=%d\n", - ts->db_wakeup, ts->wakeup_source); + NVT_INFO("double-tap-to-wake=%d, wakeup-source=%d\n", + ts->db_wakeup, ts->wakeup_source); ret = of_property_read_u32(np, "novatek,swrst-n8-addr", &SWRST_N8_ADDR); if (ret) { @@ -1010,7 +1010,7 @@ static uint32_t nvt_dump_fw_history(void) line_cnt++; } } - NVT_LOG("%s", tmp_dump); + NVT_ERR("%s", tmp_dump); exit_nvt_dump_fw_history: if (tmp_dump) { @@ -1139,7 +1139,7 @@ static irqreturn_t nvt_ts_work_func(int irq, void *data) goto XFER_ERROR; } - NVT_LOG("Gesture: double tap wakeup\n"); + NVT_INFO("Gesture: double tap wakeup\n"); pm_wakeup_event(&ts->client->dev, 5000); input_report_key(ts->input_dev, KEY_WAKEUP, 1); input_sync(ts->input_dev); @@ -1411,7 +1411,7 @@ static int32_t nvt_ts_probe(struct spi_device *client) int32_t retry = 0; #endif - NVT_LOG("probe start\n"); + NVT_INFO("probe start\n"); ts = kzalloc(sizeof(struct nvt_ts_data), GFP_KERNEL); if (ts == NULL) { @@ -1451,7 +1451,7 @@ static int32_t nvt_ts_probe(struct spi_device *client) goto err_spi_setup; } - NVT_LOG("mode=%d, max_speed_hz=%d\n", ts->client->mode, ts->client->max_speed_hz); + NVT_INFO("mode=%d, max_speed_hz=%d\n", ts->client->mode, ts->client->max_speed_hz); //---parse dts--- ret = nvt_parse_dt(&client->dev); @@ -1711,7 +1711,8 @@ static int32_t nvt_ts_probe(struct spi_device *client) bTouchIsAwake = 1; disable_pen_input_device(false); - NVT_LOG("end\n"); + NVT_INFO("probe complete: PID=%04X, fw_ver=0x%02X\n", + ts->nvt_pid, ts->fw_ver); nvt_irq_enable(true); diff --git a/drivers/input/touchscreen/nt36523/nt36xxx.h b/drivers/input/touchscreen/nt36523/nt36xxx.h index 0e71bb56e..2869a03bb 100644 --- a/drivers/input/touchscreen/nt36523/nt36xxx.h +++ b/drivers/input/touchscreen/nt36523/nt36xxx.h @@ -29,8 +29,6 @@ #include "nt36xxx_mem_map.h" -#define NVT_DEBUG 1 - //---GPIO number--- #define NVTTOUCH_RST_PIN 980 #define NVTTOUCH_INT_PIN 943 @@ -47,12 +45,15 @@ //---SPI driver info.--- #define NVT_SPI_NAME "NVT-ts-spi" -#if NVT_DEBUG -#define NVT_LOG(fmt, args...) pr_err("[%s] %s %d: " fmt, NVT_SPI_NAME, __func__, __LINE__, ##args) -#else -#define NVT_LOG(fmt, args...) pr_info("[%s] %s %d: " fmt, NVT_SPI_NAME, __func__, __LINE__, ##args) -#endif -#define NVT_ERR(fmt, args...) pr_err("[%s] %s %d: " fmt, NVT_SPI_NAME, __func__, __LINE__, ##args) +/* Keep suspend/resume chatter available through dynamic debug without + * misclassifying successful lifecycle transitions as hardware failures. + */ +#define NVT_LOG(fmt, args...) \ + pr_debug("[%s] %s %d: " fmt, NVT_SPI_NAME, __func__, __LINE__, ##args) +#define NVT_INFO(fmt, args...) \ + pr_info("[%s] %s %d: " fmt, NVT_SPI_NAME, __func__, __LINE__, ##args) +#define NVT_ERR(fmt, args...) \ + pr_err("[%s] %s %d: " fmt, NVT_SPI_NAME, __func__, __LINE__, ##args) //---Input device info.--- #define NVT_TS_NAME "NVTCapacitiveTouchScreen"