1
0
Fork 0
Commit Graph

562 Commits (redonkable)

Author SHA1 Message Date
Charles Keepax 0ffe8cbd51 extcon: arizona: Ensure variables are set for headphone detection
The detecting flag really refers to the microphone detection stage and
as such should be cleared before arizona_identify_headphones is called.
Also the mic flag should be set before identify headphones is called as
well.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-08-10 11:48:56 +09:00
Charles Keepax 8e5838dd7b extcon: arizona: Use gpiod inteface to handle micd_pol_gpio gpio
Convert to using the newer gpiod interface for the micd_pol_gpio.
Although we still carry support for the old gpio interface from pdata.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
[cw00.choi: Modify the patch titlei to include the detailed content]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-08-10 11:48:55 +09:00
Charles Keepax 4778d44ff3 extcon: arizona: Add basic microphone detection DT/ACPI bindings
This patch adds bindings for the basic microphone detection platform
data.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-08-10 11:48:55 +09:00
Charles Keepax feffb0cc63 extcon: arizona: Update to use the new device properties API
The device properties API will load data from both device tree and ACPI,
update the binding to use this API instead of the OF API.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-08-10 11:48:55 +09:00
Chanwoo Choi 1fe189bfb0 extcon: palmas: Remove the mutually_exclusive array
This patch removes the mutually_exclusive array of extcon-palmas.c.
After used the unique id of each external connector on 2a9de9c0f0
("extcon: Use the unique id for external connector instead of string"),
extcon driver can't directly handle the bit value indicating the external
connectors.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-08-10 11:48:55 +09:00
Chanwoo Choi 2519b7650e extcon: Remove optional print_state() function pointer of struct extcon_dev
This patch removes the optional print_state() function pointer which included
in 'struct extcon_dev' because the extcon must maintain the consistent name
of extcon device on sysfs instead of inconsistent state of external connectors.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-08-10 11:48:55 +09:00
Jaewon Kim 135d9f7d13 extcon: max77843: Clear IRQ bits state before request IRQ
IRQ signal before driver probe is needless because driver sends
current state after platform booting done.
So, this patch clears MUIC IRQ bits before request IRQ.

Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-08-10 11:48:54 +09:00
Roger Quadros f7a898117a extcon: Fix extcon_cable_get_state() from getting old state after notification
Currently the extcon code notifiers the interested listeners
before it updates the extcon state with the new state.
This will cause the listeners that use extcon_cable_get_state()
to get the stale state and loose the new state.

Fix this by first changing the extcon state variable and then
notifying listeners.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Tested-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-07-31 15:18:41 +09:00
Roger Quadros be052cc877 extcon: Fix hang and extcon_get/set_cable_state().
Users of find_cable_index_by_name() will cause a kernel hang
as the while loop counter is never incremented and end condition
is never reached.

extcon_get_cable_state() and extcon_set_cable_state() are broken
because they use cable index instead of cable id. This causes
the first cable state (cable.0) to be always invalid in sysfs
or extcon_get_cable_state() users.

Introduce a new function find_cable_id_by_name() that fixes
both of the above issues.

Fixes: commit 73b6ecdb93 ("extcon: Redefine the unique id of supported external connectors without 'enum extcon' type")
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Tested-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
[cw00.choi: Fix minor coding style]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-07-31 10:08:47 +09:00
Chanwoo Choi e350f8045f extcon: palmas: Fix NULL pointer error
This patch fixes NULL pointer error by removing the unneeded kfree() call
of edev->name because extcon-palmas no longer allocate the memory for edev->name.

Fixes: d71aadda19 ("extcon: Remove the optional name of extcon device")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
2015-07-29 17:55:53 +09:00
Krzysztof Kozlowski 309a3e00a5 mfd/extcon: max77843: Rename defines to allow inclusion with max77693
Add MAX77843_MUIC prefix to some of the defines used in max77843 extcon
driver so the max77693-private.h can be included simultaneously with
max77843-private.h.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 21:39:30 +01:00
Krzysztof Kozlowski cceb433a1e mfd/extcon: max77693: Rename defines to allow inclusion with max77843
Add MAX77693 prefix to some of the defines used in max77693 extcon
driver so the max77693-private.h can be included simultaneously with
max77843-private.h.

Additionally use BIT() macro in header.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 21:39:30 +01:00
Krzysztof Kozlowski bc1aadc186 drivers: max77843: Switch to common max77693 state container
Switch to the same definition of state container as in MAX77693 drivers.
This will allow usage of one regulator driver in both devices: MAX77693
and MAX77843.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 21:39:30 +01:00
Krzysztof Kozlowski 61b305cd2a drivers: max77693: Move state container to common header
This prepares for merging some of the drivers between max77693 and
max77843 so the child MFD driver can be attached to any parent MFD main
driver.

Move the state container to common header file. Additionally add
consistent 'i2c' prefixes to its members (of 'struct i2c_client' type).

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Acked-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 21:39:30 +01:00
Krzysztof Kozlowski 0afab670bd mfd/extcon: max77693: Remove unused extern declarations and max77693_dev members
Clean up the max77693 private header file by removing:
1. Left-overs from previous way of interrupt handling (driver uses
   regmap_irq_chip).
2. Unused members of struct 'max77693_dev' related to interrupts in
   extcon driver.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski.k@gmail.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-16 21:39:29 +01:00
Chanwoo Choi 73b6ecdb93 extcon: Redefine the unique id of supported external connectors without 'enum extcon' type
This patch just redefine the unique id of supported external connectors without
'enum extcon' type. Because unique id would be used on devictree file(*.dts) to
indicate the specific external connectors like key number of input framework.
So, I have the plan to move this definitions to following header file which
includes the unique id of supported external connectors.
- include/dt-bindings/extcon/extcon.h

Fixes: 2a9de9c0f0 ("extcon: Use the unique id for external connector instead of string")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:01:42 -07:00
Chanwoo Choi f8df880811 extcon: Remove optional print_name() function pointer of extcon_dev
This patch removes the optional print_name() function pointer included in
'struct extcon_dev' because the extcon must maintain the consistent name of
extcon device on sysfs instead of inconsistent name. After merged patch[1],
extcon can maintain the consistent name of extcon device without any hard-coded
device name.
[1] https://lkml.org/lkml/2015/4/27/258

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-29 19:56:11 +09:00
Chanwoo Choi 046050f6e6 extcon: Update the prototype of extcon_register_notifier() with enum extcon
Previously, extcon consumer driver used the extcon_register_interest()
to register the notifier chain and then to receive the notifier event
when external connector's state is changed. When registering the notifier chain
for specific external connector with extcon_register_interest(), it used the
the string name of external connector directly. There are potential problem
because of unclear, non-standard and inconsequent cable name. Namely,
it is not appropriate method to identify each external connector.

So, this patch modify the prototype of extcon_register_notifier() by using
the 'enum extcon' which are the unique id for each external connector
instead of unclear string method.

- Previously, the extcon consumer driver used the extcon_register_interest()
with 'cable_name' to point out the specific external connector. Also. it used
the un-needed structure (struct extcon_specific_cable_nb).
: int extcon_register_interest(struct extcon_specific_cable_nb *obj,
			     const char *extcon_name, const char *cable_name,
			     struct notifier_block *nb)

- Newly, the updated extcon_register_notifier() would definitely support
the same feature to detech the changed state of external connector without
any specific structure (struct extcon_specific_cable_nb).
: int extcon_register_notifier(struct extcon_dev *edev, enum extcon id,
			     struct notifier_block *nb)

This patch support the both extcon_register_interest() and new extcon_register_
notifier(). But the extcon_{register|unregister}_interest() will be deprecated
because extcon core would support the notifier event for extcon consumer driver
with only updated extcon_register_notifier() and 'extcon_specific_cable_nb'
will be removed if there are no extcon consumer driver with legacy
extcon_{register|unregister}_interest().

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
2015-05-22 18:58:55 +09:00
Chanwoo Choi 8e9bc36df5 extcon: Use capital letter for the name of external connectors
This patch uses the capital letter for the name of external connectors
to improve the readability instead of small letter.

Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-22 18:58:53 +09:00
Chanwoo Choi 2a9de9c0f0 extcon: Use the unique id for external connector instead of string
This patch uses the unique id to identify the type of external connector instead
of string name. The string name have the many potential issues. So, this patch
defines the 'extcon' enumeration which includes all supported external connector
on EXTCON subsystem. If new external connector is necessary, the unique id of
new connector have to be added in 'extcon' enumeration. There are current
supported external connector in 'enum extcon' as following:

enum extcon {
	EXTCON_NONE		= 0x0,

	/* USB external connector */
	EXTCON_USB		= 0x1,
	EXTCON_USB_HOST		= 0x2,

	/* Charger external connector */
	EXTCON_TA		= 0x10,
	EXTCON_FAST_CHARGER	= 0x11,
	EXTCON_SLOW_CHARGER	= 0x12,
	EXTCON_CHARGE_DOWNSTREAM = 0x13,

	/* Audio and video external connector */
	EXTCON_LINE_IN		= 0x20,
	EXTCON_LINE_OUT		= 0x21,
	EXTCON_MICROPHONE	= 0x22,
	EXTCON_HEADPHONE	= 0x23,

	EXTCON_HDMI		= 0x30,
	EXTCON_MHL		= 0x31,
	EXTCON_DVI		= 0x32,
	EXTCON_VGA		= 0x33,
	EXTCON_SPDIF_IN		= 0x34,
	EXTCON_SPDIF_OUT	= 0x35,
	EXTCON_VIDEO_IN		= 0x36,
	EXTCON_VIDEO_OUT	= 0x37,

	/* Miscellaneous external connector */
	EXTCON_DOCK		= 0x50,
	EXTCON_JIG		= 0x51,
	EXTCON_MECHANICAL	= 0x52,

	EXTCON_END,
};

For example in extcon-arizona.c:
To use unique id removes the potential issue about handling
the inconsistent name of external connector with string.
- Previously, use the string to register the type of arizona jack connector
static const char *arizona_cable[] = {
	"Mechanical",
	"Microphone",
	"Headphone",
	"Line-out",
};
- Newly, use the unique id to register the type of arizona jack connector
static const enum extcon arizona_cable[] = {
	EXTCON_MECHANICAL,
	EXTCON_MICROPHONE,
	EXTCON_HEADPHONE,
	EXTCON_LINE_OUT,

	EXTCON_NONE,
};

And this patch modify the prototype of extcon_{get|set}_cable_state_() which
uses the 'enum extcon id' instead of 'cable_index'. Because although one more
extcon drivers support USB cable, each extcon driver might has the differnt
'cable_index' for USB cable. All extcon drivers can use the unique id number
for same external connector with modified extcon_{get|set}_cable_state_().

- Previously, use 'cable_index' on these functions:
extcon_get_cable_state_(struct extcon_dev*, int cable_index)
extcon_set_cable_state_(struct extcon_dev*, int cable_index, bool state)

-Newly, use 'enum extcon id' on these functions:
extcon_get_cable_state_(struct extcon_dev*, enum extcon id)
extcon_set_cable_state_(struct extcon_dev*, enum extcon id, bool state)

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Felipe Balbi <balbi@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
[arnd: Report the build break about drivers/usb/phy/phy-tahvo.c after using the
unique id for external connector insteadf of string]
Reported-by: Arnd Bergmann <arnd@arndb.de>
[dan.carpenter: Report the build warning of extcon_{set|get}_cable_state_()]
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
2015-05-22 18:58:44 +09:00
Uwe Kleine-König 35eed7a076 extcon: usb-gpio: use flags argument of devm_gpiod_get to set direction
Since 39b2bbe3d7 (gpio: add flags argument to gpiod_get*() functions)
which appeared in v3.17-rc1, the gpiod_get* functions take an additional
parameter that allows to specify direction and initial value for output.

Without this patch there is no call to gpiod_direction_input but the
gpio is used for irq reporting and for that the line should be in input
mode.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-20 10:02:47 +09:00
Chanwoo Choi d71aadda19 extcon: Remove the optional name of extcon device
This patch removes the optional name of extcon device. Instead,
extcon_dev_register() set the device name as 'extcon[number]' naming pattern.
- /sys/class/extcon/[hardcoded device name] -> /sys/class/extcon/extcon[number]

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Jaewon Kim <jaewon02.kim@samsung.com>
2015-05-19 16:39:06 +09:00
Geert Uytterhoeven 638f958bae extcon: Allow compile test of GPIO consumers if !GPIOLIB
The GPIO subsystem provides dummy GPIO consumer functions if GPIOLIB is
not enabled. Hence drivers that depend on GPIOLIB, but use GPIO consumer
functionality only, can still be compiled if GPIOLIB is not enabled.

Relax the dependency on GPIOLIB if COMPILE_TEST is enabled, where
appropriate.

If GPIOLIB=n and asm-generic/gpio.h is not used:

    drivers/extcon/extcon-usb-gpio.c: In function ‘usb_extcon_detect_cable’:
    drivers/extcon/extcon-usb-gpio.c:63: error: implicit declaration of function ‘gpiod_get_value_cansleep’
    drivers/extcon/extcon-usb-gpio.c: In function ‘usb_extcon_probe’:
    drivers/extcon/extcon-usb-gpio.c:116: error: implicit declaration of function ‘devm_gpiod_get’
    drivers/extcon/extcon-usb-gpio.c:116: warning: assignment makes pointer from integer without a cast
    drivers/extcon/extcon-usb-gpio.c:122: error: implicit declaration of function ‘gpiod_set_debounce’
    drivers/extcon/extcon-usb-gpio.c:129: error: implicit declaration of function ‘gpiod_to_irq’

Add the missing #include <linux/gpio/consumer.h> to fix this.

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:06 +09:00
Chanwoo Choi c571bbb4b6 extcon: adc-jack: Remove the unneeded num_cables field
This patch removes the 'num_cables' filed from 'struct adc_jack_pdata'
because 'struct extcon_dev' contains the 'max_supported' field which
means the number of supported cable of extcon device.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:06 +09:00
Chanwoo Choi 942e0239d5 extcon: Alter MHL-TA cable name to TA cable name
This patch alters the MHL-TA cable name to TA cable name because MHL-TA is not
standard name. The MHL-TA is MHL cable with charger cable (TA or USB). So, this
patch use the TA cable instead of MHL-TA to inform the charger cable state.
- MHL-TA -> TA

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
2015-05-19 16:39:06 +09:00
Chanwoo Choi d519c423ff extcon: Unify the dock device names on max8997/77693
This patch change the name of various dock devices as 'DOCK' because the name of
various dock devices have not the standard naming rules. The name of dock devices
include the differenct word but it is ambiguous and never important information
on user-space aspect. This patch unifies the name of dock devices as following:
- Dock-Smart   -->|--> DOCK
- Dock-Desk    -->|
- Dock-Audio   -->|
- Dock-Card    -->|

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
2015-05-19 16:39:06 +09:00
Chanwoo Choi 41b3c0154c extcon: Unify the jig cable names on rt8973 and max14577/77693/77843
This patch change the name of various jig cables as 'JIG' because the name of
various jig cables are strange and ambiguous on user-space aspect. They include
the different information of either USB and UART state. It is never important
for user-space process. This patch unifies the name of jig cables as following:
- JIG-USB-ON   -->|--> JIG
- JIG-USB-OFF  -->|
- JIG-UART-ON  -->|
- JIG-UART-OFF -->|

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:05 +09:00
Inha Song 9e86b2ad4c extcon: arizona: Add support for select accessory detect mode when headphone detection
This patch add support for select accessory detect mode to HPDETL or HPDETR.
Arizona provides a headphone detection circuit on the HPDETL and HPDETR pins
to measure the impedance of an external load connected to the headphone.

Depending on board design, headphone detect pins can change to HPDETR or HPDETL.

Signed-off-by: Inha Song <ideal.song@samsung.com>
Acked-by: Lee Jones <lee@kernel.org>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:05 +09:00
Charles Keepax 2b51f9c2f1 extcon: arizona: Apply HP clamps correctly for WM8280
The headphone clamping is not set correctly currently, this was missed
because the wm8280 patches and the patch fixing the clamping for wm5110
went upstream at very similar times. This patch sets the headphone
clamping correctly for wm8280.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:05 +09:00
Chanwoo Choi a71fbc1525 extcon: arizona: Remove the setting of device name
This patch removes the setting of device name. Instead, extcon_dev_register()
set the device name such as 'extcon[number]' naming method.
- /sys/class/extcon/Headset Jack -> /sys/class/extcon/extcon[number]

Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
2015-05-19 16:39:05 +09:00
Chanwoo Choi b9ec23c08a extcon: Fix the checkpatch warning and minor coding style issue
This patch clean up the extcon core driver by fixing the checkpatch warning
and minor coding style issue.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:04 +09:00
Chanwoo Choi 707d755087 extcon: Add extcon_get_edev_name() API to get the extcon device name
This patch adds the extcon_get_edev_name() API to get the name of extcon device
because all information inclued in the structure extcon_dev should be accessed
by extcon core API instead of directly accessing the data.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:04 +09:00
Chanwoo Choi 71c3ffa5d2 extcon: Modify the device name as extcon[X] for sysfs
This patch modify the device name as extcon[X] for sysfs by using the 'extcon'
prefix word instead of separate device name. On user-space aspect, user would
find the some extcon drvier with extcon[X] pattern. So, this patch modify the
device name as following:
- /sys/class/extcon/[device name] -> /sys/class/extcon/extcon[X]

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:04 +09:00
Ramakrishna Pallala f03123783d extcon: axp288: Add axp288 extcon driver support
This patch adds the extcon support for AXP288 PMIC which
has the BC1.2 charger detection capability. Additionally
it also adds the USB mux switching support b/w SOC and PMIC
based on GPIO control.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
[cw00.choi: Modify the log message to keep the consistent log message pattern]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:04 +09:00
Richard Fitzgerald d0fd5fbc09 extcon: arizona: Rename hpdet_ip to make its purpose clearer
Renamed to hpdet_ip_version to make it clearer what it does
and that the value in it is simply a version number.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:03 +09:00
Chanwoo Choi ed2c0604ac extcon: Add manufactor name of each extcon device
This patch adds the manufactor name of each extcon device
and removes un-necessary comment in Kconfig.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-05-19 16:39:03 +09:00
Robert Baldyga bc1aabad39 extcon: usb-gpio: register extcon device before IRQ registration
IRQ handler touches info->edev, so if interrupt occurs before extcon
device initialization it can cause NULL pointer dereference. Doing extcon
initialization before IRQ handler registration fixes this problem.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-04-27 11:06:05 +09:00
Linus Torvalds 1fc149933f Char/Misc driver patches for 4.1-rc1
Here's the big char/misc driver patchset for 4.1-rc1.
 
 Lots of different driver subsystem updates here, nothing major, full
 details are in the shortlog below.
 
 All of this has been in linux-next for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlU2IMEACgkQMUfUDdst+yloDQCfbyIRL23WVAn9ckQse/y8gbjB
 OT4AoKTJbwndDP9Kb/lrj2tjd9QjNVrC
 =xhen
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver updates from Greg KH:
 "Here's the big char/misc driver patchset for 4.1-rc1.

  Lots of different driver subsystem updates here, nothing major, full
  details are in the shortlog.

  All of this has been in linux-next for a while"

