hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/usb/phy/phy.c
....@@ -34,6 +34,14 @@
3434 struct notifier_block *nb;
3535 };
3636
37
+static const char *const usb_chger_type[] = {
38
+ [UNKNOWN_TYPE] = "USB_CHARGER_UNKNOWN_TYPE",
39
+ [SDP_TYPE] = "USB_CHARGER_SDP_TYPE",
40
+ [CDP_TYPE] = "USB_CHARGER_CDP_TYPE",
41
+ [DCP_TYPE] = "USB_CHARGER_DCP_TYPE",
42
+ [ACA_TYPE] = "USB_CHARGER_ACA_TYPE",
43
+};
44
+
3745 static struct usb_phy *__usb_find_phy(struct list_head *list,
3846 enum usb_phy_type type)
3947 {
....@@ -80,7 +88,7 @@
8088
8189 /**
8290 * usb_phy_notify_charger_work - notify the USB charger state
83
- * @work - the charger work to notify the USB charger state
91
+ * @work: the charger work to notify the USB charger state
8492 *
8593 * This work can be issued when USB charger state has been changed or
8694 * USB charger current has been changed, then we can notify the current
....@@ -98,7 +106,8 @@
98106 {
99107 struct usb_phy *usb_phy = container_of(work, struct usb_phy, chg_work);
100108 char uchger_state[50] = { 0 };
101
- char *envp[] = { uchger_state, NULL };
109
+ char uchger_type[50] = { 0 };
110
+ char *envp[] = { uchger_state, uchger_type, NULL };
102111 unsigned int min, max;
103112
104113 switch (usb_phy->chg_state) {
....@@ -122,6 +131,8 @@
122131 return;
123132 }
124133
134
+ snprintf(uchger_type, ARRAY_SIZE(uchger_type),
135
+ "USB_CHARGER_TYPE=%s", usb_chger_type[usb_phy->chg_type]);
125136 kobject_uevent_env(&usb_phy->dev->kobj, KOBJ_CHANGE, envp);
126137 }
127138
....@@ -149,9 +160,9 @@
149160
150161 /**
151162 * usb_phy_get_charger_type - get charger type from extcon subsystem
152
- * @nb -the notifier block to determine charger type
153
- * @state - the cable state
154
- * @data - private data
163
+ * @nb: the notifier block to determine charger type
164
+ * @state: the cable state
165
+ * @data: private data
155166 *
156167 * Determin the charger type from extcon subsystem which also means the
157168 * charger state has been chaned, then we should notify this event.
....@@ -167,8 +178,8 @@
167178
168179 /**
169180 * usb_phy_set_charger_current - set the USB charger current
170
- * @usb_phy - the USB phy to be used
171
- * @mA - the current need to be set
181
+ * @usb_phy: the USB phy to be used
182
+ * @mA: the current need to be set
172183 *
173184 * Usually we only change the charger default current when USB finished the
174185 * enumeration as one SDP charger. As one SDP charger, usb_phy_set_power()
....@@ -220,9 +231,9 @@
220231
221232 /**
222233 * usb_phy_get_charger_current - get the USB charger current
223
- * @usb_phy - the USB phy to be used
224
- * @min - the minimum current
225
- * @max - the maximum current
234
+ * @usb_phy: the USB phy to be used
235
+ * @min: the minimum current
236
+ * @max: the maximum current
226237 *
227238 * Usually we will notify the maximum current to power user, but for some
228239 * special case, power user also need the minimum current value. Then the
....@@ -258,8 +269,8 @@
258269
259270 /**
260271 * usb_phy_set_charger_state - set the USB charger state
261
- * @usb_phy - the USB phy to be used
262
- * @state - the new state need to be set for charger
272
+ * @usb_phy: the USB phy to be used
273
+ * @state: the new state need to be set for charger
263274 *
264275 * The usb phy driver can issue this function when the usb phy driver
265276 * detected the charger state has been changed, in this case the charger
....@@ -403,8 +414,8 @@
403414
404415 /**
405416 * devm_usb_get_phy - find the USB PHY
406
- * @dev - device that requests this phy
407
- * @type - the type of the phy the controller requires
417
+ * @dev: device that requests this phy
418
+ * @type: the type of the phy the controller requires
408419 *
409420 * Gets the phy using usb_get_phy(), and associates a device with it using
410421 * devres. On driver detach, release function is invoked on the devres data,
....@@ -433,7 +444,7 @@
433444
434445 /**
435446 * usb_get_phy - find the USB PHY
436
- * @type - the type of the phy the controller requires
447
+ * @type: the type of the phy the controller requires
437448 *
438449 * Returns the phy driver, after getting a refcount to it; or
439450 * -ENODEV if there is no such phy. The caller is responsible for
....@@ -469,9 +480,9 @@
469480
470481 /**
471482 * devm_usb_get_phy_by_node - find the USB PHY by device_node
472
- * @dev - device that requests this phy
473
- * @node - the device_node for the phy device.
474
- * @nb - a notifier_block to register with the phy.
483
+ * @dev: device that requests this phy
484
+ * @node: the device_node for the phy device.
485
+ * @nb: a notifier_block to register with the phy.
475486 *
476487 * Returns the phy driver associated with the given device_node,
477488 * after getting a refcount to it, -ENODEV if there is no such phy or
....@@ -529,9 +540,9 @@
529540
530541 /**
531542 * devm_usb_get_phy_by_phandle - find the USB PHY by phandle
532
- * @dev - device that requests this phy
533
- * @phandle - name of the property holding the phy phandle value
534
- * @index - the index of the phy
543
+ * @dev: device that requests this phy
544
+ * @phandle: name of the property holding the phy phandle value
545
+ * @index: the index of the phy
535546 *
536547 * Returns the phy driver associated with the given phandle value,
537548 * after getting a refcount to it, -ENODEV if there is no such phy or
....@@ -567,8 +578,8 @@
567578
568579 /**
569580 * devm_usb_put_phy - release the USB PHY
570
- * @dev - device that wants to release this phy
571
- * @phy - the phy returned by devm_usb_get_phy()
581
+ * @dev: device that wants to release this phy
582
+ * @phy: the phy returned by devm_usb_get_phy()
572583 *
573584 * destroys the devres associated with this phy and invokes usb_put_phy
574585 * to release the phy.
....@@ -604,9 +615,9 @@
604615 EXPORT_SYMBOL_GPL(usb_put_phy);
605616
606617 /**
607
- * usb_add_phy - declare the USB PHY
618
+ * usb_add_phy: declare the USB PHY
608619 * @x: the USB phy to be used; or NULL
609
- * @type - the type of this PHY
620
+ * @type: the type of this PHY
610621 *
611622 * This call is exclusively for use by phy drivers, which
612623 * coordinate the activities of drivers for host and peripheral
....@@ -703,6 +714,7 @@
703714 /**
704715 * usb_phy_set_event - set event to phy event
705716 * @x: the phy returned by usb_get_phy();
717
+ * @event: event to set
706718 *
707719 * This sets event to phy event
708720 */