Skip to contentSkip to conversation

Extcon: adc_jack: adc-jack driver to support 3.5 pi or simliar devices

PATCH Superseded anish kumar 2 participants 2 messages Aug 7, 2012

Subsystems (2)

v3 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 Extcon: adc_jack: adc-jack driver to support 3.5 pi or simliar devices

From: anish kumar <[email protected]>

External connector devices that decides connection information based on ADC values may use adc-jack device driver. The user simply needs to provide a table of adc range and connection states. Then, extcon framework will automatically notify others.

Changes in V1:
added Lars-Peter Clausen suggested changes:
Using macros to get rid of boiler plate code such as devm_kzalloc and module_platform_driver.Other changes suggested are related to coding guidelines.

Changes in V2:
Removed some unnecessary checks and changed the way we are un-regitering extcon and freeing the irq while removing.

Changes in this version:
Renamed the files to comply with extcon naming.

---
 drivers/extcon/Kconfig                 |    5 +
 drivers/extcon/Makefile                |    1 +
 drivers/extcon/extcon-adc-jack.c       |  193 ++++++++++++++++++++++++++++++++
 include/linux/extcon/extcon-adc-jack.h |   73 ++++++++++++
 4 files changed, 272 insertions(+), 0 deletions(-)
 create mode 100644 drivers/extcon/extcon-adc-jack.c
 create mode 100644 include/linux/extcon/extcon-adc-jack.h
drivers/extcon/Kconfig +5 -0
index e175c8e..596e277 100644
@@ -21,6 +21,11 @@ config EXTCON_GPIO
 	  Say Y here to enable GPIO based extcon support. Note that GPIO
 	  extcon supports single state per extcon instance.
 
+config EXTCON_ADC_JACK
+        tristate "ADC Jack extcon support"
+        help
+          Say Y here to enable extcon device driver based on ADC values.
+
 config EXTCON_MAX77693
 	tristate "MAX77693 EXTCON Support"
 	depends on MFD_MAX77693
drivers/extcon/Makefile +1 -0
index 88961b3..bc7111e 100644
@@ -4,6 +4,7 @@
 
 obj-$(CONFIG_EXTCON)		+= extcon_class.o
 obj-$(CONFIG_EXTCON_GPIO)	+= extcon_gpio.o
+obj-$(CONFIG_EXTCON_ADC_JACK)   += extcon-adc-jack.o
 obj-$(CONFIG_EXTCON_MAX77693)	+= extcon-max77693.o
 obj-$(CONFIG_EXTCON_MAX8997)	+= extcon-max8997.o
 obj-$(CONFIG_EXTCON_ARIZONA)	+= extcon-arizona.o
drivers/extcon/extcon-adc-jack.c new file +193 -0

193 lines not on this page · raw message

include/linux/extcon/extcon-adc-jack.h new file +73 -0

73 lines not on this page · raw message

Signature · 1 line
1.7.1
Reviewed-by on v3 1/1
#1 lore raw
Quoted 17 lines · anish kumar

From: anish kumar <[email protected]>

External connector devices that decides connection information based on ADC values may use adc-jack device driver. The user simply needs to provide a table of adc range and connection states. Then, extcon framework will automatically notify others.

Changes in V1:
added Lars-Peter Clausen suggested changes:
Using macros to get rid of boiler plate code such as devm_kzalloc and module_platform_driver.Other changes suggested are related to coding guidelines.

Changes in V2:
Removed some unnecessary checks and changed the way we are un-regitering extcon and freeing the irq while removing.

Quoted 5 lines

Changes in this version:
Renamed the files to comply with extcon naming.

I missed one thing though in the previous reviews, sorry about that.

Quoted 8 lines
---
 drivers/extcon/Kconfig                 |    5 +
 drivers/extcon/Makefile                |    1 +
 drivers/extcon/extcon-adc-jack.c       |  193 ++++++++++++++++++++++++++++++++
 include/linux/extcon/extcon-adc-jack.h |   73 ++++++++++++
 4 files changed, 272 insertions(+), 0 deletions(-)
 create mode 100644 drivers/extcon/extcon-adc-jack.c
 create mode 100644 include/linux/extcon/extcon-adc-jack.h

drivers/extcon/extcon-adc-jack.c line 178

Quoted 6 lines
drivers/extcon/extcon-adc-jack.c new file +6 -0
+
+static int __devexit adc_jack_remove(struct platform_device *pdev)
+{
+	struct adc_jack_data *data = platform_get_drvdata(pdev);
+
+	free_irq(data->irq, data);

We should probably make sure that the work is not pending or running here.

Quoted 4 lines
drivers/extcon/extcon-adc-jack.c new file +4 -0
+	extcon_dev_unregister(&data->edev);
+
+	return 0;
+}