Maxim Integrated MAX3355E chip integrates a charge pump and comparators to
enable a system with an integrated USB OTG dual-role transceiver to
function as an USB OTG dual-role device. In addition to sensing/controlling
Vbus, the chip also passes thru the ID signal from the USB OTG connector.
On some Renesas boards, this signal is just fed into the SoC thru a GPIO
pin -- there's no real OTG controller, only host and gadget USB controllers
sharing the same USB bus; however, we'd like to allow host or gadget
drivers to be loaded depending on the cable type, hence the need for the
MAX3355 extcon driver. The Vbus status signals are also wired to GPIOs
(however, we aren't currently interested in them), the OFFVBUS# signal is
controlled by the host controllers, there's also the SHDN# signal wired to
a GPIO, it should be driven high for the normal operation.
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Rob Herring <robh@kernel.org>
[cw00.choi: Add the GPIOLIB dependency]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The function can return negative values, so its result should
be assigned to signed variable.
The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The function can return negative values, so its result should
be assigned to signed variable.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Suggested-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The function can return negative values, so its result should
be assigned to signed variable.
The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Add device bindings to support configuring the jack detection
configurations. Each configuration needs to specify the connection of
the mic det pins, which micbias should be used and the value of the
micd polarity GPIO required to activate that configuration.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This patch adds IRQF_ONESHOT if no primary handler is provided for request
threaded irq.
Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Add time units of -ms (milliseconds) to wlf,micd-timeout.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Update the name for the second jack detection pin binding to be a little
less confusing.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Some Arizona devices have the option to use the GPIO5 pin as a second
jack detection pin. This patch adds device bindings to specify to the
driver that it should use this pin. Note that the second jack detection
pin is hard wired in the chip so can only be enabled through the
binding, rather than a pin being specified.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
By default the driver expects the jackdet pin to be pulled low when a
jack is inserted. This patch adds a device binding that allows the user
to specify that the jackdet pin will be pulled high when a jack is
inserted.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The switch is generally used in conjunction with the MICDET clamp to
suppress pops and clicks associated with jack insertion. This patch adds
a binding that allows the user to select the mode of operation for this
switch.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Add a simple boolean binding to turn on and off the use of ADC
microphone detection mode to determine 3/4 pole jack.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This patch modifies the id and name of external connector with the
additional prefix to clarify both attribute and meaning of external
connector as following:
- EXTCON_CHG_* mean the charger connector.
- EXTCON_JACK_* mean the jack connector.
- EXTCON_DISP_* mean the display port connector.
Following table show the new name of external connector with old name:
--------------------------------------------------
Old extcon name | New extcon name |
--------------------------------------------------
EXTCON_TA | EXTCON_CHG_USB_DCP |
EXTCON_CHARGE_DOWNSTREAM| EXTCON_CHG_USB_CDP |
EXTCON_FAST_CHARGER | EXTCON_CHG_USB_FAST |
EXTCON_SLOW_CHARGER | EXTCON_CHG_USB_SLOW |
--------------------------------------------------
EXTCON_MICROPHONE | EXTCON_JACK_MICROPHONE |
EXTCON_HEADPHONE | EXTCON_JACK_HEADPHONE |
EXTCON_LINE_IN | EXTCON_JACK_LINE_IN |
EXTCON_LINE_OUT | EXTCON_JACK_LINE_OUT |
EXTCON_VIDEO_IN | EXTCON_JACK_VIDEO_IN |
EXTCON_VIDEO_OUT | EXTCON_JACK_VIDEO_OUT |
EXTCON_SPDIF_IN | EXTCON_JACK_SPDIF_IN |
EXTCON_SPDIF_OUT | EXTCON_JACK_SPDIF_OUT |
--------------------------------------------------
EXTCON_HMDI | EXTCON_DISP_HDMI |
EXTCON_MHL | EXTCON_DISP_MHL |
EXTCON_DVI | EXTCON_DISP_DVI |
EXTCON_VGA | EXTCON_DISP_VGA |
--------------------------------------------------
And, when altering the name of USB charger connector, EXTCON refers to the
"Battery Charging v1.2 Spec and Adopters Agreement"[1] to use the standard
name of USB charging port as following. Following name of USB charging port
are already used in power_supply subsystem. We chan check it on patch[2].
- EXTCON_CHG_USB_SDP /* Standard Downstream Port */
- EXTCON_CHG_USB_DCP /* Dedicated Charging Port */
- EXTCON_CHG_USB_CDP /* Charging Downstream Port */
- EXTCON_CHG_USB_ACA /* Accessory Charger Adapter */
[1] www.usb.org/developers/docs/devclass_docs/BCv1.2_070312.zip
[2] commit 85efc8a18c ("power_supply: Add types for USB chargers")
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
[ckeepax: For the Arizona changes]
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
This patch uses the descriptor-based GPIO interface (gpiod_* API) instead of
legacy gpio_* API and add the internal gpio_extcon_init() to handle
all gpio-related tasks.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This patch fixes the minor coding style about indentation and removes the
unused fields from struct gpio_extcon_platform_data.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The commit 2a9de9c0 ("extcon: Use the unique id for external connector instead
of string") defines the unique id of each external connector to identify the
type of external connector instead of string name. So, devm_extcon_dev_allocate()
should include the second parameter (unsigned int *supported_cable). This patch
adds the supported_cable parameter which is passed by platform data.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
There are duplicate data between struct gpio_extcon_data and struct
gpio_extcon_platform_data. This patch removes them from struct gpio_extcon_data.
Instead, this patch add pdata field to struct gpio_extcon_data.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This patch reorders the default statement to remove unnecessary warning message
when info->hpdet_ip_version is higher than 2.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
This patch adds support for the WM8998 and WM1814 codecs.
These use the same IP version as WM5110 but have different
clamp control.
Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The function can return negative value.
The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The function can return negative value.
The problem has been detected using proposed semantic patch
scripts/coccinelle/tests/assign_signed_to_unsigned.cocci [1].
[1]: http://permalink.gmane.org/gmane.linux.kernel/2046107
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Use resource managed functions devm_usb_get_phy and
devm_gpio_request to make error path simpler. To be
compatible the change, various gotos are replaced
with direct returns and unnecessary label
gpio_req_failed is dropped.
Also, remove function axp288_extcon_remove as it is
now redundant.
Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The I2C core always reports the MODALIAS uevent as "i2c:<modalias>"
regardless of the mechanism that was used to register the device
(i.e: OF or board code) and the table that is used later to match
the driver with the device (i.e: I2C id table or OF match table).
So drivers needs to export the I2C id table and this be built into
the module or udev won't have the necessary information to autoload
the needed driver module when the device is added.
But this means that OF-only drivers needs to have both OF and I2C id
tables that have to be kept in sync and also the dev node compatible
manufacturer prefix is stripped when reporting the MODALIAS. Which can
lead to issues if two vendors use the same I2C device name for example.
To avoid the above, the I2C core behavior may be changed in the future
to not require an SPI device table for OF-only drivers and report the
OF module alias. So, it's better to also export the OF table even when
is unused now to prevent breaking module loading when the core changes.
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Whilst the jack is connected we disable the jack detection debounce to
ensure as quick as possible a detection of jack removal. However, it is
only safe to disable the jack debounce whilst the jack is connected if
using the micd clamp or the jack is not inverted. Otherwise spurious
interrupts might be generated when we re-enable the debounce.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Currently we only use the microphone clamp IRQ if GPIO5 is being used as
a second jack detection pin. But we should be using it on any system
where the clamp is available. This patch updates the driver to do so.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The polarity of MICD_CLAMP_STS does not change when different clamp
modes are used, this patch corrects this issue.
Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
If the TST_CAP_SEL bits aren't set correctly on wm5110/8280 there will
be a 100k load along side the headphones, which will affect the accurary
towards the very top of the detection range. This patch sets those bits.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The switch is typically used in conjunction with the MICDET clamp in
order to suppress pops and clicks associated with jack insertion.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Newer devices give users the option to make the 3/4 pole jack
determination using a software comparison rather than a hardware one.
This patch adds support for this functionality.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
is_extcon_changed should only check the idx-th bit of new, not
the entirety of new when setting attached.
This fixes extcon sending notifications that a cable was inserted when
it gets removed while another cable is still connected.
Cc: stable@vger.kernel.org
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The biggest changes in the core this time around have been some
refactorings that move us towards being able to drop the list of
regulators maintained by the core and instead just use the driver model
list maintained for the class devices for regulators which will make the
code smaller and avoid some potential bugs. Otherwise another fairly
quiet release for the regulator API, highlights include:
- A new API for setting voltages based on a minimum, target, maximum
triplet.
- Support for continuous voltage ranges rather than tables of explicit
steps in the PWM regulator, requiring less explicit configuration.
- New driver support for Dialog DA9215, Maxim 77843, Mediatek MT6311
and Qualcomm RPM.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAABAgAGBQJV5DCWAAoJECTWi3JdVIfQDgYH/3mNwtRcwslt8M1L8lzRVyf1
gRrJY5r4EUOcqqsLnQvDHdjgO2yowEolEd3Hd/GElZqzeFgwXaQ62kHwgqnvOt9k
O0l99FbU6ECpB56tSENrV1lfvBTlld9bEhq9NhxvNiWAdpGPqIcjvXfSH28GssJ0
NGr4Yt/A1DG6GsOWxKSODX56WJXJn4emKx3vHH+leUClNWwQVK6JunTmj5IPKLxW
K94Ke41L3JgAy18TLqvFNlTAC22QaHFaM8ul9v7gnPW+S8Bx15MCQz16rMkGViZV
c/DyCu69qCVFLI1svRrvB5oq700QT0GT6jANCVmw+CrkIkESwjS39kX861H6hk8=
=vrVx
-----END PGP SIGNATURE-----
Merge tag 'regulator-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown:
"The biggest changes in the core this time around have been some
refactorings that move us towards being able to drop the list of
regulators maintained by the core and instead just use the driver
model list maintained for the class devices for regulators which will
make the code smaller and avoid some potential bugs.
Otherwise another fairly quiet release for the regulator API,
highlights include:
- a new API for setting voltages based on a minimum, target, maximum
triplet
- support for continuous voltage ranges rather than tables of
explicit steps in the PWM regulator, requiring less explicit
configuration
- new driver support for Dialog DA9215, Maxim 77843, Mediatek MT6311
and Qualcomm RPM"
* tag 'regulator-v4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (70 commits)
regulator: mt6311: fix platform_no_drv_owner.cocci warnings
regulator: ltc3589: Remove unnecessary MODULE_ALIAS()
regulator: ad5398: Remove unnecessary MODULE_ALIAS()
regulator: pfuze100: Remove unnecessary MODULE_ALIAS()
regulator: core: use debug level print in regulator_check_drms
regulator: lp872x: handle error case
regulator: lp872x: use the private data instead of updating I2C device platform data
regulator: isl9305: Export OF module alias information
regulators: max77693: register driver earlier to avoid deferred probe
regulator: qcom_smd: Set n_voltages for pm8941_lnldo
regulator: core: Use IS_ERR_OR_NULL()
regulator: core: Define regulator_set_voltage_triplet()
regulator: Regulator driver for the Qualcomm RPM
regulator: pbias: Fix broken pbias disable functionality
regulator: core: Spelling fix
regulator: core: Use class device list for regulator_list in late init
regulator: core: Move more deallocation into class unregister
regulator: core: Reduce rdev locking region when releasing regulator
Input: Remove the max77843 haptic driver
Input: max77693: Add support for Maxim 77843
...
With commit b17d1bf16c ("gpio: make flags mandatory for gpiod_get functions")
it becomes necessary to pass the flags argument. And this patch adds the gpio
header file to fix the build breakage when build testing with random
configuration files.
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Some palmas based chip variants do not have OTG based ID logic.
For these variants we rely on GPIO based USB ID detection.
These chips do have VBUS comparator for VBUS detection so we
continue to use the old way of detecting VBUS.
Signed-off-by: Roger Quadros <rogerq@ti.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Unsigned is never less than zero so this error handling won't work.
Fixes: be052cc877 ('extcon: Fix hang and extcon_get/set_cable_state().')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Roger Quadros <rogerq@ti.com>
[cw00.choi: Change the patch title and fix signedness bug of find_cable_index_by_id() ]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
i2c_driver does not need to set an owner because i2c_register_driver()
will set it.
Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Currently micd_dbtime can be set to 0 for default, 1 for 4 measurements,
or a greater than 16-bit value for 2 measurements. This patch simplifies
the symantics to 2 for 2 measurements, 4 for 4 measurements and any
other value for the default.
I am not super keen on changing the symantics of the pdata at this stage
in the drivers life, but acceptance of the DT binding for this field has
been made conditional on this happening.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Detecting an open-circuit on the microphone pin, usually means the
headset has a microphone but the cable is faulty. Currently the code
will simply stop detecting and declare nothing in this situation. It is
better to declare this as headphones such that the user can still use
their headset as plain headphones even if the microphone is faulty.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The detecting flag really refers to the microphone detection stage and
as such should be cleared before arizona_identify_headphones is called.
Also the mic flag should be set before identify headphones is called as
well.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Convert to using the newer gpiod interface for the micd_pol_gpio.
Although we still carry support for the old gpio interface from pdata.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
[cw00.choi: Modify the patch titlei to include the detailed content]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This patch adds bindings for the basic microphone detection platform
data.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
The device properties API will load data from both device tree and ACPI,
update the binding to use this API instead of the OF API.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This patch removes the mutually_exclusive array of extcon-palmas.c.
After used the unique id of each external connector on 2a9de9c0f0
("extcon: Use the unique id for external connector instead of string"),
extcon driver can't directly handle the bit value indicating the external
connectors.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This patch removes the optional print_state() function pointer which included
in 'struct extcon_dev' because the extcon must maintain the consistent name
of extcon device on sysfs instead of inconsistent state of external connectors.
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
IRQ signal before driver probe is needless because driver sends
current state after platform booting done.
So, this patch clears MUIC IRQ bits before request IRQ.
Signed-off-by: Jaewon Kim <jaewon02.kim@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Currently the extcon code notifiers the interested listeners
before it updates the extcon state with the new state.
This will cause the listeners that use extcon_cable_get_state()
to get the stale state and loose the new state.
Fix this by first changing the extcon state variable and then
notifying listeners.
Signed-off-by: Roger Quadros <rogerq@ti.com>
Tested-by: Ivan T. Ivanov <ivan.ivanov@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>