summaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-arizona.c
AgeCommit message (Collapse)Author
2014-02-20ASoC: dapm: Add locking to snd_soc_dapm_xxxx_pin functionsCharles Keepax
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-01-07extcon: arizona: Add support for headphone detection on wm5110 rev DCharles Keepax
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-07extcon: arizona: No need to switch back down HPDET rangesCharles Keepax
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-07extcon: arizona: Fix race with microphone detection and removalCharles Keepax
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-07extcon: arizona: Fix reset of HPDET after race with removalCharles Keepax
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-07extcon: arizona: Add defines for microphone detection levelsCharles Keepax
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>
2013-11-26extcon: arizona: Get pdata from arizona structure not deviceCharles Keepax
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-09-26Merge tag 'extcon-next-for-3.13' of ↵Greg Kroah-Hartman
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-27extcon: Simplify extcon_dev_register() prototype by removing unnecessary ↵Chanwoo Choi
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-27extcon: arizona: Don't require micbias to be shifted in pdataCharles Keepax
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-27extcon: arizona: Correct typo in headphone detect range transitionsCharles Keepax
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-27extcon: arizona: Fix a typo in a commentSachin Kamat
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-27extcon: arizona: Clear trig_sts bits on all pathsCharles Keepax
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-26extcon: arizona: Fix up minor coding style to remove unnecessary bracesChanwoo Choi
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-26extcon: Fix up 80 column coding style issuesChanwoo Choi
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-08-05extcon: arizona: Use power efficient workqueueMark Brown
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-04-02extcon: arizona: Make mic detection timeout configurableMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02extcon: arizona: Allow additional debounce during microphone detectionMark Brown
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-02extcon: arizona: Clear existing button reports before reporting new oneMark Brown
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-02extcon: arizona: Time out if MICDET fails to reportMark Brown
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-02extcon: arizona: Simplify HPDET based identificationMark Brown
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-02extcon: arizona: Don't ground flip when using HPDET identificationMark Brown
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-02extcon: arizona: Retry HPDET identification for high impedanceMark Brown
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-02extcon: arizona: Tune up HPDET debounceMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02extcon: arizona: Check we report a valid impedanceCharles Keepax
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-02extcon: arizona: Suppress duplicate JACKDET reportsMark Brown
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-02extcon: arizona: Raise minimum microphone impedance for HPDET methodMark Brown
Ensure greater reliability by increasing the minimum threashold for identifying a microphone. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02extcon: arizona: Allow pull to be disabled on GPIO5 when used for JACKETMark Brown
In some designs an external pull won't be needed. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02extcon: arizona: Don't pulse MICBIAS for HPDET identificationMark Brown
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-02extcon: arizona: Allow configuration of button detectionMark Brown
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-01extcon: arizona: Attempt more microphone measurementsMark Brown
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-03-26extcon: arizona: Fix interaction between headphone outputs and identificationMark Brown
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-26extcon: arizona: Factor out magic applicationMark Brown
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-02-11extcon: arizona: Use MICDET for final microphone identificationMark Brown
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-11extcon: arizona: Always take the first HPDET reading as the final oneMark Brown
This should always be the most accurate reading for supported accessory configurations. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-11extcon: arizona: Clear _trig_sts bits after jack detectionCharles Keepax
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-11extcon: arizona: Don't HPDET magic when headphones are enabledMark Brown
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-11extcon: arizona: Add some debounce time before starting HPDET identificationMark Brown
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-11extcon: arizona: Remove extra jack flip incrementCharles Keepax
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-07extcon: arizona: Use regulated mode for microphone supply when detectingMark Brown
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-07extcon: arizona: Support additional configuration of microphone detectionMark Brown
Allow systems to tune detection rate and debounce suitably for their mechanical parameters. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-23extcon: arizona: Remove duplicate rate configurationMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-23extcon: arizona: Retry failed HP measurementsMark Brown
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-23extcon: arizona: Disable debouce for accessory removal detectionMark Brown
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-15extcon: arizona: Support direct microphone measurement via HPDETMark Brown
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-15extcon: arizona: Support HPDET based accessory identificationMark Brown
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-15extcon: Simple code motion supporting future work.Mark Brown
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-15extcon: arizona: Enable basic headphone identificationMark Brown
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-15extcon: arizona: Support use of GPIO5 as an input to jack detectionMark Brown
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-15extcon: arizona: Use microphone clamp function if availableMark Brown
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>