summaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-arizona.c
Commit message (Collapse)AuthorAgeFilesLines
* extcon: arizona: Make mic detection timeout configurableMark Brown2013-04-021-3/+10
| | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* extcon: arizona: Allow additional debounce during microphone detectionMark Brown2013-04-021-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>
* extcon: arizona: Clear existing button reports before reporting new oneMark Brown2013-04-021-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>
* extcon: arizona: Time out if MICDET fails to reportMark Brown2013-04-021-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>
* extcon: arizona: Simplify HPDET based identificationMark Brown2013-04-021-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>
* extcon: arizona: Don't ground flip when using HPDET identificationMark Brown2013-04-021-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>
* extcon: arizona: Retry HPDET identification for high impedanceMark Brown2013-04-021-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>
* extcon: arizona: Tune up HPDET debounceMark Brown2013-04-021-1/+1
| | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* extcon: arizona: Check we report a valid impedanceCharles Keepax2013-04-021-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>
* extcon: arizona: Suppress duplicate JACKDET reportsMark Brown2013-04-021-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>
* extcon: arizona: Raise minimum microphone impedance for HPDET methodMark Brown2013-04-021-1/+1
| | | | | | | Ensure greater reliability by increasing the minimum threashold for identifying a microphone. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* extcon: arizona: Allow pull to be disabled on GPIO5 when used for JACKETMark Brown2013-04-021-2/+7
| | | | | | In some designs an external pull won't be needed. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* extcon: arizona: Don't pulse MICBIAS for HPDET identificationMark Brown2013-04-021-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>
* extcon: arizona: Allow configuration of button detectionMark Brown2013-04-021-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>
* extcon: arizona: Attempt more microphone measurementsMark Brown2013-04-011-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>
* extcon: arizona: Fix interaction between headphone outputs and identificationMark Brown2013-03-261-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>
* extcon: arizona: Factor out magic applicationMark Brown2013-03-261-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>
* extcon: arizona: Use MICDET for final microphone identificationMark Brown2013-02-111-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>
* extcon: arizona: Always take the first HPDET reading as the final oneMark Brown2013-02-111-3/+4
| | | | | | | This should always be the most accurate reading for supported accessory configurations. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* extcon: arizona: Clear _trig_sts bits after jack detectionCharles Keepax2013-02-111-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>
* extcon: arizona: Don't HPDET magic when headphones are enabledMark Brown2013-02-111-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>
* extcon: arizona: Add some debounce time before starting HPDET identificationMark Brown2013-02-111-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>
* extcon: arizona: Remove extra jack flip incrementCharles Keepax2013-02-111-2/+0
| | | | | Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* extcon: arizona: Use regulated mode for microphone supply when detectingMark Brown2013-02-071-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>
* extcon: arizona: Support additional configuration of microphone detectionMark Brown2013-02-071-0/+12
| | | | | | | Allow systems to tune detection rate and debounce suitably for their mechanical parameters. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* extcon: arizona: Remove duplicate rate configurationMark Brown2013-01-231-4/+0
| | | | Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* extcon: arizona: Retry failed HP measurementsMark Brown2013-01-231-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>
* extcon: arizona: Disable debouce for accessory removal detectionMark Brown2013-01-231-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>
* extcon: arizona: Support direct microphone measurement via HPDETMark Brown2013-01-151-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>
* extcon: arizona: Support HPDET based accessory identificationMark Brown2013-01-151-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>
* extcon: Simple code motion supporting future work.Mark Brown2013-01-151-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>
* extcon: arizona: Enable basic headphone identificationMark Brown2013-01-151-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>
* extcon: arizona: Support use of GPIO5 as an input to jack detectionMark Brown2013-01-151-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>
* extcon: arizona: Use microphone clamp function if availableMark Brown2013-01-151-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>
* extcon: arizona: Allow configuration of MICBIAS rise timeMark Brown2013-01-151-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>
* extcon: arizona: Only set GPIO if it has been requestedMark Brown2013-01-151-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>
* extcon: arizona: Remove duplicate mic ramp configurationMark Brown2013-01-151-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>
* extcon: arizona: Convert to devm_input_allocate_device()Mark Brown2013-01-151-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>
* Merge tag 'pull_req_20121122' of ↵Greg Kroah-Hartman2012-11-271-0/+1
|\ | | | | | | | | | | | | | | 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"
| * extcon: arizona: unlock mutex on error path in arizona_micdet()Alexey Khoroshilov2012-11-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* | extcon: remove use of __devexit_pBill Pemberton2012-11-261-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>
* | extcon: remove use of __devinitBill Pemberton2012-11-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* | extcon: remove use of __devexitBill Pemberton2012-11-261-1/+1
|/ | | | | | | | | | | 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>
* Merge tag 'driver-core-3.6' of ↵Linus Torvalds2012-10-011-9/+69
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ...
| * extcon: fix typos in extcon-arizonaPeter Meerwald2012-09-051-2/+2
| | | | | | | | | | | | 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>
| * extcon: arizona: Free MICDET IRQ on error during probeMark Brown2012-09-051-1/+3
| | | | | | | | | | | | 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>
| * extcon: arizona: Implement button detection supportMark Brown2012-08-161-7/+65
| | | | | | | | | | | | | | | | | | | | 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>
* | extcon: arizona: Use bypass mode for MICVDDMark Brown2012-09-101-0/+5
|/ | | | | | | | | 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>
* extcon: arizona: Stop microphone detection if we give up on itMark Brown2012-07-171-0/+2
| | | | | | | | 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>
* extcon: arizona: Update cable reporting calls and split headsetMark Brown2012-07-171-22/+19
| | | | | | | | 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>
OpenPOWER on IntegriCloud