Commit 24d142d5 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

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

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

Chanwoo writes:

Update extcon for 4.16

Detailed description for this pull request:
1. Add support to notify USB connector for "ChromeOS Embedded Controller".
- extcon-usbc-cros-ec driver detects the EXTCON_USB and EXTCON_USB_HOST
  connector type and then notify the state/properties to the consumer device.

2. Update the detection on probe time and clean-up code for "X-Power AXP288".
- Detect the state of connector after a couple of seconds after probe()
  becasue extcon-axp288.c driver depends on other device driver like mux.
  In order to guarantee the correct state, the extcon-axp288.c uses the
  delayed_work.
- Set EXTCON_CHG_USB_SDP type as the safe default type if unknown connector
  is attached because the data sheet of axp288 doesn't handle
  the all exception cases.
- Remove unused code

3. Fix the minor issue of extcon driver
- Fix platform get_irq's error checking for extcon-adc-jack.
- Delete unneeded initialization for extcon-max8997/max77693.
parents 337ccce6 ca90a64d
...@@ -144,7 +144,7 @@ static int adc_jack_probe(struct platform_device *pdev) ...@@ -144,7 +144,7 @@ static int adc_jack_probe(struct platform_device *pdev)
return err; return err;
data->irq = platform_get_irq(pdev, 0); data->irq = platform_get_irq(pdev, 0);
if (!data->irq) { if (data->irq < 0) {
dev_err(&pdev->dev, "platform_get_irq failed\n"); dev_err(&pdev->dev, "platform_get_irq failed\n");
return -ENODEV; return -ENODEV;
} }
......
/* /*
* extcon-axp288.c - X-Power AXP288 PMIC extcon cable detection driver * extcon-axp288.c - X-Power AXP288 PMIC extcon cable detection driver
* *
* Copyright (C) 2016-2017 Hans de Goede <hdegoede@redhat.com>
* Copyright (C) 2015 Intel Corporation * Copyright (C) 2015 Intel Corporation
* Author: Ramakrishna Pallala <ramakrishna.pallala@intel.com> * Author: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
* *
...@@ -24,8 +25,6 @@ ...@@ -24,8 +25,6 @@
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/extcon-provider.h> #include <linux/extcon-provider.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/mfd/axp20x.h> #include <linux/mfd/axp20x.h>
/* Power source status register */ /* Power source status register */
...@@ -79,11 +78,6 @@ enum axp288_extcon_reg { ...@@ -79,11 +78,6 @@ enum axp288_extcon_reg {
AXP288_BC_DET_STAT_REG = 0x2f, AXP288_BC_DET_STAT_REG = 0x2f,
}; };
enum axp288_mux_select {
EXTCON_GPIO_MUX_SEL_PMIC = 0,
EXTCON_GPIO_MUX_SEL_SOC,
};
enum axp288_extcon_irq { enum axp288_extcon_irq {
VBUS_FALLING_IRQ = 0, VBUS_FALLING_IRQ = 0,
VBUS_RISING_IRQ, VBUS_RISING_IRQ,
...@@ -104,11 +98,11 @@ struct axp288_extcon_info { ...@@ -104,11 +98,11 @@ struct axp288_extcon_info {
struct device *dev; struct device *dev;
struct regmap *regmap; struct regmap *regmap;
struct regmap_irq_chip_data *regmap_irqc; struct regmap_irq_chip_data *regmap_irqc;
struct gpio_desc *gpio_mux_cntl; struct delayed_work det_work;
int irq[EXTCON_IRQ_END]; int irq[EXTCON_IRQ_END];
struct extcon_dev *edev; struct extcon_dev *edev;
struct notifier_block extcon_nb;
unsigned int previous_cable; unsigned int previous_cable;
bool first_detect_done;
}; };
/* Power up/down reason string array */ /* Power up/down reason string array */
...@@ -146,6 +140,25 @@ static void axp288_extcon_log_rsi(struct axp288_extcon_info *info) ...@@ -146,6 +140,25 @@ static void axp288_extcon_log_rsi(struct axp288_extcon_info *info)
regmap_write(info->regmap, AXP288_PS_BOOT_REASON_REG, clear_mask); regmap_write(info->regmap, AXP288_PS_BOOT_REASON_REG, clear_mask);
} }
static void axp288_chrg_detect_complete(struct axp288_extcon_info *info)
{
/*
* We depend on other drivers to do things like mux the data lines,
* enable/disable vbus based on the id-pin, etc. Sometimes the BIOS has
* not set these things up correctly resulting in the initial charger
* cable type detection giving a wrong result and we end up not charging
* or charging at only 0.5A.
*
* So we schedule a second cable type detection after 2 seconds to
* give the other drivers time to load and do their thing.
*/
if (!info->first_detect_done) {
queue_delayed_work(system_wq, &info->det_work,
msecs_to_jiffies(2000));
info->first_detect_done = true;
}
}
static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info) static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)
{ {
int ret, stat, cfg, pwr_stat; int ret, stat, cfg, pwr_stat;
...@@ -192,20 +205,11 @@ static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info) ...@@ -192,20 +205,11 @@ static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)
cable = EXTCON_CHG_USB_DCP; cable = EXTCON_CHG_USB_DCP;
break; break;
default: default:
dev_warn(info->dev, dev_warn(info->dev, "unknown (reserved) bc detect result\n");
"disconnect or unknown or ID event\n"); cable = EXTCON_CHG_USB_SDP;
} }
no_vbus: no_vbus:
/*
* If VBUS is absent Connect D+/D- lines to PMIC for BC
* detection. Else connect them to SOC for USB communication.
*/
if (info->gpio_mux_cntl)
gpiod_set_value(info->gpio_mux_cntl,
vbus_attach ? EXTCON_GPIO_MUX_SEL_SOC
: EXTCON_GPIO_MUX_SEL_PMIC);
extcon_set_state_sync(info->edev, info->previous_cable, false); extcon_set_state_sync(info->edev, info->previous_cable, false);
if (info->previous_cable == EXTCON_CHG_USB_SDP) if (info->previous_cable == EXTCON_CHG_USB_SDP)
extcon_set_state_sync(info->edev, EXTCON_USB, false); extcon_set_state_sync(info->edev, EXTCON_USB, false);
...@@ -219,6 +223,8 @@ static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info) ...@@ -219,6 +223,8 @@ static int axp288_handle_chrg_det_event(struct axp288_extcon_info *info)
info->previous_cable = cable; info->previous_cable = cable;
} }
axp288_chrg_detect_complete(info);
return 0; return 0;
dev_det_ret: dev_det_ret:
...@@ -240,8 +246,11 @@ static irqreturn_t axp288_extcon_isr(int irq, void *data) ...@@ -240,8 +246,11 @@ static irqreturn_t axp288_extcon_isr(int irq, void *data)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void axp288_extcon_enable(struct axp288_extcon_info *info) static void axp288_extcon_det_work(struct work_struct *work)
{ {
struct axp288_extcon_info *info =
container_of(work, struct axp288_extcon_info, det_work.work);
regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG, regmap_update_bits(info->regmap, AXP288_BC_GLOBAL_REG,
BC_GLOBAL_RUN, 0); BC_GLOBAL_RUN, 0);
/* Enable the charger detection logic */ /* Enable the charger detection logic */
...@@ -253,8 +262,7 @@ static int axp288_extcon_probe(struct platform_device *pdev) ...@@ -253,8 +262,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
{ {
struct axp288_extcon_info *info; struct axp288_extcon_info *info;
struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent); struct axp20x_dev *axp20x = dev_get_drvdata(pdev->dev.parent);
struct axp288_extcon_pdata *pdata = pdev->dev.platform_data; int ret, i, pirq;
int ret, i, pirq, gpio;
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
if (!info) if (!info)
...@@ -264,8 +272,7 @@ static int axp288_extcon_probe(struct platform_device *pdev) ...@@ -264,8 +272,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
info->regmap = axp20x->regmap; info->regmap = axp20x->regmap;
info->regmap_irqc = axp20x->regmap_irqc; info->regmap_irqc = axp20x->regmap_irqc;
info->previous_cable = EXTCON_NONE; info->previous_cable = EXTCON_NONE;
if (pdata) INIT_DELAYED_WORK(&info->det_work, axp288_extcon_det_work);
info->gpio_mux_cntl = pdata->gpio_mux_cntl;
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
...@@ -286,21 +293,11 @@ static int axp288_extcon_probe(struct platform_device *pdev) ...@@ -286,21 +293,11 @@ static int axp288_extcon_probe(struct platform_device *pdev)
return ret; return ret;
} }
/* Set up gpio control for USB Mux */
if (info->gpio_mux_cntl) {
gpio = desc_to_gpio(info->gpio_mux_cntl);
ret = devm_gpio_request(&pdev->dev, gpio, "USB_MUX");
if (ret < 0) {
dev_err(&pdev->dev,
"failed to request the gpio=%d\n", gpio);
return ret;
}
gpiod_direction_output(info->gpio_mux_cntl,
EXTCON_GPIO_MUX_SEL_PMIC);
}
for (i = 0; i < EXTCON_IRQ_END; i++) { for (i = 0; i < EXTCON_IRQ_END; i++) {
pirq = platform_get_irq(pdev, i); pirq = platform_get_irq(pdev, i);
if (pirq < 0)
return pirq;
info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq); info->irq[i] = regmap_irq_get_virq(info->regmap_irqc, pirq);
if (info->irq[i] < 0) { if (info->irq[i] < 0) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
...@@ -321,7 +318,7 @@ static int axp288_extcon_probe(struct platform_device *pdev) ...@@ -321,7 +318,7 @@ static int axp288_extcon_probe(struct platform_device *pdev)
} }
/* Start charger cable type detection */ /* Start charger cable type detection */
axp288_extcon_enable(info); queue_delayed_work(system_wq, &info->det_work, 0);
return 0; return 0;
} }
......
...@@ -266,7 +266,7 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info, ...@@ -266,7 +266,7 @@ static int max77693_muic_set_debounce_time(struct max77693_muic_info *info,
static int max77693_muic_set_path(struct max77693_muic_info *info, static int max77693_muic_set_path(struct max77693_muic_info *info,
u8 val, bool attached) u8 val, bool attached)
{ {
int ret = 0; int ret;
unsigned int ctrl1, ctrl2 = 0; unsigned int ctrl1, ctrl2 = 0;
if (attached) if (attached)
......
...@@ -204,7 +204,7 @@ static int max8997_muic_set_debounce_time(struct max8997_muic_info *info, ...@@ -204,7 +204,7 @@ static int max8997_muic_set_debounce_time(struct max8997_muic_info *info,
static int max8997_muic_set_path(struct max8997_muic_info *info, static int max8997_muic_set_path(struct max8997_muic_info *info,
u8 val, bool attached) u8 val, bool attached)
{ {
int ret = 0; int ret;
u8 ctrl1, ctrl2 = 0; u8 ctrl1, ctrl2 = 0;
if (attached) if (attached)
......
...@@ -34,16 +34,26 @@ struct cros_ec_extcon_info { ...@@ -34,16 +34,26 @@ struct cros_ec_extcon_info {
struct notifier_block notifier; struct notifier_block notifier;
unsigned int dr; /* data role */
bool pr; /* power role (true if VBUS enabled) */
bool dp; /* DisplayPort enabled */ bool dp; /* DisplayPort enabled */
bool mux; /* SuperSpeed (usb3) enabled */ bool mux; /* SuperSpeed (usb3) enabled */
unsigned int power_type; unsigned int power_type;
}; };
static const unsigned int usb_type_c_cable[] = { static const unsigned int usb_type_c_cable[] = {
EXTCON_USB,
EXTCON_USB_HOST,
EXTCON_DISP_DP, EXTCON_DISP_DP,
EXTCON_NONE, EXTCON_NONE,
}; };
enum usb_data_roles {
DR_NONE,
DR_HOST,
DR_DEVICE,
};
/** /**
* cros_ec_pd_command() - Send a command to the EC. * cros_ec_pd_command() - Send a command to the EC.
* @info: pointer to struct cros_ec_extcon_info * @info: pointer to struct cros_ec_extcon_info
...@@ -150,6 +160,7 @@ static int cros_ec_usb_get_role(struct cros_ec_extcon_info *info, ...@@ -150,6 +160,7 @@ static int cros_ec_usb_get_role(struct cros_ec_extcon_info *info,
pd_control.port = info->port_id; pd_control.port = info->port_id;
pd_control.role = USB_PD_CTRL_ROLE_NO_CHANGE; pd_control.role = USB_PD_CTRL_ROLE_NO_CHANGE;
pd_control.mux = USB_PD_CTRL_MUX_NO_CHANGE; pd_control.mux = USB_PD_CTRL_MUX_NO_CHANGE;
pd_control.swap = USB_PD_CTRL_SWAP_NONE;
ret = cros_ec_pd_command(info, EC_CMD_USB_PD_CONTROL, 1, ret = cros_ec_pd_command(info, EC_CMD_USB_PD_CONTROL, 1,
&pd_control, sizeof(pd_control), &pd_control, sizeof(pd_control),
&resp, sizeof(resp)); &resp, sizeof(resp));
...@@ -183,11 +194,72 @@ static int cros_ec_pd_get_num_ports(struct cros_ec_extcon_info *info) ...@@ -183,11 +194,72 @@ static int cros_ec_pd_get_num_ports(struct cros_ec_extcon_info *info)
return resp.num_ports; return resp.num_ports;
} }
static const char *cros_ec_usb_role_string(unsigned int role)
{
return role == DR_NONE ? "DISCONNECTED" :
(role == DR_HOST ? "DFP" : "UFP");
}
static const char *cros_ec_usb_power_type_string(unsigned int type)
{
switch (type) {
case USB_CHG_TYPE_NONE:
return "USB_CHG_TYPE_NONE";
case USB_CHG_TYPE_PD:
return "USB_CHG_TYPE_PD";
case USB_CHG_TYPE_PROPRIETARY:
return "USB_CHG_TYPE_PROPRIETARY";
case USB_CHG_TYPE_C:
return "USB_CHG_TYPE_C";
case USB_CHG_TYPE_BC12_DCP:
return "USB_CHG_TYPE_BC12_DCP";
case USB_CHG_TYPE_BC12_CDP:
return "USB_CHG_TYPE_BC12_CDP";
case USB_CHG_TYPE_BC12_SDP:
return "USB_CHG_TYPE_BC12_SDP";
case USB_CHG_TYPE_OTHER:
return "USB_CHG_TYPE_OTHER";
case USB_CHG_TYPE_VBUS:
return "USB_CHG_TYPE_VBUS";
case USB_CHG_TYPE_UNKNOWN:
return "USB_CHG_TYPE_UNKNOWN";
default:
return "USB_CHG_TYPE_UNKNOWN";
}
}
static bool cros_ec_usb_power_type_is_wall_wart(unsigned int type,
unsigned int role)
{
switch (type) {
/* FIXME : Guppy, Donnettes, and other chargers will be miscategorized
* because they identify with USB_CHG_TYPE_C, but we can't return true
* here from that code because that breaks Suzy-Q and other kinds of
* USB Type-C cables and peripherals.
*/
case USB_CHG_TYPE_PROPRIETARY:
case USB_CHG_TYPE_BC12_DCP:
return true;
case USB_CHG_TYPE_PD:
case USB_CHG_TYPE_C:
case USB_CHG_TYPE_BC12_CDP:
case USB_CHG_TYPE_BC12_SDP:
case USB_CHG_TYPE_OTHER:
case USB_CHG_TYPE_VBUS:
case USB_CHG_TYPE_UNKNOWN:
case USB_CHG_TYPE_NONE:
default:
return false;
}
}
static int extcon_cros_ec_detect_cable(struct cros_ec_extcon_info *info, static int extcon_cros_ec_detect_cable(struct cros_ec_extcon_info *info,
bool force) bool force)
{ {
struct device *dev = info->dev; struct device *dev = info->dev;
int role, power_type; int role, power_type;
unsigned int dr = DR_NONE;
bool pr = false;
bool polarity = false; bool polarity = false;
bool dp = false; bool dp = false;
bool mux = false; bool mux = false;
...@@ -206,9 +278,12 @@ static int extcon_cros_ec_detect_cable(struct cros_ec_extcon_info *info, ...@@ -206,9 +278,12 @@ static int extcon_cros_ec_detect_cable(struct cros_ec_extcon_info *info,
dev_err(dev, "failed getting role err = %d\n", role); dev_err(dev, "failed getting role err = %d\n", role);
return role; return role;
} }
dev_dbg(dev, "disconnected\n");
} else { } else {
int pd_mux_state; int pd_mux_state;
dr = (role & PD_CTRL_RESP_ROLE_DATA) ? DR_HOST : DR_DEVICE;
pr = (role & PD_CTRL_RESP_ROLE_POWER);
pd_mux_state = cros_ec_usb_get_pd_mux_state(info); pd_mux_state = cros_ec_usb_get_pd_mux_state(info);
if (pd_mux_state < 0) if (pd_mux_state < 0)
pd_mux_state = USB_PD_MUX_USB_ENABLED; pd_mux_state = USB_PD_MUX_USB_ENABLED;
...@@ -216,20 +291,62 @@ static int extcon_cros_ec_detect_cable(struct cros_ec_extcon_info *info, ...@@ -216,20 +291,62 @@ static int extcon_cros_ec_detect_cable(struct cros_ec_extcon_info *info,
dp = pd_mux_state & USB_PD_MUX_DP_ENABLED; dp = pd_mux_state & USB_PD_MUX_DP_ENABLED;
mux = pd_mux_state & USB_PD_MUX_USB_ENABLED; mux = pd_mux_state & USB_PD_MUX_USB_ENABLED;
hpd = pd_mux_state & USB_PD_MUX_HPD_IRQ; hpd = pd_mux_state & USB_PD_MUX_HPD_IRQ;
}
if (force || info->dp != dp || info->mux != mux || dev_dbg(dev,
info->power_type != power_type) { "connected role 0x%x pwr type %d dr %d pr %d pol %d mux %d dp %d hpd %d\n",
role, power_type, dr, pr, polarity, mux, dp, hpd);
}
/*
* When there is no USB host (e.g. USB PD charger),
* we are not really a UFP for the AP.
*/
if (dr == DR_DEVICE &&
cros_ec_usb_power_type_is_wall_wart(power_type, role))
dr = DR_NONE;
if (force || info->dr != dr || info->pr != pr || info->dp != dp ||
info->mux != mux || info->power_type != power_type) {
bool host_connected = false, device_connected = false;
dev_dbg(dev, "Type/Role switch! type = %s role = %s\n",
cros_ec_usb_power_type_string(power_type),
cros_ec_usb_role_string(dr));
info->dr = dr;
info->pr = pr;
info->dp = dp; info->dp = dp;
info->mux = mux; info->mux = mux;
info->power_type = power_type; info->power_type = power_type;
extcon_set_state(info->edev, EXTCON_DISP_DP, dp); if (dr == DR_DEVICE)
device_connected = true;
else if (dr == DR_HOST)
host_connected = true;
extcon_set_state(info->edev, EXTCON_USB, device_connected);
extcon_set_state(info->edev, EXTCON_USB_HOST, host_connected);
extcon_set_state(info->edev, EXTCON_DISP_DP, dp);
extcon_set_property(info->edev, EXTCON_USB,
EXTCON_PROP_USB_VBUS,
(union extcon_property_value)(int)pr);
extcon_set_property(info->edev, EXTCON_USB_HOST,
EXTCON_PROP_USB_VBUS,
(union extcon_property_value)(int)pr);
extcon_set_property(info->edev, EXTCON_USB,
EXTCON_PROP_USB_TYPEC_POLARITY,
(union extcon_property_value)(int)polarity);
extcon_set_property(info->edev, EXTCON_USB_HOST,
EXTCON_PROP_USB_TYPEC_POLARITY,
(union extcon_property_value)(int)polarity);
extcon_set_property(info->edev, EXTCON_DISP_DP, extcon_set_property(info->edev, EXTCON_DISP_DP,
EXTCON_PROP_USB_TYPEC_POLARITY, EXTCON_PROP_USB_TYPEC_POLARITY,
(union extcon_property_value)(int)polarity); (union extcon_property_value)(int)polarity);
extcon_set_property(info->edev, EXTCON_USB,
EXTCON_PROP_USB_SS,
(union extcon_property_value)(int)mux);
extcon_set_property(info->edev, EXTCON_USB_HOST,
EXTCON_PROP_USB_SS,
(union extcon_property_value)(int)mux);
extcon_set_property(info->edev, EXTCON_DISP_DP, extcon_set_property(info->edev, EXTCON_DISP_DP,
EXTCON_PROP_USB_SS, EXTCON_PROP_USB_SS,
(union extcon_property_value)(int)mux); (union extcon_property_value)(int)mux);
...@@ -237,6 +354,8 @@ static int extcon_cros_ec_detect_cable(struct cros_ec_extcon_info *info, ...@@ -237,6 +354,8 @@ static int extcon_cros_ec_detect_cable(struct cros_ec_extcon_info *info,
EXTCON_PROP_DISP_HPD, EXTCON_PROP_DISP_HPD,
(union extcon_property_value)(int)hpd); (union extcon_property_value)(int)hpd);
extcon_sync(info->edev, EXTCON_USB);
extcon_sync(info->edev, EXTCON_USB_HOST);
extcon_sync(info->edev, EXTCON_DISP_DP); extcon_sync(info->edev, EXTCON_DISP_DP);
} else if (hpd) { } else if (hpd) {
...@@ -322,13 +441,28 @@ static int extcon_cros_ec_probe(struct platform_device *pdev) ...@@ -322,13 +441,28 @@ static int extcon_cros_ec_probe(struct platform_device *pdev)
return ret; return ret;
} }
extcon_set_property_capability(info->edev, EXTCON_USB,
EXTCON_PROP_USB_VBUS);
extcon_set_property_capability(info->edev, EXTCON_USB_HOST,
EXTCON_PROP_USB_VBUS);
extcon_set_property_capability(info->edev, EXTCON_USB,
EXTCON_PROP_USB_TYPEC_POLARITY);
extcon_set_property_capability(info->edev, EXTCON_USB_HOST,
EXTCON_PROP_USB_TYPEC_POLARITY);
extcon_set_property_capability(info->edev, EXTCON_DISP_DP, extcon_set_property_capability(info->edev, EXTCON_DISP_DP,
EXTCON_PROP_USB_TYPEC_POLARITY); EXTCON_PROP_USB_TYPEC_POLARITY);
extcon_set_property_capability(info->edev, EXTCON_USB,
EXTCON_PROP_USB_SS);
extcon_set_property_capability(info->edev, EXTCON_USB_HOST,
EXTCON_PROP_USB_SS);
extcon_set_property_capability(info->edev, EXTCON_DISP_DP, extcon_set_property_capability(info->edev, EXTCON_DISP_DP,
EXTCON_PROP_USB_SS); EXTCON_PROP_USB_SS);
extcon_set_property_capability(info->edev, EXTCON_DISP_DP, extcon_set_property_capability(info->edev, EXTCON_DISP_DP,
EXTCON_PROP_DISP_HPD); EXTCON_PROP_DISP_HPD);
info->dr = DR_NONE;
info->pr = false;
platform_set_drvdata(pdev, info); platform_set_drvdata(pdev, info);
/* Get PD events from the EC */ /* Get PD events from the EC */
......
...@@ -645,11 +645,6 @@ struct axp20x_dev { ...@@ -645,11 +645,6 @@ struct axp20x_dev {
const struct regmap_irq_chip *regmap_irq_chip; const struct regmap_irq_chip *regmap_irq_chip;
}; };
struct axp288_extcon_pdata {
/* GPIO pin control to switch D+/D- lines b/w PMIC and SOC */
struct gpio_desc *gpio_mux_cntl;
};
/* generic helper function for reading 9-16 bit wide regs */ /* generic helper function for reading 9-16 bit wide regs */
static inline int axp20x_read_variable_width(struct regmap *regmap, static inline int axp20x_read_variable_width(struct regmap *regmap,
unsigned int reg, unsigned int width) unsigned int reg, unsigned int width)
......
...@@ -2904,16 +2904,33 @@ enum usb_pd_control_mux { ...@@ -2904,16 +2904,33 @@ enum usb_pd_control_mux {
USB_PD_CTRL_MUX_AUTO = 5, USB_PD_CTRL_MUX_AUTO = 5,
}; };
enum usb_pd_control_swap {
USB_PD_CTRL_SWAP_NONE = 0,
USB_PD_CTRL_SWAP_DATA = 1,
USB_PD_CTRL_SWAP_POWER = 2,
USB_PD_CTRL_SWAP_VCONN = 3,
USB_PD_CTRL_SWAP_COUNT
};
struct ec_params_usb_pd_control { struct ec_params_usb_pd_control {
uint8_t port; uint8_t port;
uint8_t role; uint8_t role;
uint8_t mux; uint8_t mux;
uint8_t swap;
} __packed; } __packed;
#define PD_CTRL_RESP_ENABLED_COMMS (1 << 0) /* Communication enabled */ #define PD_CTRL_RESP_ENABLED_COMMS (1 << 0) /* Communication enabled */
#define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1) /* Device connected */ #define PD_CTRL_RESP_ENABLED_CONNECTED (1 << 1) /* Device connected */
#define PD_CTRL_RESP_ENABLED_PD_CAPABLE (1 << 2) /* Partner is PD capable */ #define PD_CTRL_RESP_ENABLED_PD_CAPABLE (1 << 2) /* Partner is PD capable */
#define PD_CTRL_RESP_ROLE_POWER BIT(0) /* 0=SNK/1=SRC */
#define PD_CTRL_RESP_ROLE_DATA BIT(1) /* 0=UFP/1=DFP */
#define PD_CTRL_RESP_ROLE_VCONN BIT(2) /* Vconn status */
#define PD_CTRL_RESP_ROLE_DR_POWER BIT(3) /* Partner is dualrole power */
#define PD_CTRL_RESP_ROLE_DR_DATA BIT(4) /* Partner is dualrole data */
#define PD_CTRL_RESP_ROLE_USB_COMM BIT(5) /* Partner USB comm capable */
#define PD_CTRL_RESP_ROLE_EXT_POWERED BIT(6) /* Partner externally powerd */
struct ec_response_usb_pd_control_v1 { struct ec_response_usb_pd_control_v1 {
uint8_t enabled; uint8_t enabled;
uint8_t role; uint8_t role;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment