Skip to contentSkip to conversation

input_polling_devices design question + adxl34x polling mode patch

DISCUSSION [email protected] 2 participants 2 messages Apr 12, 2011 – Apr 13, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

Hi.

This patch allow to use the device even if its interrupts lines aren't routed.

I tried to minimize the impact of the patch on the original code, and if the CONFIG_INPUT_ADXL34X_ALLOW_POLLING option is disabled, the code should be unchanged.

Please give me your opinion.

Thanks.

Paul.

========================================
Message du 12/04/11 08:23
De : "Dmitry Torokhov"
A : [email protected]
Copie à : [email protected], [email protected], [email protected] Objet : Re: input_polling_devices design question + adxl34x polling mode patch

Hi Paul,

Quoted 18 lines · On Mon, Apr 11, 2011 at 06:21:02PM +0200, [email protected] wrote:

Hi.

I have  a board with an adxl34x (an accelerometer) on a two wire bus. Its interrupt line aren't routed.

So i would like to use the driver in polling mode.

I submit this patch as a beta version of my work.

I tried to reuse the input_polling structure but I'm facing some problems.

The driver has a "rate" attribute that i would like to control when i setup the "interval" attribute of the input_pollling.

And vice versa, when i setup the "interval" attribute i would like to setup the "rate".

Quoted 9 lines

So my questions :  - Is it possible to reimplement a workqueue for this driver only ? As it seems to have been done yet in other drivers, i wonder if it's acceptable, or if we should avoid this practice.   - I think it would be complicated to have hooks in input and input_polling for calling each other. I wonder if i haven't any design problem.

I would need an advice in order to cleaning this patch please.

Yes, just use the system workqueue (now even dedicated workqueue is not really needed) and leave input_polldev alone - it makes sense to use for devices that are purely polled ones. The devices that may or may not be interrupt driven I think we should just hook workqueue handling in the driver.

Note that I normally oppose supporting polling mode for devices that may be interrupt driven, since this normally increases power consumption.

Signature · 1 line
Dmitry

Only in linux-2.6.38.2.mod/drivers/input/misc/: .adxl34x-i2c.o.cmd Only in linux-2.6.38.2.mod/drivers/input/misc/: .adxl34x.o.cmd Only in linux-2.6.38.2.mod/drivers/input/misc/: .built-in.o.cmd

drivers/input/misc/Kconfig +7 -0
diff -x 'linux-2.6.38.2-adxl.patch~' -u linux-2.6.38.2.orig/drivers/input/misc/Kconfig linux-2.6.38.2.mod/drivers/input/misc/Kconfig
@@ -430,6 +430,13 @@
 	  To compile this driver as a module, choose M here: the
 	  module will be called adxl34x-spi.
 
+config INPUT_ADXL34X_ALLOW_POLLING
+	bool "allow to fallback to polling mode"
+	depends on INPUT_ADXL34X
+	default n
+	help
+	  Say Y here if the int lines of your ADXL345/6 are unused.
+
 config INPUT_CMA3000
 	tristate "VTI CMA3000 Tri-axis accelerometer"
 	help

Only in linux-2.6.38.2.mod/drivers/input/misc/: Kconfig~ Only in linux-2.6.38.2.mod/drivers/input/misc/: adxl34x-i2c.o

drivers/input/misc/adxl34x.c +65 -8

131 lines not on this page · raw message

maintainer Acked-by
#1 lore raw

[email protected] wrote on 2011-04-12:

Quoted 10 lines

Hi.

This patch allow to use the device even if its interrupts lines aren't routed.

I tried to minimize the impact of the patch on the original code, and if the CONFIG_INPUT_ADXL34X_ALLOW_POLLING option is disabled, the code should be unchanged.

Please give me your opinion.

Hi Paul,

Looks good to me. However I wouldn't do the CONFIG_INPUT_ADXL34X_ALLOW_POLLING ifdefery at all.
In case no irq is given, dev_info about the switch to polling mode. Just in case no irq was not on purpose.

Whatever Dmitry prefers most.

-Michael

Quoted 40 lines

========================================
Message du 12/04/11 08:23
De : "Dmitry Torokhov"
A : [email protected]
Copie à : [email protected], device-driver- [email protected], [email protected] Objet : Re:
input_polling_devices design question + adxl34x polling mode patch

Hi Paul,

Quoted 18 lines · On Mon, Apr 11, 2011 at 06:21:02PM +0200, [email protected] wrote:

Hi.

I have a board with an adxl34x (an accelerometer) on a two wire bus. Its interrupt line aren't routed.

So i would like to use the driver in polling mode.

I submit this patch as a beta version of my work.

I tried to reuse the input_polling structure but I'm facing some problems.

The driver has a "rate" attribute that i would like to control when i setup the "interval" attribute of the input_pollling.

And vice versa, when i setup the "interval" attribute i would like to setup the "rate".

Quoted 8 lines

So my questions : - Is it possible to reimplement a workqueue for this driver only ? As it seems to have been done yet in other
drivers, i wonder if it's acceptable, or if we should avoid this
practice. - I think it would be complicated to have hooks in input
and input_polling for calling each other. I wonder if i haven't any design problem.

I would need an advice in order to cleaning this patch please.

Quoted 9 lines

Yes, just use the system workqueue (now even dedicated workqueue is not really needed) and leave input_polldev alone - it makes sense to use for devices that are purely polled ones. The devices that may or may not be interrupt driven I think we should just hook workqueue handling in the driver.

Note that I normally oppose supporting polling mode for devices that may be interrupt driven, since this normally increases power consumption.

Greetings,
Michael

--
Analog Devices GmbH Wilhelm-Wagenfeld-Str. 6 80807 Muenchen
Sitz der Gesellschaft: Muenchen; Registergericht: Muenchen HRB 40368; Geschaeftsfuehrer:Dr.Carsten Suckrow, Thomas Wessel, William A. Martin, Margaret Seif