All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: touchscreen: ad7877: Use new structure for SPI transfer delays
@ 2020-02-27 13:06 Sergiu Cuciurean
  2020-02-28 10:19 ` kbuild test robot
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Sergiu Cuciurean @ 2020-02-27 13:06 UTC (permalink / raw)
  To: linux-kernel, linux-input, dmitry.torokhov, michael.hennerich
  Cc: Sergiu Cuciurean

In a recent change to the SPI subsystem [1], a new `delay` struct was added
to replace the `delay_usecs`. This change replaces the current
`delay_usecs` with `delay` for this driver.

The `spi_transfer_delay_exec()` function [in the SPI framework] makes sure
that both `delay_usecs` & `delay` are used (in this order to preserve
backwards compatibility).

[1] commit bebcfd272df6 ("spi: introduce `delay` field for
`spi_transfer` + spi_transfer_delay_exec()")

Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
---
 drivers/input/touchscreen/ad7877.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index 9b652f61837f..0007aaf5cbd7 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -281,12 +281,14 @@ static int ad7877_read_adc(struct spi_device *spi, unsigned command)
 
 	req->xfer[1].tx_buf = &req->ref_on;
 	req->xfer[1].len = 2;
-	req->xfer[1].delay_usecs = ts->vref_delay_usecs;
+	req->xfer[1].delay.value = ts->vref_delay_usecs;
+	req->xfer[1].delay.unit = SPI_DELAY_UNIT_USECS;
 	req->xfer[1].cs_change = 1;
 
 	req->xfer[2].tx_buf = &req->command;
 	req->xfer[2].len = 2;
-	req->xfer[2].delay_usecs = ts->vref_delay_usecs;
+	req->xfer[2].delay.value = ts->vref_delay_usecs;
+	req->xfer[2].delay.unit = SPI_DELAY_UNIT_USECS;
 	req->xfer[2].cs_change = 1;
 
 	req->xfer[3].rx_buf = &req->sample;
@@ -716,7 +718,8 @@ static int ad7877_probe(struct spi_device *spi)
 	spin_lock_init(&ts->lock);
 
 	ts->model = pdata->model ? : 7877;
-	ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100;
+	ts->vref_delay.value = pdata->vref_delay_usecs ? : 100;
+	ts->vref_delay.unit = SPI_DELAY_UNIT_USECS;
 	ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
 	ts->pressure_max = pdata->pressure_max ? : ~0;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] input: touchscreen: ad7877: Use new structure for SPI transfer delays
  2020-02-27 13:06 [PATCH] input: touchscreen: ad7877: Use new structure for SPI transfer delays Sergiu Cuciurean
@ 2020-02-28 10:19 ` kbuild test robot
  2020-02-28 10:41 ` kbuild test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2020-02-28 10:19 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5990 bytes --]

Hi Sergiu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on input/next]
[also build test ERROR on linux/master linus/master v5.6-rc3 next-20200227]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Sergiu-Cuciurean/input-touchscreen-ad7877-Use-new-structure-for-SPI-transfer-delays/20200228-141053
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: c6x-allyesconfig (attached as .config)
compiler: c6x-elf-gcc (GCC) 7.5.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.5.0 make.cross ARCH=c6x 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/input/touchscreen/ad7877.c: In function 'ad7877_probe':
>> drivers/input/touchscreen/ad7877.c:721:6: error: 'struct ad7877' has no member named 'vref_delay'; did you mean 'vref_delay_usecs'?
     ts->vref_delay.value = pdata->vref_delay_usecs ? : 100;
         ^~~~~~~~~~
         vref_delay_usecs
   drivers/input/touchscreen/ad7877.c:722:6: error: 'struct ad7877' has no member named 'vref_delay'; did you mean 'vref_delay_usecs'?
     ts->vref_delay.unit = SPI_DELAY_UNIT_USECS;
         ^~~~~~~~~~
         vref_delay_usecs

vim +721 drivers/input/touchscreen/ad7877.c

   668	
   669	static int ad7877_probe(struct spi_device *spi)
   670	{
   671		struct ad7877			*ts;
   672		struct input_dev		*input_dev;
   673		struct ad7877_platform_data	*pdata = dev_get_platdata(&spi->dev);
   674		int				err;
   675		u16				verify;
   676	
   677		if (!spi->irq) {
   678			dev_dbg(&spi->dev, "no IRQ?\n");
   679			return -ENODEV;
   680		}
   681	
   682		if (!pdata) {
   683			dev_dbg(&spi->dev, "no platform data?\n");
   684			return -ENODEV;
   685		}
   686	
   687		/* don't exceed max specified SPI CLK frequency */
   688		if (spi->max_speed_hz > MAX_SPI_FREQ_HZ) {
   689			dev_dbg(&spi->dev, "SPI CLK %d Hz?\n",spi->max_speed_hz);
   690			return -EINVAL;
   691		}
   692	
   693		spi->bits_per_word = 16;
   694		err = spi_setup(spi);
   695		if (err) {
   696			dev_dbg(&spi->dev, "spi master doesn't support 16 bits/word\n");
   697			return err;
   698		}
   699	
   700		ts = devm_kzalloc(&spi->dev, sizeof(struct ad7877), GFP_KERNEL);
   701		if (!ts)
   702			return -ENOMEM;
   703	
   704		input_dev = devm_input_allocate_device(&spi->dev);
   705		if (!input_dev)
   706			return -ENOMEM;
   707	
   708		err = devm_add_action_or_reset(&spi->dev, ad7877_disable, ts);
   709		if (err)
   710			return err;
   711	
   712		spi_set_drvdata(spi, ts);
   713		ts->spi = spi;
   714		ts->input = input_dev;
   715	
   716		timer_setup(&ts->timer, ad7877_timer, 0);
   717		mutex_init(&ts->mutex);
   718		spin_lock_init(&ts->lock);
   719	
   720		ts->model = pdata->model ? : 7877;
 > 721		ts->vref_delay.value = pdata->vref_delay_usecs ? : 100;
   722		ts->vref_delay.unit = SPI_DELAY_UNIT_USECS;
   723		ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
   724		ts->pressure_max = pdata->pressure_max ? : ~0;
   725	
   726		ts->stopacq_polarity = pdata->stopacq_polarity;
   727		ts->first_conversion_delay = pdata->first_conversion_delay;
   728		ts->acquisition_time = pdata->acquisition_time;
   729		ts->averaging = pdata->averaging;
   730		ts->pen_down_acc_interval = pdata->pen_down_acc_interval;
   731	
   732		snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev));
   733	
   734		input_dev->name = "AD7877 Touchscreen";
   735		input_dev->phys = ts->phys;
   736		input_dev->dev.parent = &spi->dev;
   737	
   738		__set_bit(EV_KEY, input_dev->evbit);
   739		__set_bit(BTN_TOUCH, input_dev->keybit);
   740		__set_bit(EV_ABS, input_dev->evbit);
   741		__set_bit(ABS_X, input_dev->absbit);
   742		__set_bit(ABS_Y, input_dev->absbit);
   743		__set_bit(ABS_PRESSURE, input_dev->absbit);
   744	
   745		input_set_abs_params(input_dev, ABS_X,
   746				pdata->x_min ? : 0,
   747				pdata->x_max ? : MAX_12BIT,
   748				0, 0);
   749		input_set_abs_params(input_dev, ABS_Y,
   750				pdata->y_min ? : 0,
   751				pdata->y_max ? : MAX_12BIT,
   752				0, 0);
   753		input_set_abs_params(input_dev, ABS_PRESSURE,
   754				pdata->pressure_min, pdata->pressure_max, 0, 0);
   755	
   756		ad7877_write(spi, AD7877_REG_SEQ1, AD7877_MM_SEQUENCE);
   757	
   758		verify = ad7877_read(spi, AD7877_REG_SEQ1);
   759	
   760		if (verify != AD7877_MM_SEQUENCE) {
   761			dev_err(&spi->dev, "%s: Failed to probe %s\n",
   762				dev_name(&spi->dev), input_dev->name);
   763			return -ENODEV;
   764		}
   765	
   766		if (gpio3)
   767			ad7877_write(spi, AD7877_REG_EXTWRITE, AD7877_EXTW_GPIO_3_CONF);
   768	
   769		ad7877_setup_ts_def_msg(spi, ts);
   770	
   771		/* Request AD7877 /DAV GPIO interrupt */
   772	
   773		err = devm_request_threaded_irq(&spi->dev, spi->irq, NULL, ad7877_irq,
   774						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
   775						spi->dev.driver->name, ts);
   776		if (err) {
   777			dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
   778			return err;
   779		}
   780	
   781		err = devm_device_add_group(&spi->dev, &ad7877_attr_group);
   782		if (err)
   783			return err;
   784	
   785		err = input_register_device(input_dev);
   786		if (err)
   787			return err;
   788	
   789		return 0;
   790	}
   791	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 50618 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] input: touchscreen: ad7877: Use new structure for SPI transfer delays
  2020-02-27 13:06 [PATCH] input: touchscreen: ad7877: Use new structure for SPI transfer delays Sergiu Cuciurean
  2020-02-28 10:19 ` kbuild test robot
