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

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

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

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

Chanwoo writes:

Update extcon for v3.18

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

Detailed description for patchset:
1. Add new Richtek RT8973A extcon driver
This driver support for Richtek RT8973A which is Micro USB Switch OVP and
i2c interface. The RT8973A is a USB port accessory detector and switch that is
optimized to protect low voltage system from abnormal high input voltage
(up to 28V) and supports high speed USB operation. Also, RT8973A support
'auto-configuration' mode. If auto-configuration mode is enabled, RT8973A
would control internal h/w patch for USB D-/D+ switching.

2. Fix code cleanup for other extcon driver
- extcon-sm5502 driver
 : Fix bug to check cable type and build break.
 : Move header file from include/linux/extcon to drivers/extcon because this
   header file is only user for extcon-sm5502.c.
 : Clean up codes by using checkpatch script
- extcon-max77693 driver
 : Use resource managed interrupt function
 : Fix bug to set ADC debounce time
- extcon-gpio driver
 : Fix minor code cleanup
parents 9e82bf01 62364357
Loading
Loading
Loading
Loading
+25 −0
Original line number Original line Diff line number Diff line

* Richtek RT8973A - Micro USB Switch device

The Richtek RT8973A is Micro USB Switch with OVP and I2C interface. The RT8973A
is a USB port accessory detector and switch that is optimized to protect low
voltage system from abnormal high input voltage (up to 28V) and supports high
speed USB operation. Also, RT8973A support 'auto-configuration' mode.
If auto-configuration mode is enabled, RT8973A would control internal h/w patch
for USB D-/D+ switching.

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

Example:

	rt8973a@14 {
		compatible = "richtek,rt8973a-muic";
		interrupt-parent = <&gpx1>;
		interrupts = <5 0>;
		reg = <0x14>;
	};
+13 −0
Original line number Original line Diff line number Diff line
@@ -70,8 +70,21 @@ config EXTCON_PALMAS
	  Say Y here to enable support for USB peripheral and USB host
	  Say Y here to enable support for USB peripheral and USB host
	  detection by palmas usb.
	  detection by palmas usb.


config EXTCON_RT8973A
	tristate "RT8973A EXTCON support"
	depends on I2C
	select IRQ_DOMAIN
	select REGMAP_I2C
	select REGMAP_IRQ
	help
	  If you say yes here you get support for the MUIC device of
	  Richtek RT8973A. The RT8973A is a USB port accessory detector
	  and switch that is optimized to protect low voltage system
	  from abnormal high input voltage (up to 28V).

config EXTCON_SM5502
config EXTCON_SM5502
	tristate "SM5502 EXTCON support"
	tristate "SM5502 EXTCON support"
	depends on I2C
	select IRQ_DOMAIN
	select IRQ_DOMAIN
	select REGMAP_I2C
	select REGMAP_I2C
	select REGMAP_IRQ
	select REGMAP_IRQ
+1 −0
Original line number Original line Diff line number Diff line
@@ -10,4 +10,5 @@ obj-$(CONFIG_EXTCON_MAX14577) += extcon-max14577.o
obj-$(CONFIG_EXTCON_MAX77693)	+= extcon-max77693.o
obj-$(CONFIG_EXTCON_MAX77693)	+= extcon-max77693.o
obj-$(CONFIG_EXTCON_MAX8997)	+= extcon-max8997.o
obj-$(CONFIG_EXTCON_MAX8997)	+= extcon-max8997.o
obj-$(CONFIG_EXTCON_PALMAS)	+= extcon-palmas.o
obj-$(CONFIG_EXTCON_PALMAS)	+= extcon-palmas.o
obj-$(CONFIG_EXTCON_RT8973A)	+= extcon-rt8973a.o
obj-$(CONFIG_EXTCON_SM5502)	+= extcon-sm5502.o
obj-$(CONFIG_EXTCON_SM5502)	+= extcon-sm5502.o
+5 −5
Original line number Original line Diff line number Diff line
@@ -20,16 +20,16 @@
 *
 *
*/
*/


#include <linux/module.h>
#include <linux/extcon.h>
#include <linux/kernel.h>
#include <linux/extcon/extcon-gpio.h>
#include <linux/gpio.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/workqueue.h>
#include <linux/gpio.h>
#include <linux/extcon.h>
#include <linux/extcon/extcon-gpio.h>


