All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/3] Input: Add TouchNetix axiom touchscreen driver
@ 2023-12-04 14:05 Kamel Bouhara
  2023-12-04 14:05 ` [PATCH v4 1/3] dt-bindings: vendor-prefixes: Add TouchNetix AS Kamel Bouhara
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Kamel Bouhara @ 2023-12-04 14:05 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Henrik Rydberg, linux-input, linux-kernel, devicetree,
	Marco Felsch, Jeff LaBundy
  Cc: catalin.popescu, mark.satterthwaite, bartp, hannah.rossiter,
	Thomas Petazzoni, Gregory Clement, bsp-development.geo,
	Kamel Bouhara

Add a new driver for the TouchNetix's axiom family of
touchscreen controller. This driver only support i2c
and can be later adapted for SPI and USB support.

---
Changes in v2:
 - Add device tree binding documentation
 - Move core functions in axiom_i2c as we only care about i2c support now
 - Use static function when required
 - Use syntax dev_err_probe()
 - Add an hardware based reset

Changes in v3:
 - Remove irq-gpios property in dt-binding
 - Use a generic node name
 - Fix issues reported in https://lore.kernel.org/oe-kbuild-all/202310100300.oAC2M62R-lkp@intel.com/

Changes in v4:
 - Cleanup unused headers and macros
 - Use standard kernel type
 - Namespace structures and functions
 - Use packed struct when possible to avoid bitfield operators
 - Fix missing break when address is found in axiom_populate_target_address()
 - Split reads in two steps for the reports, first length then report
   itself so we only read required bytes
 - Get poll-interval from devicetree
 - Add VDDI/VDDA regulators
 - Add a startup delay of 110 ms required after VDDA/VDDI is applied
 - Remove axiom_i2c_write() as it is no more used

Kamel Bouhara (3):
  dt-bindings: vendor-prefixes: Add TouchNetix AS
  dt-bindings: input: Add TouchNetix axiom touchscreen
  Input: Add TouchNetix axiom i2c touchscreen driver

 .../input/touchscreen/touchnetix,ax54a.yaml   |  56 ++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   7 +
 drivers/input/touchscreen/Kconfig             |  12 +
 drivers/input/touchscreen/Makefile            |   1 +
 drivers/input/touchscreen/touchnetix_axiom.c  | 675 ++++++++++++++++++
 6 files changed, 753 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/touchnetix,ax54a.yaml
 create mode 100644 drivers/input/touchscreen/touchnetix_axiom.c

--
2.25.1


^ permalink raw reply	[flat|nested] 12+ messages in thread
* Re: [PATCH v4 3/3] Input: Add TouchNetix axiom i2c touchscreen driver
@ 2023-12-06 22:14 kernel test robot
  0 siblings, 0 replies; 12+ messages in thread
From: kernel test robot @ 2023-12-06 22:14 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20231204140505.2838916-4-kamel.bouhara@bootlin.com>
References: <20231204140505.2838916-4-kamel.bouhara@bootlin.com>
TO: Kamel Bouhara <kamel.bouhara@bootlin.com>
TO: Dmitry Torokhov <dmitry.torokhov@gmail.com>
TO: Rob Herring <robh+dt@kernel.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>
TO: Conor Dooley <conor+dt@kernel.org>
TO: Henrik Rydberg <rydberg@bitmath.org>
TO: linux-input@vger.kernel.org
TO: linux-kernel@vger.kernel.org
TO: devicetree@vger.kernel.org
TO: Marco Felsch <m.felsch@pengutronix.de>
TO: Jeff LaBundy <jeff@labundy.com>
CC: catalin.popescu@leica-geosystems.com
CC: mark.satterthwaite@touchnetix.com
CC: bartp@baasheep.co.uk
CC: hannah.rossiter@touchnetix.com
CC: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
CC: Gregory Clement <gregory.clement@bootlin.com>
CC: bsp-development.geo@leica-geosystems.com
CC: Kamel Bouhara <kamel.bouhara@bootlin.com>

Hi Kamel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on dtor-input/for-linus robh/for-next linus/master krzk-dt/for-next v6.7-rc4 next-20231206]
[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/Kamel-Bouhara/dt-bindings-vendor-prefixes-Add-TouchNetix-AS/20231204-222017
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link:    https://lore.kernel.org/r/20231204140505.2838916-4-kamel.bouhara%40bootlin.com
patch subject: [PATCH v4 3/3] Input: Add TouchNetix axiom i2c touchscreen driver
:::::: branch date: 2 days ago
:::::: commit date: 2 days ago
config: i386-randconfig-r071-20231206 (https://download.01.org/0day-ci/archive/20231207/202312070608.vxtNAYhk-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231207/202312070608.vxtNAYhk-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>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202312070608.vxtNAYhk-lkp@intel.com/

smatch warnings:
drivers/input/touchscreen/touchnetix_axiom.c:565 axiom_i2c_probe() warn: passing zero to 'PTR_ERR'

vim +/PTR_ERR +565 drivers/input/touchscreen/touchnetix_axiom.c

a9f3450f06a026 Kamel Bouhara 2023-12-04  535  
a9f3450f06a026 Kamel Bouhara 2023-12-04  536  static int axiom_i2c_probe(struct i2c_client *client)
a9f3450f06a026 Kamel Bouhara 2023-12-04  537  {
a9f3450f06a026 Kamel Bouhara 2023-12-04  538  	struct device *dev = &client->dev;
a9f3450f06a026 Kamel Bouhara 2023-12-04  539  	struct input_dev *input_dev;
a9f3450f06a026 Kamel Bouhara 2023-12-04  540  	struct axiom_data *ts;
a9f3450f06a026 Kamel Bouhara 2023-12-04  541  	u32 startup_delay_ms;
a9f3450f06a026 Kamel Bouhara 2023-12-04  542  	u32 poll_interval;
a9f3450f06a026 Kamel Bouhara 2023-12-04  543  	int target;
a9f3450f06a026 Kamel Bouhara 2023-12-04  544  	int error;
a9f3450f06a026 Kamel Bouhara 2023-12-04  545  
a9f3450f06a026 Kamel Bouhara 2023-12-04  546  	ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
a9f3450f06a026 Kamel Bouhara 2023-12-04  547  	if (!ts)
a9f3450f06a026 Kamel Bouhara 2023-12-04  548  		return -ENOMEM;
a9f3450f06a026 Kamel Bouhara 2023-12-04  549  
a9f3450f06a026 Kamel Bouhara 2023-12-04  550  	ts->client = client;
a9f3450f06a026 Kamel Bouhara 2023-12-04  551  	i2c_set_clientdata(client, ts);
a9f3450f06a026 Kamel Bouhara 2023-12-04  552  	ts->dev = dev;
a9f3450f06a026 Kamel Bouhara 2023-12-04  553  
a9f3450f06a026 Kamel Bouhara 2023-12-04  554  	ts->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
a9f3450f06a026 Kamel Bouhara 2023-12-04  555  	if (IS_ERR(ts->reset_gpio))
a9f3450f06a026 Kamel Bouhara 2023-12-04  556  		return dev_err_probe(dev, PTR_ERR(ts->reset_gpio), "failed to get reset GPIO\n");
a9f3450f06a026 Kamel Bouhara 2023-12-04  557  
a9f3450f06a026 Kamel Bouhara 2023-12-04  558  	if (ts->reset_gpio)
a9f3450f06a026 Kamel Bouhara 2023-12-04  559  		axiom_reset(ts->reset_gpio);
a9f3450f06a026 Kamel Bouhara 2023-12-04  560  
a9f3450f06a026 Kamel Bouhara 2023-12-04  561  	ts->vddi = devm_regulator_get_optional(dev, "VDDI");
a9f3450f06a026 Kamel Bouhara 2023-12-04  562  	if (!IS_ERR(ts->vddi)) {
a9f3450f06a026 Kamel Bouhara 2023-12-04  563  		error = regulator_enable(ts->vddi);
a9f3450f06a026 Kamel Bouhara 2023-12-04  564  		if (error)
a9f3450f06a026 Kamel Bouhara 2023-12-04 @565  			return dev_err_probe(&client->dev, PTR_ERR(ts->vddi),
a9f3450f06a026 Kamel Bouhara 2023-12-04  566  					     "Failed to enable VDDI regulator\n");
a9f3450f06a026 Kamel Bouhara 2023-12-04  567  	}
a9f3450f06a026 Kamel Bouhara 2023-12-04  568  
a9f3450f06a026 Kamel Bouhara 2023-12-04  569  	ts->vdda = devm_regulator_get_optional(dev, "VDDA");
a9f3450f06a026 Kamel Bouhara 2023-12-04  570  	if (!IS_ERR(ts->vdda)) {
a9f3450f06a026 Kamel Bouhara 2023-12-04  571  		error = regulator_enable(ts->vdda);
a9f3450f06a026 Kamel Bouhara 2023-12-04  572  		if (error) {
a9f3450f06a026 Kamel Bouhara 2023-12-04  573  			dev_err(dev, "Failed to get VDDA regulator\n");
a9f3450f06a026 Kamel Bouhara 2023-12-04  574  			regulator_disable(ts->vddi);
a9f3450f06a026 Kamel Bouhara 2023-12-04  575  			return error;
a9f3450f06a026 Kamel Bouhara 2023-12-04  576  		}
a9f3450f06a026 Kamel Bouhara 2023-12-04  577  		if (!device_property_read_u32(dev, "startup-time-ms", &startup_delay_ms))
a9f3450f06a026 Kamel Bouhara 2023-12-04  578  			msleep(startup_delay_ms);
a9f3450f06a026 Kamel Bouhara 2023-12-04  579  	}
a9f3450f06a026 Kamel Bouhara 2023-12-04  580  
a9f3450f06a026 Kamel Bouhara 2023-12-04  581  	error = axiom_discover(ts);
a9f3450f06a026 Kamel Bouhara 2023-12-04  582  	if (error)
a9f3450f06a026 Kamel Bouhara 2023-12-04  583  		return dev_err_probe(dev, error, "Failed touchscreen discover\n");
a9f3450f06a026 Kamel Bouhara 2023-12-04  584  
a9f3450f06a026 Kamel Bouhara 2023-12-04  585  	input_dev = devm_input_allocate_device(ts->dev);
a9f3450f06a026 Kamel Bouhara 2023-12-04  586  	if (!input_dev)
a9f3450f06a026 Kamel Bouhara 2023-12-04  587  		return -ENOMEM;
a9f3450f06a026 Kamel Bouhara 2023-12-04  588  
a9f3450f06a026 Kamel Bouhara 2023-12-04  589  	input_dev->name = "TouchNetix axiom Touchscreen";
a9f3450f06a026 Kamel Bouhara 2023-12-04  590  	input_dev->phys = "input/axiom_ts";
a9f3450f06a026 Kamel Bouhara 2023-12-04  591  
a9f3450f06a026 Kamel Bouhara 2023-12-04  592  	/* Single Touch */
a9f3450f06a026 Kamel Bouhara 2023-12-04  593  	input_set_abs_params(input_dev, ABS_X, 0, 65535, 0, 0);
a9f3450f06a026 Kamel Bouhara 2023-12-04  594  	input_set_abs_params(input_dev, ABS_Y, 0, 65535, 0, 0);
a9f3450f06a026 Kamel Bouhara 2023-12-04  595  
a9f3450f06a026 Kamel Bouhara 2023-12-04  596  	/* Multi Touch */
a9f3450f06a026 Kamel Bouhara 2023-12-04  597  	/* Min, Max, Fuzz (expected noise in px, try 4?) and Flat */
a9f3450f06a026 Kamel Bouhara 2023-12-04  598  	input_set_abs_params(input_dev, ABS_MT_POSITION_X, 0, 65535, 0, 0);
a9f3450f06a026 Kamel Bouhara 2023-12-04  599  	/* Min, Max, Fuzz (expected noise in px, try 4?) and Flat */
a9f3450f06a026 Kamel Bouhara 2023-12-04  600  	input_set_abs_params(input_dev, ABS_MT_POSITION_Y, 0, 65535, 0, 0);
a9f3450f06a026 Kamel Bouhara 2023-12-04  601  	input_set_abs_params(input_dev, ABS_MT_TOOL_TYPE, 0, MT_TOOL_MAX, 0, 0);
a9f3450f06a026 Kamel Bouhara 2023-12-04  602  	input_set_abs_params(input_dev, ABS_MT_DISTANCE, 0, 127, 0, 0);
a9f3450f06a026 Kamel Bouhara 2023-12-04  603  	input_set_abs_params(input_dev, ABS_MT_PRESSURE, 0, 127, 0, 0);
a9f3450f06a026 Kamel Bouhara 2023-12-04  604  
a9f3450f06a026 Kamel Bouhara 2023-12-04  605  	input_set_capability(input_dev, EV_KEY, BTN_TOUCH);
a9f3450f06a026 Kamel Bouhara 2023-12-04  606  
a9f3450f06a026 Kamel Bouhara 2023-12-04  607  	/* Registers the axiom device as a touchscreen instead of a mouse pointer */
a9f3450f06a026 Kamel Bouhara 2023-12-04  608  	error = input_mt_init_slots(input_dev, AXIOM_U41_MAX_TARGETS, INPUT_MT_DIRECT);
a9f3450f06a026 Kamel Bouhara 2023-12-04  609  	if (error)
a9f3450f06a026 Kamel Bouhara 2023-12-04  610  		return error;
a9f3450f06a026 Kamel Bouhara 2023-12-04  611  
a9f3450f06a026 Kamel Bouhara 2023-12-04  612  	/* Enables the raw data for up to 4 force channels to be sent to the input subsystem */
a9f3450f06a026 Kamel Bouhara 2023-12-04  613  	set_bit(EV_REL, input_dev->evbit);
a9f3450f06a026 Kamel Bouhara 2023-12-04  614  	set_bit(EV_MSC, input_dev->evbit);
a9f3450f06a026 Kamel Bouhara 2023-12-04  615  	/* Declare that we support "RAW" Miscellaneous events */
a9f3450f06a026 Kamel Bouhara 2023-12-04  616  	set_bit(MSC_RAW, input_dev->mscbit);
a9f3450f06a026 Kamel Bouhara 2023-12-04  617  
a9f3450f06a026 Kamel Bouhara 2023-12-04  618  	ts->input_dev = input_dev;
a9f3450f06a026 Kamel Bouhara 2023-12-04  619  	input_set_drvdata(ts->input_dev, ts);
a9f3450f06a026 Kamel Bouhara 2023-12-04  620  
a9f3450f06a026 Kamel Bouhara 2023-12-04  621  	/* Ensure that all reports are initialised to not be present. */
a9f3450f06a026 Kamel Bouhara 2023-12-04  622  	for (target = 0; target < AXIOM_U41_MAX_TARGETS; target++)
a9f3450f06a026 Kamel Bouhara 2023-12-04  623  		ts->targets[target].state = AXIOM_TARGET_STATE_NOT_PRESENT;
a9f3450f06a026 Kamel Bouhara 2023-12-04  624  
a9f3450f06a026 Kamel Bouhara 2023-12-04  625  	error = input_register_device(input_dev);
a9f3450f06a026 Kamel Bouhara 2023-12-04  626  	if (error)
a9f3450f06a026 Kamel Bouhara 2023-12-04  627  		return dev_err_probe(ts->dev, error,
a9f3450f06a026 Kamel Bouhara 2023-12-04  628  				     "Could not register with Input Sub-system.\n");
a9f3450f06a026 Kamel Bouhara 2023-12-04  629  
a9f3450f06a026 Kamel Bouhara 2023-12-04  630  	error = devm_request_threaded_irq(dev, client->irq, NULL,
a9f3450f06a026 Kamel Bouhara 2023-12-04  631  					  axiom_irq, IRQF_ONESHOT, dev_name(dev), ts);
a9f3450f06a026 Kamel Bouhara 2023-12-04  632  	if (error < 0) {
a9f3450f06a026 Kamel Bouhara 2023-12-04  633  		dev_warn(dev, "Request irq failed, falling back to polling mode");
a9f3450f06a026 Kamel Bouhara 2023-12-04  634  
a9f3450f06a026 Kamel Bouhara 2023-12-04  635  		error = input_setup_polling(input_dev, axiom_i2c_poll);
a9f3450f06a026 Kamel Bouhara 2023-12-04  636  		if (error)
a9f3450f06a026 Kamel Bouhara 2023-12-04  637  			return dev_err_probe(ts->dev, error, "Unable to set up polling mode\n");
a9f3450f06a026 Kamel Bouhara 2023-12-04  638  
a9f3450f06a026 Kamel Bouhara 2023-12-04  639  		if (!device_property_read_u32(ts->dev, "poll-interval", &poll_interval))
a9f3450f06a026 Kamel Bouhara 2023-12-04  640  			input_set_poll_interval(input_dev, poll_interval);
a9f3450f06a026 Kamel Bouhara 2023-12-04  641  		else
a9f3450f06a026 Kamel Bouhara 2023-12-04  642  			input_set_poll_interval(input_dev, POLL_INTERVAL_DEFAULT_MS);
a9f3450f06a026 Kamel Bouhara 2023-12-04  643  	}
a9f3450f06a026 Kamel Bouhara 2023-12-04  644  
a9f3450f06a026 Kamel Bouhara 2023-12-04  645  	return 0;
a9f3450f06a026 Kamel Bouhara 2023-12-04  646  }
a9f3450f06a026 Kamel Bouhara 2023-12-04  647  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2023-12-07  5:28 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-04 14:05 [PATCH v4 0/3] Input: Add TouchNetix axiom touchscreen driver Kamel Bouhara
2023-12-04 14:05 ` [PATCH v4 1/3] dt-bindings: vendor-prefixes: Add TouchNetix AS Kamel Bouhara
2023-12-04 14:05 ` [PATCH v4 2/3] dt-bindings: input: Add TouchNetix axiom touchscreen Kamel Bouhara
2023-12-05  8:15   ` Krzysztof Kozlowski
2023-12-05  9:17     ` Kamel BOUHARA
2023-12-05  9:26       ` Krzysztof Kozlowski
2023-12-04 14:05 ` [PATCH v4 3/3] Input: Add TouchNetix axiom i2c touchscreen driver Kamel Bouhara
2023-12-04 15:09   ` POPESCU Catalin
2023-12-04 16:16     ` Kamel Bouhara
2023-12-05  6:36   ` kernel test robot
2023-12-07  5:28   ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2023-12-06 22:14 kernel 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.