1
0
Fork 0
Commit Graph

124 Commits (redonkable)

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