* tag 'char-misc-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (133 commits)
  mei: trace: remove unused TRACE_SYSTEM_STRING
  DTS: ARM: OMAP3-N900: Add lis3lv02d support
  Documentation: DT: lis302: update wakeup binding
  lis3lv02d: DT: add wakeup unit 2 and wakeup threshold
  lis3lv02d: DT: use s32 to support negative values
  Drivers: hv: hv_balloon: correctly handle num_pages>INT_MAX case
  Drivers: hv: hv_balloon: correctly handle val.freeram<num_pages case
  mei: replace check for connection instead of transitioning
  mei: use mei_cl_is_connected consistently
  mei: fix mei_poll operation
  hv_vmbus: Add gradually increased delay for retries in vmbus_post_msg()
  Drivers: hv: hv_balloon: survive ballooning request with num_pages=0
  Drivers: hv: hv_balloon: eliminate jumps in piecewiese linear floor function
  Drivers: hv: hv_balloon: do not online pages in offline blocks
  hv: remove the per-channel workqueue
  hv: don't schedule new works in vmbus_onoffer()/vmbus_onoffer_rescind()
  hv: run non-blocking message handlers in the dispatch tasklet
  coresight: moving to new "hwtracing" directory
  coresight-tmc: Adding a status interface to sysfs
  coresight: remove the unnecessary configuration coresight-default-sink
  ...
2015-04-21 09:42:58 -07:00
Hans de Goede 66bee35f29 extcon: Fix missing locking when [un]registering notifiers
Since extcon.c is using raw_notifiers it must protect the notifier
list itself when [un]registering notifiers to avoid the list changing while
extcon_update_state is walking the list (through raw_notifier_call_chain).

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
[cw00.choi: Apply this patch to extcon.c driver instead of old extcon-class.c]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-03-23 11:06:04 +09:00
Dan Carpenter b9b518f539 extcon: max77843: Fix an error code in max77843_init_muic_regmap()
The i2c_new_dummy() return the NULL if error happen. So, If i2c_new_dummy()
return NULL, max77843_init_muic_regmap() return the proper error value
(-ENOMEM);

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
[cw00.choi: Use -ENOMEM instead of -ENODEV and modify patch description]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-03-23 10:50:27 +09:00
Dan Carpenter d927c59076 extcon: max77843: Fix signedness bug in max77843_muic_set_debounce_time()
This patch fixes the variable type of 'ret' from 'unsigned int' to 'int' type
because the return type of regmap_update_bits() is 'int' type.

Fixes: 27a28d32b4 ('extcon: max77843: Add max77843 MUIC driver')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
[cw00.choi: Fix the patch description]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-03-16 13:15:00 +09:00
Chanwoo Choi 34825e5119 extcon: Fix the checkpatch warning
This patch fixes the checkpatch warning about coding style.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-03-07 22:58:28 +09:00
Chanwoo Choi f68a8342b1 extcon: Rename extcon core driver
This patch renames the extcon core driver from extcon-class.c
to extcon.c because '-class' postfix is not necessary.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-03-07 22:58:10 +09:00
Charles Keepax 43f0acd961 extcon: arizona: Fix headphone clamping on wm5110
wm5110 requires slightly different configuration of the headphone
clamps to other Arizona devices. Otherwise headphone detection accuracy
will be way off. This patch adds the needed clamping.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-03-04 09:42:24 +09:00
Charles Keepax 112bdfaa52 extcon: arizona: Deobfuscate arizona_extcon_do_magic
arizona_extcon_do_magic does not lend a lot of clarity to the purpose
of the function, and as all the registers used are described in the
datasheet there is no need to obfuscate the code. This patch renames the
function to arizona_extcon_hp_clamp, as it controls clamping on the
headphone output.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-03-04 09:41:48 +09:00
Richard Fitzgerald 2f2b6aa8c5 extcon: arizona: Add support for WM8280/WM8281
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2015-02-26 10:04:44 +00:00
Jaewon Kim 27a28d32b4 extcon: max77843: Add max77843 MUIC driver
This patch adds MAX77843 extcon driver to support for MUIC(Micro
USB Interface Controller) device by using EXTCON subsystem to handle
various external connectors.

Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-02-24 09:00:54 +09:00
Roger Quadros e52817faae extcon: usb-gpio: Introduce gpio usb extcon driver
This driver observes the USB ID pin connected over a GPIO and
updates the USB cable extcon states accordingly.

The existing GPIO extcon driver is not suitable for this purpose
as it needs to be taught to understand USB cable states and it
can't handle more than one cable per instance.

For the USB case we need to handle 2 cable states.
1) USB (attach/detach)
2) USB-HOST (attach/detach)

This driver can be easily updated in the future to handle VBUS
events in case it happens to be available on GPIO for any platform.

Signed-off-by: Roger Quadros <rogerq@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-02-24 09:00:53 +09:00
Jaewon Kim 4c883abee0 extcon: max77693: Use HOST term to express USB-HOST cable instead of OTG term
This patch unifies the term called 'USB_OTG' and 'USB_HOST'
into USB_HOST. OTG(On-The-Go) function supports USB host and
this driver sents 'USB-Host event. So, unifies term to USB_HOST.

Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
[cw00.choi: Fix patch title to indicate the correct meaning of patch]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-02-24 09:00:53 +09:00
Jaewon Kim 4f0be26a79 extcon: max77693: Fix cable name of MHL-TA
This patch fixes extcon cable name of MHL-TA instead of MHL_TA
to unify cable name style.

Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-02-24 09:00:52 +09:00
Krzysztof Kozlowski 6594890020 extcon: max77693: Constify struct regmap_config
The regmap_config struct may be const because it is not modified by the
driver and regmap_init() accepts pointer to const.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-01-26 13:47:55 +09:00
Ivan T. Ivanov 5a696d9760 extcon: adc-jack: Release IIO channel on driver remove
Release IIO channel acquired during driver probe.

Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-01-26 13:47:55 +09:00
Wei Yongjun 25c0f4e42b extcon: Remove duplicated include from extcon-class.c
Remove duplicated "of.h" header file.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2015-01-26 13:47:54 +09:00
Linus Torvalds 6ae840e7cc Char/Misc driver patches for 3.19-rc1
Here's the big char/misc driver update for 3.19-rc1
 
 Lots of little things all over the place in different drivers, and a new
 subsystem, "coresight" has been added.  Full details are in the
 shortlog.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlSODosACgkQMUfUDdst+ykSNwCfcqx1Z3rQzbLwSrR2sa1fV3Zb
 yEAAniJoLZ4ZkoQK4/1ozsFc31q+gXNm
 =/epr
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver updates from Greg KH:
 "Here's the big char/misc driver update for 3.19-rc1

  Lots of little things all over the place in different drivers, and a
  new subsystem, "coresight" has been added.  Full details are in the
  shortlog"

* tag 'char-misc-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (73 commits)
  parport: parport_pc, do not remove parent devices early
  spmi: Remove shutdown/suspend/resume kernel-doc
  carma-fpga-program: drop videobuf dependency
  carma-fpga: drop videobuf dependency
  carma-fpga-program.c: fix compile errors
  i8k: Fix temperature bug handling in i8k_get_temp()
  cxl: Name interrupts in /proc/interrupt
  CXL: Return error to PSL if IRQ demultiplexing fails & print clearer warning
  coresight-replicator: remove .owner field for driver
  coresight: fixed comments in coresight.h
  coresight: fix typo in comment in coresight-priv.h
  coresight: bindings for coresight drivers
  coresight: Adding ABI documentation
  w1: support auto-load of w1_bq27000 module.
  w1: avoid potential u16 overflow
  cn: verify msg->len before making callback
  mei: export fw status registers through sysfs
  mei: read and print all six FW status registers
  mei: txe: add cherrytrail device id
  mei: kill cached host and me csr values
  ...
2014-12-14 16:43:47 -08:00
Krzysztof Kozlowski 6ab0b1171b extcon: max14577: Fix obvious typo in company name in copyright
Fix a typo in name of company in copyright comment.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-11-24 20:51:15 +09:00
Krzysztof Kozlowski c22159a2d5 extcon: max77693: Fix cable name of JIG_UART_ON
When JIG was set to "boot on" mode, the UART connection did not work
because it was assigned to Dock-Car cable (path: audio), not JIG-UART-ON
cable.

This was introduced in 39bf369e4e ("extcon: max77693: Add support dock
device and buttons") while adding dock features.

Assign the JIG-UART-ON back to UART path.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
[cw00.choi: Modify the patch name to remove specific board name]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-11-24 20:51:15 +09:00
Tomasz Figa f841afb174 extcon: Implement OF-based extcon lookup properly
Platform bus is not the only way to have extcon devices, so current
implementation of of_extcon_get_extcon_dev() is broken. Also using
parent device node only to get device name is quite ugly.

This patch reimplements of_extcon_get_extcon_dev() to do exactly the
same as extcon_get_extcon_dev() but instead of comparing names, compare
node pointers.

Signed-off-by: Tomasz Figa <tomasz.figa@gmail.com>
[mszyprow: simplified the code]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-11-24 20:51:15 +09:00
Wolfram Sang 08147bb19a extcon: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:20:30 +02:00
George Cherian 62364357c1 extcon: gpio: Fix code cleanup
This patch fixes following minor cleanup:
 - Order the include files in alphabetical order.
 - Fix description of state_off in extcon_gpio.h
 - Add a descrition for check_on_resume in extcon_gpio.h

Signed-off-by: George Cherian <george.cherian@ti.com>
[Modify the name/description of patch to keep standary codiyg style by Chanwoo Choi]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-09-22 16:48:47 +09:00
Jonghwa Lee dc6048d723 extcon: max77693: Fix a bug occured at changing ADC debounce time.
When it writes some value other than 0 to BTLDset and JIGset, muic device
will be reset automatically. And it happens during updating ADC debounce time,
because it shares same register. To update ADC debounce time without reset,
set value only to ADCDbset and 0 to BTLDset and JIGset.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
[Remove un-needed masking operation by Chanwoo Choi]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-09-22 16:14:58 +09:00
Jean Delvare b7c7e08659 extcon: sm5502: Drop useless include
Don't include <linux/input.h> when the driver does not use anything
from this header file.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
2014-09-22 16:00:23 +09:00
Krzysztof Kozlowski d715523174 extcon: max77693: Use resource managed interrupt line
Use resource managed interrupt line devm_request_threaded_irq() to
simplify a little cleanup paths:
 - no goto to cleanup label,
 - simpler remove function.

Overall the driver size is decreased by 11 line of code.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-09-22 15:53:23 +09:00
Chanwoo Choi c03e017c4d extcon: rt8973a: Add Richtek RT8973A extcon driver
This patch add support for Richtek RT8973A which is Micro USB Switch OVP
and i2c interface. The RT8973A is a USB port accessory detector and switch
that is optimized to protect low voltage system from abnormal high input
voltage (up to 28V) and supports high speed USB operation. Also, RT8973A
support 'auto-configuration' mode. If auto-configuration mode is enabled,
RT8973A would control internal h/w patch for USB D-/D+ switching.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
2014-09-22 11:43:08 +09:00
Chanwoo Choi fbae30d8dd extcon: sm5502: Clean up codes by using checkpatch script
This patch just clean up codes by using checkpatch script and fix warning
message about if statement.

- the result of checkpatch script as following:
WARNING: void function return statements are not generally useful
+	return;
+}

WARNING: quoted string split across lines
+			dev_err(info->dev, "failed: irq request (IRQ: %d,"
+				" error :%d)\n", muic_irq->irq, ret);

- warning message about coding style.

	drivers/extcon/extcon-sm5502.c:398 sm5502_muic_cable_handler()
		warn: we tested 'attached' before and it was 'false'

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-09-22 11:43:08 +09:00
Chanwoo Choi ca2a07e45d extcon: sm5502: Move sm5502.h header file to extcon directory
This patch move sm5502.h header file from 'include/linux/extcon' to
'driver/extcon' because sm5502.h is used for driver/extcon/extcon-sm5502.c.
and remove duplicate license description.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-09-22 11:43:08 +09:00
Chanwoo Choi 0746d5d31f extcon: sm5502: Add I2C dependency to fix build break
This patch add I2C configuration dependency to fix following build break.
If specific kernel build I2C as module, extcon-sm5502 have to depend on
I2C configuration.

	drivers/built-in.o: In function `regmap_smbus_byte_reg_read':
	regmap-i2c.c:(.text+0x5030a): undefined reference to `i2c_smbus_read_byte_data'
	drivers/built-in.o: In function `regmap_smbus_byte_reg_write':
	regmap-i2c.c:(.text+0x50338): undefined reference to `i2c_smbus_write_byte_data'
	drivers/built-in.o: In function `regmap_smbus_word_reg_read':
	regmap-i2c.c:(.text+0x50356): undefined reference to `i2c_smbus_read_word_data'
	drivers/built-in.o: In function `regmap_smbus_word_reg_write':
	regmap-i2c.c:(.text+0x50384): undefined reference to `i2c_smbus_write_word_data'
	drivers/built-in.o: In function `regmap_i2c_read':
	regmap-i2c.c:(.text+0x503cf): undefined reference to `i2c_transfer'
	drivers/built-in.o: In function `regmap_i2c_gather_write':
	regmap-i2c.c:(.text+0x50442): undefined reference to `i2c_transfer'
	drivers/built-in.o: In function `regmap_i2c_write':
	regmap-i2c.c:(.text+0x50474): undefined reference to `i2c_master_send'
	drivers/built-in.o: In function `sm5502_muic_i2c_init':
	extcon-sm5502.c:(.init.text+0x6630): undefined reference to `i2c_register_driver'

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-09-22 11:43:07 +09:00
Chanwoo Choi 0ccc7955ac extcon: sm5502: Fix bug to check cable type
This patch fix bug when checking cable type. SM5502 have to use ADC value
to get correct cable type.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-09-22 11:43:07 +09:00
Chanwoo Choi a75fed2ee6 extcon: sm5502: Change internal hardware switch according to cable type
This patch changes internal hardware DP_CON/DM_CON switch according to
cable type. The SM5502 MUIC device can set hardware switch as following:
- OPEN (not connected state) / USB / UART / AUDIO
Also, this patch set VBUSIN switch according to cable type.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-07-23 10:22:35 +09:00
Chanwoo Choi e1954452f5 extcon: sm5502: Detect cable state after completing platform booting
This patch detect whether cable is connected or not and the cable type
after completing kernel/platform booting using system_power_efficient_wq.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-07-23 10:22:35 +09:00
Chanwoo Choi 914b881f94 extcon: sm5502: Add support new SM5502 extcon device driver
This patch add new SM5502 MUIC(Micro-USB Interface Controller) device by using
EXTCON subsystem. The extcon-sm5502 driver is capable of identifying the type
of the external power source and attached accessory. An external power sources,
such as Deticated Charger or a standard USB port, are able to charge the battery
in the smart phone via the connector.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-07-23 10:22:30 +09:00
Charles Keepax 17271f608b extcon: arizona: Get MICVDD against extcon device
Previously we would do a regulator get against the main Arizona device
to obtain the MICVDD regulator. Arizona is an MFD device and normally
MICVDD will be supplied by one of its children (the arizona-micsupp
regulator). As devres destruction for the MFD device will run after all
its children have been destroyed, the regulator will be destroyed before
devres calls regulator_put. This causes a warning from both the
destruction of the child node, as the regulator is still open, and from
the put of the regulator as the regulator device has already been
destroyed.

A simple fix here is to get the regulator against the extcon device
itself such that devres runs when the child is destroyed. This has the
additional benefit that if for some reason the extcon driver is unloaded
the regulator reference won't hang around until the MFD is unloaded.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-07-23 10:07:42 +09:00
Jingoo Han 0a16ee633a extcon: Remove unnecessary OOM messages
The site-specific OOM messages are unnecessary, because they
duplicate the MM subsystem generic OOM message. The following
checkpatch warning is also removed.

  WARNING: Possible unnecessary 'out of memory' message

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
[Acked by Charles Keepax for arizona part]
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-07-23 10:07:09 +09:00
Chanwoo Choi 6b18aa1806 Immutable branch between MFD, Extcon and Regulator due for v3.17
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJToFLNAAoJEFGvii+H/HdhAy0QAIHM4bHpC8xbP52RH/Nubi2N
 vNSQ6ky1WNz0mCIzgFb0xfQhjeMZ72nRAWzbkSiZGaqqDTD+qU00NJCRC+e3a/bd
 nXaaDAAVne9LmQiqz4z5BRjg2png5FeJ72+y8FlFXi/f8H/cbrGg1Wl10f2fH0Fx
 DtKAsIkoUvsNGKyFy9aEZdeEYOLRhaIWMWODZaIPokqhQJs1u12Jn2apuyAyIwQt
 V2wrAbf8dPd7BywcN1RSORsrY86pkwyOKDEPK3bpmo1C4jryfWyqU+t8aaCkGQ7v
 t/JJQmGfcVIl9kuxKBZ9bO5yIkcdUlhi3NEc37GO6S1fDGVoYUOuPGr2WhHNmzip
 A08U5mSVUQNPHtJRUPMB4+cCTVaFQvgWmHR5Sjd6YE9vqhKSrhZW9BHzhV6hbNSb
 i+V+4hINYuJLR64bo9Z661Urf97RWfbC1AKxNBVKIC9F9y3edDXviBlBtHc8rEUq
 U2yOCjmRaySMRbWSYClkGkk7Ps1dV3rM6ukQ+7vheHEPcwLsDunnRk2bHxwKHMkm
 FbTZXhIO0QzjKmcicWpuMknEq+64Bor3WTUrs8SKYDuzd8mi1u1k3TRhhu/HOtFz
 pzdgRwdmOGDzb/tekVe1NMYpB4mQcLmPnQeuWCal2DCoyF1Enm4A3eCimQKjU9ue
 ZPiqXQ2FR2oS0/to7+Zm
 =+XpG
 -----END PGP SIGNATURE-----

Merge tag 'mfd-extcon-regulator-v3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into extcon-next

Immutable branch between MFD, Extcon and Regulator due for v3.17
2014-07-23 10:05:34 +09:00
Robert Baldyga 342d669c1e mfd: max77693: Handle IRQs using regmap
This patch modifies mfd driver to use regmap for handling interrupts.
It allows to simplify irq handling process. This modifications needed
to make small changes in function drivers, which use interrupts.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-06-17 15:17:00 +01:00
Robert Baldyga d0540f91cf mfd: max77693: Remove unnecessary wrapper functions
This patch removes wrapper functions used to access regmap, and
make driver using regmap_*() functions instead.

Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Mark Brown <broonie@linaro.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-06-17 15:16:10 +01:00
Chanwoo Choi ac65a625a0 extcon: Set parent device of extcon device using prameter of devm_extcon_dev_allocate
This patch set the parent device of extcon device using first parameter of
devm_extco_dev_allocate() to remove duplicate code on all of extcon provider
drivers.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reported-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Tested-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
2014-06-16 13:33:19 +09:00
Charles Keepax 24a279b1ca extcon: arizona: Update manual headphone detection calculation
The higher levels of impedance have a higher minimum value than the
first level. As the same value was used for all levels, higher impedances
were reported with a very low level of accuracy. This patch applies the
approriate lower threshold for each level, whilst we are changing things
add a define for the maximum value at each level to improve readability.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-06-16 13:33:19 +09:00
Charles Keepax e368f52521 extcon: arizona: Correct typo to disable regulation for button detection
We can use the bypass mode on the MICVDD reg for button detection, as
the comment in the code states, however the code was mistakenly
disabling bypass. This patch corrects this and allows bypass mode during
button detection.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-06-16 13:33:19 +09:00
Nikesh Oswal 34602486d0 extcon: arizona: Use extcon cable API with index of extcon cable instead of string
Use extcon cable API instead of state API as it is much more
idiomatic.

