aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-arizona.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-11-26extcon: arizona: Get pdata from arizona structure not deviceCharles Keepax1-3/+1
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 git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-nextGreg Kroah-Hartman1-9/+11
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 parameterChanwoo Choi1-1/+2
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 Keepax1-4/+5
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 Keepax1-2/+2
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 Kamat1-1/+1
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 Keepax1-1/+1
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 Choi1-6/+4
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 Choi1-10/+15
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 Brown1-10/+15
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 Brown1-3/+10
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02extcon: arizona: Allow additional debounce during microphone detectionMark Brown1-5/+30
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 Brown1-0/+4
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 Brown1-3/+35
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 Brown1-21/+25
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 Brown1-23/+1
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 Brown1-1/+17
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 Brown1-1/+1
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-02extcon: arizona: Check we report a valid impedanceCharles Keepax1-10/+18
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 Brown1-4/+22
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 Brown1-1/+1
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 Brown1-2/+7
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 Brown1-2/+0
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 Brown1-39/+125
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 Brown1-1/+3
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 Brown1-14/+30
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 Brown1-55/+36
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 Brown1-8/+8
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 Brown1-3/+4
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 Keepax1-0/+7
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 Brown1-12/+46
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 Brown1-2/+20
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 Keepax1-2/+0
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 Brown1-0/+93
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 Brown1-0/+12
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 Brown1-4/+0
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-23extcon: arizona: Retry failed HP measurementsMark Brown1-6/+4
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 Brown1-0/+9
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 Brown1-5/+45
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 Brown1-12/+147
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 Brown1-60/+60
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 Brown1-21/+320
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 Brown1-18/+58
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 Brown1-0/+19
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-15extcon: arizona: Allow configuration of MICBIAS rise timeMark Brown1-0/+6
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-15extcon: arizona: Only set GPIO if it has been requestedMark Brown1-2/+3
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-15extcon: arizona: Remove duplicate mic ramp configurationMark Brown1-2/+0
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-15extcon: arizona: Convert to devm_input_allocate_device()Mark Brown1-3/+1
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>
2012-11-27Merge tag 'pull_req_20121122' of git://git.kernel.org/pub/scm/linux/kernel/git/mzx/extcon into char-misc-nextGreg Kroah-Hartman1-0/+1
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-26extcon: remove use of __devexit_pBill Pemberton1-1/+1
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>