@ 2020-02-28 10:41 ` kbuild test robot
  2020-02-28 10:45 ` [PATCH v2] " Sergiu Cuciurean
  2020-02-28 15:01 ` [PATCH] " kbuild test robot
  3 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2020-02-28 10:41 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5718 bytes --]

Hi Sergiu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on input/next]
[also build test ERROR on linux/master linus/master v5.6-rc3 next-20200227]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Sergiu-Cuciurean/input-touchscreen-ad7877-Use-new-structure-for-SPI-transfer-delays/20200228-141053
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: x86_64-randconfig-s1-20200228 (attached as .config)
compiler: gcc-5 (Ubuntu 5.5.0-12ubuntu1) 5.5.0 20171010
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/input/touchscreen/ad7877.c: In function 'ad7877_probe':
>> drivers/input/touchscreen/ad7877.c:721:4: error: 'struct ad7877' has no member named 'vref_delay'
     ts->vref_delay.value = pdata->vref_delay_usecs ? : 100;
       ^
   drivers/input/touchscreen/ad7877.c:722:4: error: 'struct ad7877' has no member named 'vref_delay'
     ts->vref_delay.unit = SPI_DELAY_UNIT_USECS;
       ^

vim +721 drivers/input/touchscreen/ad7877.c

   668	
   669	static int ad7877_probe(struct spi_device *spi)
   670	{
   671		struct ad7877			*ts;
   672		struct input_dev		*input_dev;
   673		struct ad7877_platform_data	*pdata = dev_get_platdata(&spi->dev);
   674		int				err;
   675		u16				verify;
   676	
   677		if (!spi->irq) {
   678			dev_dbg(&spi->dev, "no IRQ?\n");
   679			return -ENODEV;
   680		}
   681	
   682		if (!pdata) {
   683			dev_dbg(&spi->dev, "no platform data?\n");
   684			return -ENODEV;
   685		}
   686	
   687		/* don't exceed max specified SPI CLK frequency */
   688		if (spi->max_speed_hz > MAX_SPI_FREQ_HZ) {
   689			dev_dbg(&spi->dev, "SPI CLK %d Hz?\n",spi->max_speed_hz);
   690			return -EINVAL;
   691		}
   692	
   693		spi->bits_per_word = 16;
   694		err = spi_setup(spi);
   695		if (err) {
   696			dev_dbg(&spi->dev, "spi master doesn't support 16 bits/word\n");
   697			return err;
   698		}
   699	
   700		ts = devm_kzalloc(&spi->dev, sizeof(struct ad7877), GFP_KERNEL);
   701		if (!ts)
   702			return -ENOMEM;
   703	
   704		input_dev = devm_input_allocate_device(&spi->dev);
   705		if (!input_dev)
   706			return -ENOMEM;
   707	
   708		err = devm_add_action_or_reset(&spi->dev, ad7877_disable, ts);
   709		if (err)
   710			return err;
   711	
   712		spi_set_drvdata(spi, ts);
   713		ts->spi = spi;
   714		ts->input = input_dev;
   715	
   716		timer_setup(&ts->timer, ad7877_timer, 0);
   717		mutex_init(&ts->mutex);
   718		spin_lock_init(&ts->lock);
   719	
   720		ts->model = pdata->model ? : 7877;
 > 721		ts->vref_delay.value = pdata->vref_delay_usecs ? : 100;
   722		ts->vref_delay.unit = SPI_DELAY_UNIT_USECS;
   723		ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
   724		ts->pressure_max = pdata->pressure_max ? : ~0;
   725	
   726		ts->stopacq_polarity = pdata->stopacq_polarity;
   727		ts->first_conversion_delay = pdata->first_conversion_delay;
   728		ts->acquisition_time = pdata->acquisition_time;
   729		ts->averaging = pdata->averaging;
   730		ts->pen_down_acc_interval = pdata->pen_down_acc_interval;
   731	
   732		snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev));
   733	
   734		input_dev->name = "AD7877 Touchscreen";
   735		input_dev->phys = ts->phys;
   736		input_dev->dev.parent = &spi->dev;
   737	
   738		__set_bit(EV_KEY, input_dev->evbit);
   739		__set_bit(BTN_TOUCH, input_dev->keybit);
   740		__set_bit(EV_ABS, input_dev->evbit);
   741		__set_bit(ABS_X, input_dev->absbit);
   742		__set_bit(ABS_Y, input_dev->absbit);
   743		__set_bit(ABS_PRESSURE, input_dev->absbit);
   744	
   745		input_set_abs_params(input_dev, ABS_X,
   746				pdata->x_min ? : 0,
   747				pdata->x_max ? : MAX_12BIT,
   748				0, 0);
   749		input_set_abs_params(input_dev, ABS_Y,
   750				pdata->y_min ? : 0,
   751				pdata->y_max ? : MAX_12BIT,
   752				0, 0);
   753		input_set_abs_params(input_dev, ABS_PRESSURE,
   754				pdata->pressure_min, pdata->pressure_max, 0, 0);
   755	
   756		ad7877_write(spi, AD7877_REG_SEQ1, AD7877_MM_SEQUENCE);
   757	
   758		verify = ad7877_read(spi, AD7877_REG_SEQ1);
   759	
   760		if (verify != AD7877_MM_SEQUENCE) {
   761			dev_err(&spi->dev, "%s: Failed to probe %s\n",
   762				dev_name(&spi->dev), input_dev->name);
   763			return -ENODEV;
   764		}
   765	
   766		if (gpio3)
   767			ad7877_write(spi, AD7877_REG_EXTWRITE, AD7877_EXTW_GPIO_3_CONF);
   768	
   769		ad7877_setup_ts_def_msg(spi, ts);
   770	
   771		/* Request AD7877 /DAV GPIO interrupt */
   772	
   773		err = devm_request_threaded_irq(&spi->dev, spi->irq, NULL, ad7877_irq,
   774						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
   775						spi->dev.driver->name, ts);
   776		if (err) {
   777			dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
   778			return err;
   779		}
   780	
   781		err = devm_device_add_group(&spi->dev, &ad7877_attr_group);
   782		if (err)
   783			return err;
   784	
   785		err = input_register_device(input_dev);
   786		if (err)
   787			return err;
   788	
   789		return 0;
   790	}
   791	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36961 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2] input: touchscreen: ad7877: Use new structure for SPI transfer delays
  2020-02-27 13:06 [PATCH] input: touchscreen: ad7877: Use new structure for SPI transfer delays Sergiu Cuciurean
  2020-02-28 10:19 ` kbuild test robot
  2020-02-28 10:41 ` kbuild test robot
@ 2020-02-28 10:45 ` Sergiu Cuciurean
  2020-12-11  5:55   ` Dmitry Torokhov
  2020-02-28 15:01 ` [PATCH] " kbuild test robot
  3 siblings, 1 reply; 6+ messages in thread
