Message ID | 20250514061944.125857-8-even.xu@intel.com |
---|---|
State | New |
Headers | show |
Series | Add two new features for QuickI2C | expand |
Hi Even, kernel test robot noticed the following build warnings: [auto build test WARNING on hid/for-next] [also build test WARNING on linus/master v6.15-rc6 next-20250516] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Even-Xu/HID-Intel-thc-hid-Intel-thc-Add-thc_dma_content-into-kernel-doc/20250514-142347 base: https://git.kernel.org/pub/scm/linux/kernel/git/hid/hid.git for-next patch link: https://lore.kernel.org/r/20250514061944.125857-8-even.xu%40intel.com patch subject: [PATCH v1 7/7] HID: Intel-thc-hid: Intel-quicki2c: Add two new features to PTL config: x86_64-randconfig-121-20250517 (https://download.01.org/0day-ci/archive/20250517/202505171535.Yrj5T8jh-lkp@intel.com/config) compiler: clang version 20.1.2 (https://github.com/llvm/llvm-project 58df0ef89dd64126512e4ee27b4ac3fd8ddf6247) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250517/202505171535.Yrj5T8jh-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202505171535.Yrj5T8jh-lkp@intel.com/ sparse warnings: (new ones prefixed by >>) >> drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c:21:23: sparse: sparse: symbol 'ptl_ddata' was not declared. Should it be static? vim +/ptl_ddata +21 drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c 20 > 21 struct quicki2c_ddata ptl_ddata = { 22 .max_detect_size = MAX_RX_DETECT_SIZE_PTL, 23 }; 24
Hi, Jiri, Noted, thanks for creating this patch! I was prepared to submit a fix patch after the current patch set is merged, thank you so much for helping get it done quickly ^_^ Best Regards, Even Xu > -----Original Message----- > From: Jiri Kosina <jikos@kernel.org> > Sent: Wednesday, June 11, 2025 3:27 AM > To: lkp <lkp@intel.com> > Cc: Xu, Even <even.xu@intel.com>; bentiss@kernel.org; oe-kbuild- > all@lists.linux.dev; srinivas.pandruvada@linux.intel.com; linux- > input@vger.kernel.org; linux-kernel@vger.kernel.org; linux-doc@vger.kernel.org; > Han, Chong <chong.han@intel.com> > Subject: [PATCH] HID: intel-thc: make ptl_ddata static > > From: Jiri Kosina <jkosina@suse.com> > > ptl_ddata is local to pci-quicki2c.c, so it'd better be static. > > Reported-by: kernel test robot <lkp@intel.com> > Closes: https://lore.kernel.org/oe-kbuild-all/202505171535.Yrj5T8jh- > lkp@intel.com/ > Signed-off-by: Jiri Kosina <jkosina@suse.com> > --- > > This is now in hid.git#for-6.17/intel-thc > > drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c > b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c > index 208e933e23d8..e944a6ccb776 100644 > --- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c > +++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c > @@ -21,7 +21,7 @@ > #include "quicki2c-hid.h" > #include "quicki2c-protocol.h" > > -struct quicki2c_ddata ptl_ddata = { > +static struct quicki2c_ddata ptl_ddata = { > .max_detect_size = MAX_RX_DETECT_SIZE_PTL, }; > > -- > Jiri Kosina > SUSE Labs
diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c index 918cb9eb6b50..40faba5bd81d 100644 --- a/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c +++ b/drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c @@ -18,6 +18,10 @@ #include "quicki2c-hid.h" #include "quicki2c-protocol.h" +struct quicki2c_ddata ptl_ddata = { + .max_detect_size = MAX_RX_DETECT_SIZE_PTL, +}; + /* THC QuickI2C ACPI method to get device properties */ /* HIDI2C device method */ static guid_t i2c_hid_guid = @@ -413,6 +417,50 @@ static void quicki2c_dev_deinit(struct quicki2c_device *qcdev) qcdev->state = QUICKI2C_DISABLED; } +/** + * quicki2c_dma_adv_enable - Configure and enable DMA advanced features + * @qcdev: Pointer to the quicki2c_device structure + * + * If platform supports THC DMA advanced features, such as max input size + * control or interrupt delay, configures and enables them. + */ +static void quicki2c_dma_adv_enable(struct quicki2c_device *qcdev) +{ + /* + * If platform supports max input size control feature and touch device + * max input length <= THC detect capability, enable the feature with device + * max input length. + */ + if (qcdev->ddata->max_detect_size >= + le16_to_cpu(qcdev->dev_desc.max_input_len)) { + thc_i2c_set_rx_max_size(qcdev->thc_hw, + le16_to_cpu(qcdev->dev_desc.max_input_len)); + thc_i2c_rx_max_size_enable(qcdev->thc_hw, true); + } + + /* If platform supports interrupt delay feature, enable it with given delay */ + if (qcdev->ddata->interrupt_delay) { + thc_i2c_set_rx_int_delay(qcdev->thc_hw, + qcdev->ddata->interrupt_delay); + thc_i2c_rx_int_delay_enable(qcdev->thc_hw, true); + } +} + +/** + * quicki2c_dma_adv_disable - Disable DMA advanced features + * @qcdev: Pointer to the quicki2c device structure + * + * Disable all DMA advanced features if platform supports. + */ +static void quicki2c_dma_adv_disable(struct quicki2c_device *qcdev) +{ + if (qcdev->ddata->max_detect_size) + thc_i2c_rx_max_size_enable(qcdev->thc_hw, false); + + if (qcdev->ddata->interrupt_delay) + thc_i2c_rx_int_delay_enable(qcdev->thc_hw, false); +} + /** * quicki2c_dma_init - Configure THC DMA for QuickI2C device * @qcdev: Pointer to the quicki2c_device structure @@ -452,6 +500,9 @@ static int quicki2c_dma_init(struct quicki2c_device *qcdev) return ret; } + if (qcdev->ddata) + quicki2c_dma_adv_enable(qcdev); + return 0; } @@ -466,6 +517,9 @@ static void quicki2c_dma_deinit(struct quicki2c_device *qcdev) { thc_dma_unconfigure(qcdev->thc_hw); thc_dma_release(qcdev->thc_hw); + + if (qcdev->ddata) + quicki2c_dma_adv_disable(qcdev); } /** @@ -929,10 +983,10 @@ static const struct dev_pm_ops quicki2c_pm_ops = { static const struct pci_device_id quicki2c_pci_tbl[] = { { PCI_DEVICE_DATA(INTEL, THC_LNL_DEVICE_ID_I2C_PORT1, NULL) }, { PCI_DEVICE_DATA(INTEL, THC_LNL_DEVICE_ID_I2C_PORT2, NULL) }, - { PCI_DEVICE_DATA(INTEL, THC_PTL_H_DEVICE_ID_I2C_PORT1, NULL) }, - { PCI_DEVICE_DATA(INTEL, THC_PTL_H_DEVICE_ID_I2C_PORT2, NULL) }, - { PCI_DEVICE_DATA(INTEL, THC_PTL_U_DEVICE_ID_I2C_PORT1, NULL) }, - { PCI_DEVICE_DATA(INTEL, THC_PTL_U_DEVICE_ID_I2C_PORT2, NULL) }, + { PCI_DEVICE_DATA(INTEL, THC_PTL_H_DEVICE_ID_I2C_PORT1, &ptl_ddata) }, + { PCI_DEVICE_DATA(INTEL, THC_PTL_H_DEVICE_ID_I2C_PORT2, &ptl_ddata) }, + { PCI_DEVICE_DATA(INTEL, THC_PTL_U_DEVICE_ID_I2C_PORT1, &ptl_ddata) }, + { PCI_DEVICE_DATA(INTEL, THC_PTL_U_DEVICE_ID_I2C_PORT2, &ptl_ddata) }, { } }; MODULE_DEVICE_TABLE(pci, quicki2c_pci_tbl); diff --git a/drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-dev.h b/drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-dev.h index e130598d13c1..93d6fa982d60 100644 --- a/drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-dev.h +++ b/drivers/hid/intel-thc-hid/intel-quicki2c/quicki2c-dev.h @@ -36,6 +36,12 @@ #define QUICKI2C_DEFAULT_LP_LTR_VALUE 500 #define QUICKI2C_RPM_TIMEOUT_MS 500 +/* PTL Max packet size detection capability is 255 Bytes */ +#define MAX_RX_DETECT_SIZE_PTL 255 + +/* Default interrupt delay is 1ms, suitable for most devices */ +#define DEFAULT_INTERRUPT_DELAY_US (1 * USEC_PER_MSEC) + /* * THC uses runtime auto suspend to dynamically switch between THC active LTR * and low power LTR to save CPU power.