You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
Merge tag 'extcon-next-for-4.15' of git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon into usb-next
Chanwoo writes: Update extcon for 4.15 Detailed description for this pull request: 1. Split out extcon header file for consumer and provider device : The extcon has two type of extcon devices as following. - 'extcon provider deivce' adds new extcon device and detect the state/properties of external connector. Also, it notifies the state/properties to the extcon consumer device. - 'extcon consumer device' gets the change state/properties from extcon provider device. Prior to that, include/linux/extcon.h contains all exported API for both provider and consumer device driver. To clarify the meaning of header file and to remove the wrong use-case on consumer device. - include/linux/extcon-provider.h includes API for the provider device driver. - include/linux/extcon.h includes the API for the consumer device driver. 2. Support the SmartDock accessory on extcon-max77843.c device driver - Support the SmartDock accessory which detects following connectors at the same time. : USB host throught USB hub for mouse, keyboard and so on. : MHL connector for video output. : Charger connector for battery charging. - It tested with Unitek Y-2165 MHL+OTG Hub Smart Phone Dock. 3. Fix the minor issue of extcon driver - Delete the unneeded initialization in extcon-max14577. - Make extcon_info static const in order to fix the warning.
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/iio/consumer.h>
|
||||
#include <linux/extcon/extcon-adc-jack.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
|
||||
/**
|
||||
* struct adc_jack_data - internal data for adc_jack device driver
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include <linux/pm_runtime.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
|
||||
#include <sound/soc.h>
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/extcon/extcon-gpio.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* more details.
|
||||
*/
|
||||
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mfd/intel_soc_pmic.h>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mfd/max14577.h>
|
||||
#include <linux/mfd/max14577-private.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
|
||||
#define DELAY_MS_DEFAULT 17000 /* unit: millisecond */
|
||||
|
||||
@@ -204,8 +204,8 @@ static int max14577_muic_set_debounce_time(struct max14577_muic_info *info,
|
||||
static int max14577_muic_set_path(struct max14577_muic_info *info,
|
||||
u8 val, bool attached)
|
||||
{
|
||||
int ret = 0;
|
||||
u8 ctrl1, ctrl2 = 0;
|
||||
int ret;
|
||||
|
||||
/* Set open state to path before changing hw path */
|
||||
ret = max14577_update_reg(info->max14577->regmap,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*/
|
||||
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/interrupt.h>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <linux/mfd/max77693.h>
|
||||
#include <linux/mfd/max77693-common.h>
|
||||
#include <linux/mfd/max77693-private.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/irqdomain.h>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
* (at your option) any later version.
|
||||
*/
|
||||
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/kernel.h>
|
||||
@@ -80,7 +80,7 @@ enum max77843_muic_accessory_type {
|
||||
MAX77843_MUIC_ADC_REMOTE_S12_BUTTON,
|
||||
MAX77843_MUIC_ADC_RESERVED_ACC_1,
|
||||
MAX77843_MUIC_ADC_RESERVED_ACC_2,
|
||||
MAX77843_MUIC_ADC_RESERVED_ACC_3,
|
||||
MAX77843_MUIC_ADC_RESERVED_ACC_3, /* SmartDock */
|
||||
MAX77843_MUIC_ADC_RESERVED_ACC_4,
|
||||
MAX77843_MUIC_ADC_RESERVED_ACC_5,
|
||||
MAX77843_MUIC_ADC_AUDIO_DEVICE_TYPE2,
|
||||
@@ -119,6 +119,7 @@ enum max77843_muic_charger_type {
|
||||
MAX77843_MUIC_CHG_SPECIAL_BIAS,
|
||||
MAX77843_MUIC_CHG_RESERVED,
|
||||
MAX77843_MUIC_CHG_GND,
|
||||
MAX77843_MUIC_CHG_DOCK,
|
||||
};
|
||||
|
||||
static const unsigned int max77843_extcon_cable[] = {
|
||||
@@ -130,6 +131,7 @@ static const unsigned int max77843_extcon_cable[] = {
|
||||
EXTCON_CHG_USB_FAST,
|
||||
EXTCON_CHG_USB_SLOW,
|
||||
EXTCON_DISP_MHL,
|
||||
EXTCON_DOCK,
|
||||
EXTCON_JIG,
|
||||
EXTCON_NONE,
|
||||
};
|
||||
@@ -200,7 +202,7 @@ static const struct regmap_irq_chip max77843_muic_irq_chip = {
|
||||
};
|
||||
|
||||
static int max77843_muic_set_path(struct max77843_muic_info *info,
|
||||
u8 val, bool attached)
|
||||
u8 val, bool attached, bool nobccomp)
|
||||
{
|
||||
struct max77693_dev *max77843 = info->max77843;
|
||||
int ret = 0;
|
||||
@@ -210,10 +212,16 @@ static int max77843_muic_set_path(struct max77843_muic_info *info,
|
||||
ctrl1 = val;
|
||||
else
|
||||
ctrl1 = MAX77843_MUIC_CONTROL1_SW_OPEN;
|
||||
if (nobccomp) {
|
||||
/* Disable BC1.2 protocol and force manual switch control */
|
||||
ctrl1 |= MAX77843_MUIC_CONTROL1_NOBCCOMP_MASK;
|
||||
}
|
||||
|
||||
ret = regmap_update_bits(max77843->regmap_muic,
|
||||
MAX77843_MUIC_REG_CONTROL1,
|
||||
MAX77843_MUIC_CONTROL1_COM_SW, ctrl1);
|
||||
MAX77843_MUIC_CONTROL1_COM_SW |
|
||||
MAX77843_MUIC_CONTROL1_NOBCCOMP_MASK,
|
||||
ctrl1);
|
||||
if (ret < 0) {
|
||||
dev_err(info->dev, "Cannot switch MUIC port\n");
|
||||
return ret;
|
||||
@@ -240,6 +248,21 @@ static int max77843_muic_set_path(struct max77843_muic_info *info,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void max77843_charger_set_otg_vbus(struct max77843_muic_info *info,
|
||||
bool on)
|
||||
{
|
||||
struct max77693_dev *max77843 = info->max77843;
|
||||
unsigned int cnfg00;
|
||||
|
||||
if (on)
|
||||
cnfg00 = MAX77843_CHG_OTG_MASK | MAX77843_CHG_BOOST_MASK;
|
||||
else
|
||||
cnfg00 = MAX77843_CHG_ENABLE | MAX77843_CHG_BUCK_MASK;
|
||||
|
||||
regmap_update_bits(max77843->regmap_chg, MAX77843_CHG_REG_CHG_CNFG_00,
|
||||
MAX77843_CHG_MODE_MASK, cnfg00);
|
||||
}
|
||||
|
||||
static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
|
||||
enum max77843_muic_cable_group group, bool *attached)
|
||||
{
|
||||
@@ -288,6 +311,19 @@ static int max77843_muic_get_cable_type(struct max77843_muic_info *info,
|
||||
break;
|
||||
}
|
||||
|
||||
if (adc == MAX77843_MUIC_ADC_RESERVED_ACC_3) { /* SmartDock */
|
||||
if (chg_type == MAX77843_MUIC_CHG_NONE) {
|
||||
*attached = false;
|
||||
cable_type = info->prev_chg_type;
|
||||
info->prev_chg_type = MAX77843_MUIC_CHG_NONE;
|
||||
} else {
|
||||
*attached = true;
|
||||
cable_type = MAX77843_MUIC_CHG_DOCK;
|
||||
info->prev_chg_type = MAX77843_MUIC_CHG_DOCK;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (chg_type == MAX77843_MUIC_CHG_NONE) {
|
||||
*attached = false;
|
||||
cable_type = info->prev_chg_type;
|
||||
@@ -350,17 +386,18 @@ static int max77843_muic_adc_gnd_handler(struct max77843_muic_info *info)
|
||||
case MAX77843_MUIC_GND_USB_HOST_VB:
|
||||
ret = max77843_muic_set_path(info,
|
||||
MAX77843_MUIC_CONTROL1_SW_USB,
|
||||
attached);
|
||||
attached, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
extcon_set_state_sync(info->edev, EXTCON_USB_HOST, attached);
|
||||
max77843_charger_set_otg_vbus(info, attached);
|
||||
break;
|
||||
case MAX77843_MUIC_GND_MHL_VB:
|
||||
case MAX77843_MUIC_GND_MHL:
|
||||
ret = max77843_muic_set_path(info,
|
||||
MAX77843_MUIC_CONTROL1_SW_OPEN,
|
||||
attached);
|
||||
attached, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -396,7 +433,7 @@ static int max77843_muic_jig_handler(struct max77843_muic_info *info,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ret = max77843_muic_set_path(info, path, attached);
|
||||
ret = max77843_muic_set_path(info, path, attached, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -405,6 +442,26 @@ static int max77843_muic_jig_handler(struct max77843_muic_info *info,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int max77843_muic_dock_handler(struct max77843_muic_info *info,
|
||||
bool attached)
|
||||
{
|
||||
int ret;
|
||||
|
||||
dev_dbg(info->dev, "external connector is %s (adc: 0x10)\n",
|
||||
attached ? "attached" : "detached");
|
||||
|
||||
ret = max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_USB,
|
||||
attached, attached);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
extcon_set_state_sync(info->edev, EXTCON_DISP_MHL, attached);
|
||||
extcon_set_state_sync(info->edev, EXTCON_USB_HOST, attached);
|
||||
extcon_set_state_sync(info->edev, EXTCON_DOCK, attached);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int max77843_muic_adc_handler(struct max77843_muic_info *info)
|
||||
{
|
||||
int ret, cable_type;
|
||||
@@ -419,6 +476,11 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
|
||||
info->prev_cable_type);
|
||||
|
||||
switch (cable_type) {
|
||||
case MAX77843_MUIC_ADC_RESERVED_ACC_3: /* SmartDock */
|
||||
ret = max77843_muic_dock_handler(info, attached);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
break;
|
||||
case MAX77843_MUIC_ADC_GROUND:
|
||||
ret = max77843_muic_adc_gnd_handler(info);
|
||||
if (ret < 0)
|
||||
@@ -446,7 +508,6 @@ static int max77843_muic_adc_handler(struct max77843_muic_info *info)
|
||||
case MAX77843_MUIC_ADC_REMOTE_S12_BUTTON:
|
||||
case MAX77843_MUIC_ADC_RESERVED_ACC_1:
|
||||
case MAX77843_MUIC_ADC_RESERVED_ACC_2:
|
||||
case MAX77843_MUIC_ADC_RESERVED_ACC_3:
|
||||
case MAX77843_MUIC_ADC_RESERVED_ACC_4:
|
||||
case MAX77843_MUIC_ADC_RESERVED_ACC_5:
|
||||
case MAX77843_MUIC_ADC_AUDIO_DEVICE_TYPE2:
|
||||
@@ -490,7 +551,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
|
||||
case MAX77843_MUIC_CHG_USB:
|
||||
ret = max77843_muic_set_path(info,
|
||||
MAX77843_MUIC_CONTROL1_SW_USB,
|
||||
attached);
|
||||
attached, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -501,7 +562,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
|
||||
case MAX77843_MUIC_CHG_DOWNSTREAM:
|
||||
ret = max77843_muic_set_path(info,
|
||||
MAX77843_MUIC_CONTROL1_SW_OPEN,
|
||||
attached);
|
||||
attached, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -511,7 +572,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
|
||||
case MAX77843_MUIC_CHG_DEDICATED:
|
||||
ret = max77843_muic_set_path(info,
|
||||
MAX77843_MUIC_CONTROL1_SW_OPEN,
|
||||
attached);
|
||||
attached, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -521,7 +582,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
|
||||
case MAX77843_MUIC_CHG_SPECIAL_500MA:
|
||||
ret = max77843_muic_set_path(info,
|
||||
MAX77843_MUIC_CONTROL1_SW_OPEN,
|
||||
attached);
|
||||
attached, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -531,7 +592,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
|
||||
case MAX77843_MUIC_CHG_SPECIAL_1A:
|
||||
ret = max77843_muic_set_path(info,
|
||||
MAX77843_MUIC_CONTROL1_SW_OPEN,
|
||||
attached);
|
||||
attached, false);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
@@ -550,6 +611,9 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
|
||||
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP,
|
||||
false);
|
||||
break;
|
||||
case MAX77843_MUIC_CHG_DOCK:
|
||||
extcon_set_state_sync(info->edev, EXTCON_CHG_USB_DCP, attached);
|
||||
break;
|
||||
case MAX77843_MUIC_CHG_NONE:
|
||||
break;
|
||||
default:
|
||||
@@ -558,7 +622,7 @@ static int max77843_muic_chg_handler(struct max77843_muic_info *info)
|
||||
attached ? "attached" : "detached", chg_type);
|
||||
|
||||
max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_OPEN,
|
||||
attached);
|
||||
attached, false);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -798,7 +862,8 @@ static int max77843_muic_probe(struct platform_device *pdev)
|
||||
max77843_muic_set_debounce_time(info, MAX77843_DEBOUNCE_TIME_25MS);
|
||||
|
||||
/* Set initial path for UART */
|
||||
max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_UART, true);
|
||||
max77843_muic_set_path(info, MAX77843_MUIC_CONTROL1_SW_UART, true,
|
||||
false);
|
||||
|
||||
/* Check revision number of MUIC device */
|
||||
ret = regmap_read(max77843->regmap_muic, MAX77843_MUIC_REG_ID, &id);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <linux/kobject.h>
|
||||
#include <linux/mfd/max8997.h>
|
||||
#include <linux/mfd/max8997-private.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/irqdomain.h>
|
||||
|
||||
#define DEV_NAME "max8997-muic"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
|
||||
#include "extcon-rt8973a.h"
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
|
||||
#include "extcon-sm5502.h"
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mfd/cros_ec.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
#define SUPPORTED_CABLE_MAX 32
|
||||
|
||||
struct __extcon_info {
|
||||
static const struct __extcon_info {
|
||||
unsigned int type;
|
||||
unsigned int id;
|
||||
const char *name;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef __LINUX_EXTCON_INTERNAL_H__
|
||||
#define __LINUX_EXTCON_INTERNAL_H__
|
||||
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
|
||||
/**
|
||||
* struct extcon_dev - An extcon device represents one external connector.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <linux/clk.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/kernel.h>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/extcon.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/init.h>
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user