Commit Graph

165 Commits

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