Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 326142
b: refs/heads/master
c: 655db79
h: refs/heads/master
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Sep 25, 2012
1 parent e36a688 commit 58c3019
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 1,546 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 80fab3b244a22e0ca539d2439bdda50e81e5666f
refs/heads/master: 655db7980596f0ad4f15f8f4c51beb3e705762de
24 changes: 0 additions & 24 deletions trunk/Documentation/ABI/testing/sysfs-bus-usb
Original file line number Diff line number Diff line change
Expand Up @@ -227,27 +227,3 @@ Contact: Lan Tianyu <tianyu.lan@intel.com>
Description:
The /sys/bus/usb/devices/.../(hub interface)/portX
is usb port device's sysfs directory.

What: /sys/bus/usb/devices/.../(hub interface)/portX/control
Date: August 2012
Contact: Lan Tianyu <tianyu.lan@intel.com>
Description:
The /sys/bus/usb/devices/.../(hub interface)/portX/control
attribute allows user space to control the power policy on
the usb port.

All ports have one of the following two values for control
"on" - port power must be on.
"off" - port power must be off.

What: /sys/bus/usb/devices/.../(hub interface)/portX/state
Date: August 2012
Contact: Lan Tianyu <tianyu.lan@intel.com>
Description:
The /sys/bus/usb/devices/.../(hub interface)/portX/state
attribute allows user space to check hub port's power state.

All ports have three following states
"on" - port power on
"off" - port power off
"error" - can't get the hub port's power state
133 changes: 1 addition & 132 deletions trunk/drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,11 @@
#endif
#endif

enum port_power_policy {
USB_PORT_POWER_ON = 0,
USB_PORT_POWER_OFF,
};

struct usb_port {
struct usb_device *child;
struct device dev;
struct dev_state *port_owner;
enum usb_port_connect_type connect_type;
enum port_power_policy port_power_policy;
};