From: Sergiu Cuciurean @ 2020-02-28 10:45 UTC (permalink / raw)
  To: linux-kernel, linux-input, dmitry.torokhov, michael.hennerich
  Cc: Sergiu Cuciurean

In a recent change to the SPI subsystem [1], a new `delay` struct was added
to replace the `delay_usecs`. This change replaces the current
`delay_usecs` with `delay` for this driver.

The `spi_transfer_delay_exec()` function [in the SPI framework] makes sure
that both `delay_usecs` & `delay` are used (in this order to preserve
backwards compatibility).

[1] commit bebcfd272df6 ("spi: introduce `delay` field for
`spi_transfer` + spi_transfer_delay_exec()")

Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>
---

Changelog v1->v2:
*Restore initial name of wrongfully modfied struct member

 drivers/input/touchscreen/ad7877.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index 9b652f61837f..08f5372f0bfd 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -281,12 +281,14 @@ static int ad7877_read_adc(struct spi_device *spi, unsigned command)
 
 	req->xfer[1].tx_buf = &req->ref_on;
 	req->xfer[1].len = 2;
-	req->xfer[1].delay_usecs = ts->vref_delay_usecs;
+	req->xfer[1].delay.value = ts->vref_delay_usecs;
+	req->xfer[1].delay.unit = SPI_DELAY_UNIT_USECS;
 	req->xfer[1].cs_change = 1;
 
 	req->xfer[2].tx_buf = &req->command;
 	req->xfer[2].len = 2;
-	req->xfer[2].delay_usecs = ts->vref_delay_usecs;
+	req->xfer[2].delay.value = ts->vref_delay_usecs;
+	req->xfer[2].delay.unit = SPI_DELAY_UNIT_USECS;
 	req->xfer[2].cs_change = 1;
 
 	req->xfer[3].rx_buf = &req->sample;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] input: touchscreen: ad7877: Use new structure for SPI transfer delays
  2020-02-27 13:06 [PATCH] input: touchscreen: ad7877: Use new structure for SPI transfer delays Sergiu Cuciurean
                   ` (2 preceding siblings ...)
  2020-02-28 10:45 ` [PATCH v2] " Sergiu Cuciurean
