forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-02-20 e636c8d336489bf3eed5878299e6cc045bbad077
kernel/drivers/usb/core/port.c
....@@ -16,6 +16,15 @@
1616
1717 static const struct attribute_group *port_dev_group[];
1818
19
+static ssize_t location_show(struct device *dev,
20
+ struct device_attribute *attr, char *buf)
21
+{
22
+ struct usb_port *port_dev = to_usb_port(dev);
23
+
24
+ return sprintf(buf, "0x%08x\n", port_dev->location);
25
+}
26
+static DEVICE_ATTR_RO(location);
27
+
1928 static ssize_t connect_type_show(struct device *dev,
2029 struct device_attribute *attr, char *buf)
2130 {
....@@ -140,6 +149,7 @@
140149
141150 static struct attribute *port_dev_attrs[] = {
142151 &dev_attr_connect_type.attr,
152
+ &dev_attr_location.attr,
143153 &dev_attr_quirks.attr,
144154 &dev_attr_over_current_count.attr,
145155 NULL,
....@@ -281,6 +291,14 @@
281291 }
282292 #endif
283293
294
+static void usb_port_shutdown(struct device *dev)
295
+{
296
+ struct usb_port *port_dev = to_usb_port(dev);
297
+
298
+ if (port_dev->child)
299
+ usb_disable_usb2_hardware_lpm(port_dev->child);
300
+}
301
+
284302 static const struct dev_pm_ops usb_port_pm_ops = {
285303 #ifdef CONFIG_PM
286304 .runtime_suspend = usb_port_runtime_suspend,
....@@ -297,6 +315,7 @@
297315 static struct device_driver usb_port_driver = {
298316 .name = "usb",
299317 .owner = THIS_MODULE,
318
+ .shutdown = usb_port_shutdown,
300319 };
301320
302321 static int link_peers(struct usb_port *left, struct usb_port *right)