| .. | .. |
|---|
| 34 | 34 | struct notifier_block *nb; |
|---|
| 35 | 35 | }; |
|---|
| 36 | 36 | |
|---|
| 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 | + |
|---|
| 37 | 45 | static struct usb_phy *__usb_find_phy(struct list_head *list, |
|---|
| 38 | 46 | enum usb_phy_type type) |
|---|
| 39 | 47 | { |
|---|
| .. | .. |
|---|
| 80 | 88 | |
|---|
| 81 | 89 | /** |
|---|
| 82 | 90 | * 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 |
|---|
| 84 | 92 | * |
|---|
| 85 | 93 | * This work can be issued when USB charger state has been changed or |
|---|
| 86 | 94 | * USB charger current has been changed, then we can notify the current |
|---|
| .. | .. |
|---|
| 98 | 106 | { |
|---|
| 99 | 107 | struct usb_phy *usb_phy = container_of(work, struct usb_phy, chg_work); |
|---|
| 100 | 108 | 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 }; |
|---|
| 102 | 111 | unsigned int min, max; |
|---|
| 103 | 112 | |
|---|
| 104 | 113 | switch (usb_phy->chg_state) { |
|---|
| .. | .. |
|---|
| 122 | 131 | return; |
|---|
| 123 | 132 | } |
|---|
| 124 | 133 | |
|---|
| 134 | + snprintf(uchger_type, ARRAY_SIZE(uchger_type), |
|---|
| 135 | + "USB_CHARGER_TYPE=%s", usb_chger_type[usb_phy->chg_type]); |
|---|
| 125 | 136 | kobject_uevent_env(&usb_phy->dev->kobj, KOBJ_CHANGE, envp); |
|---|
| 126 | 137 | } |
|---|
| 127 | 138 | |
|---|
| .. | .. |
|---|
| 149 | 160 | |
|---|
| 150 | 161 | /** |
|---|
| 151 | 162 | * 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 |
|---|
| 155 | 166 | * |
|---|
| 156 | 167 | * Determin the charger type from extcon subsystem which also means the |
|---|
| 157 | 168 | * charger state has been chaned, then we should notify this event. |
|---|
| .. | .. |
|---|
| 167 | 178 | |
|---|
| 168 | 179 | /** |
|---|
| 169 | 180 | * 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 |
|---|
| 172 | 183 | * |
|---|
| 173 | 184 | * Usually we only change the charger default current when USB finished the |
|---|
| 174 | 185 | * enumeration as one SDP charger. As one SDP charger, usb_phy_set_power() |
|---|
| .. | .. |
|---|
| 220 | 231 | |
|---|
| 221 | 232 | /** |
|---|
| 222 | 233 | * 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 |
|---|
| 226 | 237 | * |
|---|
| 227 | 238 | * Usually we will notify the maximum current to power user, but for some |
|---|
| 228 | 239 | * special case, power user also need the minimum current value. Then the |
|---|
| .. | .. |
|---|
| 258 | 269 | |
|---|
| 259 | 270 | /** |
|---|
| 260 | 271 | * 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 |
|---|
| 263 | 274 | * |
|---|
| 264 | 275 | * The usb phy driver can issue this function when the usb phy driver |
|---|
| 265 | 276 | * detected the charger state has been changed, in this case the charger |
|---|
| .. | .. |
|---|
| 403 | 414 | |
|---|
| 404 | 415 | /** |
|---|
| 405 | 416 | * 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 |
|---|
| 408 | 419 | * |
|---|
| 409 | 420 | * Gets the phy using usb_get_phy(), and associates a device with it using |
|---|
| 410 | 421 | * devres. On driver detach, release function is invoked on the devres data, |
|---|
| .. | .. |
|---|
| 433 | 444 | |
|---|
| 434 | 445 | /** |
|---|
| 435 | 446 | * 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 |
|---|
| 437 | 448 | * |
|---|
| 438 | 449 | * Returns the phy driver, after getting a refcount to it; or |
|---|
| 439 | 450 | * -ENODEV if there is no such phy. The caller is responsible for |
|---|
| .. | .. |
|---|
| 469 | 480 | |
|---|
| 470 | 481 | /** |
|---|
| 471 | 482 | * 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. |
|---|
| 475 | 486 | * |
|---|
| 476 | 487 | * Returns the phy driver associated with the given device_node, |
|---|
| 477 | 488 | * after getting a refcount to it, -ENODEV if there is no such phy or |
|---|
| .. | .. |
|---|
| 529 | 540 | |
|---|
| 530 | 541 | /** |
|---|
| 531 | 542 | * 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 |
|---|
| 535 | 546 | * |
|---|
| 536 | 547 | * Returns the phy driver associated with the given phandle value, |
|---|
| 537 | 548 | * after getting a refcount to it, -ENODEV if there is no such phy or |
|---|
| .. | .. |
|---|
| 567 | 578 | |
|---|
| 568 | 579 | /** |
|---|
| 569 | 580 | * 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() |
|---|
| 572 | 583 | * |
|---|
| 573 | 584 | * destroys the devres associated with this phy and invokes usb_put_phy |
|---|
| 574 | 585 | * to release the phy. |
|---|
| .. | .. |
|---|
| 604 | 615 | EXPORT_SYMBOL_GPL(usb_put_phy); |
|---|
| 605 | 616 | |
|---|
| 606 | 617 | /** |
|---|
| 607 | | - * usb_add_phy - declare the USB PHY |
|---|
| 618 | + * usb_add_phy: declare the USB PHY |
|---|
| 608 | 619 | * @x: the USB phy to be used; or NULL |
|---|
| 609 | | - * @type - the type of this PHY |
|---|
| 620 | + * @type: the type of this PHY |
|---|
| 610 | 621 | * |
|---|
| 611 | 622 | * This call is exclusively for use by phy drivers, which |
|---|
| 612 | 623 | * coordinate the activities of drivers for host and peripheral |
|---|
| .. | .. |
|---|
| 703 | 714 | /** |
|---|
| 704 | 715 | * usb_phy_set_event - set event to phy event |
|---|
| 705 | 716 | * @x: the phy returned by usb_get_phy(); |
|---|
| 717 | + * @event: event to set |
|---|
| 706 | 718 | * |
|---|
| 707 | 719 | * This sets event to phy event |
|---|
| 708 | 720 | */ |
|---|