@ 2020-02-28 15:01 ` kbuild test robot
  3 siblings, 0 replies; 6+ messages in thread
From: kbuild test robot @ 2020-02-28 15:01 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 5717 bytes --]

Hi Sergiu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on input/next]
[also build test ERROR on linux/master linus/master v5.6-rc3 next-20200227]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Sergiu-Cuciurean/input-touchscreen-ad7877-Use-new-structure-for-SPI-transfer-delays/20200228-141053
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project 949134e2fefd34a38ed71de90dffe2300e2e1139)
reproduce:
        # FIXME the reproduce steps for clang is not ready yet

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/input/touchscreen/ad7877.c:721:6: error: no member named 'vref_delay' in 'struct ad7877'
           ts->vref_delay.value = pdata->vref_delay_usecs ? : 100;
           ~~  ^
   drivers/input/touchscreen/ad7877.c:722:6: error: no member named 'vref_delay' in 'struct ad7877'
           ts->vref_delay.unit = SPI_DELAY_UNIT_USECS;
           ~~  ^
   2 errors generated.

vim +721 drivers/input/touchscreen/ad7877.c

   668	
   669	static int ad7877_probe(struct spi_device *spi)
   670	{
   671		struct ad7877			*ts;
   672		struct input_dev		*input_dev;
   673		struct ad7877_platform_data	*pdata = dev_get_platdata(&spi->dev);
   674		int				err;
   675		u16				verify;
   676	
   677		if (!spi->irq) {
   678			dev_dbg(&spi->dev, "no IRQ?\n");
   679			return -ENODEV;
   680		}
   681	
   682		if (!pdata) {
   683			dev_dbg(&spi->dev, "no platform data?\n");
   684			return -ENODEV;
   685		}
   686	
   687		/* don't exceed max specified SPI CLK frequency */
   688		if (spi->max_speed_hz > MAX_SPI_FREQ_HZ) {
   689			dev_dbg(&spi->dev, "SPI CLK %d Hz?\n",spi->max_speed_hz);
   690			return -EINVAL;
   691		}
   692	
   693		spi->bits_per_word = 16;
   694		err = spi_setup(spi);
   695		if (err) {
   696			dev_dbg(&spi->dev, "spi master doesn't support 16 bits/word\n");
   697			return err;
   698		}
   699	
   700		ts = devm_kzalloc(&spi->dev, sizeof(struct ad7877), GFP_KERNEL);
   701		if (!ts)
   702			return -ENOMEM;
   703	
   704		input_dev = devm_input_allocate_device(&spi->dev);
   705		if (!input_dev)
   706			return -ENOMEM;
   707	
   708		err = devm_add_action_or_reset(&spi->dev, ad7877_disable, ts);
   709		if (err)
   710			return err;
   711	
   712		spi_set_drvdata(spi, ts);
   713		ts->spi = spi;
   714		ts->input = input_dev;
   715	
   716		timer_setup(&ts->timer, ad7877_timer, 0);
   717		mutex_init(&ts->mutex);
   718		spin_lock_init(&ts->lock);
   719	
   720		ts->model = pdata->model ? : 7877;
 > 721		ts->vref_delay.value = pdata->vref_delay_usecs ? : 100;
   722		ts->vref_delay.unit = SPI_DELAY_UNIT_USECS;
   723		ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
   724		ts->pressure_max = pdata->pressure_max ? : ~0;
   725	
   726		ts->stopacq_polarity = pdata->stopacq_polarity;
   727		ts->first_conversion_delay = pdata->first_conversion_delay;
   728		ts->acquisition_time = pdata->acquisition_time;
   729		ts->averaging = pdata->averaging;
   730		ts->pen_down_acc_interval = pdata->pen_down_acc_interval;
   731	
   732		snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev));
   733	
   734		input_dev->name = "AD7877 Touchscreen";
   735		input_dev->phys = ts->phys;
   736		input_dev->dev.parent = &spi->dev;
   737	
   738		__set_bit(EV_KEY, input_dev->evbit);
   739		__set_bit(BTN_TOUCH, input_dev->keybit);
   740		__set_bit(EV_ABS, input_dev->evbit);
   741		__set_bit(ABS_X, input_dev->absbit);
   742		__set_bit(ABS_Y, input_dev->absbit);
   743		__set_bit(ABS_PRESSURE, input_dev->absbit);
   744	
   745		input_set_abs_params(input_dev, ABS_X,
   746				pdata->x_min ? : 0,
   747				pdata->x_max ? : MAX_12BIT,
   748				0, 0);
   749		input_set_abs_params(input_dev, ABS_Y,
   750				pdata->y_min ? : 0,
   751				pdata->y_max ? : MAX_12BIT,
   752				0, 0);
   753		input_set_abs_params(input_dev, ABS_PRESSURE,
   754				pdata->pressure_min, pdata->pressure_max, 0, 0);
   755	
   756		ad7877_write(spi, AD7877_REG_SEQ1, AD7877_MM_SEQUENCE);
   757	
   758		verify = ad7877_read(spi, AD7877_REG_SEQ1);
   759	
   760		if (verify != AD7877_MM_SEQUENCE) {
   761			dev_err(&spi->dev, "%s: Failed to probe %s\n",
   762				dev_name(&spi->dev), input_dev->name);
   763			return -ENODEV;
   764		}
   765	
   766		if (gpio3)
   767			ad7877_write(spi, AD7877_REG_EXTWRITE, AD7877_EXTW_GPIO_3_CONF);
   768	
   769		ad7877_setup_ts_def_msg(spi, ts);
   770	
   771		/* Request AD7877 /DAV GPIO interrupt */
   772	
   773		err = devm_request_threaded_irq(&spi->dev, spi->irq, NULL, ad7877_irq,
   774						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
   775						spi->dev.driver->name, ts);
   776		if (err) {
   777			dev_dbg(&spi->dev, "irq %d busy?\n", spi->irq);
   778			return err;
   779		}
   780	
   781		err = devm_device_add_group(&spi->dev, &ad7877_attr_group);
   782		if (err)
   783			return err;
   784	
   785		err = input_register_device(input_dev);
   786		if (err)
   787			return err;
   788	
   789		return 0;
   790	}
   791	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 70970 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] input: touchscreen: ad7877: Use new structure for SPI transfer delays
  2020-02-28 10:45 ` [PATCH v2] " Sergiu Cuciurean