struct gpio_extcon_data {
struct gpio_extcon_data {
	struct extcon_dev *edev;
	struct extcon_dev *edev;
+15 −22
Original line number Original line Diff line number Diff line
@@ -255,9 +255,13 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
	case ADC_DEBOUNCE_TIME_10MS:
	case ADC_DEBOUNCE_TIME_10MS:
	case ADC_DEBOUNCE_TIME_25MS:
	case ADC_DEBOUNCE_TIME_25MS:
	case ADC_DEBOUNCE_TIME_38_62MS:
	case ADC_DEBOUNCE_TIME_38_62MS:
		ret = regmap_update_bits(info->max77693->regmap_muic,
		/*
		 * Don't touch BTLDset, JIGset when you want to change adc
		 * debounce time. If it writes other than 0 to BTLDset, JIGset
		 * muic device will be reset and loose current state.
		 */
		ret = regmap_write(info->max77693->regmap_muic,
				  MAX77693_MUIC_REG_CTRL3,
				  MAX77693_MUIC_REG_CTRL3,
					  CONTROL3_ADCDBSET_MASK,
				  time << CONTROL3_ADCDBSET_SHIFT);
				  time << CONTROL3_ADCDBSET_SHIFT);
		if (ret) {
		if (ret) {
			dev_err(info->dev, "failed to set ADC debounce time\n");
			dev_err(info->dev, "failed to set ADC debounce time\n");
@@ -1155,13 +1159,11 @@ static int max77693_muic_probe(struct platform_device *pdev)


		virq = regmap_irq_get_virq(max77693->irq_data_muic,
		virq = regmap_irq_get_virq(max77693->irq_data_muic,
					muic_irq->irq);
					muic_irq->irq);
		if (!virq) {
		if (!virq)
			ret = -EINVAL;
			return -EINVAL;
			goto err_irq;
		}
		muic_irq->virq = virq;
		muic_irq->virq = virq;


		ret = request_threaded_irq(virq, NULL,
		ret = devm_request_threaded_irq(&pdev->dev, virq, NULL,
				max77693_muic_irq_handler,
				max77693_muic_irq_handler,
				IRQF_NO_SUSPEND,
				IRQF_NO_SUSPEND,
				muic_irq->name, info);
				muic_irq->name, info);
@@ -1170,7 +1172,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
				"failed: irq request (IRQ: %d,"
				"failed: irq request (IRQ: %d,"
				" error :%d)\n",
				" error :%d)\n",
				muic_irq->irq, ret);
				muic_irq->irq, ret);
			goto err_irq;
			return ret;
		}
		}
	}
	}


@@ -1179,15 +1181,14 @@ static int max77693_muic_probe(struct platform_device *pdev)
					      max77693_extcon_cable);
					      max77693_extcon_cable);
	if (IS_ERR(info->edev)) {
	if (IS_ERR(info->edev)) {
		dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
		dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
		ret = -ENOMEM;
		return -ENOMEM;
		goto err_irq;
	}
	}
	info->edev->name = DEV_NAME;
	info->edev->name = DEV_NAME;


	ret = devm_extcon_dev_register(&pdev->dev, info->edev);
	ret = devm_extcon_dev_register(&pdev->dev, info->edev);
	if (ret) {
	if (ret) {
		dev_err(&pdev->dev, "failed to register extcon device\n");
		dev_err(&pdev->dev, "failed to register extcon device\n");
		goto err_irq;
		return ret;
	}
	}


	/* Initialize MUIC register by using platform data or default data */
	/* Initialize MUIC register by using platform data or default data */
@@ -1265,7 +1266,7 @@ static int max77693_muic_probe(struct platform_device *pdev)
			MAX77693_MUIC_REG_ID, &id);
			MAX77693_MUIC_REG_ID, &id);
	if (ret < 0) {
	if (ret < 0) {
		dev_err(&pdev->dev, "failed to read revision number\n");
		dev_err(&pdev->dev, "failed to read revision number\n");
		goto err_irq;
		return ret;
	}
	}
	dev_info(info->dev, "device ID : 0x%x\n", id);
	dev_info(info->dev, "device ID : 0x%x\n", id);


@@ -1285,20 +1286,12 @@ static int max77693_muic_probe(struct platform_device *pdev)
			delay_jiffies);
			delay_jiffies);


	return ret;
	return ret;

err_irq:
	while (--i >= 0)
		free_irq(muic_irqs[i].virq, info);
	return ret;
}
}


static int max77693_muic_remove(struct platform_device *pdev)
static int max77693_muic_remove(struct platform_device *pdev)
{
{
	struct max77693_muic_info *info = platform_get_drvdata(pdev);
	struct max77693_muic_info *info = platform_get_drvdata(pdev);
	int i;


	for (i = 0; i < ARRAY_SIZE(muic_irqs); i++)
		free_irq(muic_irqs[i].virq, info);
	cancel_work_sync(&info->irq_work);
	cancel_work_sync(&info->irq_work);
	input_unregister_device(info->dock);
	input_unregister_device(info->dock);


Loading