struct usb_hub {
Expand Down Expand Up @@ -99,10 +93,6 @@ struct usb_hub {
struct usb_port **ports;
};

static const char on_string[] = "on";
static const char off_string[] = "off";
static const struct attribute_group *port_dev_group[];

static inline int hub_is_superspeed(struct usb_device *hdev)
{
return (hdev->descriptor.bDeviceProtocol == USB_HUB_PR_SS);
Expand Down Expand Up @@ -855,12 +845,7 @@ static unsigned hub_power_on(struct usb_hub *hub, bool do_delay)
dev_dbg(hub->intfdev, "trying to enable port power on "
"non-switchable hub\n");
for (port1 = 1; port1 <= hub->descriptor->bNbrPorts; port1++)
if (hub->ports[port1 - 1]->port_power_policy
== USB_PORT_POWER_ON)
set_port_feature(hub->hdev, port1, USB_PORT_FEAT_POWER);
else
clear_port_feature(hub->hdev, port1,
USB_PORT_FEAT_POWER);
set_port_feature(hub->hdev, port1, USB_PORT_FEAT_POWER);

/* Wait at least 100 msec for power to become stable */
delay = max(pgood_delay, (unsigned) 100);
Expand Down Expand Up @@ -1278,7 +1263,6 @@ static int usb_hub_create_port_device(struct usb_hub *hub,

hub->ports[port1 - 1] = port_dev;
port_dev->dev.parent = hub->intfdev;
port_dev->dev.groups = port_dev_group;
port_dev->dev.type = &usb_port_device_type;
dev_set_name(&port_dev->dev, "port%d", port1);

Expand Down Expand Up @@ -2644,25 +2628,6 @@ static int port_is_power_on(struct usb_hub *hub, unsigned portstatus)
return ret;
}

static int usb_get_hub_port_power_state(struct usb_device *hdev, int port1)
{
struct usb_hub *hub = hdev_to_hub(hdev);
struct usb_port_status data;
u16 portstatus;
int ret;

ret = get_port_status(hub->hdev, port1, &data);
if (ret < 4) {
dev_err(hub->intfdev,
"%s failed (err = %d)\n", __func__, ret);
if (ret >= 0)
ret = -EIO;
return ret;
} else
portstatus = le16_to_cpu(data.wPortStatus);
return port_is_power_on(hub, portstatus);
}

#ifdef CONFIG_PM

/* Check if a port is suspended(USB2.0 port) or in U3 state(USB3.0 port) */
Expand Down Expand Up @@ -4669,102 +4634,6 @@ static int hub_thread(void *__unused)
return 0;
}

static ssize_t show_port_power_state(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct usb_device *udev = to_usb_device(dev->parent->parent);
struct usb_interface *intf = to_usb_interface(dev->parent);
int port1, power_state;
const char *result;

sscanf(dev_name(dev), "port%d", &port1);
usb_autopm_get_interface(intf);
power_state = usb_get_hub_port_power_state(udev, port1);
usb_autopm_put_interface(intf);
if (power_state == 1)
result = on_string;
else if (!power_state)
result = off_string;
else
result = "error";
return sprintf(buf, "%s\n", result);
}
static DEVICE_ATTR(state, S_IRUGO, show_port_power_state, NULL);

static ssize_t show_port_power_control(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct usb_port *hub_port = to_usb_port(dev);
const char *result;

switch (hub_port->port_power_policy) {
case USB_PORT_POWER_ON:
result = on_string;
break;
case USB_PORT_POWER_OFF:
result = off_string;
break;
default:
return -EINVAL;
}
return sprintf(buf, "%s\n", result);
}

static ssize_t store_port_power_control(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct usb_device *hdev = to_usb_device(dev->parent->parent);
struct usb_interface *intf = to_usb_interface(dev->parent);
struct usb_port *hub_port = to_usb_port(dev);
int port1, ret, len = count;
char *cp;

sscanf(dev_name(dev), "port%d", &port1);
cp = memchr(buf, '\n', count);
if (cp)
len = cp - buf;
if (len == sizeof(on_string) - 1
&& strncmp(buf, on_string, len) == 0) {
hub_port->port_power_policy = USB_PORT_POWER_ON;
usb_autopm_get_interface(intf);
ret = set_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
usb_autopm_put_interface(intf);
if (ret < 0)
return -EIO;
} else if (len == sizeof(off_string) - 1
&& strncmp(buf, off_string, len) == 0) {
struct usb_hub *hub = hdev_to_hub(hdev);

hub_port->port_power_policy = USB_PORT_POWER_OFF;
usb_autopm_get_interface(intf);
hub_port_logical_disconnect(hub, port1);
ret = clear_port_feature(hdev, port1, USB_PORT_FEAT_POWER);
usb_autopm_put_interface(intf);
if (ret < 0)
return -EIO;
} else
return -EINVAL;

return count;
}
static DEVICE_ATTR(control, S_IWUSR | S_IRUGO, show_port_power_control,
store_port_power_control);

static struct attribute *port_dev_attrs[] = {
&dev_attr_control.attr,
&dev_attr_state.attr,
NULL,
};

static struct attribute_group port_dev_attr_grp = {
.attrs = port_dev_attrs,
};

static const struct attribute_group *port_dev_group[] = {
&port_dev_attr_grp,
NULL,
};

static const struct usb_device_id hub_id_table[] = {
{ .match_flags = USB_DEVICE_ID_MATCH_DEV_CLASS,
.bDeviceClass = USB_CLASS_HUB},
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/usb/host/ehci-fsl.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,7 @@ static int ehci_fsl_setup_phy(struct usb_hcd *hcd,
break;
}

if ((pdata->controller_ver) && ((phy_mode == FSL_USB2_PHY_ULPI) ||
(phy_mode == FSL_USB2_PHY_UTMI))) {
if (pdata->controller_ver && (phy_mode == FSL_USB2_PHY_ULPI)) {
/* check PHY_CLK_VALID to get phy clk valid */
if (!spin_event_timeout(in_be32(non_ehci + FSL_SOC_USB_CTRL) &
PHY_CLK_VALID, FSL_USB_PHY_CLK_TIMEOUT, 0)) {
Expand Down
8 changes: 0 additions & 8 deletions trunk/drivers/usb/serial/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,6 @@ config USB_SERIAL_VISOR
To compile this driver as a module, choose M here: the
module will be called visor.

config USB_SERIAL_VIZZINI
tristate "USB Vizzini Serial Converter Driver"
help
Say Y here if you have a Vizzini USB to serial device.

To compile this driver as a module, choose M here: the
module will be called vizzini.

config USB_SERIAL_IPAQ
tristate "USB PocketPC PDA Driver"
help
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/usb/serial/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ obj-$(CONFIG_USB_SERIAL_SYMBOL) += symbolserial.o
obj-$(CONFIG_USB_SERIAL_WWAN) += usb_wwan.o
obj-$(CONFIG_USB_SERIAL_TI) += ti_usb_3410_5052.o
obj-$(CONFIG_USB_SERIAL_VISOR) += visor.o
obj-$(CONFIG_USB_SERIAL_VIZZINI) += vizzini.o
obj-$(CONFIG_USB_SERIAL_WHITEHEAT) += whiteheat.o
obj-$(CONFIG_USB_SERIAL_XIRCOM) += keyspan_pda.o
obj-$(CONFIG_USB_SERIAL_VIVOPAY_SERIAL) += vivopay-serial.o
Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/usb/serial/ftdi_sio.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ static struct usb_device_id id_table_combined [] = {
{ USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_TAVIR_STK500_PID) },
{ USB_DEVICE(FTDI_VID, FTDI_TIAO_UMPA_PID),
.driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
/*
* ELV devices:
*/
Expand Down
5 changes: 5 additions & 0 deletions trunk/drivers/usb/serial/ftdi_sio_ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,11 @@
*/
#define FTDI_TAVIR_STK500_PID 0xFA33 /* STK500 AVR programmer */

/*
* TIAO product ids (FTDI_VID)
* http://www.tiaowiki.com/w/Main_Page
*/
#define FTDI_TIAO_UMPA_PID 0x8a98 /* TIAO/DIYGADGET USB Multi-Protocol Adapter */


/********************************/
Expand Down
Loading

0 comments on commit 58c3019

Please sign in to comment.