Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 16eb2bfc authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

Merge tag 'extcon-next-for-3.17' of...

Merge tag 'extcon-next-for-3.17' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into char-misc-next

Chanwoo writes:

Update extcon for v3.17

This patchset add new extcon provider driver and fix minor issue of extcon driver.

Detailed description for patchset:
1. Add new Silicon-Mitus SM5502 MUIC (Micro-USB Interface Controller) device
- extcon-sm5502 driver  is capable of identifying the type of the external power
source and attached accessory. And external power sources, such as Dedicated
charger or a standard USB port, are able to charge the battery in the smart
phone via the connector.

2. Fix minor issue of extcon driver
- extcon-arizona driver
- extcon-palmas driver
- Remove unnecessary OOM messages for all extcon device drivers

3. Fix minor issue of extcon core
- Re-order the sequence of extcon device driver in Kconfig/Makefile alphabitically
- Set parent device of extcon device automatically using devm_extcon_dev_allocate()

4. Fix MAX77693 driver
- This patchset has dependency on MFD/Regulator/Extcon. So, Lee Jones
(MFD Maintainer) created Immutable branch between MFD and Extcon due
for v3.17 merge-window and then I merged this patchset from MFD git repo[1]
to Extcon git repo.
  [1] git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd
  (branch: ib-mfd-extcon-regulator)
parents 7b9d1f0b d3b50314
Loading
Loading
Loading
Loading
+23 −0
Original line number Diff line number Diff line

* SM5502 MUIC (Micro-USB Interface Controller) device

The Silicon Mitus SM5502 is a MUIC (Micro-USB Interface Controller) device
which can detect the state of external accessory when external accessory is
attached or detached and button is pressed or released. It is interfaced to
the host controller using an I2C interface.

Required properties:
- compatible: Should be "siliconmitus,sm5502-muic"
- reg: Specifies the I2C slave address of the MUIC block. It should be 0x25
- interrupt-parent: Specifies the phandle of the interrupt controller to which
  the interrupts from sm5502 are delivered to.
- interrupts: Interrupt specifiers for detection interrupt sources.

Example:

	sm5502@25 {
		compatible = "siliconmitus,sm5502-muic";
		interrupt-parent = <&gpx1>;
		interrupts = <5 0>;
		reg = <0x25>;
	};
+24 −14
Original line number Diff line number Diff line
@@ -14,6 +14,20 @@ if EXTCON

comment "Extcon Device Drivers"

config EXTCON_ADC_JACK
	tristate "ADC Jack extcon support"
	depends on IIO
	help
	  Say Y here to enable extcon device driver based on ADC values.

config EXTCON_ARIZONA
	tristate "Wolfson Arizona EXTCON support"
	depends on MFD_ARIZONA && INPUT && SND_SOC
	help
	  Say Y here to enable support for external accessory detection
	  with Wolfson Arizona devices. These are audio CODECs with
	  advanced audio accessory detection support.

config EXTCON_GPIO
	tristate "GPIO extcon support"
	depends on GPIOLIB
@@ -21,12 +35,6 @@ config EXTCON_GPIO
	  Say Y here to enable GPIO based extcon support. Note that GPIO
	  extcon supports single state per extcon instance.

config EXTCON_ADC_JACK
	tristate "ADC Jack extcon support"
	depends on IIO
	help
	  Say Y here to enable extcon device driver based on ADC values.

config EXTCON_MAX14577
	tristate "MAX14577/77836 EXTCON Support"
	depends on MFD_MAX14577
@@ -55,14 +63,6 @@ config EXTCON_MAX8997
	  Maxim MAX8997 PMIC. The MAX8997 MUIC is a USB port accessory
	  detector and switch.

config EXTCON_ARIZONA
	tristate "Wolfson Arizona EXTCON support"
	depends on MFD_ARIZONA && INPUT && SND_SOC
	help
	  Say Y here to enable support for external accessory detection
	  with Wolfson Arizona devices. These are audio CODECs with
	  advanced audio accessory detection support.

config EXTCON_PALMAS
	tristate "Palmas USB EXTCON support"
	depends on MFD_PALMAS
@@ -70,4 +70,14 @@ config EXTCON_PALMAS
	  Say Y here to enable support for USB peripheral and USB host
	  detection by palmas usb.

config EXTCON_SM5502
	tristate "SM5502 EXTCON support"
	select IRQ_DOMAIN
	select REGMAP_I2C
	select REGMAP_IRQ
	help
	  If you say yes here you get support for the MUIC device of
	  Silicon Mitus SM5502. The SM5502 is a USB port accessory
	  detector and switch.

