Commit Graph

23 Commits (060f0ce6ff975decd1e0ee318c08e228bccbee1e)

Author SHA1 Message Date
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 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 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
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 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 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
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
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
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 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
Linus Torvalds 5d4e2d08e7 Driver core pull for 3.5-rc1
Here's the driver core, and other driver subsystems, pull request for
 the 3.5-rc1 merge window.
 
 Outside of a few minor driver core changes, we ended up with the
 following different subsystem and core changes as well, due to
 interdependancies on the driver core:
  - hyperv driver updates
  - drivers/memory being created and some drivers moved into it
  - extcon driver subsystem created out of the old Android staging switch
    driver code
  - dynamic debug updates
  - printk rework, and /dev/kmsg changes
 
 All of this has been tested in the linux-next releases for a few weeks
 with no reported problems.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
 iEYEABECAAYFAk+7q28ACgkQMUfUDdst+ykXmwCfcPASzC+/bDkuqdWsqzxlWZ7+
 VOQAnAriySv397St36J6Hz5bMQZwB1Yq
 =SQc+
 -----END PGP SIGNATURE-----

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

Pull driver core updates from Greg Kroah-Hartman:
 "Here's the driver core, and other driver subsystems, pull request for
  the 3.5-rc1 merge window.

  Outside of a few minor driver core changes, we ended up with the
  following different subsystem and core changes as well, due to
  interdependancies on the driver core:
   - hyperv driver updates
   - drivers/memory being created and some drivers moved into it
   - extcon driver subsystem created out of the old Android staging
     switch driver code
   - dynamic debug updates
   - printk rework, and /dev/kmsg changes

  All of this has been tested in the linux-next releases for a few weeks
  with no reported problems.

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

Fix up conflicts in drivers/extcon/extcon-max8997.c where git noticed
that a patch to the deleted drivers/misc/max8997-muic.c driver needs to
be applied to this one.

* tag 'driver-core-3.5-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (90 commits)
  uio_pdrv_genirq: get irq through platform resource if not set otherwise
  memory: tegra{20,30}-mc: Remove empty *_remove()
  printk() - isolate KERN_CONT users from ordinary complete lines
  sysfs: get rid of some lockdep false positives
  Drivers: hv: util: Properly handle version negotiations.
  Drivers: hv: Get rid of an unnecessary check in vmbus_prep_negotiate_resp()
  memory: tegra{20,30}-mc: Use dev_err_ratelimited()
  driver core: Add dev_*_ratelimited() family
  Driver Core: don't oops with unregistered driver in driver_find_device()
  printk() - restore prefix/timestamp printing for multi-newline strings
  printk: add stub for prepend_timestamp()
  ARM: tegra30: Make MC optional in Kconfig
  ARM: tegra20: Make MC optional in Kconfig
  ARM: tegra30: MC: Remove unnecessary BUG*()
  ARM: tegra20: MC: Remove unnecessary BUG*()
  printk: correctly align __log_buf
  ARM: tegra30: Add Tegra Memory Controller(MC) driver
  ARM: tegra20: Add Tegra Memory Controller(MC) driver
  printk() - restore timestamp printing at console output
  printk() - do not merge continuation lines of different threads
  ...
2012-05-22 16:02:13 -07:00
Chanwoo Choi b76668ba8a Extcon: add MAX8997 extcon driver
This patch add extcon-max8997 driver to support the muic feature
of Maxim max8997 by using Extcon framework.

The extcon-max8997 driver is implemented based on 'drivers/misc/
max8997-muic.c' and then use Extcon interface instead of callback
function in struct max8997_muic_platform_data to notify cable state
of notifee which want to know always newly cable state when external
connector(e.g., USB, TA, JIG) is attached or detached.

v1
- Use Extcon interface to notify cable state of notifee instead of
 callback function when external connector is attached or detached.
- Bug fix of getting platform_data for irq_base value.

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-05-09 15:14:19 -07:00