@ 2020-12-11  5:55   ` Dmitry Torokhov
  0 siblings, 0 replies; 6+ messages in thread
From: Dmitry Torokhov @ 2020-12-11  5:55 UTC (permalink / raw)
  To: Sergiu Cuciurean; +Cc: linux-kernel, linux-input, michael.hennerich

On Fri, Feb 28, 2020 at 12:45:08PM +0200, Sergiu Cuciurean wrote:
> In a recent change to the SPI subsystem [1], a new `delay` struct was added
> to replace the `delay_usecs`. This change replaces the current
> `delay_usecs` with `delay` for this driver.
> 
> The `spi_transfer_delay_exec()` function [in the SPI framework] makes sure
> that both `delay_usecs` & `delay` are used (in this order to preserve
> backwards compatibility).
> 
> [1] commit bebcfd272df6 ("spi: introduce `delay` field for
> `spi_transfer` + spi_transfer_delay_exec()")
> 
> Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@analog.com>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-11  5:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27 13:06 [PATCH] input: touchscreen: ad7877: Use new structure for SPI transfer delays Sergiu Cuciurean
2020-02-28 10:19 ` kbuild test robot
2020-02-28 10:41 ` kbuild test robot
2020-02-28 10:45 ` [PATCH v2] " Sergiu Cuciurean
2020-12-11  5:55   ` Dmitry Torokhov
2020-02-28 15:01 ` [PATCH] " kbuild test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.