endif # MULTISTATE_SWITCH
+4 −3
Original line number Diff line number Diff line
#

# Makefile for external connector class (extcon) devices
#

obj-$(CONFIG_EXTCON)		+= extcon-class.o
obj-$(CONFIG_EXTCON_GPIO)	+= extcon-gpio.o
obj-$(CONFIG_EXTCON_ADC_JACK)	+= extcon-adc-jack.o
obj-$(CONFIG_EXTCON_ARIZONA)	+= extcon-arizona.o
obj-$(CONFIG_EXTCON_GPIO)	+= extcon-gpio.o
obj-$(CONFIG_EXTCON_MAX14577)	+= extcon-max14577.o
obj-$(CONFIG_EXTCON_MAX77693)	+= extcon-max77693.o
obj-$(CONFIG_EXTCON_MAX8997)	+= extcon-max8997.o
obj-$(CONFIG_EXTCON_ARIZONA)	+= extcon-arizona.o
obj-$(CONFIG_EXTCON_PALMAS)	+= extcon-palmas.o
obj-$(CONFIG_EXTCON_SM5502)	+= extcon-sm5502.o
+0 −1
Original line number Diff line number Diff line
@@ -112,7 +112,6 @@ static int adc_jack_probe(struct platform_device *pdev)
		dev_err(&pdev->dev, "failed to allocate extcon device\n");
		return -ENOMEM;
	}
	data->edev->dev.parent = &pdev->dev;
	data->edev->name = pdata->name;

	/* Check the length of array and set num_cables */
+45 −29
Original line number Diff line number Diff line
@@ -39,6 +39,11 @@
#define ARIZONA_ACCDET_MODE_HPL 1
#define ARIZONA_ACCDET_MODE_HPR 2

#define ARIZONA_MICD_CLAMP_MODE_JDL      0x4
#define ARIZONA_MICD_CLAMP_MODE_JDH      0x5
#define ARIZONA_MICD_CLAMP_MODE_JDL_GP5H 0x9
#define ARIZONA_MICD_CLAMP_MODE_JDH_GP5H 0xb

#define ARIZONA_HPDET_MAX 10000

#define HPDET_DEBOUNCE 500
@@ -324,14 +329,17 @@ static void arizona_stop_mic(struct arizona_extcon_info *info)
}

static struct {
	unsigned int threshold;
	unsigned int factor_a;
	unsigned int factor_b;
} arizona_hpdet_b_ranges[] = {
	{  5528,   362464 },
	{ 11084,  6186851 },
	{ 11065, 65460395 },
	{ 100,  5528,   362464 },
	{ 169, 11084,  6186851 },
	{ 169, 11065, 65460395 },
};

#define ARIZONA_HPDET_B_RANGE_MAX 0x3fb

static struct {
	int min;
	int max;
@@ -386,7 +394,8 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
			   >> ARIZONA_HP_IMPEDANCE_RANGE_SHIFT;

		if (range < ARRAY_SIZE(arizona_hpdet_b_ranges) - 1 &&
		    (val < 100 || val >= 0x3fb)) {
		    (val < arizona_hpdet_b_ranges[range].threshold ||
		     val >= ARIZONA_HPDET_B_RANGE_MAX)) {
			range++;
			dev_dbg(arizona->dev, "Moving to HPDET range %d\n",
				range);
@@ -399,7 +408,8 @@ static int arizona_hpdet_read(struct arizona_extcon_info *info)
		}

		/* If we go out of range report top of range */
		if (val < 100 || val >= 0x3fb) {
		if (val < arizona_hpdet_b_ranges[range].threshold ||
		    val >= ARIZONA_HPDET_B_RANGE_MAX) {
			dev_dbg(arizona->dev, "Measurement out of range\n");
			return ARIZONA_HPDET_MAX;
		}
@@ -664,9 +674,8 @@ static void arizona_identify_headphone(struct arizona_extcon_info *info)
			   ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);

	/* Just report headphone */
	ret = extcon_update_state(info->edev,
				  1 << ARIZONA_CABLE_HEADPHONE,
				  1 << ARIZONA_CABLE_HEADPHONE);
	ret = extcon_set_cable_state_(info->edev,
				      ARIZONA_CABLE_HEADPHONE, true);
	if (ret != 0)
		dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);