Signed-off-by: Nikesh Oswal <Nikesh.Oswal@wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
[Modify patch title by Chanwoo Choi]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-06-16 13:33:19 +09:00
Charles Keepax 5a8844b596 extcon: arizona: Remove duplicate set of input parent device
devm_input_allocate_device already sets the parent device to be that
passed to it, we also set this manually in arizona_extcon_probe. This
patch removes the redundant set from arizona_extcon_probe.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-06-16 13:33:19 +09:00
Chanwoo Choi e48f9dac3f extcon: Reorder the sequence of extcon device driver alphabetically
This patch reorder the sequence of extcon device diver alphabetically
to imporbe readability.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-06-16 13:33:18 +09:00
Krzysztof Kozlowski 3bc2ac7def extcon: palmas: Make of_device_id array const
Array of struct of_device_id may be be const as expected by
of_match_table field.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-06-16 13:33:18 +09:00
Richard Fitzgerald a288d64871 extcon: arizona: support inverted jack detect switch
Add config option for inverted jack detect switch that
opens when jack is inserted.

Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
[Acked by Lee Jones for MFD part]
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-06-16 13:33:18 +09:00
Chanwoo Choi 3f79a3fb5f extcon: palmas: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control
of extcon device.

Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Cc: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Felipe Balbi <balbi@ti.com>
Tested-by: Felipe Balbi <balbi@ti.com>
2014-04-29 09:52:12 +09:00
Chanwoo Choi 60cd62d4f7 extcon: gpio: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control
of extcon device.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
2014-04-29 09:51:48 +09:00
Chanwoo Choi 1876fd9af5 extcon: adc-jack: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control
of extcon device.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
2014-04-29 09:51:22 +09:00
Chanwoo Choi ef70a214b5 extcon: arizona: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control
of extcon device.

Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: patches@opensource.wolfsonmicro.com
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
2014-04-29 09:50:55 +09:00
Chanwoo Choi 0604002cde extcon: max14577: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control
of extcon device.

Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
2014-04-29 09:50:31 +09:00
Chanwoo Choi 577bef1104 extcon: max77693: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control
of extcon device.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
2014-04-29 09:50:07 +09:00
Chanwoo Choi 22f9afb95b extcon: max8997: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control
of extcon device.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
2014-04-29 09:46:28 +09:00
Chanwoo Choi 739ba1bfdb extcon: Add devm_extcon_dev_allocate/free to manage the resource of extcon device
This patch add device managed devm_extcon_dev_{allocate,free} to automatically
free the memory of extcon_dev structure without handling free operation.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
2014-04-29 09:45:56 +09:00
Chanwoo Choi a9af65223b extcon: Add extcon_dev_allocate/free() to control the memory of extcon device
This patch add APIs to control the extcon device on extcon provider driver.
The extcon_dev_allocate() allocates the memory of extcon device and initializes
supported cables. And then extcon_dev_free() decrement the reference of the
device of extcon device and free the memory of the extcon device. This APIs
must need to implement devm_extcon_dev_allocate()/free() APIs.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
2014-04-29 09:35:15 +09:00
Sangjung Woo d88cc36704 extcon: arizona: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e.
devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device
is attached with this function, that extcon device is automatically unregistered
on driver detach. That reduces tiresome managing code.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 19:37:06 +09:00
Sangjung Woo b4dad55abd extcon: palmas: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e.
devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device
is attached with this function, that extcon device is automatically unregistered
on driver detach. That reduces tiresome managing code.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 19:37:05 +09:00
Sangjung Woo 2923803d4f extcon: max8997: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e.
devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device
is attached with this function, that extcon device is automatically unregistered
on driver detach. That reduces tiresome managing code.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 19:37:05 +09:00
Sangjung Woo 10fae1184d extcon: max77693: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e.
devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device
is attached with this function, that extcon device is automatically unregistered
on driver detach. That reduces tiresome managing code.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 19:37:04 +09:00
Sangjung Woo 14dbd54962 extcon: max14577: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e.
devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device
is attached with this function, that extcon device is automatically unregistered
on driver detach. That reduces tiresome managing code.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 19:37:04 +09:00
Sangjung Woo d92c2f12f8 extcon: gpio: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e.
devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device
is attached with this function, that extcon device is automatically unregistered
on driver detach. That reduces tiresome managing code.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 19:37:03 +09:00
Sangjung Woo 4b5dd73883 extcon: adc-jack: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e.
devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device
is attached with this function, that extcon device is automatically unregistered
on driver detach. That reduces tiresome managing code.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 19:37:03 +09:00
Sangjung Woo 1111244ff4 extcon: Add resource-managed extcon register function
Add resource-managed extcon device register function for convenience.
For example, if a extcon device is attached with new
devm_extcon_dev_register(), that extcon device is automatically
unregistered on driver detach.

Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
[Fix bug about devm_extcon_dev_match/release() and code clean by Chanwoo Choi]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 19:36:55 +09:00
Krzysztof Kozlowski 369afd4ba2 extcon: max14577: Properly handle regmap_irq_get_virq error
The regmap_irq_get_virq may return 0 or -EINVAL on error. Fail the probe
in both situations.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 17:26:31 +09:00
Krzysztof Kozlowski 12adef5b49 extcon: max14577: Fix probe failure on successful work queue
In probe the driver queued delayed work for cable detection and
returned the result of queue_delayed_work() call. However the return
value of queue_delayed_work() does not indicate an error and in normal
condition it returns true which means successful work queue.
This effectively resulted in probe failure:
[    2.088204] max14577-muic: probe of max77836-muic failed with error 1

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <stable@vger.kernel.org>
Fixes: 962e56bfcf ("extcon: max14577: Add extcon-max14577 driver...")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 17:26:30 +09:00
Chanwoo Choi a55d952a2b Immutable branch between MFD and Extcon due for v3.16 merge-window.
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJTV7vmAAoJEFGvii+H/HdhStcQAIPXONkcTtnRijYYVo4+zMfY
 5lyEc7bpboK3FJW0SrSM3gt6jSjFayz7HN+oVd5ez73XYlKr+X4oap6GD1VnP+r2
 d2kc0ccfRa5oMPdeth0xabwmXnG2Cm3i3EwLGZAjxRAI72nmmTJu08HSWYSw9tBs
 oxKLuuYNhdIRAoEHrA5wyymb4fq2AdQrdNGEXZ9utZEK7z0+DRxD3LxeNEiW8dU2
 pU9XXlEbp9gQKsyiRL+MPxuFH7C7QpaQN1aryKupHEHtuRPjxqIsXETUsmxGt+sQ
 P3jN3FayYRYknqWSda+/lgEjkzw0CgeLFpR13emt5P2K8K8NPcV17mHhggWxFaes
 iGPi9cgotV9X2zxAgayAusunPRHEQ8Yz7bnQsXBuH04CbBgnu53gBUQyELQhJ2xO
 HBG6VVn5kXCpb80OWX/lTefEIN3yfuH15eV/cmBk3Qu6qqVFjCg6cBqi2b5QFPYN
 8ks/58ewbhKqh+T+yr7N70sXIfOF9aBIqREdnlp/uXaCYLkylSNaUPpxZTllDUnE
 QoJVTMwb/BgGKolhpfwva2UkVPt5C50w1+mNLh05d9IMF/C9kyQMcsC7rOa229LU
 XwtDoWFUTMzjNqTRBTLdElfkEnEET07xDvv3SQTAj30eTCaQs0+gxDMNSrDN/0zN
 u6uUTp1grfVVOoz1FPcS
 =q4Ul
 -----END PGP SIGNATURE-----

Merge tag 'ib-mfd-extcon-3.16' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into HEAD

Immutable branch between MFD and Extcon due for v3.16 merge-window.
2014-04-24 17:21:58 +09:00
Krzysztof Kozlowski bf9509e032 extcon: max8997: Use power efficient workqueue for delayed cable detection
Schedule delayed cable detection work on power efficient workqueue
so the scheduler won't wake up idle core for that work.
This extends the idle time for CPU cores and conserves power.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 17:20:39 +09:00
Krzysztof Kozlowski b8629411bf extcon: max77693: Use power efficient workqueue for delayed cable detection
Schedule delayed cable detection work on power efficient workqueue
so the scheduler won't wake up idle core for that work.
This extends the idle time for CPU cores and conserves power.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 17:20:38 +09:00
Krzysztof Kozlowski dfee4111fe extcon: max8997: Fix NULL pointer exception on missing pdata
Fix NULL pointer exception when platform data is not supplied. The
driver dereferenced pdata pointer where it could be NULL.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <stable@vger.kernel.org>
Fixes: 810d601f07
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 17:20:37 +09:00
Krzysztof Kozlowski d5653f2b73 extcon: max77693: Fix two NULL pointer exceptions on missing pdata
Fix NULL pointer exceptions when platform data is not supplied.

Trace of one exception:
Unable to handle kernel NULL pointer dereference at virtual address 00000008
pgd = c0004000
[00000008] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT SMP ARM
Modules linked in:
CPU: 2 PID: 1 Comm: swapper/0 Not tainted 3.14.0-12045-gead5dd4687a6-dirty #1628
task: eea80000 ti: eea88000 task.ti: eea88000
PC is at max77693_muic_probe+0x27c/0x528
LR is at regmap_write+0x50/0x60
pc : [<c041d1c8>]    lr : [<c02eba60>]    psr: 20000113
sp : eea89e38  ip : 00000000  fp : c098a834
r10: ee1a5a10  r9 : 00000005  r8 : c098a83c
r7 : 0000000a  r6 : c098a774  r5 : 00000005  r4 : eeb006d0
r3 : c0697bd8  r2 : 00000000  r1 : 00000001  r0 : 00000000
Flags: nzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 10c5387d  Table: 4000404a  DAC: 00000015
Process swapper/0 (pid: 1, stack limit = 0xeea88240)
Stack: (0xeea89e38 to 0xeea8a000)
9e20:                                                       c08499fc eeb006d0
9e40: 00000000 00000000 c0915f98 00000001 00000000 ee1a5a10 c098a730 c09a88b8
9e60: 00000000 c098a730 c0915f98 00000000 00000000 c02d6aa0 c02d6a88 ee1a5a10
9e80: c0a712c8 c02d54e4 00001204 c0628b00 ee1a5a10 c098a730 ee1a5a44 00000000
9ea0: eea88000 c02d57b4 00000000 c098a730 c02d5728 c02d3a24 ee813e5c eeb9d534
9ec0: c098a730 ee22f700 c097c720 c02d4b14 c08174ec c098a730 00000006 c098a730
9ee0: 00000006 c092fd30 c09b8500 c02d5df8 00000000 c093cbb8 00000006 c0008928
9f00: 000000c3 ef7fc785 00000000 ef7fc794 00000000 c08af968 00000072 eea89f30
9f20: ef7fc85e c065f198 000000c3 c003e87c 00000003 00000000 c092fd3c 00000000
9f40: c08af618 c0826d58 00000006 00000006 c0956f58 c093cbb8 00000006 c092fd30
9f60: c09b8500 000000c3 c092fd3c c08e8510 00000000 c08e8bb0 00000006 00000006
9f80: c08e8510 c0c0c0c0 00000000 c0628fac 00000000 00000000 00000000 00000000
9fa0: 00000000 c0628fb4 00000000 c000f038 00000000 00000000 00000000 00000000
9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 c0c0c0c0 c0c0c0c0
[<c041d1c8>] (max77693_muic_probe) from [<c02d6aa0>] (platform_drv_probe+0x18/0x48)
[<c02d6aa0>] (platform_drv_probe) from [<c02d54e4>] (driver_probe_device+0x140/0x384)
[<c02d54e4>] (driver_probe_device) from [<c02d57b4>] (__driver_attach+0x8c/0x90)
[<c02d57b4>] (__driver_attach) from [<c02d3a24>] (bus_for_each_dev+0x54/0x88)
[<c02d3a24>] (bus_for_each_dev) from [<c02d4b14>] (bus_add_driver+0xe8/0x204)
[<c02d4b14>] (bus_add_driver) from [<c02d5df8>] (driver_register+0x78/0xf4)
[<c02d5df8>] (driver_register) from [<c0008928>] (do_one_initcall+0xc4/0x174)
[<c0008928>] (do_one_initcall) from [<c08e8bb0>] (kernel_init_freeable+0xfc/0x1c8)
[<c08e8bb0>] (kernel_init_freeable) from [<c0628fb4>] (kernel_init+0x8/0xec)
[<c0628fb4>] (kernel_init) from [<c000f038>] (ret_from_fork+0x14/0x3c)
Code: caffffe7 e59d200c e3550001 b3a05001 (e5923008)
---[ end trace 85db969ce011bde7 ]---

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: <stable@vger.kernel.org>
Fixes: 190d7cfc86
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-24 17:20:37 +09:00
Krzysztof Kozlowski 4706a5253b extcon: max14577: Add support for MAX77836
Add support for MAX77836 chipset to the max14577 extcon driver. The
MAX77836 MUIC has additional interrupts (VIDRM, ADC1K) so IRQ handling
is split up into two functions: max14577_parse_irq() and
max77836_parse_irq().

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-04-23 14:09:25 +01:00
Krzysztof Kozlowski 0ca852b794 extcon: max14577: Choose muic_irqs according to device type
This patch continues the preparation for adding support for max77836
device to existing max14577 driver.

During probe choose muic_irqs according to device type. Currently there
are only "max14577_muic_irqs" but later patch will add max77836
interrupts.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-04-23 14:08:34 +01:00
Krzysztof Kozlowski 2b1d18f181 extcon: max14577: Add max14577 prefix to muic_irqs
Add max14577 prefix to muic_irqs array. This prepares for max77836
support in this extcon driver.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-04-23 14:08:18 +01:00
Chanwoo Choi 4005da5ce8 extcon: max14577: Change extcon name instead of static name according to device type
This patch use device name to make sysfs path according to device type:

max14577-muic
- /sys/class/extcon/max14577-muic/
max77836-muic
- /sys/class/extcon/max77836-muic/

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-04-23 14:07:16 +01:00
Kishon Vijay Abraham I f63d32d408 extcon: palmas: explicitly set edev name as node name
commit ca488 (extcon: of: Remove unnecessary function call by using the
name of device_node) started using node name instead of device name
to get the extcon device. This breaks dwc3-omap since it's not able to
get the extcon device anymore. Fixed it by setting edev name of
palmas to be the same as its node name.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Reported-by: Felipe Balbi <balbi@ti.com>
Reviewed-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-04-22 15:41:10 +09:00
Chanwoo Choi 1ad94ffef2 extcon: Move OF helper function to extcon core and change function name
This patch move simply OF helper function to extcon core and change function
name as following:
- of_extcon_get_extcon_dev() -> extcon_get_edev_by_phandle()

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Felipe Balbi <balbi@ti.com>
2014-03-19 14:41:58 +09:00
Chanwoo Choi ca48824117 extcon: of: Remove unnecessary function call by using the name of device_node
This patch remove unnecessary function call in of_extcon_get_extcon_dev()
by using the name of device_node structure.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-03-19 13:45:43 +09:00
Jingoo Han 3cc731d97f extcon: gpio: Use SIMPLE_DEV_PM_OPS macro
Use SIMPLE_DEV_PM_OPS macro in order to make the code simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-03-19 13:45:42 +09:00
Jingoo Han 8d4288fb99 extcon: palmas: Use SIMPLE_DEV_PM_OPS macro
Use SIMPLE_DEV_PM_OPS macro in order to make the code simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-03-19 13:45:41 +09:00
Charles Keepax 1139110064 ASoC: dapm: Add locking to snd_soc_dapm_xxxx_pin functions
The snd_soc_dapm_xxxx_pin all require the dapm_mutex to be held when
they are called as they edit the dirty list, however very few of the
callers do so.

This patch adds unlocked versions of all the functions replacing the
existing implementations with one that holds the lock internally. We
also fix up the places where the lock was actually held on the caller
side.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stable@vger.kernel.org
2014-02-20 18:40:07 +09:00
Rongjun Ying 6544dfa579 extcon: gpio: Add power resume support
When system on the suspend state, Some SoC can't get gpio interrupt.
After system resume, need send extcon uevent to userspace.

Signed-off-by: Rongjun Ying <rongjun.ying@csr.com>
Reviewed-by: Barry Song <Baohua.Song@csr.com>
Acked-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-01-09 09:53:30 +09:00
Chanwoo Choi 962e56bfcf extcon: max14577: Add extcon-max14577 driver to support MUIC device
This patch supports Maxim MAX14577 MUIC(Micro USB Interface Controller)
device by using EXTCON subsystem to handle various external connectors.
The max14577 device uses regmap method for i2c communication and
supports irq domain.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2014-01-07 11:54:29 +09:00
Charles Keepax 77438610ff extcon: arizona: Add support for headphone detection on wm5110 rev D
wm5110 rev D is the first chip to use headphone detection IP 2, specify
such and make a small correction as the impedance value is actually read
in 0.5 ohm increments now.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-01-07 11:54:28 +09:00
Charles Keepax 9141461d81 extcon: arizona: No need to switch back down HPDET ranges
No point in revisiting ranges the detection will be no more accurate
the second time simply report that the resistance is right on the
range boundry.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-01-07 11:54:28 +09:00
Charles Keepax 31a847e6e1 extcon: arizona: Fix race with microphone detection and removal
The microphone detection code is run as delayed work to provide
additional debounce, it is possible that the jack could have been
removed by the time we process the microphone detection. Turn this
case into a no op.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-01-07 11:54:28 +09:00
Charles Keepax a3e00d4bd8 extcon: arizona: Fix reset of HPDET after race with removal
We need to make sure we reset back to our starting state, especially
making sure that we have disabled poll in the register cache.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-01-07 11:54:28 +09:00
Charles Keepax ffae24fed8 extcon: arizona: Add defines for microphone detection levels
Improve readability by creating a define for each microphone detection
level.

Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-01-07 11:54:28 +09:00
George Cherian b7d2d5be3c extcon: palmas: Handle ID interrupt properly using USB_ID_INT_SRC
Always cross check with the ID state and the source of interrupt.
Also add a case in which ID Source is ID_GND but LATCH state is set
wrongly. This uses the previous Link stat to determine the new state.

Signed-off-by: George Cherian <george.cherian@ti.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-01-07 11:54:27 +09:00
Kishon Vijay Abraham I 5fbc77d6eb extcon: palmas: Added a new compatible type *ti,palmas-usb-vid*
The Palmas device contains only a USB VBUS-ID detector, so added a
compatible type *ti,palmas-usb-vid*. Didn't remove the existing compatible
types for backward compatibility.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-01-07 11:54:27 +09:00
Guenter Roeck 4288d9b8ed extcon: gpio: Request gpio pin before modifying its state
Commit 338de0ca (extcon: gpio: Use gpio driver/chip debounce if supported)
introduced a call to gpio_set_debounce() before actually requesting the
respective gpio pin from the gpio subsystem.

The gpio subsystem expects that a gpio pin was requested before modifying its
state. Not doing so results in a warning from gpiolib, and the gpio pin is
auto-requested. This in turn causes the subsequent devm_gpio_request_one()
to fail. So devm_gpio_request_one() must be called prior to calling
gpio_set_debounce().

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2014-01-07 11:54:26 +09:00
Wang, Xiaoming 7585ca0dc9 extcon: remove freed groups caused the panic or warning in unregister flow
(edev->extcon_dev_type.groups) has been freed before device_unregister.
extcon_dev_unregister -> kfree(edev->extcon_dev_type.groups)
then device_unregister -> device_del -> device_remove_attrs
-> device_remove_groups(dev, type->groups);
panic because type->groups has been freed.

