Commit Graph

292 Commits

Author SHA1 Message Date
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