@@ -723,9 +732,8 @@ static void arizona_start_hpdet_acc_id(struct arizona_extcon_info *info)
			   ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC);

	/* Just report headphone */
	ret = extcon_update_state(info->edev,
				  1 << ARIZONA_CABLE_HEADPHONE,
				  1 << ARIZONA_CABLE_HEADPHONE);
	ret = extcon_set_cable_state_(info->edev,
				      ARIZONA_CABLE_HEADPHONE, true);
	if (ret != 0)
		dev_err(arizona->dev, "Failed to report headphone: %d\n", ret);

@@ -812,16 +820,15 @@ static void arizona_micd_detect(struct work_struct *work)
	if (info->detecting && (val & ARIZONA_MICD_LVL_8)) {
		arizona_identify_headphone(info);

		ret = extcon_update_state(info->edev,
					  1 << ARIZONA_CABLE_MICROPHONE,
					  1 << ARIZONA_CABLE_MICROPHONE);
		ret = extcon_set_cable_state_(info->edev,
					      ARIZONA_CABLE_MICROPHONE, true);

		if (ret != 0)
			dev_err(arizona->dev, "Headset report failed: %d\n",
				ret);

		/* Don't need to regulate for button detection */
		ret = regulator_allow_bypass(info->micvdd, false);
		ret = regulator_allow_bypass(info->micvdd, true);
		if (ret != 0) {
			dev_err(arizona->dev, "Failed to bypass MICVDD: %d\n",
				ret);
@@ -962,9 +969,15 @@ static irqreturn_t arizona_jackdet(int irq, void *data)

	if (arizona->pdata.jd_gpio5) {
		mask = ARIZONA_MICD_CLAMP_STS;
		if (arizona->pdata.jd_invert)
			present = ARIZONA_MICD_CLAMP_STS;
		else
			present = 0;
	} else {
		mask = ARIZONA_JD1_STS;
		if (arizona->pdata.jd_invert)
			present = 0;
		else
			present = ARIZONA_JD1_STS;
	}

@@ -1096,6 +1109,7 @@ static int arizona_extcon_probe(struct platform_device *pdev)
	struct arizona_pdata *pdata = &arizona->pdata;
	struct arizona_extcon_info *info;
	unsigned int val;
	unsigned int clamp_mode;
	int jack_irq_fall, jack_irq_rise;
	int ret, mode, i, j;

@@ -1103,12 +1117,10 @@ static int arizona_extcon_probe(struct platform_device *pdev)
		return -EPROBE_DEFER;

	info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
	if (!info) {
		dev_err(&pdev->dev, "Failed to allocate memory\n");
	if (!info)
		return -ENOMEM;
	}

	info->micvdd = devm_regulator_get(arizona->dev, "MICVDD");
	info->micvdd = devm_regulator_get(&pdev->dev, "MICVDD");
	if (IS_ERR(info->micvdd)) {
		ret = PTR_ERR(info->micvdd);
		dev_err(arizona->dev, "Failed to get MICVDD: %d\n", ret);
@@ -1156,7 +1168,6 @@ static int arizona_extcon_probe(struct platform_device *pdev)
		return -ENOMEM;
	}
	info->edev->name = "Headset Jack";
	info->edev->dev.parent = arizona->dev;

	ret = devm_extcon_dev_register(&pdev->dev, info->edev);
	if (ret < 0) {
@@ -1174,7 +1185,6 @@ static int arizona_extcon_probe(struct platform_device *pdev)

	info->input->name = "Headset";
	info->input->phys = "arizona/extcon";
	info->input->dev.parent = &pdev->dev;

	if (pdata->num_micd_configs) {
		info->micd_modes = pdata->micd_configs;
@@ -1305,14 +1315,20 @@ static int arizona_extcon_probe(struct platform_device *pdev)
			regmap_write(arizona->regmap, ARIZONA_GPIO5_CTRL,
				     val);

			regmap_update_bits(arizona->regmap,
					   ARIZONA_MICD_CLAMP_CONTROL,
					   ARIZONA_MICD_CLAMP_MODE_MASK, 0x9);
			if (arizona->pdata.jd_invert)
				clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDH_GP5H;
			else
				clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDL_GP5H;
		} else {
			if (arizona->pdata.jd_invert)
				clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDH;
			else
				clamp_mode = ARIZONA_MICD_CLAMP_MODE_JDL;
		}

		regmap_update_bits(arizona->regmap,
				   ARIZONA_MICD_CLAMP_CONTROL,
					   ARIZONA_MICD_CLAMP_MODE_MASK, 0x4);
		}
				   ARIZONA_MICD_CLAMP_MODE_MASK, clamp_mode);

		regmap_update_bits(arizona->regmap,
				   ARIZONA_JACK_DETECT_DEBOUNCE,
Loading