This patch is move device_unregister ahead of groups free
to avoid panic in extcon_dev_unregister.

stack
[ 22.847226] BUG: unable to handle kernel paging request at 5f39746e
[ 22.847234] IP: [<c1387fcd>] sysfs_remove_group+0x2d/0xd0
[ 22.847238] *pdpt = 0000000000000000 *pde = 0000000000000000
[ 22.847241] Oops: 0000 [#1] PREEMPT SMP
[ 22.847244] Modules linked in:
[ 22.847249] CPU: 0 PID: 1 Comm: swapper/0 Tainted: G W 3.10.16-261140-g6533774 #1
[ 22.847251] task: f3078000 ti: f3072000 task.ti: f3072000
[ 22.847254] EIP: 0060:[<c1387fcd>] EFLAGS: 00010206 CPU: 0
[ 22.847257] EIP is at sysfs_remove_group+0x2d/0xd0
[ 22.847259] EAX: 00000004 EBX: 5f39746e ECX: 00000000 EDX: f2773560
[ 22.847261] ESI: f2653b80 EDI: f2773560 EBP: f3073c90 ESP: f3073c70
[ 22.847263] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
[ 22.847264] CR0: 8005003b CR2: 5f39746e CR3: 020e5000 CR4: 001007f0
[ 22.847266] DR0: 00000000 DR1: 00000000 DR2: 00000000 DR3: 00000000
[ 22.847268] DR6: ffff0ff0 DR7: 00000400
[ 22.847269] Stack:
[ 22.847276] c13848c9 c1ae3805 f3073c80 f24ddc4c 00000246 f2773e88 f1c44408 f2531340
[ 22.847283] f3073ca0 c16935ca f1c44400 f27d3340 f3073cb4 c1693858 f24ddc44 f1c44400
[ 22.847289] f1c4420c f3073cc8 c1693f76 f1c44400 00000001 00000000 f3073ce8 c1694011
[ 22.847290] Call Trace:
[ 22.847295] [<c13848c9>] ? sysfs_hash_and_remove+0x49/0xa0
[ 22.847300] [<c1ae3805>] ? sub_preempt_count+0x55/0xe0
[ 22.847306] [<c16935ca>] device_remove_groups+0x2a/0x40
[ 22.847309] [<c1693858>] device_remove_attrs+0x38/0x60
[ 22.847313] [<c1693f76>] device_del+0xd6/0x150
[ 22.847316] [<c1694011>] device_unregister+0x21/0x60
[ 22.847320] [<c13869e8>] ? sysfs_remove_link+0x18/0x30
[ 22.847323] [<c1697d04>] ? class_compat_remove_link+0x34/0x50
[ 22.847329] [<c18bf5d9>] extcon_dev_unregister+0xf9/0x130
[ 22.847333] [<c18bd21f>] pwrsrc_extcon_dev_reg_callback+0x7f/0xa0
[ 22.847337] [<c1ae36e3>] notifier_call_chain+0x43/0x60
[ 22.847343] [<c12634e1>] __blocking_notifier_call_chain+0x41/0x80
[ 22.847347] [<c126353f>] blocking_notifier_call_chain+0x1f/0x30
[ 22.847351] [<c18bef39>] extcon_dev_notify_add_device+0x19/0x20
[ 22.847354] [<c18bf074>] extcon_dev_register+0x134/0x580
[ 22.847358] [<c1ae3805>] ? sub_preempt_count+0x55/0xe0
[ 22.847363] [<c154b4da>] ? gpiod_request+0x6a/0x1d0
[ 22.847368] [<c132528a>] ? kmem_cache_alloc_trace+0xaa/0x170
[ 22.847372] [<c18c0179>] ? fsa9285_probe+0x99/0x3f0
[ 22.847375] [<c18c00e0>] ? fsa9285_irq_handler+0xf0/0xf0
[ 22.847379] [<c18c019f>] fsa9285_probe+0xbf/0x3f0
[ 22.847383] [<c18c00e0>] ? fsa9285_irq_handler+0xf0/0xf0
[ 22.847388] [<c1828d9e>] i2c_device_probe+0x7e/0xf0
[ 22.847392] [<c1386e52>] ? sysfs_create_link+0x22/0x40
[ 22.847395] [<c1696c62>] ? driver_sysfs_add+0x72/0xa0
[ 22.847399] [<c1697119>] driver_probe_device+0x79/0x360
[ 22.847403] [<c1697491>] __driver_attach+0x91/0xa0
[ 22.847407] [<c1697400>] ? driver_probe_device+0x360/0x360
[ 22.847410] [<c16955a2>] bus_for_each_dev+0x42/0x80
[ 22.847414] [<c1696bee>] driver_attach+0x1e/0x20
[ 22.847417] [<c1697400>] ? driver_probe_device+0x360/0x360
[ 22.847420] [<c169675f>] bus_add_driver+0xef/0x270
[ 22.847425] [<c1828e10>] ? i2c_device_probe+0xf0/0xf0
[ 22.847428] [<c1828e10>] ? i2c_device_probe+0xf0/0xf0
[ 22.847432] [<c1697a8a>] driver_register+0x6a/0x160
[ 22.847436] [<c1addb3d>] ? mutex_unlock+0xd/0x10
[ 22.847440] [<c1438ab2>] ? __create_file+0x122/0x2a0
[ 22.847446] [<c20557d3>] ? extcon_class_init+0x15/0x15
[ 22.847450] [<c1827cbb>] i2c_register_driver+0x2b/0xd0
[ 22.847454] [<c1438d05>] ? debugfs_create_file+0x35/0x40
[ 22.847458] [<c20557d3>] ? extcon_class_init+0x15/0x15
[ 22.847461] [<c20557e4>] fsa9285_extcon_init+0x11/0x29
[ 22.847465] [<c12001aa>] do_one_initcall+0xba/0x170
[ 22.847471] [<c2012b4a>] kernel_init_freeable+0x119/0x1b8
[ 22.847475] [<c20124d3>] ? do_early_param+0x7a/0x7a
[ 22.847480] [<c1ac4090>] kernel_init+0x10/0xd0
[ 22.847485] [<c1ae6cf7>] ret_from_kernel_thread+0x1b/0x28
[ 22.847488] [<c1ac4080>] ? rest_init+0x80/0x80

Tested-by: Liu, Chuansheng <chuansheng.liu@intel.com>
Reviewed-by: Liu, Chuansheng <chuansheng.liu@intel.com>
Signed-off-by: xiaoming wang <xiaoming.wang@intel.com>
Signed-off-by: Zhang Dongxing <dongxing.zhang@intel.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-11-26 15:17:23 +09:00
Charles Keepax 6ac6b475c5 extcon: arizona: Get pdata from arizona structure not device
In the case of a device tree system there will be no pdata attached to
the device, causing us to deference a NULL pointer. Better to take the
pdata from the Arizona structure as this will always exist and we know
will have been populated since it is populated by the MFD device which
binds in the extcon driver.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-11-26 14:30:10 +09:00
Greg Kroah-Hartman 2424a7339b Update extcon for 3.13
This patchset modify extcon core to remove unnecessary allocation sequence for
 'dev' instance and change extcon_dev_register() interface. extcon-gpio use
 gpiolib API to get debounce time and include small fix of extcon core/device
 driver.
 
 Detailed description for patchset:
 1. Modify extcon core driver
 - The extcon-gpio driver use gpio_set_debounce() API provided from gpiolib
 if gpio driver for SoC support gpio_set_debounce() function and support 'gpio_
 activ_low' filed to check whether gpio active state is 1(high) or 0(low).
 - Change field type of 'dev' in structure extcon_dev and remove the sequence
 of allocating memory of 'struct dev' on extcon_dev_register() function because
 extcon device must need 'struct device.
 - Change extcon_dev_register() prototype to simplify it and remove unnecessary
 parameter as below:
 
 2. Fix coding style and typo
 - extcon core     : Fix indentation coding style and remove unnecessary casting
 - extcon-max8997  : Fix checkpatch warning
 - extcon-max77693 : Fix checkpatch warning
 - extcon-arizona  : Fix typo of comment and modify minor issue
 - extcon-palmas   : Use dev_get_platdata()
 
 3. Modify extcon-arizona driver
 - Modify minor issue about micbias and comparision statement
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJSRNuGAAoJEJzN3yze689TcaQP/0jyJEFTkB0EsutUsK5K4Ul9
 Hv6G07ccCQZOR8Bk5VR3a/ldX2nMlc8uZkhCrcvxbPM9NDuUNt5Q18EFrMCYomwz
 bipFPds6Q2UuGxnaSgqBQKJ6PH/IYXTfS1Y2nbaOivKK18L62WBWw4wCz59WWyS8
 B4ROjn0OjfzHlbp3uPjjCAqY9PpVsxFfTxszR0+Xt4hbapet/7UTgyMO6fJRZ0JF
 gzWCKcXghRvv5ZEravX5sUc4SW6bNYKq3CgPBPIEmo33W0obk5bKOY5qDVdc7e03
 WhYCPhm/gYsEfHq/Ah9k9xz3Q5ObrNdDep5nAFrS4PpoyJfalYwpRmcExTTuCEXj
 CXmR/NpSK2BPlxgrQ32/bTve2bMtT16ZAMXKAIxHGwAUG/RAuQIZx0trjTSERNi1
 A0juMZG3a2o9q+heCIeUp/bjhMGqCgfmlSwGrinU6hZMEj8DL4KtgiZrozOp4RlF
 SX+LOvNA40EK+S2FljY30G3NkTCLksJimjQ6v37b1vhSnXBNh5R+lhzXUY6cBBHB
 b5oo+6P4A9CCcmoUg8XOb5/NEjJX8JxpUKGpF/saBgHOQl5xXAfYBYVi5HVpgrJ1
 Soqlv2s/wUxmGGjG9meC+AEvTu/DtKGNUMtGDZM8TUULAxwFsvdStSeJ5JHqyXuE
 iaAj5pGTNkFsXnwPISZT
 =8Hr2
 -----END PGP SIGNATURE-----

Merge tag 'extcon-next-for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon for 3.13

This patchset modify extcon core to remove unnecessary allocation sequence for
'dev' instance and change extcon_dev_register() interface. extcon-gpio use
gpiolib API to get debounce time and include small fix of extcon core/device
driver.

Detailed description for patchset:
1. Modify extcon core driver
- The extcon-gpio driver use gpio_set_debounce() API provided from gpiolib
if gpio driver for SoC support gpio_set_debounce() function and support 'gpio_
activ_low' filed to check whether gpio active state is 1(high) or 0(low).
- Change field type of 'dev' in structure extcon_dev and remove the sequence
of allocating memory of 'struct dev' on extcon_dev_register() function because
extcon device must need 'struct device.
- Change extcon_dev_register() prototype to simplify it and remove unnecessary
parameter as below:

2. Fix coding style and typo
- extcon core     : Fix indentation coding style and remove unnecessary casting
- extcon-max8997  : Fix checkpatch warning
- extcon-max77693 : Fix checkpatch warning
- extcon-arizona  : Fix typo of comment and modify minor issue
- extcon-palmas   : Use dev_get_platdata()

3. Modify extcon-arizona driver
- Modify minor issue about micbias and comparision statement
2013-09-26 20:47:25 -07:00
Chanwoo Choi 42d7d7539a extcon: Simplify extcon_dev_register() prototype by removing unnecessary parameter
This patch remove extcon_dev_register()'s second parameter which means
the pointer of parent device to simplify prototype of this function.
So, if extcon device has the parent device, it should set the pointer of
parent device to edev.dev.parent in extcon device driver instead of in
extcon_dev_register().

Cc: Graeme Gregory <gg@slimlogic.co.uk>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-09-27 09:37:01 +09:00
Chanwoo Choi dae6165124 extcon: Change field type of 'dev' in extcon_dev structure
The extcon device must always need 'struct device' so this patch change
field type of 'dev' instead of allocating memory for 'struct device' on
extcon_dev_register() function.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <cw00.choi@samsung.com>
2013-09-27 09:37:01 +09:00
Charles Keepax 4102424302 extcon: arizona: Don't require micbias to be shifted in pdata
Every other pdata field is specified unshifted the patch handles
shifting for the MICBIAS from the microphone detection polarity
configurations in the extcon driver rather than demanding it in
pdata to match other fields.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:37:01 +09:00
Charles Keepax 4ba1a9ff59 extcon: arizona: Correct typo in headphone detect range transitions
We should move range when the measured value is greater than or equal to
the max value not when greater than.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:37:01 +09:00
Guenter Roeck 5bfbdc9caa extcon: gpio: Add support for active-low presence to detect pins
This patch add 'gpio_active_low' field to 'struct gpio_extcon_data'
to check whether gpio active state is 1(high) or 0(low).

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:37:01 +09:00
Jingoo Han 7c0f6558f8 extcon: use dev_get_platdata()
Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly. This is a cosmetic change
to make the code simpler and enhance the readability.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:37:01 +09:00
Guenter Roeck 338de0ca68 extcon: gpio: Use gpio driver/chip debounce if supported
This patch use gpio_set_debounce() API provided from gpiolib if SoC or device
driver with gpio support gpio_set_debounce() function.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:37:00 +09:00
Guenter Roeck 1073514b11 extcon: gpio: Do not unnecessarily initialize variables
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:37:00 +09:00
Jingoo Han cb8bb3a772 extcon: Remove casting the return value which is a void pointer
Casting the return value which is a void pointer is redundant.
The conversion from void pointer to any other pointer type is
guaranteed by the C programming language.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:37:00 +09:00
Chanwoo Choi a75e1c73a4 extcon: Fix indentation coding style to improve readability
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-09-27 09:37:00 +09:00
Sachin Kamat a33411b26e extcon: max77693: Fix checkpatch warning
Fixes the following warning:
WARNING: space prohibited before semicolon

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:37:00 +09:00
Sachin Kamat d97abdde17 extcon: arizona: Fix a typo in a comment
Fixes an incomplete comment introduced by commit 9c2ba270
("extcon: arizona: Simplify HPDET based identification").

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:37:00 +09:00
Charles Keepax cb9005d7da extcon: arizona: Clear trig_sts bits on all paths
We want the trig_sts bits to be cleared in all cases where we consider
the jack detection interrupt to have been handled. Specifically, if a
duplicate detection event was suppressed these bits were not cleared
causing the CODEC to not enter a low power state. This patch clears the
bits on the duplicate detection code path.

Reported-by: Ryo Tsutsui <ryo.tsutsui@wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:37:00 +09:00
Sachin Kamat ad07d8b489 extcon: max8997: Fix checkpatch warning
Fixes the following warning:
WARNING: space prohibited before semicolon

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2013-09-27 09:36:59 +09:00
Chanwoo Choi d667566754 extcon: arizona: Fix up minor coding style to remove unnecessary braces
This fixes up braces coding style issue by using checkpatch script.

Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 12:03:31 -07:00
Chanwoo Choi 2cc7e4d4b8 extcon: class: Remove unnecessary extern declaration
This patch remove unnecessary extern declaration (extcon_set_state).
checkpatch found this coding style issue.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 12:03:30 -07:00
Chanwoo Choi c2275d2fa5 extcon: Fix up 80 column coding style issues
This patch fix 80 column coding sytle issues by using checkpatch script.

Cc: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-09-26 12:03:30 -07:00
Linus Torvalds 542a086ac7 Driver core patches for 3.12-rc1
Here's the big driver core pull request for 3.12-rc1.
 
 Lots of tiny changes here fixing up the way sysfs attributes are
 created, to try to make drivers simpler, and fix a whole class race
 conditions with creations of device attributes after the device was
 announced to userspace.
 
 All the various pieces are acked by the different subsystem maintainers.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.21 (GNU/Linux)
 
 iEYEABECAAYFAlIlIPcACgkQMUfUDdst+ynUMwCaAnITsxyDXYQ4DqEsz8EcOtMk
 718AoLrgnUZs3B+70AT34DVktg4HSThk
 =USl9
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core patches from Greg KH:
 "Here's the big driver core pull request for 3.12-rc1.

  Lots of tiny changes here fixing up the way sysfs attributes are
  created, to try to make drivers simpler, and fix a whole class race
  conditions with creations of device attributes after the device was
  announced to userspace.

  All the various pieces are acked by the different subsystem
  maintainers"

* tag 'driver-core-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (119 commits)
  firmware loader: fix pending_fw_head list corruption
  drivers/base/memory.c: introduce help macro to_memory_block
  dynamic debug: line queries failing due to uninitialized local variable
  sysfs: sysfs_create_groups returns a value.
  debugfs: provide debugfs_create_x64() when disabled
  rbd: convert bus code to use bus_groups
  firmware: dcdbas: use binary attribute groups
  sysfs: add sysfs_create/remove_groups for when SYSFS is not enabled
  driver core: add #include <linux/sysfs.h> to core files.
  HID: convert bus code to use dev_groups
  Input: serio: convert bus code to use drv_groups
  Input: gameport: convert bus code to use drv_groups
  driver core: firmware: use __ATTR_RW()
  driver core: core: use DEVICE_ATTR_RO
  driver core: bus: use DRIVER_ATTR_WO()
  driver core: create write-only attribute macros for devices and drivers
  sysfs: create __ATTR_WO()
  driver-core: platform: convert bus code to use dev_groups
  workqueue: convert bus code to use dev_groups
  MEI: convert bus code to use dev_groups
  ...
2013-09-03 11:37:15 -07:00
Mark Brown 1a82e81e0e extcon: adc-jack: Use power efficient workqueue
The debounce timeout is generally quite long and the work not performance
critical so allow the scheduler to run the work anywhere rather than in
the normal per-CPU workqueue.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-08-05 08:53:34 +09:00
Mark Brown d0db2e7ae7 extcon: gpio: Use power efficient workqueue for debounce
The debounce timeout is generally quite long and the work not performance
critical so allow the scheduler to run the work anywhere rather than in
the normal per-CPU workqueue.

Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-08-05 08:53:34 +09:00
Mark Brown df9a5ab463 extcon: arizona: Use power efficient workqueue
None of the delayed work the driver schedules has particularly short delays
and it is not performance sensitive so let the scheduler run it wherever
is most efficient rather than in a per CPU workqueue by using the system
power efficient workqueue.

Signed-off-by: Mark Brown <broonie@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-08-05 08:53:34 +09:00
Laxman Dewangan 7281e05aab extcon: palmas: Option to disable ID/VBUS detection based on platform
Based on system design, platform needs to detect the VBUS or ID or
both. Provide option to select this through platform data to
disable part of cable detection through palmas-usb.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-08-05 08:53:34 +09:00
Laxman Dewangan 024783ef42 extcon: palams: add support for suspend/resume
Add suspend/resume callbacks and support for wakeup from
suspend on USB HOST or USB Device cable insertion or removal.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-08-05 08:53:34 +09:00
Laxman Dewangan 002945f014 extcon: palmas: enable ID_GND and ID_FLOAT detection always
When integrating driver with Tegra platform, it is found that
the ID pins get detected only once after booting system and
further removal and re-insert does not detect the ID pin.

Fixing this issue with enabling interrupt on ID_GND and ID_FLOAT
always  and clearing the status on LATCH register which actually
occurred.

Also if interrupt occurs with line status as zero then based on
previous status, set the cable state.

Add debug prints to display the cable state when any cable
insertion/removal happen.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Acked-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-08-05 08:53:34 +09:00
Kishon Vijay Abraham I fc57303a82 extcon: palmas: remove assigning "edev.name" to palmas
of_extcon_get_extcon_dev() uses dev_name for getting the reference
to the extcon device. If the extcon driver assigns a different
name other than dev_name, of_extcon_get_extcon_dev() wouldn't
be able to find the reference to the extcon device. Since the
client drivers of extcon-palmas would be using
of_extcon_get_extcon_dev(), removed assigning edev.name
in extcon-palmas.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-08-05 08:53:33 +09:00
Kishon Vijay Abraham I 6eee5b3b49 extcon: Add an API to get extcon device from dt node
Added an API of_extcon_get_extcon_dev() to be used by drivers to get
extcon device in the case of dt boot (this can be used instead of
extcon_get_extcon_dev()).

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-08-05 08:52:45 +09:00
Greg Kroah-Hartman af01da0e02 extcon: convert extcon_class to use dev_groups
The dev_attrs field of struct class is going away soon, dev_groups
should be used instead.  This converts the extcon_class code to use the
correct field.

Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Chanwoo Choi<cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-07-25 16:34:39 -07:00
Kees Cook 02aa2a3763 drivers: avoid format string in dev_set_name
Calling dev_set_name with a single paramter causes it to be handled as a
format string.  Many callers are passing potentially dynamic string
content, so use "%s" in those cases to avoid any potential accidents,
including wrappers like device_create*() and bdi_register().

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-07-03 16:07:41 -07:00
Graeme Gregory b1f254e35d extcon: Palmas Extcon Driver
This is the driver for the USB comparator built into the palmas chip. It
handles the various USB OTG events that can be generated by cable
insertion/removal.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Moiz Sonasath <m-sonasath@ti.com>
Signed-off-by: Ruchika Kharwar <ruchika@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: George Cherian <george.cherian@ti.com>
[kishon@ti.com: adapted palmas usb driver to use the extcon framework]
Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 16:08:36 -07:00
Kishon Vijay Abraham I 9c8a013af4 extcon: add EXPORT_SYMBOL_GPL for exported functions
Added EXPORT_SYMBOL_GPL() for extcon_register_interest and
extcon_register_notifier in order to avoid undefined reference
error when building the consumer modules of extcon as _modules_.

Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 16:03:35 -07:00
Chanwoo Choi ea9dd9d655 extcon: Change permission 'state' sysfs entry (rw -> r)
This patch change permission from read/write to only read.
The specific process in the user-space couldn't change the state
of cable when cable is attached or detached.
- /sys/class/extcon/[devine name]/state

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-06-17 16:02:33 -07:00
Linus Torvalds 5647ac0ad4 Removal of GENERIC_GPIO for v3.10
GENERIC_GPIO now synonymous with GPIOLIB. There are no longer any valid
 cases for enableing GENERIC_GPIO without GPIOLIB, even though it is
 possible to do so which has been causing confusion and breakage. This
 branch does the work to completely eliminate GENERIC_GPIO.
 
 However, it is not trivial to just create a branch to remove it. Over
 the course of the v3.9 cycle more code referencing GENERIC_GPIO has been
 added to linux-next that conflicts with this branch. The following must
 be done to resolve the conflicts when merging this branch into mainline:
 
 * "git grep CONFIG_GENERIC_GPIO" should return 0 hits. Matches should be
   replaced with CONFIG_GPIOLIB
 * "git grep '\bGENERIC_GPIO\b'" should return 1 hit in the Chinese
   documentation.
 * Selectors of GENERIC_GPIO should be turned into selectors of GPIOLIB
 * definitions of the option in architecture Kconfig code should be deleted.
 
 Stephen has 3 merge fixup patches[1] that do the above. They are currently
 applicable on mainline as of May 2nd.
 
 [1] http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg428056.html
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRifUnAAoJEEFnBt12D9kBs2YP/0U6+ia+xYvkVaJc28PDVIzn
 OReZNcJOYU8D5voxz0voaRD0EdcPwjbMu9Kp9aXMHlk4VxevF+8jCc/us0bIjtO1
 VcB5VmSCIhMhxdnBlum11Mk7Vr5MCweyl9NBsypnPt8cl4obMBZHf2yzoodFktNb
 wtyYlOb6FALtc6iDbOO6dG3w9F7FAOLvskUFzdv89m8mupTsBu9jw9NqFDbJHOex
 rxq0Sdd+kWF/nkJVcV5Y6jIdletRlhpipefMJ9diexreHvwqh+c4kJEYZaXgB5+m
 ha95cPbReK1d+RqzM3A8d4irzSVSmq4k7ijI6QkFOr48+AH7XsgKv5so885LKzMN
 IIXg2Phm9i0H8+ecEvhcc4oIYBHJiEKK54Y0qUD9dqbFoDGPTCSqMHdSSMbpAY+J
 bIIXlVzj1En3PPNUJLPt8q8Qz6WxCT9mDST3QSGYnD4o90HT+1R9j92RxGL6McOq
 rUOyJDwmzFvpBvKK4raGdOU435M+ps2NPKKNIRaIGQPPY9rM1kN4YqvhXukEsC9L
 3a3+3cQLh7iKxBHncxeQsJfethP1CPkJnzvF9r+ZZLf2rcPH4pbQIE2uO0XnX/nd
 5/DKi0nGgAJ//GMMzdo3RiOA5zGFjIZ/KMvfhQldpP6qFJRhqdGi6FPlAcwr1z1n
 YnCByPwwlvfC4LTXFOGL
 =xodc
 -----END PGP SIGNATURE-----

Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux

Pull removal of GENERIC_GPIO from Grant Likely:
 "GENERIC_GPIO now synonymous with GPIOLIB.  There are no longer any
  valid cases for enableing GENERIC_GPIO without GPIOLIB, even though it
  is possible to do so which has been causing confusion and breakage.
  This branch does the work to completely eliminate GENERIC_GPIO."

* tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux:
  gpio: update gpio Chinese documentation
  Remove GENERIC_GPIO config option
  Convert selectors of GENERIC_GPIO to GPIOLIB
  blackfin: force use of gpiolib
  m68k: coldfire: use gpiolib
  mips: pnx833x: remove requirement for GENERIC_GPIO
  openrisc: default GENERIC_GPIO to false
  avr32: default GENERIC_GPIO to false
  xtensa: remove explicit selection of GENERIC_GPIO
  sh: replace CONFIG_GENERIC_GPIO by CONFIG_GPIOLIB
  powerpc: remove redundant GENERIC_GPIO selection
  unicore32: default GENERIC_GPIO to false
  unicore32: remove unneeded select GENERIC_GPIO
  arm: plat-orion: use GPIO driver on CONFIG_GPIOLIB
  arm: remove redundant GENERIC_GPIO selection
  mips: alchemy: require gpiolib
  mips: txx9: change GENERIC_GPIO to GPIOLIB
  mips: loongson: use GPIO driver on CONFIG_GPIOLIB
  mips: remove redundant GENERIC_GPIO select
2013-05-09 09:59:16 -07:00
Alexandre Courbot 76ec9d18b8 Convert selectors of GENERIC_GPIO to GPIOLIB
GENERIC_GPIO is now equivalent to GPIOLIB and features that depended on
GENERIC_GPIO can now depend on GPIOLIB to allow removal of this option.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
2013-04-16 18:47:14 +09:00
Greg Kroah-Hartman 606f34ad12 This is small fixes for extcon driver.
MAX77693 extcon driver
 - Add 'static' keryword to internal data structure
 - Fix return value using 'ret' instead of hardcoding
 
 MAX8997 extcon driver
 - Use dev_err() instead of pr_err()
 - Fix return value using 'ret' instead of hardcoding
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJRY0rlAAoJEJzN3yze689TccwP/1ZyeE0fhn6S9wxgdtz2jBJC
 vh0eWeYwLlJnXKMfC78FpJWV+zjOkKhlXZFOLqy/I7KN6ejGAFDKsTW22abo7Fml
 qggp5ofMEwJS3gSDVjDBx2CDIHW7haHtPSnNH3KX++0p+///mK/JNQaNW62/j874
 nelL3OXpZI6WhF1uYvnh3EQg6ExD/MfKEng8wdVYL9sRXRzbDv+tnQT4Cdq0CSEB
 zTSY5zS6mXYMZRlUxBXhtFvkSfhxL9bJEj0QPcTS47uY+6hKt24gCcP7kq5fIhpB
 bq5Bpp+DGEJ7t/FgAVbWukdNkizgEzVtbQFro7JvoqiK097qhedYXn0ni4Hl7xPe
 mQ+q4N7AkHxDBx068lnb9EF/3ujRSzWJy4Rvy3AC/6KY1F2hDjlI3TJKDjIx8eQz
 kmflwl5UVZ42Ug9P6QGK+mU+1ZuaMFNhMm99FBzAEeyCdIHiBF2wz/JJWbYuPlj7
 DTgycOwYw035hwj504Ae+jIpjuzPdLd22uKxuMEFNmJd/rFUXgFp5ZMQb47jJIDI
 58wiH1+nEqVmYYhnxOcnQh//g0RALVxJoO3P3GDDbWF5jtk/hleGa7VAY3MhLGJ1
 rOwdD0g16LU/gcmOrm5OdbVqofedH/LDjHx1GdY9g1vGGcq0ES+FZEyOBRjSHue2
 bza21ioK4U85wwnq7cly
 =vnWV
 -----END PGP SIGNATURE-----

Merge tag 'extcon-for-3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

	This is small fixes for extcon driver.

	MAX77693 extcon driver
	- Add 'static' keryword to internal data structure
	- Fix return value using 'ret' instead of hardcoding

	MAX8997 extcon driver
	- Use dev_err() instead of pr_err()
	- Fix return value using 'ret' instead of hardcoding
2013-04-08 16:50:23 -07:00
Sachin Kamat 3ad9e86d54 extcon: max8997: Fix return value
Return the value obtained from the function instead of hardcoding.
Fixes the following warnings:
drivers/extcon/extcon-max8997.c:235 max8997_muic_set_path() info:
why not propagate 'ret' from max8997_update_reg() instead of (-11)?
drivers/extcon/extcon-max8997.c:248 max8997_muic_set_path() info:
why not propagate 'ret' from max8997_update_reg() instead of (-11)?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-04-09 07:53:46 +09:00
Sachin Kamat c2536543d5 extcon: max77693: Fix return value
Return the value obtained from the function instead of hardcoding.
Silences the following warnings:
drivers/extcon/extcon-max77693.c:297 max77693_muic_set_path()
info: why not propagate 'ret' from max77693_update_reg() instead of (-11)?
drivers/extcon/extcon-max77693.c:310 max77693_muic_set_path()
info: why not propagate 'ret' from max77693_update_reg() instead of (-11)?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-04-09 07:53:46 +09:00
Jingoo Han 6ed28105c0 extcon: max8997: use dev_err() instead of pr_err()
dev_err() is more preferred than pr_err().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-04-09 07:53:46 +09:00
Sachin Kamat 813b451644 extcon: max77693: Staticize default_init_data
Commit 0ec83bd246 ("extcon: max77693: Initialize register of MUIC
device to bring up it without platform data") added this structure
but forgot to make it static. Without this patch we get the following
warning:
drivers/extcon/extcon-max77693.c:41:26: warning:
symbol 'default_init_data' was not declared. Should it be static?

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-04-09 07:53:46 +09:00
Greg Kroah-Hartman 2638953fcd extcon: arizona: Updates for v3.10
There's a bunch of different things in this series, I can split them out
 if need be:
 
  - Support for configuring the button detection circuit to reflect the
    accessories supplied with the system.
  - Improvements in the HPDET based detection scheme.
  - Additional robustness against more pathological use cases.
  - A few small standalone fixes.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRWr1qAAoJELSic+t+oim9DUwP/3ur4GgIjk4T3Kix364EeWyw
 CDipdcxw/kEIopXSbFX3nMolWvvA0bEtOVGnu67lTm1K2YQxStn9XnK/SnijZq0x
 DR7cWygKwWVF+STYZrWW3OX/4Lyb3MCCeKqBTmw8LNUBHIrWgEi7YB96G3aO+top
 lsHlPNhXYfG65017NmLyGdWCVsCnzRA21nj4ZPJORf9ij+5wNCJwcCsCLvC1kULX
 ol5apYUoToEUCrkHa5x5vYVEGif3483CwPIteKLUWyHgQ1vIxkNqxAQLxJHdyH+M
 +tJ+qKciavttUjXhIwZ/ZaOY5NiQo8d/1OQFUb2z1ZmOpj7uS7ICS6nBg2pBRK+h
 vRY/q+0zZI89o6gggV5HFHmwJtCiYmcLgsX3YL4KH4oXTX/nQvUkkSKzWf3pXCQb
 NpmcWhRuGsiNr6qq/twdJ+34ddxgesmXwtzozlecZ4Goz/9ooInpT5QYtXWzHFqm
 vbUrfk+WrXY6jpz5Xo2hDf2N7zmZaBiPbggJk5wymCWscHl4gANjkfHYEoRedUnX
 VKC21WHxaR22e0KLKo+Aq+eDdOy8BZjCKbOUbhhWe1L5TCQ6QojptLyNJJIuNQ7c
 NAdu8nQDLUnQBC8HTZrDWlsjo/xIatozvhWyI3NX5Q9VSgkCYnu7fpQ/Q2UYn13p
 MkxOYhqCsBuqH9cPDvB8
 =6SXJ
 -----END PGP SIGNATURE-----

Merge tag 'extcon-arizona-v3.10' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc into char-misc-next

Mark writes:

	extcon: arizona: Updates for v3.10

	There's a bunch of different things in this series, I can split them out
	if need be:

	 - Support for configuring the button detection circuit to reflect the
	   accessories supplied with the system.
	 - Improvements in the HPDET based detection scheme.
	 - Additional robustness against more pathological use cases.
	 - A few small standalone fixes.
2013-04-03 11:28:18 -07:00
Mark Brown 7abd4e2a8f extcon: arizona: Make mic detection timeout configurable
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:54:07 +01:00
Mark Brown cd59e79656 extcon: arizona: Allow additional debounce during microphone detection
Help mitigate against mechanical bounce during the initial detection by
allowing the configuration of an additional debounce on top of that the
hardware does during the initial phase of microphone detection operation.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:54:06 +01:00
Mark Brown 41a57850b5 extcon: arizona: Clear existing button reports before reporting new one
If the user moves directly from one button to another then we won't get a
no buttons pressed event and will therefore end up reporting that two
buttons are simultaneously pressed which isn't supported by the hardware.
Make sure we clear any existing button reports before reporting any new
ones.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:54:05 +01:00
Mark Brown 939c5671d1 extcon: arizona: Time out if MICDET fails to report
In pathological cases the microphone detection may fail to report, for
example due to a failure to get a stable measurement. Provide a timeout
to cover such cases.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:54:03 +01:00
Mark Brown 9c2ba270ea extcon: arizona: Simplify HPDET based identification
Rather than measuring both HP channels we can simply directly measure the
microphone impedance and then rely on MICDET for final confirmation of the
presence of a suitable microphone. This improves the overall performance
of the identification process.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:54:02 +01:00
Mark Brown db924ff5c7 extcon: arizona: Don't ground flip when using HPDET identification
This extra check makes the procedure take longer and is of marginal use
in identification so do not execute it.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:54:01 +01:00
Mark Brown 9dd5e53d9d extcon: arizona: Retry HPDET identification for high impedance
Sometimes we can trigger measurements early if contacts are shorted during
a slow insertion. As well as debouncing add further robustness by retrying
if we get a high impedance measurement for headphones as this can indicate
that the headphones were not yet connected.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:54:00 +01:00
Mark Brown 2643fd641a extcon: arizona: Tune up HPDET debounce
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:53:58 +01:00
Charles Keepax e2c0f476ec extcon: arizona: Check we report a valid impedance
Occasionally we can trigger an interrupt before we have completed
impedance measurement, although the valid bit will still be set. This
patch spins reading the impedance value until a valid value is seen.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:53:57 +01:00
Mark Brown a3e2078d6a extcon: arizona: Suppress duplicate JACKDET reports
In cases where we see a brief (dis)connection of the jack detection signals
we may see a noop jack insertion or removal where the jack has returned to
the original state by the time the interrupt is serviced. Suppress these
events in order to save work and avoid confusing the rest of the code.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:53:56 +01:00
Mark Brown 82e2e0fd3f extcon: arizona: Raise minimum microphone impedance for HPDET method
Ensure greater reliability by increasing the minimum threashold for
identifying a microphone.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:53:55 +01:00
Mark Brown e56a0a572b extcon: arizona: Allow pull to be disabled on GPIO5 when used for JACKET
In some designs an external pull won't be needed.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:53:54 +01:00
Mark Brown 77ff4f95d7 extcon: arizona: Don't pulse MICBIAS for HPDET identification
There is no need to do this as HPDET identification will cause MICBIAS to
be powered down again.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:53:52 +01:00
Mark Brown 6fed4d869a extcon: arizona: Allow configuration of button detection
The Arizona button detection circuit is configurable, allowing the system
integrator to program a range of thresholds for the buttons supported on
the accessory but currently the driver uses the default button ranges and
does not provide any flexibility in how this is exposed to the application
layer.

Provide platform data allowing the user to control this and to map
the buttons to keys in the input subsystem.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02 11:53:51 +01:00
Mark Brown 84eaa13616 extcon: arizona: Attempt more microphone measurements
In some pathological use cases users may insert an accessory very slowly
causing multiple indeterminate measurements. Handle this by retrying many
measurements before we give up and declare a headphone.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-01 22:06:39 +01:00
Greg Kroah-Hartman 8c876be81a Merge branch 'char-misc-linus' into char-misc-next
This picks up the MEI fixes that we need in this branch now.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-03-26 16:09:30 -07:00
Mark Brown df8c3dbee9 extcon: arizona: Fix interaction between headphone outputs and identification
Running HPDET while the headphone outputs are enabled can disrupt the
operation of HPDET. In order to avoid this HPDET needs to disable the
headphone outputs and ASoC needs to not enable them while HPDET is
running.

For extcon instead of checking if the headphone output is enabled when
doing magic application unconditionally disable the output and restore
the state which ASoC wants set when undoing the magic.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-26 15:45:26 +00:00
Mark Brown 03409071ce extcon: arizona: Factor out magic application
We have a very similar sequence doing magic writes in several places
(one of which missed an update to interlock with the CODEC driver) so
factor it out into a function.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-26 14:26:03 +00:00
Chanwoo Choi 0ec83bd246 extcon: max77693: Initialize register of MUIC device to bring up it without platform data
This patch set default value of MUIC register to bring up MUIC device.

If user don't set some initial value for MUIC device through platform data,
extcon-max77693 driver use 'default_init_data' to bring up base operation
of MAX77693 MUIC device.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-03-13 17:38:57 +09:00
Chanwoo Choi 190d7cfc86 extcon: max77693: Fix bug of wrong pointer when platform data is not used
This patch fix wrong pointer of platform data. If each machine set
platform data for h/w path or delay time of workqueue, this driver
happen kernel panic related to null pointer.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-03-13 17:32:35 +09:00
Chanwoo Choi 810d601f07 extcon: max8997: Check the pointer of platform data to protect null pointer error
This patch check the pointer of platform data to protect
kernel panic when platform data is not used and code clean.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-03-13 17:28:15 +09:00
Linus Torvalds 7ed214ac20 Char/Misc driver patches for 3.9-rc1
Here's the big char/misc driver patches for 3.9-rc1.
 
 Nothing major here, just lots of different driver updates (mei, hyperv, ipack,
 extcon, vmci, etc.).
 
 All of these have been in the linux-next tree for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iEYEABECAAYFAlEmZJgACgkQMUfUDdst+ymhZgCgo2dn37r9uMCwgTSpxSq92Je5
 x8kAnRF1UnD6ZvySRIlLUBV5LW1YgFnK
 =i5HH
 -----END PGP SIGNATURE-----

Merge tag 'char-misc-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver patches from Greg Kroah-Hartman:
 "Here's the big char/misc driver patches for 3.9-rc1.

  Nothing major here, just lots of different driver updates (mei,
  hyperv, ipack, extcon, vmci, etc.).

  All of these have been in the linux-next tree for a while."

* tag 'char-misc-3.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (209 commits)
  w1: w1_therm: Add force-pullup option for "broken" sensors
  w1: ds2482: Added 1-Wire pull-up support to the driver
  vme: add missing put_device() after device_register() fails
  extcon: max8997: Use workqueue to check cable state after completing boot of platform
  extcon: max8997: Set default UART/USB path on probe
  extcon: max8997: Consolidate duplicate code for checking ADC/CHG cable type
  extcon: max8997: Set default of ADC debounce time during initialization
  extcon: max8997: Remove duplicate code related to set H/W line path
  extcon: max8997: Move defined constant to header file
  extcon: max77693: Make max77693_extcon_cable static
  extcon: max8997: Remove unreachable code
  extcon: max8997: Make max8997_extcon_cable static
  extcon: max77693: Remove unnecessary goto statement to improve readability
  extcon: max77693: Convert to devm_input_allocate_device()
  extcon: gpio: Rename filename of extcon-gpio.c according to kernel naming style
  CREDITS: update email and address of Harald Hoyer
  extcon: arizona: Use MICDET for final microphone identification
  extcon: arizona: Always take the first HPDET reading as the final one
  extcon: arizona: Clear _trig_sts bits after jack detection
  extcon: arizona: Don't HPDET magic when headphones are enabled
  ...
2013-02-21 13:57:13 -08:00
Chanwoo Choi af5eb1a132 extcon: max8997: Use workqueue to check cable state after completing boot of platform
This patch use delayed workqueue to check cable state after a certain
time. If extcon-max8997 driver check cable state during booting of
platform, this couldn't send the correct notification of cable state
to extcon consumer. Alwasys, this driver should check cable state
after the completion of platform initialization

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-02-14 07:54:49 +09:00
Chanwoo Choi 685dc9a7db extcon: max8997: Set default UART/USB path on probe
This patch set default H/W line path according to platfomr data.
The MAX8997 MUIC device can possibly set UART/USB or UART_AUX
/USB_AUX to internal H/W line path of MUIC device. Namely, only
one H/W line is used for two operation.

For example,
if H/W line path of MAX8997 device set UART/USB, micro usb cable
is connected to AP(Application Processor) and if H/W line path
set UART_AUX/USB_AUX, micro usb cable is connected to CP(Coprocessor).

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-02-14 07:54:36 +09:00
Chanwoo Choi f73f6232af extcon: max8997: Consolidate duplicate code for checking ADC/CHG cable type
This patch make max8997_muic_get_cable_type() function to remove
duplicate code for checking ADC/Charger cable type because almost
internal function need to read adc/chg_type value of MUIC register.

Also, remove *_detach() function, extcon-max8997 driver treat
attach/detach operation of cable in max8997_*_handler() function.
Lastly, this patch move defined constant in header file(include/
linux/mfd/max8997.h, max8997-private.h) because defined constant
is only used in the 'extcon-max8997.c'.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-02-14 07:54:22 +09:00
Chanwoo Choi 027fcd5050 extcon: max8997: Set default of ADC debounce time during initialization
This patch set default of ADC Debounce Time(25ms) during probe step.
Also, can possible change ADC Debounce Time according to H/W situation
by using max8997_set_adc_debounce_time()

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-02-14 07:54:09 +09:00
Chanwoo Choi 07c70503a4 extcon: max8997: Remove duplicate code related to set H/W line path
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-02-14 07:53:55 +09:00
Chanwoo Choi e3e5bc02d2 extcon: max8997: Move defined constant to header file
This patch move defined constants to header file(max77693-private.h)
because of mask/unmask selectively interrupt of MUIC device according
to attribute of H/W board.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-02-14 07:53:42 +09:00
Sachin Kamat 45d4a4e6f5 extcon: max77693: Make max77693_extcon_cable static
'max77693_extcon_cable' is used only in this file. Hence
make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-02-14 07:52:49 +09:00
Sachin Kamat 6a462e1d00 extcon: max8997: Remove unreachable code
'break' after 'return' is never executed and hence can be deleted.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-02-14 07:52:47 +09:00
Sachin Kamat cae93db311 extcon: max8997: Make max8997_extcon_cable static
'max8997_extcon_cable' is used only in this file. Hence make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-02-14 07:52:42 +09:00
Chanwoo Choi 19d3243e79 extcon: max77693: Remove unnecessary goto statement to improve readability
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-13 08:35:44 -08:00
Chanwoo Choi eff7d74f5b extcon: max77693: Convert to devm_input_allocate_device()
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-13 08:35:43 -08:00
Chanwoo Choi fd116066d9 extcon: gpio: Rename filename of extcon-gpio.c according to kernel naming style
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-13 08:35:43 -08:00
Greg Kroah-Hartman 105cf1fe1d extcon: arizona: Updates for v3.9
More updates for v3.9, a mix of fixes for the code that's already there
 and a few new features.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJRGRlTAAoJELSic+t+oim9lJkP/3x1GqmPUT8cOY4lVNbLuEwL
 VI0Y5V/ILGSKFWNxN4OE7BRh2biejWIM+xiqJFay1cRJtoa6v7N7s1WUnsupYQfK
 WYzWC14AIr3zGSDqaBS15EvNrykj2BN5FZ5fZNuq0GOHeSUu3pDmXtJoHeZ53irr
 5aWXZM4TxAortjvbYujftW9/T4D3Zrg94dcc9tMKuK45qon01WlhCY5ibDtLMWSG
 bioMt+ilJmOycDni54iTx41etm9EaIAfk6sX5VjNxEX5kVsDgQdQJ8HUJ5pX5PM8
 vvX5SnrSvI7AbaSztXAmmCdYrs5mWhsDw1cp+LVY4SDQjt0iBZaLKsg020NZ9iA0
 PRgvtjJSuWKwmnAZ23iIgl0YCxUtwSp/dtoV1USGGNt6JxWf2YnHKptkLkVtEr5Q
 yqnSe1YIqdAQ+bbvbmn/ZDM7t8feodFD58/qE30efo+oekRYTB3FqkB0s/tALT6x
 TBswvhqMQAuP2lT9eqCUHYRL97Sxg6PJpcc8RlR5LGzj7bJ2+JjQPFC+mneK/1V0
 NW/NgOckcFhjr+SY4Cd9KVlkokrv+yBlxPjgAkfA1dqRwmYLpmTvHqMYstrqEogA
 sFxT5bdmxPRi/Nq2z1K6zcEK/QAoiPUpUQrpvH9bcjq4NLEJ7s8/B7o++7Ga7TRH
 EtaN7kdl7seOVt7Jy/Cs
 =7J4T
 -----END PGP SIGNATURE-----

Merge tag 'extcon-arizona-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc into char-misc-next

Mark writes:
	extcon: arizona: Updates for v3.9

	More updates for v3.9, a mix of fixes for the code that's already there
	and a few new features.
2013-02-11 13:44:43 -08:00
Mark Brown bf14ee5a46 extcon: arizona: Use MICDET for final microphone identification
When using HPDET to identify the accessory still run MICDET before we
report a microphone in order to ensure that the accessory identified is
compatible with the MICDET detection ranges after having confirmed that
the device is not using a headphone.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-11 16:06:25 +00:00
Mark Brown c37b387f07 extcon: arizona: Always take the first HPDET reading as the final one
This should always be the most accurate reading for supported accessory
configurations.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-11 16:06:25 +00:00
Charles Keepax 5d9ab70820 extcon: arizona: Clear _trig_sts bits after jack detection
It is important to clear the wake trigger status bits otherwise DCVDD
will be held high independent of the state of the LDOENA line.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-11 16:06:23 +00:00
Mark Brown 903aa56fdf extcon: arizona: Don't HPDET magic when headphones are enabled
The magic is already done as part of enabling the headphone output so
does not need to be done when the headphone outputs are enabled. We hold
the DAPM lock so the headphone status can't be changed underneath us.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-11 16:06:22 +00:00
Mark Brown 0e27bd3137 extcon: arizona: Add some debounce time before starting HPDET identification
The HPDET identification method does not have the same natural debounce
built into it that the standard MICDET method does so add some extra on
top of what the jack detection does in hardware to make sure we get a
robust result.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-11 16:06:22 +00:00
Charles Keepax e339af1c45 extcon: arizona: Remove extra jack flip increment
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-11 16:06:19 +00:00
Mark Brown bbbd46e3d7 extcon: arizona: Use regulated mode for microphone supply when detecting
When starting microphone detection some headsets should be exposed to
the fully regulated microphone bias in order to ensure that they behave
in an optimal fashion.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-07 18:19:14 +00:00
Mark Brown 2e033db5dd extcon: arizona: Support additional configuration of microphone detection
Allow systems to tune detection rate and debounce suitably for their
mechanical parameters.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-07 18:04:07 +00:00
Guenter Roeck 5aa57f0a65 iio: Update iio_channel_get API to use consumer device pointer as argument
For iio_channel_get to work with OF based configurations, it needs the
consumer device pointer instead of the consumer device name as argument.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Anton Vorontsov <anton@enomsg.org>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-06 19:23:52 +00:00
Chanwoo Choi 1aa0590525 extcon: max77693: Fix bug of build error related to INPUT subsystem
This patch fix build error of following log:

drivers/built-in.o: In function `max77693_muic_remove':
extcon-max77693.c:(.text+0x664853): undefined reference to `input_unregister_device'
drivers/built-in.o: In function `max77693_muic_probe':
extcon-max77693.c:(.text+0x664971): undefined reference to `input_allocate_device'
extcon-max77693.c:(.text+0x6649c1): undefined reference to `input_set_capability'
extcon-max77693.c:(.text+0x6649d6): undefined reference to `input_set_capability'
extcon-max77693.c:(.text+0x6649eb): undefined reference to `input_set_capability'
extcon-max77693.c:(.text+0x664a00): undefined reference to `input_set_capability'
extcon-max77693.c:(.text+0x664a15): undefined reference to `input_set_capability'
extcon-max77693.c:(.text+0x664a20): undefined reference to `input_register_device'
drivers/built-in.o: In function `max77693_muic_adc_handler':
extcon-max77693.c:(.text+0x665318): undefined reference to `input_event'
extcon-max77693.c:(.text+0x66532a): undefined reference to `input_event'
make[1]: *** [vmlinux] Error 1

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-25 11:19:15 -08:00
Mark Brown f9365d07dd extcon: arizona: Remove duplicate rate configuration
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-23 09:32:03 +08:00
Mark Brown e6dd8cf223 extcon: arizona: Retry failed HP measurements
We now have mechanisms in place to allow retries so let's use them rather
than guessing.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-23 09:32:02 +08:00
Mark Brown 4e61687795 extcon: arizona: Disable debouce for accessory removal detection
Ensure we clamp as quickly as possible after removal by disabling the
debounce while there is an accessory present.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-23 09:31:49 +08:00
Mark Brown 1eda6aa7ce extcon: arizona: Support direct microphone measurement via HPDET
With some GPIO control it is possible to detect microphones in a wider
range of configurations by directly measuring the microphone impedance
when the HPDET method cannot distinguish between the behaviour of the
two grounds. Allow a GPIO to be provided in platform data and use it to
implement this behaviour.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:18 +09:00
Mark Brown dd235eea4e extcon: arizona: Support HPDET based accessory identification
The accessory detection functionality in Arizona devices is flexible and
supports several system designs in addition to the default one implemented
by the existing driver. One such design uses the HPDET feature to determine
what kind of accessory is present by comparing measurements taken with the
two headphone grounds available on the device, implement that if selected
by platform data.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:18 +09:00
Mark Brown 9b1270c71f extcon: Simple code motion supporting future work.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:18 +09:00
Mark Brown 4f34033382 extcon: arizona: Enable basic headphone identification
Use the headphone detection to identify if the accessory is a headphone or
line load. There are two different revisions of the IP with different
register layouts, support both.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:17 +09:00
Mark Brown 92a49871b3 extcon: arizona: Support use of GPIO5 as an input to jack detection
Some system designs provide an input on GPIO5 which in conjunction with
the jack detection feature indicates the presence of an accessory.
Support such systems, using the microphone clamp feature to minimise
wakeups of the processor.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:17 +09:00
Mark Brown dab63eb25c extcon: arizona: Use microphone clamp function if available
Newer Arizona devices include a microphone clamp function which is tied to
jack detect. Activate this feature when present in order to ensure best
performance of the subsystem.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:17 +09:00
Mark Brown b17e54625c extcon: arizona: Allow configuration of MICBIAS rise time
Allow configuration of the rise time for MICBIAS via platform data, the
delay required depends on things like the external component selection.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:17 +09:00
Mark Brown cd74f7b3b3 extcon: arizona: Only set GPIO if it has been requested
The micd_pol GPIO is only requested if we've specified one greater than 0
so apply the same test before we set it.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:17 +09:00
Mark Brown db72e6a162 extcon: arizona: Remove duplicate mic ramp configuration
Now this is configured by platform data remove the defualt configuration
the driver had.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:16 +09:00
Mark Brown 3d44ea1cfb extcon: arizona: Convert to devm_input_allocate_device()
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:16 +09:00
Chanwoo Choi a162629859 extcon: max77693: Add support Dock-Smart device for desktop mode
This patch support the detection of Dock-Smart device which include
three type of port(HDMI, USB for mouse/keyboard and Micro-USB for
USB/TA cable).The Dock-Smart device need always exteranl power supply
(USB/TA cable through micro-usb cable). Dock-Smart device support screen
output of target to separate monitor and mouse/keyboard for desktop
mode.

Features of 'Dock-Smart device'
- Support HDMI
- Support external output feature of audio
- Support charging through micro-usb port without data
  connection if TA cable is connected to target.
- Support charging and data connection through micro-usb port
  if USB cable is connected between target and host device.
- Support OTG device (Mouse/Keyboard)

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:16 +09:00
Chanwoo Choi 0e2738f59c extcon: max77693: Fix bug when detecting MHL/Dock-Audio with USB/TA cable
This patch fix bug that muic couldn't detect MHL/Dock-Audio with USB/TA
cable on exception situation. I explain detail case on following:

When MHL(with USB/TA cable) or Dock-Audio with USB/TA cable is attached,
the MUIC device happen following two interrupt.
- 'MAX77693_MUIC_IRQ_INT1_ADC' for detecting MHL/Dock-Audio.
- 'MAX77693_MUIC_IRQ_INT2_CHGTYP' for detecting USB/TA cable connected to
MHL/Dock-Audio. Always, happen eariler MAX77693_MUIC_IRQ_INT1_ADC interrupt
than MAX77693_MUIC_IRQ_INT2_CHGTYP interrupt.

If user attach MHL with USB/TA cable and immediately detach MHL with USB/TA
cable before MAX77693_MUIC_IRQ_INT2_CHGTYP interrupt is happened, USB/TA
connected to MHL cable remain connected state to target. But USB/TA connected
to MHL cable isn't connected to target. user be faced with unusual action.
So, driver should check this situation in spite of that, previous charger type
is N/A.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:16 +09:00
Chanwoo Choi 2b75799f5a extcon: max77693: Set default uart/usb path by using platform data
This patch determine default uart/usb path by using platform data.
The MAX77693 MUIC device can possibliy set USB/UART/AUDIO/USB_AUX
/UART_AUX to internal h/w path of MUIC device. So, drvier should
determine default uart/usb path.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:16 +09:00
Chanwoo Choi ae3b3215f8 extcon: max8997/max77693: Support IRQF_NO_SUSPEND flag for interrupt
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:15 +09:00
Chanwoo Choi 297620fd1e extcon: max77693: Check the state/type of cable after boot completed
This patch check the state/type of cable after completing the initialization
of platform and notify platform of cable state/type through extcon. If extcon
provider driver notify the state/type of cable before completing platform boot,
this uevent is unused and ignored.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:15 +09:00
Chanwoo Choi 39bf369e4e extcon: max77693: Add support dock device and buttons
This patch support detection of dock device with extcon and
buttons of dock device for playing music with input subsystem.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:15 +09:00
Chanwoo Choi d0587eb794 extcon: max77693: Add support jig cable
This patch detect several kinds of JIG cable according to ADC value
and set the hardware line path according to type of JIG cable(JIG-USB-ON
/JIG-USB-OFF/JIG-UART-OFF).

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:15 +09:00
Chanwoo Choi 06bed0afa2 extcon: max77693: Add support MHL_TA cable for charging battery
This patch support MHL_TA cable for charging battery. The MHL_TA
cable include MHL with TA cable or MHL with micro USB cable. When
MHL with TA/USB cable is attached, extcon-max77693 driver detect
two interrupt for handling precise operation according to each cable
(MHL and TA/USB cable).

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:15 +09:00
Chanwoo Choi 154f757fd3 extcon: max77693: Remove duplicate code by making function
This patch make max77693-muic_get_cable_type() function to remove
duplicate code because almost internal function need to read
adc/adc1k/adclow/chg_type value of MUIC register. Also, this patch
add description of internal function move field constant of muic device
from extcon-max77693 driver to max77693 header file because of it
is needed for masking some interrupt through platform data.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2013-01-15 15:42:14 +09:00
Greg Kroah-Hartman 962b686c45 extcon pull request targetting Linux 3.8 for Greg KH on 2012.11.22
This is based on Linux 3.7 rc6
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJQra3OAAoJEBOhurvWBoCKtT8P/2oQ/lB5S7Snh5LkoB7OUvmT
 pczaGGjX9ZWkrTUanuRaB2Ye3I/ctAZ7Nhg0YLPJLUZWR9AjqhzuF06LIcr26W7N
 DkVtqiURbV64b4QMYXssLS7B6YfgC7iEEwF/yf35j3HlerDG33veth98nnhHeLA5
 tLUMTtGdpMelZP2D0533Hihyu5ndl1gH1l6Qhy8Aqel2WJMqx1oZgexIRNpwUjuH
 hN1WkQH3hvrsVwDENX25nVMx3PvgngPb0006dZDtBkuHI/z0TvW7iyIOc5db/FfG
 TBZHcSciDjSTkYURu1mn60fmXdrAXWHpGCVx1ikiWQ8xQiXj3ctaxUDWJP9ZbxNb
 T4KPk5DxGg0f0OctjORRV+Q6KV0YH9d+Gig6O9AHOC8VK8LQQaGv3Mgq0PBGHW+D
 6XmtIud142VHgHqHlGMB6MLl2dno3s2mtu0Ckb79s8nMMEhzRCgY/aBc5AW3wFvz
 eGEK+X82BrSEAc4w2NiwhpqUti7W4KgQiw1S9UivEFGzqUcXX90aXFpz6SghEThd
 h5h0apoAurWorwETF8Smh2Gtp0ZBuDEgX7acWeICbnp+/Pn00rC5LNUhgd0WDHJS
 kkVq8LXW1W+VvcMZqlBRmC2x+UC0zWqnzevbyYFnXB5xxwk12ud6K1DVHUO7CWrv
 0izBUP5SwLSSCp+SAe+t
 =/KTt
 -----END PGP SIGNATURE-----

Merge tag 'pull_req_20121122' of git://git.kernel.org/pub/scm/linux/kernel/git/mzx/extcon into char-misc-next

MyungJoo writes:
 "extcon pull request targetting Linux 3.8 for Greg KH on 2012.11.22
  This is based on Linux 3.7 rc6"
2012-11-27 06:44:10 -08:00
Bill Pemberton 5f7e22283c extcon: remove use of __devexit_p
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-26 15:57:24 -08:00
Bill Pemberton 44f34fd4a7 extcon: remove use of __devinit
CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-26 15:57:24 -08:00
Bill Pemberton 93ed032780 extcon: remove use of __devexit
CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-26 15:57:24 -08:00
Sachin Kamat 3bf742ffd4 extcon: max77693: Fix uninitialised variable warning
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
2012-11-21 20:06:38 +09:00
Sachin Kamat f4bb5cb54e extcon: max77693: Use devm_kzalloc
devm_kzalloc() is a device managed function. It makes error handling
and cleanup code a bit simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2012-11-21 20:01:17 +09:00
Sachin Kamat 0b672e9b21 extcon: max8997: Use devm_kzalloc
devm_kzalloc() is a device managed function. It makes error handling
and cleanup code a bit simpler.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2012-11-21 20:01:16 +09:00
Sachin Kamat 2ca36f4afd extcon: max8997: Fix a typo
Electrnoics -> Electronics

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2012-11-21 20:01:16 +09:00
Sachin Kamat 8117cc3a0c extcon: max8997: Fix checkpatch error
Fixes the following checkpatch error:
ERROR: space required after that ',' (ctx:VxV)
460: FILE: extcon/extcon-max8997.c:460:
		ret = request_threaded_irq(virq, NULL,max8997_muic_irq_handler,
		                                     ^

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2012-11-21 20:01:15 +09:00
Sachin Kamat 1967fa08d9 extcon: max77693: Fix coding style
As per kernel coding style, if one branch of conditional statement has braces,
the other one should have too.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
2012-11-21 20:01:14 +09:00
Sachin Kamat 00af4b16e0 extcon: max77693: Fix incorrect error check and return value
irq_create_mapping() returns 0 if it fails to provide a valid irq number.
'ret' needs to be updated with a negative error code before returning from
probe to signal probe failure. While at it, also corrected the 'virq' type to
unsigned from signed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2012-11-21 20:00:40 +09:00
Sachin Kamat 68c9274d0f extcon: max8997: Fix incorrect error check and return value
irq_create_mapping() returns 0 if it fails to provide a valid irq number.
'ret' needs to be updated with a negative error code before returning from
probe to signal probe failure. While at it, also corrected the 'virq' type to
unsigned from signed.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2012-11-21 20:00:40 +09:00
Sachin Kamat c0c078c363 extcon: Fix return value in extcon-class.c
Return the value obtained from the function extcon_register_interest
instead of -ENODEV.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2012-11-21 20:00:39 +09:00
Alexey Khoroshilov be31cc0bc9 extcon: arizona: unlock mutex on error path in arizona_micdet()
If regmap_read() failed, arizona_micdet() returns IRQ_NONE
leaving &info->lock mutex locked as opposed to all other return paths.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
2012-11-20 16:00:44 +09:00
Jenny TC 4f2de3bf17 extcon : register for cable interest by cable name
There are some scnearios where a driver/framework needs to register
interest for a particular cable without specifying the extcon device
name. One such scenario is charger notifications. The platform will
have charger cabel which will be bound to any extcon device. It's
not mandatory for the charger driver to know which extcon device
it should use. This patch enables the support for registering
interest for a cable just by cable name wihtout specifying the
extcon device name

Signed-off-by: Jenny TC <jenny.tc@intel.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Tested-by: Chanwoo Choi <cw00.choi@samsung.com>

--
Kernel-doc comment added by MyungJoo Ham
2012-10-23 16:32:18 +09:00
anish kumar 44b7bccf7c extcon: trivial: kfree missed from remove path
Extcon core doesn't free the memory when we do unregister.
Kfree is added in the remove path as it was missing.

Signed-off-by: anish kumar <anish198519851985@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-10-23 16:32:17 +09:00
anish kumar 57e7cd3705 extcon: driver model release call not needed
There was a case where free and list_del can be called twice
on the same pointer.So fixed it by re-arranging the code and
removing a function which was not needed.

Signed-off-by: anish kumar <anish198519851985@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-10-23 16:32:17 +09:00
Chanwoo Choi f8457d574f extcon: MAX77693: Add platform data for MUIC device to initialize registers
This patch add platform data for MUIC device to initialize register
on probe() call because it should unmask interrupt mask register
and initialize some register related to MUIC device.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-10-23 16:32:16 +09:00
Axel Lin bf2627d66d extcon: max77693: Use max77693_update_reg for rmw operations
This simplifies the code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-23 16:32:15 +09:00
Axel Lin 909f9ec0a4 extcon: Fix kerneldoc for extcon_set_cable_state and extcon_set_cable_state_
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-23 16:32:15 +09:00
Axel Lin d9310e35a8 extcon: adc-jack: Add missing MODULE_LICENSE
This driver can be built as a module, add MODULE_LICENSE for it.
For completeness, also adds MODULE_AUTHOR and MODULE_DESCRIPTION.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-23 16:32:14 +09:00
Axel Lin 03019759b9 extcon: adc-jack: Fix checking return value of request_any_context_irq
On failure, request_any_context_irq() returns a negative value.
On success, it returns either IRQC_IS_HARDIRQ or IRQC_IS_NESTED.

Also ensure adc_jack_probe() return 0 on success.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-23 16:32:13 +09:00
Sachin Kamat 5cd3c277eb extcon: Fix return value in extcon_register_interest()
Propagate the value returned from extcon_find_cable_index()
instead of -ENODEV. For readability, -EINVAL is returned in place of
the variable.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-23 16:32:13 +09:00
Peter Huewe 824a1bc045 extcon: unregister compat link on cleanup
Since extcon registers this compat link at device registration
(extcon_dev_register), we should probably remove them at deregistration/cleanup.

Cc: stable@vger.kernel.org
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-23 16:32:12 +09:00
Peter Huewe 0dc77b6dab extcon: Unregister compat class at module unload to fix oops
If you compile extcon with CONFIG_ANDROID and then load and unload the
module you get a simple oops as the driver does not unregister its
compat class and thus cannot register it again.

Full trace:

root@(none):~# modprobe extcon_class
root@(none):~# rmmod extcon_class
root@(none):~# modprobe extcon_class
------------[ cut here ]------------
WARNING: at fs/sysfs/dir.c:536 sysfs_add_one+0xde/0x100()
sysfs: cannot create duplicate filename '/class/switch'
Modules linked in: extcon_class(+) [last unloaded: extcon_class]
Call Trace:
9f451a00:  [<602a58bc>] printk+0x0/0xa8
9f451a18:  [<60039b43>] warn_slowpath_common+0x93/0xd0
9f451a28:  [<6012c6de>] sysfs_add_one+0xde/0x100
9f451a50:  [<601d3d90>] strcat+0x0/0x40
9f451a68:  [<60039cdc>] warn_slowpath_fmt+0x9c/0xa0
9f451a90:  [<6002fe32>] unblock_signals+0x0/0x84
9f451ab0:  [<60039c40>] warn_slowpath_fmt+0x0/0xa0
9f451ac0:  [<6002fe32>] unblock_signals+0x0/0x84
9f451ae8:  [<6012bd97>] sysfs_pathname.isra.10+0x57/0x70
9f451b00:  [<601d3d90>] strcat+0x0/0x40
9f451b18:  [<6012bd97>] sysfs_pathname.isra.10+0x57/0x70
9f451b48:  [<6012c6de>] sysfs_add_one+0xde/0x100
9f451b78:  [<6012c96f>] create_dir+0x8f/0x100
9f451bc0:  [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class]
9f451bd8:  [<6012cda6>] sysfs_create_dir+0xa6/0x1c0
9f451be8:  [<601d89f1>] kvasprintf+0x81/0xa0
9f451bf8:  [<601cf0f0>] kobject_get+0x0/0x50
9f451c18:  [<601cf396>] kobject_add_internal+0x96/0x280
9f451c60:  [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class]
9f451c78:  [<601cfb93>] kobject_add+0xd3/0x140
9f451cc0:  [<601cfac0>] kobject_add+0x0/0x140
9f451cd0:  [<6002fe32>] unblock_signals+0x0/0x84
9f451cf8:  [<6002fffc>] set_signals+0x29/0x3f
9f451d28:  [<600c1de1>] kmem_cache_alloc+0xe1/0x100
9f451d78:  [<601cffa0>] kobject_create_and_add+0x50/0xa0
9f451da8:  [<601fbe76>] class_compat_register+0x56/0x80
9f451dc8:  [<a085d118>] create_extcon_class+0x88/0xd0 [extcon_class]
9f451de8:  [<a0861010>] extcon_class_init+0x10/0x12 [extcon_class]
9f451df8:  [<600189a8>] do_one_initcall+0x48/0x1f0
9f451e20:  [<60061920>] blocking_notifier_call_chain+0x0/0x20
9f451e30:  [<60061920>] blocking_notifier_call_chain+0x0/0x20
9f451e58:  [<6007e3c3>] sys_init_module+0xa3/0x280
9f451e88:  [<6001e2ad>] handle_syscall+0x8d/0x90
9f451ea8:  [<60033370>] userspace+0x405/0x531
9f451ee8:  [<6001e380>] copy_chunk_to_user+0x0/0x40
9f451ef8:  [<6001e5cd>] do_op_one_page+0x14d/0x220
9f451fd8:  [<6001a355>] fork_handler+0x95/0xa0

---[ end trace dd512cc03fe1c367 ]---
------------[ cut here ]------------
WARNING: at lib/kobject.c:196 kobject_add_internal+0x26e/0x280()
kobject_add_internal failed for switch with -EEXIST, don't try to
register things with the same name in the same directory.
Modules linked in: extcon_class(+) [last unloaded: extcon_class]
Call Trace:
9f451ad0:  [<602a58bc>] printk+0x0/0xa8
9f451ae8:  [<60039b43>] warn_slowpath_common+0x93/0xd0
9f451af8:  [<601cf56e>] kobject_add_internal+0x26e/0x280
9f451b18:  [<601cf140>] kobject_put+0x0/0x70
9f451b20:  [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class]
9f451b38:  [<60039cdc>] warn_slowpath_fmt+0x9c/0xa0
9f451b88:  [<60039c40>] warn_slowpath_fmt+0x0/0xa0
9f451bc0:  [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class]
9f451bd8:  [<6012cda6>] sysfs_create_dir+0xa6/0x1c0
9f451be8:  [<601d89f1>] kvasprintf+0x81/0xa0
9f451bf8:  [<601cf0f0>] kobject_get+0x0/0x50
9f451c18:  [<601cf56e>] kobject_add_internal+0x26e/0x280
9f451c60:  [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class]
9f451c78:  [<601cfb93>] kobject_add+0xd3/0x140
9f451cc0:  [<601cfac0>] kobject_add+0x0/0x140
9f451cd0:  [<6002fe32>] unblock_signals+0x0/0x84
9f451cf8:  [<6002fffc>] set_signals+0x29/0x3f
9f451d28:  [<600c1de1>] kmem_cache_alloc+0xe1/0x100
9f451d78:  [<601cffa0>] kobject_create_and_add+0x50/0xa0
9f451da8:  [<601fbe76>] class_compat_register+0x56/0x80
9f451dc8:  [<a085d118>] create_extcon_class+0x88/0xd0 [extcon_class]
9f451de8:  [<a0861010>] extcon_class_init+0x10/0x12 [extcon_class]
9f451df8:  [<600189a8>] do_one_initcall+0x48/0x1f0
9f451e20:  [<60061920>] blocking_notifier_call_chain+0x0/0x20
9f451e30:  [<60061920>] blocking_notifier_call_chain+0x0/0x20
9f451e58:  [<6007e3c3>] sys_init_module+0xa3/0x280
9f451e88:  [<6001e2ad>] handle_syscall+0x8d/0x90
9f451ea8:  [<60033370>] userspace+0x405/0x531
9f451ee8:  [<6001e380>] copy_chunk_to_user+0x0/0x40
9f451ef8:  [<6001e5cd>] do_op_one_page+0x14d/0x220
9f451fd8:  [<6001a355>] fork_handler+0x95/0xa0

---[ end trace dd512cc03fe1c368 ]---
kobject_create_and_add: kobject_add error: -17
------------[ cut here ]------------
WARNING: at drivers/extcon/extcon_class.c:545
create_extcon_class+0xbc/0xd0 [extcon_class]()
cannot allocate
Modules linked in: extcon_class(+) [last unloaded: extcon_class]
Call Trace:
9f451c80:  [<602a58bc>] printk+0x0/0xa8
9f451c98:  [<60039b43>] warn_slowpath_common+0x93/0xd0
9f451ca0:  [<6002fe32>] unblock_signals+0x0/0x84
9f451ca8:  [<a085d14c>] create_extcon_class+0xbc/0xd0 [extcon_class]
9f451cd0:  [<a0861000>] extcon_class_init+0x0/0x12 [extcon_class]
9f451ce8:  [<60039cdc>] warn_slowpath_fmt+0x9c/0xa0
9f451d20:  [<6002fe32>] unblock_signals+0x0/0x84
9f451d28:  [<60039c40>] warn_slowpath_fmt+0x0/0xa0
9f451d48:  [<6002fffc>] set_signals+0x29/0x3f
9f451d58:  [<601cf172>] kobject_put+0x32/0x70
9f451d78:  [<600c22c3>] kfree+0xb3/0x100
9f451da8:  [<601fbe9a>] class_compat_register+0x7a/0x80
9f451dc8:  [<a085d14c>] create_extcon_class+0xbc/0xd0 [extcon_class]
9f451de8:  [<a0861010>] extcon_class_init+0x10/0x12 [extcon_class]
9f451df8:  [<600189a8>] do_one_initcall+0x48/0x1f0
9f451e20:  [<60061920>] blocking_notifier_call_chain+0x0/0x20
9f451e30:  [<60061920>] blocking_notifier_call_chain+0x0/0x20
9f451e58:  [<6007e3c3>] sys_init_module+0xa3/0x280
9f451e88:  [<6001e2ad>] handle_syscall+0x8d/0x90
9f451ea8:  [<60033370>] userspace+0x405/0x531
9f451ee8:  [<6001e380>] copy_chunk_to_user+0x0/0x40
9f451ef8:  [<6001e5cd>] do_op_one_page+0x14d/0x220
9f451fd8:  [<6001a355>] fork_handler+0x95/0xa0

---[ end trace dd512cc03fe1c369 ]---
FATAL: Error inserting extcon_class
(/lib/modules/3.6.0-rc6-00178-g811315f/kernel/drivers/extcon/extcon_class.ko):
Cannot allocate memory

This patch fixes this.

Cc: stable@vger.kernel.org
Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
2012-10-23 16:32:11 +09:00
anish kumar 28c0ada62d extcon: optimising the check_mutually_exclusive function
Rather than re-inventing the wheel we can use the hamming function
to calculate the number of bits set to check for violation of
exclusivity.

Signed-off-by: anish kumar <anish198519851985@gmail.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-10-22 11:28:10 +09:00
anish kumar 0cf6ad8a18 extcon: standard cable names definition and declaration changed
With this change now individual drivers can use standard cable
names as below:
static const char *arizona_cable[] = {
    extcon_cable_name[EXTCON_USB],
    extcon_cable_name[EXTCON_USB_HOST],
    "CUSTOM_CABLE"
    NULL,
}

Signed-off-by: anish kumar <anish198519851985@gmail.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-10-22 11:28:10 +09:00
Devendra Naga 3cafbd4e50 extcon-max8997: remove usage of ret in max8997_muic_handle_charger_type_detach
actually we can do returns with error or success with out ret in this function,
so remove the ret variable, and reduce a very little (4byte) space on stack of this function

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-10-22 11:28:10 +09:00
Sachin Kamat 8dee001d98 extcon: Remove duplicate inclusion of extcon.h header file
extcon.h header file was included twice.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Sachin Kamat <sachin.kamat@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
2012-10-22 11:28:10 +09:00
Linus Torvalds 033d9959ed Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq
Pull workqueue changes from Tejun Heo:
 "This is workqueue updates for v3.7-rc1.  A lot of activities this
  round including considerable API and behavior cleanups.

   * delayed_work combines a timer and a work item.  The handling of the
     timer part has always been a bit clunky leading to confusing
     cancelation API with weird corner-case behaviors.  delayed_work is
     updated to use new IRQ safe timer and cancelation now works as
     expected.

   * Another deficiency of delayed_work was lack of the counterpart of
     mod_timer() which led to cancel+queue combinations or open-coded
     timer+work usages.  mod_delayed_work[_on]() are added.

     These two delayed_work changes make delayed_work provide interface
     and behave like timer which is executed with process context.

   * A work item could be executed concurrently on multiple CPUs, which
     is rather unintuitive and made flush_work() behavior confusing and
     half-broken under certain circumstances.  This problem doesn't
     exist for non-reentrant workqueues.  While non-reentrancy check
     isn't free, the overhead is incurred only when a work item bounces
     across different CPUs and even in simulated pathological scenario
     the overhead isn't too high.

     All workqueues are made non-reentrant.  This removes the
     distinction between flush_[delayed_]work() and
     flush_[delayed_]_work_sync().  The former is now as strong as the
     latter and the specified work item is guaranteed to have finished
     execution of any previous queueing on return.

   * In addition to the various bug fixes, Lai redid and simplified CPU
     hotplug handling significantly.

   * Joonsoo introduced system_highpri_wq and used it during CPU
     hotplug.

  There are two merge commits - one to pull in IRQ safe timer from
  tip/timers/core and the other to pull in CPU hotplug fixes from
  wq/for-3.6-fixes as Lai's hotplug restructuring depended on them."

Fixed a number of trivial conflicts, but the more interesting conflicts
were silent ones where the deprecated interfaces had been used by new
code in the merge window, and thus didn't cause any real data conflicts.

Tejun pointed out a few of them, I fixed a couple more.

* 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq: (46 commits)
  workqueue: remove spurious WARN_ON_ONCE(in_irq()) from try_to_grab_pending()
  workqueue: use cwq_set_max_active() helper for workqueue_set_max_active()
  workqueue: introduce cwq_set_max_active() helper for thaw_workqueues()
  workqueue: remove @delayed from cwq_dec_nr_in_flight()
  workqueue: fix possible stall on try_to_grab_pending() of a delayed work item
  workqueue: use hotcpu_notifier() for workqueue_cpu_down_callback()
  workqueue: use __cpuinit instead of __devinit for cpu callbacks
  workqueue: rename manager_mutex to assoc_mutex
  workqueue: WORKER_REBIND is no longer necessary for idle rebinding
  workqueue: WORKER_REBIND is no longer necessary for busy rebinding
  workqueue: reimplement idle worker rebinding
  workqueue: deprecate __cancel_delayed_work()
  workqueue: reimplement cancel_delayed_work() using try_to_grab_pending()
  workqueue: use mod_delayed_work() instead of __cancel + queue
  workqueue: use irqsafe timer for delayed_work
  workqueue: clean up delayed_work initializers and add missing one
  workqueue: make deferrable delayed_work initializer names consistent
  workqueue: cosmetic whitespace updates for macro definitions
  workqueue: deprecate system_nrt[_freezable]_wq
  workqueue: deprecate flush[_delayed]_work_sync()
  ...
2012-10-02 09:54:49 -07:00
Linus Torvalds 06d2fe153b Driver core merge for 3.7-rc1
Here is the big driver core update for 3.7-rc1.
 
 A number of firmware_class.c updates (as you saw a month or so ago), and
 some hyper-v updates and some printk fixes as well.  All patches that
 are outside of the drivers/base area have been acked by the respective
 maintainers, and have all been in the linux-next tree for a while.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.19 (GNU/Linux)
 
 iEYEABECAAYFAlBp3vkACgkQMUfUDdst+ylQoACgldktGFgkCLzH+rGYthrXOC5P
 9hUAnjmOhdoHlMTL81vWTlH+BrGernym
 =khrr
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core

Pull driver core merge from Greg Kroah-Hartman:
 "Here is the big driver core update for 3.7-rc1.

  A number of firmware_class.c updates (as you saw a month or so ago),
  and some hyper-v updates and some printk fixes as well.  All patches
  that are outside of the drivers/base area have been acked by the
  respective maintainers, and have all been in the linux-next tree for a
  while.

  Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>"

* tag 'driver-core-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (95 commits)
  memory: tegra{20,30}-mc: Fix reading incorrect register in mc_readl()
  device.h: Add missing inline to #ifndef CONFIG_PRINTK dev_vprintk_emit
  memory: emif: Add ifdef CONFIG_DEBUG_FS guard for emif_debugfs_[init|exit]
  Documentation: Fixes some translation error in Documentation/zh_CN/gpio.txt
  Documentation: Remove 3 byte redundant code at the head of the Documentation/zh_CN/arm/booting
  Documentation: Chinese translation of Documentation/video4linux/omap3isp.txt
  device and dynamic_debug: Use dev_vprintk_emit and dev_printk_emit
  dev: Add dev_vprintk_emit and dev_printk_emit
  netdev_printk/netif_printk: Remove a superfluous logging colon
  netdev_printk/dynamic_netdev_dbg: Directly call printk_emit
  dev_dbg/dynamic_debug: Update to use printk_emit, optimize stack
  driver-core: Shut up dev_dbg_reatelimited() without DEBUG
  tools/hv: Parse /etc/os-release
  tools/hv: Check for read/write errors
  tools/hv: Fix exit() error code
  tools/hv: Fix file handle leak
  Tools: hv: Implement the KVP verb - KVP_OP_GET_IP_INFO
  Tools: hv: Rename the function kvp_get_ip_address()
  Tools: hv: Implement the KVP verb - KVP_OP_SET_IP_INFO
  Tools: hv: Add an example script to configure an interface
  ...
2012-10-01 12:10:44 -07:00
Mark Brown 6a2027abd2 Merge remote-tracking branches 'regulator/topic/core', 'regulator/topic/bypass', 'regulator/topic/tol', 'regulator/topic/drivers' and 'regulator/topic/tps6586x' into regulator-next 2012-09-28 14:45:07 +01:00
Greg Kroah-Hartman 8f949b9a7e Merge 3.6-rc7 into driver-core-next
This pulls in the fixes in that branch that are needed here as well.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-16 16:51:27 -07:00
Linus Torvalds 73f8be297e This is the remaining MFD fixes for 3.6, with 5 pending fixes:
- A tps65217 build error fix.
 - A lcp_ich regression fix caused by the MFD driver failing to initialize the
   watchdog sub device due to ACPI conflicts.
 - 2 MAX77693 interrupt handling bug fixes.
 - An MFD core fix, adding an IRQ domain argument to the MFD device addition
   API in order to prevent silent and potentially harmful remapping behaviour
   changes for drivers supporting non-DT platforms.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJQVQpwAAoJEIqAPN1PVmxKpnQP/iDPakfGT0m00nxk9VvuXfaA
 SlNxhhM1ZPxlZcBrVFULZ+dCVuUaBYIfwoT4Wwl2yZsmp8uYb62Rd6LGXDnjO+FH
 zKMg3b/KDHq/jicYxqFy4bVq3I850jTLN4Hti6hArn8HM6gxZJQxM810Poxt6M0T
 odud6oHSevGpCoL7GU4O+gmx1wKSDRrw6TZPokJDfXaQcFPJEt0YGGtI2zAO1sV+
 iBPQE/bI3bF5r/kowbh9ro5WybGNyFrwiYtaTzJWntXoPKN1lmr0F2F2NaCEo1xj
 2vJPFSCK3qC9Ft7sPQEBYxrSXzyzgu7G8HGgkcBG5SaSo+W3awe9DEaHfk5E7sdr
 iyc01kh4FmGlMAvHG/zcK3YvchR7GJdRI7BrR+MTQ03ZUv/ZrmTYFAHv5fAzBQ+N
 6ZUoC/1bqPKpfeFPOKYpDeYJVnFBWLYr+t7McTqqg+kpxUuYnQ0HyJVjDh01ZVQT
 AtCjjW7R+Ka44B+xfMOartPZMqZZEHSJ0UjacyEyzMpAAY14eUDMtTqs/jtNp+8Z
 B0bZiA8ZhUmNVH7TZoT/u57FgEW34JnM8oH6jLVN+yjInpuugIvqpZn0TA90GL7V
 Fh2DALMgUN5z/TXduGSsSPg1hvXFPOujaS+4o78e8PWiVQd5XUk/mc8OOS/mrRwj
 +mILnzxJcp8iYrYqESbt
 =nP/y
 -----END PGP SIGNATURE-----

Merge tag 'mfd-for-linus-3.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6

Pull mfd fixes from Samuel Ortiz:
 "This is the remaining MFD fixes for 3.6, with 5 pending fixes:

   - A tps65217 build error fix.
   - A lcp_ich regression fix caused by the MFD driver failing to
     initialize the watchdog sub device due to ACPI conflicts.
   - 2 MAX77693 interrupt handling bug fixes.
   - An MFD core fix, adding an IRQ domain argument to the MFD device
     addition API in order to prevent silent and potentially harmful
     remapping behaviour changes for drivers supporting non-DT
     platforms."

* tag 'mfd-for-linus-3.6-2' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6:
  mfd: MAX77693: Fix NULL pointer error when initializing irqs
  mfd: MAX77693: Fix interrupt handling bug
  mfd: core: Push irqdomain mapping out into devices
  mfd: lpc_ich: Fix a 3.5 kernel regression for iTCO_wdt driver
  mfd: Move tps65217 regulator plat data handling to regulator
2012-09-16 13:22:21 -07:00
Chanwoo Choi b186b12487 mfd: MAX77693: Fix NULL pointer error when initializing irqs
This patch initialize register map of MUIC device because mfd driver
of Maxim MAX77693 use regmap-muic instance of MUIC device when irqs of
Maxim MAX77693 is initialized before call max77693-muic probe() function.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reported-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-09-16 00:33:09 +02:00
Mark Brown b8575a1143 extcon: arizona: Use bypass mode for MICVDD
We can perform microphone detection with MICVDD in bypass mode so try to
enable that during startup for minimal power - other users or machine
constraints will prevent bypass mode being activated if it is unsuitable.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-10 11:25:14 +08:00
Fengguang Wu aa49312f29 extcon: use IRQF_ONESHOT
Generated by: scripts/coccinelle/misc/irqf_oneshot.cocci

Make sure threaded IRQs without a primary handler are always
requested with IRQF_ONESHOT.

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-06 09:36:56 -07:00
Randy Dunlap cdc1a790b2 extcon: extcon-arizona depends on INPUT
extcon-arizona uses input_*() functions so it should depend
on INPUT.

ERROR: "input_event" [drivers/extcon/extcon-arizona.ko] undefined!
ERROR: "input_free_device" [drivers/extcon/extcon-arizona.ko] undefined!
ERROR: "input_register_device" [drivers/extcon/extcon-arizona.ko] undefined!
ERROR: "input_set_capability" [drivers/extcon/extcon-arizona.ko] undefined!
ERROR: "input_allocate_device" [drivers/extcon/extcon-arizona.ko] undefined!
ERROR: "input_unregister_device" [drivers/extcon/extcon-arizona.ko] undefined!

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05 13:31:03 -07:00
anish kumar 19939860dc extcon: adc_jack: adc-jack driver to support 3.5 pi or simliar devices
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 V3:
Renamed the files to comply with extcon naming.

Changes in V4:
Added the cancel_work_sync during removing of driver.

Changes in V5:
Added the dependency of IIO in Kconfig.

Changes in V6:
Some nitpicks related to naming.

Changes in this version:
V6 patch version patch broke the build:
ERROR: "extcon_cable_name" [drivers/extcon/extcon-adc-jack.ko] undefined!

Fixed it in this version.

Acked-by: Jonathan Cameron <jic23@kernel.org>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: anish kumar <anish.singh@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05 12:20:49 -07:00
Peter Meerwald c338bb0380 extcon: fixing typos
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05 12:18:11 -07:00
Peter Meerwald 8e5f5018e8 extcon: fix typos in extcon-arizona
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05 12:18:11 -07:00
Peter Meerwald afcfaa878d extcon: fix typos in max77693 driver
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05 12:18:11 -07:00
Mark Brown 80732cc102 extcon: arizona: Free MICDET IRQ on error during probe
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-05 12:18:11 -07:00
Greg Kroah-Hartman 9db48aaf18 Merge 3.6-rc3 into driver-core-next
This picks up the printk fixes in 3.6-rc3 that are needed in this branch.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-27 07:08:39 -07:00
Mark Brown 9baf3220af extcon: Ensure dynamically allocated sysfs attributes are initialised
The operation of lockdep requires that all dynamically allocated sysfs
nodes are initialised using sysfs_attr_init() otherwise lots of warnings
are generated. Ensure that all the dynamically allocated attributes that
extcon generates have this done.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-16 14:05:40 -07:00
MyungJoo Ham 0ea6250378 Extcon: renamed files to comply with the standard naming.
Replaced '_' with '-' in the extcon file names, which has been bogging
since new drivers have been using the standard naming.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-16 10:42:11 -07:00
Greg Kroah-Hartman 3afebf577d Revert "Extcon: adc_jack: adc-jack driver to support 3.5 pi or simliar devices"
This reverts commit 980d792981 as it
breaks the build with the error:
	ERROR: "extcon_cable_name" [drivers/extcon/extcon-adc-jack.ko] undefined!

Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: anish kumar <anish.singh@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-16 10:40:32 -07:00
anish kumar 980d792981 Extcon: adc_jack: adc-jack driver to support 3.5 pi or simliar devices
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 V3:
Renamed the files to comply with extcon naming.

Changes in V4:
Added the cancel_work_sync during removing of driver.

Changes in V5:
Added the dependency of IIO in Kconfig.

Changes in V6:
Some nitpicks related to naming.

Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: anish kumar <anish.singh@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-16 10:37:00 -07:00
Mark Brown 34efe4dc47 extcon: arizona: Implement button detection support
As well as identifying accessories the accessory detection hardware on
Arizona class devices can also detect a number of buttons which we should
report via the input API.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-16 10:35:52 -07:00
Axel Lin 7b7e995d69 extcon: extcon_gpio: Replace gpio_request_one by devm_gpio_request_one
commit 01eaf24 "extcon: Convert extcon_gpio to devm_gpio_request_one"
missed the replacement for devm_gpio_request_one. fix it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-08-16 10:29:08 -07:00
Linus Torvalds 3e701cdfe6 MFD bits for the 3.6 merge window.
We have support for a few new drivers:
 - Samsung s2mps11
 - Wolfson Microelectronics wm5102 and wm5110
 - Marvell 88PM800 and 88PM805
 - TI twl6041
 
 We also have our regular driver improvements:
 - Device tree and IRQ domain support for STE AB8500
 - Regmap and devm_* API conversion for TI tps6586x
 - Device tree support for Samsung max77686
 - devm_* API conversion for STE AB3100
 
 Besides that, quite a lot of fixing and cleanup for mc13xxx, tps65910,
 tps65090, da9052 and twl-core.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJQFpGVAAoJEIqAPN1PVmxKFNoP/1dkYngrxxV6cxdyLJ74APhG
 lVKPgaDxQhdgfwCZJmMeZK1UphZo80cWnEXG6sTHZUEQdTaslSJu5SuPfUM+fo7e
 52/dU0nx0ZE04pwPQLHbidS4TmHlbLg9oM2kmIf9RO5rg34GodwVgRL/4+k1qvhz
 aWYJt9erFhQOpqaSX66mXHSuhvzHypbcE7d2B2Ykmh3NoYiH2w9H9KmIbbb+ZLq8
 +Bp/i5Ys/vfooo+8IE2w6KZfIzMwsmmtWjjr/38yuQJaKZCh/zn23DM9HsdrVf++
 RzfniRF4YBxmeKi7zi8MFIYys8filTCXA9dXbGSAKCuUCT37yZRnUxTeN1bn7Bux
 A7KRpG7pUKQKVKqCTndvK5LcQKlT33XyW2ZzV1wVWX2JkCJ+gilPeykb8IabNvGX
 nIp0STEGR/WdCLEAKo8pJF7Usn0RuUzAug02SG/mQ6dpnLoZqp0Od5W7gRhT7M7h
 hXr/xKJ6cG5YwicpAdy5kJJ0dRgQrtaHwxrF0B68AXZ7CmAtkPuEGCYhUCFnGQUH
 XJ0CodAqqVBRyYiQS4zIpIh2nqhIdsgv4OC1+kVLbubQk+PR88zG9Jvg6i1HQi/A
 OHi7N5Wite3YUrs3sBzDKnEc/Il2YRhVaz2SLVNfZR0PS7hywHN3rK/tVFINTgei
 jNEz1H6hu7ToNLfs0UzP
 =c28c
 -----END PGP SIGNATURE-----

Merge tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6

Pull MFD bits from Samuel Ortiz:
 "We have support for a few new drivers:
   - Samsung s2mps11
   - Wolfson Microelectronics wm5102 and wm5110
   - Marvell 88PM800 and 88PM805
   - TI twl6041

  We also have our regular driver improvements:
   - Device tree and IRQ domain support for STE AB8500
   - Regmap and devm_* API conversion for TI tps6586x
   - Device tree support for Samsung max77686
   - devm_* API conversion for STE AB3100

  Besides that, quite a lot of fixing and cleanup for mc13xxx, tps65910,
  tps65090, da9052 and twl-core."

Fix up mostly trivial conflicts, with the exception of
drivers/usb/host/ehci-omap.c in particular, which had some
re-organization of the reset sequence (commit 1a49e2ac9651: "EHCI:
centralize controller initialization") that clashed with commit
2761a63945 ("mfd: USB: Fix the omap-usb EHCI ULPI PHY reset fix
issues").

In particular, commit 2761a63945 moved the usb_add_hcd() to the
*middle* of the reset sequence, which clashes fairly badly with the
reset sequence re-organization (although it could have been done inside
the new omap_ehci_init() function).

I left that part of commit 2761a63945 just undone.

* tag 'mfd-3.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (110 commits)
  mfd: Ensure AB8500 platform data is passed through db8500-prcmu to MFD Core
  mfd: Arizone core should select MFD_CORE
  mfd: Fix arizona-irq.c build by selecting REGMAP_IRQ
  mfd: Add debug trace on entering and leaving arizone runtime suspend
  mfd: Correct tps65090 cell names
  mfd: Remove gpio support from tps6586x core driver
  ARM: tegra: defconfig: Enable tps6586x gpio
  gpio: tps6586x: Add gpio support through platform driver
  mfd: Cache tps6586x register through regmap
  mfd: Use regmap for tps6586x register access.
  mfd: Use devm managed resources for tps6586x
  input: Add onkey support for 88PM80X PMIC
  mfd: Add support for twl6041
  mfd: Fix twl6040 revision information
  mfd: Matches should be NULL when populate anatop child devices
  input: ab8500-ponkey: Create AB8500 domain IRQ mapping
  mfd: Add missing out of memory check for pcf50633
  Documentation: Describe the AB8500 Device Tree bindings
  mfd: Add tps65910 32-kHz-crystal-input init
  mfd: Drop modifying mc13xxx driver's id_table in probe
  ...
2012-07-30 12:41:17 -07:00
Chanwoo Choi db1b903742 extcon: MAX77693: Add extcon-max77693 driver to support Maxim MAX77693 MUIC device
This patch support Maxim MAX77693 MUIC device by using EXTCON Subsystem
to handle various external connector. The extcon-max77693 use regmap
method for i2c communication and support irq domain instead of previous
method of irq base.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-17 10:34:56 -07:00
Mark Brown 9ef2224d9f extcon: arizona: Stop microphone detection if we give up on it
There should be no point in continuing to try to detect a microphone any
more so stop doing so.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-17 09:32:14 -07:00
Mark Brown 325c642380 extcon: arizona: Update cable reporting calls and split headset
Use extcon_set_state_ for performance and split the headset into separate
headphone and microphone reports as this is more idiomatic.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-17 09:32:14 -07:00
Chanwoo Choi dca1a71e41 extcon: Add support irq domain for MAX8997 muic
This patch add support irq domain for Maxim MAX8997 muic
instead of irq_base in platform data and max8997 driver
private data are instead. It is tested on TRATS board.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-09 00:16:13 +02:00
Greg Kroah-Hartman 6fbfd0592e Merge v3.5-rc5 into driver-core-next
This picks up the big printk fixes, and resolves a merge issue with:
	drivers/extcon/extcon_gpio.c

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-05 08:25:34 -07:00
Mark Brown f2c32a882d Extcon: Arizona: Add driver for Wolfson Arizona class devices
Most Wolfson Arizona class audio hub CODECs include a flexible ultra low
power accessory detection subsystem. This driver exposes initial support
for this subsystem via the Extcon framework, implementing support for
ultra low power detection of headphone and headset with the ability to
detect the polarity of a headset.

The functionality of the devices is much richer and more flexible than
the current driver, future patches will extend the features of the
driver to more fully exploit this.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-26 16:01:02 -07:00
Axel Lin 01eaf24587 extcon: Convert extcon_gpio to devm_gpio_request_one
Also remove unneeded devm_kfree calls.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 16:40:18 -07:00
Axel Lin b945f3fa82 extcon: Set platform drvdata in gpio_extcon_probe() and fix irq leak
Add missing platform_set_drvdata() in gpio_extcon_probe(), otherwise calling
platform_get_drvdata in gpio_extcon_remove() returns NULL.

Also add missing free_irq call in gpio_extcon_remove().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 16:40:17 -07:00
Axel Lin 96c9f05b39 extcon: max8997: Add missing kfree for info->edev in max8997_muic_remove()
extcon_dev_unregister(info->edev) doest not free info->edev, we need to call
kfree(info->edev) here.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 16:30:42 -07:00
Axel Lin 3f1dc550b0 extcon: Set platform drvdata in gpio_extcon_probe() and fix irq leak
Add missing platform_set_drvdata() in gpio_extcon_probe(), otherwise calling
platform_get_drvdata in gpio_extcon_remove() returns NULL.

Also add missing free_irq call in gpio_extcon_remove().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 16:30:42 -07:00
Axel Lin 155cb06c89 extcon: Fix wrong index in max8997_extcon_cable[]
Currently, the index of "Dock-desk" and "Dock-card" are the same.
Thus the latter one overrides the first one.
Then we have problem when calling extcon_find_cable_index() because
edev->supported_cable[7] only matches "Dock-card".

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-18 16:30:42 -07:00
Mark Brown c3b15452e2 Extcon: Don't try to create duplicate link names
We can't create a link from the device to the compatibility switch class
since we already create a link from the device to to the extcon class
object and we try to use the same name for both links. This causes a loud
complaint from sysfs on boot.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-14 17:20:09 -07:00
Mark Brown be3a07f71c Extcon: Staticise extcon_class
It's not referenced outside the core file.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-06-14 17:15:25 -07:00