Patentable/Patents/US-20260254262-A1
US-20260254262-A1

Charging Method, Electronic Device, and Related Apparatus

PublishedAugust 27, 2026
Assigneenot available in USPTO data we have
Technical Abstract

Embodiments of this application provide a charging method, an electronic device. The electronic device includes one or more universal serial bus USB ports, and the electronic device is connected to a first external device through a first USB port. The method may include: The electronic device and the first external device determine charging power of a first specification based on a first message; the electronic device outputs the charging power of the first specification to the first external device; and when the first external device supports higher charging power, the electronic device outputs charging power of a second specification to the first external device based on a protocol interaction result between the electronic device and the first external device, where the charging power of the second specification includes charging power at a highest charging level that can be received by the first external device.

Patent Claims

Legal claims defining the scope of protection, as filed with the USPTO.

1

sending a first message to the first external device through the first USB port, wherein the first message comprises charging power that the electronic device supports outputting to the first external device; receiving, from the first external device, a request for charging power of a first specification, wherein the charging power of the first specification is the charging power that the electronic device supports outputting to the first external device; outputting the charging power of the first specification to the first external device through the first USB port; receiving, from the first external device, a request for charging power of a second specification, wherein the charging power of the second specification comprises charging power of a highest charging level that can be received by the first external device, the charging power of the second specification is the charging power that the electronic device supports outputting to the first external device, and the charging power of the second specification is greater than the charging power of the first specification; and outputting the charging power of the second specification to the first external device through the first USB port. . A charging method, applied to an electronic device, wherein the electronic device comprises one or more universal serial bus USB ports, the electronic device is configured to be connected to a first external device through a first USB port in the one or more USB ports, and the method comprises:

2

claim 1 . The method according to, wherein the electronic device further comprises a switch switching circuit and a processor, the switch switching circuit corresponds to the one or more USB ports, and the switch switching circuit is connected to the processor and short-circuited to a 0-ohm resistor.

3

claim 1 when it is determined that a system of the electronic device is not in a working state and/or a battery level of the electronic device is greater than or equal to a preset threshold, outputting the charging power of the second specification to the first external device through the first USB port. . The method according to, wherein the outputting the charging power of the second specification to the first external device through the first USB port comprises:

4

claim 2 when it is determined that the second external device located at the second USB port does not charge the electronic device, outputting the charging power of the second specification to the first external device through the first USB port. . The method according to, wherein the electronic device is connected to a second external device through a second USB port in the one or more USB ports, and the outputting the charging power of the second specification to the first external device through the first USB port comprises:

5

claim 2 receiving a fast charging request from the first external device; controlling, in response to the fast charging request, the switch switching circuit to switch from being connected to the processor to being connected to the 0-ohm resistor; and performing protocol interaction with the first external device through the first USB port, and determining that the electronic device is a dedicated charging port DCP port. . The method according to, wherein the switch switching circuit is configured to be connected to the first USB port and the processor, and after the outputting the charging power of the first specification to the first external device through the first USB port and before the receiving, from the first external device, a request for charging power of a second specification, the method further comprises:

6

claim 5 when it is determined that the second external device located at the second USB port does not charge the electronic device, receiving the fast charging request from the first external device. . The method according to, wherein the electronic device is connected to a second external device through a second USB port in the one or more USB ports, and the receiving a fast charging request from the first external device comprises:

7

claim 2 . The method according to, wherein when the switch switching circuit is connected to the first USB port and the 0-ohm resistor, the electronic device is a DCP port.

8

claim 7 when it is determined that the second external device located at the second USB port does not charge the electronic device, outputting the charging power of the second specification to the first external device through the first USB port. . The method according to, wherein the electronic device is connected to a second external device through a second USB port in the one or more USB ports, and the outputting the charging power of the second specification to the first external device through the first USB port comprises:

9

claim 2 receiving, from the first external device, a request for charging power of a third specification; and adjusting a voltage and current based on the request for the charging power of the third specification, and outputting a voltage and current corresponding to the request for the charging power of the third specification. . The method according to, wherein after the outputting the charging power of the second specification to the first external device through the first USB port, the method further comprises:

10

claim 1 enabling an on-the-go OTG function of the power supply module by using the control unit; turning on a second switch of the power supply module by using the power delivery module, wherein the second switch is configured to be connected to the first USB port and a charger chip in the power supply module, and the charger chip in the power supply module is configured to provide the charging power of the second specification; and outputting the charging power of the second specification to the first external device through the first USB port based on the OTG function and the second switch in an on state. . The method according to, wherein the electronic device comprises one or more of a power delivery module, a control unit, and a power supply module, and the outputting the charging power of the second specification to the first external device through the first USB port comprises:

11

the power delivery module is configured to send a first message to the first external device through the first USB port, wherein the first message comprises charging power that the electronic device supports outputting to the first external device; the power delivery module is configured to receive, from the first external device through the first USB port, a request for charging power of a first specification, wherein the charging power of the first specification is the charging power that the electronic device supports outputting to the first external device; the control unit is configured to control the power supply module to output the charging power of the first specification; the power delivery module is configured to output the charging power of the first specification to the first external device through the first USB port; the power delivery module is further configured to receive, from the first external device through the first USB port, a request for charging power of a second specification, wherein the charging power of the second specification comprises charging power of a highest charging level that can be received by the first external device, the charging power of the second specification is the charging power that the electronic device supports outputting to the first external device, and the charging power of the second specification is greater than the charging power of the first specification; the control unit is configured to control said power supply module to output the charging power of the second specification; and the power delivery module is configured to output the charging power of the second specification to the first external device through the first USB port. . An electronic device, comprising one or more universal serial bus USB ports, a power delivery module, a control unit, and a power supply module, wherein the electronic device is connected to a first external device through a first USB port in the one or more USB ports, and

12

claim 11 . The electronic device according to, wherein the electronic device further comprises a switch switching circuit and a processor, the switch switching circuit corresponds to the one or more USB ports, and the switch switching circuit is connected to the processor and short-circuited to a 0-ohm resistor.

13

claim 12 control the switch switching circuit to switch from being connected to the processor to being connected to the 0-ohm resistor in response to receiving a fast charging request from the first external device. . The electronic device according to, wherein the switch switching circuit is configured to be connected to the first USB port and the processor, the control unit is configured to:

14

claim 13 . The electronic device according to, wherein the electronic device is a DCP port when the switch switching circuit is connected to the first USB port and the 0-ohm resistor.

15

claim 11 . The electronic device according to, wherein the power supply module comprises a buck circuit, the power delivery module comprises a first switch, the first switch connects the first USB port and the buck circuit, and the buck circuit is configured to output the charging power of the first specification.

16

claim 15 . The electronic device according to, wherein the power supply module comprises a charger chip, the power delivery module comprises a second switch, the second switch connects the first USB port and the charger chip, and the charger chip is configured to output the charging power of the second specification.

17

claim 11 . The electronic device according to, wherein the power delivery module is configured to output the charging power of the second specification to the first external device through the first USB port when it is determined that a system of the electronic device is not in a working state and/or a battery level of the electronic device is greater than or equal to a preset threshold.

18

claim 12 . The electronic device according to, wherein the electronic device is configured to be connected to a second external device through a second USB port in the one or more USB ports, the power delivery module is configured to output the charging power of the second specification to the first external device through the first USB port when it is determined that the second external device located at the second USB port does not charge the electronic device.

19

sending a first message to the first external device through the first USB port, wherein the first message comprises charging power that the electronic device supports outputting to the first external device; receiving, from the first external device, a request for charging power of a first specification, wherein the charging power of the first specification is the charging power that the electronic device supports outputting to the first external device; outputting the charging power of the first specification to the first external device through the first USB port; receiving, from the first external device, a request for charging power of a second specification, wherein the charging power of the second specification comprises charging power of a highest charging level that can be received by the first external device, the charging power of the second specification is the charging power that the electronic device supports outputting to the first external device, and the charging power of the second specification is greater than the charging power of the first specification; and outputting the charging power of the second specification to the first external device through the first USB port. . A non-transitory computer-readable storage medium, comprising instructions, wherein when the instructions are run on an electronic device which comprises one or more universal serial bus USB ports and is configured to be connected to a first external device through a first USB port in the one or more USB ports, the electronic device is enabled to perform operations comprising:

20

claim 19 controlling the switch switching circuit to switch from being connected to the processor to being connected to the 0-ohm resistor in response to receiving a fast charging request from the first external device. . The computer-readable storage medium according to, wherein the electronic device further comprises a switch switching circuit and a processor, the switch switching circuit corresponds to the one or more USB ports, and the switch switching circuit is connected to the processor and short-circuited to a 0-ohm resistor; when the instructions are run on an electronic device, the electronic device is enabled to perform operations further comprising:

Detailed Description

Complete technical specification and implementation details from the patent document.

This application is a continuation of International Application No. PCT/CN2024/106253, filed on Jul. 18, 2024, which claims priority to Chinese Patent Application No. 202311532706.8, filed on Nov. 17, 2023. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties.

This application relates to the field of electronic technologies, and in particular, to a charging method, an electronic device, and a related apparatus.

Currently, more terminal devices support a universal serial bus (universal serial bus, USB) Type-C port, and share one USB Type-C port for charging and data transmission. For example, a personal computer (personal computer, PC) product, for example, a desktop computer (Desktop), an all-in-one computer, and a notebook computer (Notebook or Laptop) may be used as a power supply, and provide a charging current for the terminal device through the USB Type-C port, to charge the terminal device.

The USB Type-C port of the PC product supports a USB power delivery (power delivery, PD) protocol, and supports providing a charging power supply of, for example, a maximum of 5 V/3 A for a connected terminal device. How to increase a charging current that can be provided by the PC product requires further research.

Embodiments of this application provide a charging method, an electronic device, and a related apparatus. A connection to an external device may be established through a USB port, to provide different charging power for the external device.

sending a first message to the first external device through the first USB port, where the first message includes charging power that the electronic device supports outputting to the first external device; receiving, from the electronic device, a request for charging power of a first specification, where the charging power of the first specification is the charging power that the electronic device supports outputting to the first external device; outputting the charging power of the first specification to the first external device through the first USB port; receiving, from the electronic device, a request for charging power of a second specification, where the charging power of the second specification includes charging power of a highest charging level that can be received by the first external device, the charging power of the second specification is the charging power that the electronic device supports outputting to the first external device, and the charging power of the second specification is greater than the charging power of the first specification; and outputting the charging power of the second specification to the first external device through the first USB port. According to a first aspect, this application provides a charging method. The method is applied to an electronic device, the electronic device includes one or more universal serial bus USB ports, the electronic device is connected to a first external device through a first USB port in the one or more USB ports, and the method includes:

In an implementation, the USB port includes a USB Type-C port.

According to this embodiment of this application, after the first external device establishes a connection to the electronic device through the USB port, the electronic device may first broadcast, to the first external device, the charging power that the electronic device supports for output. After receiving a response from the first external device, the electronic device first outputs the charging power of the first specification (default charging power, for example, 5 V/2 A) to the first external device. When the first external device supports higher charging power, the first external device may send a request for higher charging power to the electronic device. The electronic device responds to the request, and provides, for the first external device, the charging power at the highest charging level that can be received by the first external device. It may be understood that because the electronic device may provide charging power of various specifications, for the request of the first external device, the electronic device may provide charging power of different specifications for the external device, to satisfy different charging requirements.

In a possible implementation of the first aspect, the electronic device further includes a switch switching circuit and a processor. The switch switching circuit corresponds to the one or more USB ports, and the switch switching circuit is connected to the processor and short-circuited to a 0-ohm resistor. The processor is configured to satisfy requirements of some external devices to provide higher charging power for an electronic device when the electronic device is a DCP port, or satisfy charging solutions of some private protocols.

It can be learned that the USB port may be switched to be connected to the processor or be short-circuited to the 0-ohm resistor through the switch switching circuit. When the USB port is connected to the processor through the switch switching circuit, the electronic device may be considered as an SDP port, and when the USB port is short-circuited to the 0-ohm resistor through the switch switching circuit, the electronic device may be considered as a DCP port.

when it is determined that a system of the electronic device is not in a working state and/or a battery level of the electronic device is greater than or equal to a preset threshold, outputting the charging power of the second specification to the first external device through the first USB port. In a possible implementation of the first aspect, the outputting the charging power of the second specification to the first external device through the first USB port includes:

It can be learned that, in this application, the electronic device outputs charging power externally while ensuring charging requirements of the electronic device. This does not affect power requirements of the electronic device.

when it is determined that the second external device located at the second USB port does not charge the electronic device, outputting the charging power of the second specification to the first external device through the first USB port. In a possible implementation of the first aspect, the electronic device is connected to a second external device through a second USB port in the one or more USB ports, and the outputting the charging power of the second specification to the first external device through the first USB port includes:

It can be learned that, when another USB port is also connected to a device, whether the device charges the electronic device needs to be determined, and when another device does not charge the electronic device, higher charging power is output to the first external device. When another device charges the electronic device, normal charging power is restored. Therefore, unstable performance of the electronic device caused by outputting higher charging power when the electronic device is charged can be avoided.

receiving a fast charging request from the first external device; controlling, in response to the fast charging request, the switch switching circuit to switch from being connected to the processor to being connected to the 0-ohm resistor; and performing protocol interaction with the first external device through the first USB port, and determining that the electronic device is a dedicated charging port DCP port. In a possible implementation of the first aspect, the switch switching circuit is configured to be connected to the first USB port and the processor, and after the outputting the charging power of the first specification to the first external device through the first USB port and before the receiving, from the electronic device, a request for charging power of a second specification, the method further includes:

It can be learned that, when the switch switching circuit is switched to be connected to the first USB port and the processor, the electronic device is identified as an SDP port. If fast charging needs to be performed for the first external device, the switch switching circuit may be switched to be connected to the first USB port and the 0-ohm resistor. In this way, the electronic device is identified as a DCP port, and may output higher charging power to the first external device.

when it is determined that the second external device located at the second USB port does not charge the electronic device, receiving the fast charging request from the first external device. In a possible implementation of the first aspect, the electronic device is connected to a second external device through a second USB port in the one or more USB ports, and the receiving a fast charging request from the first external device includes:

It can be learned that, when another USB port is also connected to a device, whether the device charges the electronic device needs to be determined, and when another device does not charge the electronic device, the fast charging request from the first external device is received. When another device charges the electronic device, normal charging power is restored. Therefore, unstable performance of the electronic device caused by outputting higher charging power when the electronic device is charged can be avoided.

In a possible implementation of the first aspect, when the switch switching circuit is connected to the first USB port and the 0-ohm resistor, the electronic device is a DCP port.

It can be learned that, after the electronic device is identified as the DCP port, the electronic device may support some levels of a PD protocol and a PPS, to output different and higher charging power externally.

when it is determined that the second external device located at the second USB port does not charge the electronic device, outputting the charging power of the second specification to the first external device through the first USB port. In a possible implementation of the first aspect, the electronic device is connected to a second external device through a second USB port in the one or more USB ports, and the outputting the charging power of the second specification to the first external device through the first USB port includes:

It can be learned that, when the electronic device is identified as a DCP port, if another USB port is also connected to a device, whether the device charges the electronic device needs to be determined, and when another device does not charge the electronic device, higher charging power is output to the first external device. When another device charges the electronic device, normal charging power is restored. Therefore, unstable performance of the electronic device caused by outputting higher charging power when the electronic device is charged can be avoided.

receiving, from the electronic device, a request for charging power of a third specification; and adjusting a voltage and current based on the request for the charging power of the third specification, and outputting a voltage and current corresponding to the request for the charging power of the third specification. In a possible implementation of the first aspect, after the outputting the charging power of the second specification to the first external device through the first USB port, the method further includes:

It can be learned that the electronic device may adjust the voltage and current in real time based on a requirement of the first external device, to output charging power matching the requirement of the first external device, so as to adapt to different application environments.

enabling an OTG function of the power supply module by using the control unit; turning on a second switch of the power supply module by using the power delivery module, where the second switch is configured to be connected to the first USB port and a charger chip in the power supply module, and the charger chip in the power supply module is configured to provide the charging power of the second specification; and outputting the charging power of the second specification to the first external device through the first USB port based on the OTG function and the second switch in an on state. In a possible implementation of the first aspect, the electronic device includes one or more of a power delivery module, a control unit, and a power supply module, and the outputting the charging power of the second specification to the first external device through the first USB port includes:

It can be learned that the electronic device outputs higher charging power by using the control unit, the power delivery module, and the power supply module.

According to a second aspect, this application provides an electronic device, including one or more of one or more universal serial bus USB ports, a power delivery module, a control unit, and a power supply module. The electronic device is connected to a first external device through a first USB port in the one or more USB ports.

The power delivery module is configured to send a first message to the first external device through the first USB port, where the first message includes charging power that the electronic device supports outputting to the first external device.

The power delivery module is configured to receive, from the first external device through the first USB port, a request for charging power of a first specification, where the charging power of the first specification is the charging power that the electronic device supports outputting to the first external device.

The control unit is configured to control the power supply module to output the charging power of the first specification.

The power delivery module is configured to output the charging power of the first specification to the first external device through the first USB port.

The power delivery module is further configured to receive, from the first external device through the first USB port, a request for charging power of a second specification, where the charging power of the second specification includes charging power of a highest charging level that can be received by the first external device, the charging power of the second specification is the charging power that the electronic device supports outputting to the first external device, and the charging power of the second specification is greater than the charging power of the first specification.

The control unit is configured to control said power supply module to output the charging power of the second specification.

The power delivery module is configured to output the charging power of the second specification to the first external device through the first USB port.

In a possible implementation of the second aspect, the electronic device further includes a switch switching circuit and a processor. The switch switching circuit corresponds to the one or more USB ports, and the switch switching circuit is connected to the processor and short-circuited to a 0-ohm resistor.

According to a third aspect, an embodiment of this application provides an electronic device. The electronic device includes one or more USB ports, one or more processors, and a memory. The USB port is configured to establish a connection to a device having the USB port, the memory is coupled to the one or more processors, and the memory is configured to store computer program code. The computer program code includes computer instructions, and the one or more processors invoke the computer instructions to enable the electronic device to perform the charging method according to any one of the first aspect or the possible implementations of the first aspect.

According to a fourth aspect, this application provides a chip or a chip system. The chip or the chip system includes at least one processor and a communication interface. The communication interface and the at least one processor are interconnected through a line. The at least one processor is configured to run a computer program or instructions, to perform the charging method according to any one of the first aspect or the possible implementations of the first aspect. The communication interface in the chip may be an input/output interface, a pin, a circuit, or the like.

In a possible implementation, the chip or chip system described above in this embodiment of this application further includes at least one memory, and the at least one memory stores instructions. The memory may be a storage unit inside the chip, for example, a register or a cache, or may be a storage unit (for example, a read-only memory or a random access memory) of the chip.

According to a fifth aspect, an embodiment of this application provides a computer storage medium. The computer storage medium stores a computer program. When the computer program is executed by a processor, a computer is enabled to perform the charging method according to any one of the first aspect or the possible implementations of the first aspect.

According to a sixth aspect, an embodiment of this application provides a computer program product. When the computer program product runs on a communication apparatus, the communication apparatus is enabled to perform the charging method according to any one of the first aspect or the possible implementations of the first aspect.

It should be understood that descriptions of technical features, technical solutions, beneficial effects or similar expressions in this application do not imply that all features and advantages can be achieved in any single embodiment. On the contrary, it may be understood that descriptions of features or beneficial effects mean that specific technical features, technical solutions, or beneficial effects are included in at least one embodiment. Therefore, the descriptions of the technical features, the technical solutions, or the beneficial effects in the specification do not necessarily mean a same embodiment. Further, the technical features, technical solutions, and beneficial effects described in this embodiment may be combined in any suitable manner. A person skilled in the art understands that embodiments can be implemented without one or more particular technical features, technical solutions, or beneficial effects of a particular embodiment. In other embodiments, additional technical features and beneficial effects may be further recognized in a specific embodiment that does not reflect all embodiments.

Terms used in the following embodiments of this application are merely intended to describe specific embodiments, but are not intended to limit this application. The terms “one”, “a”, “the”, “the foregoing”, “this”, and “the one” of singular forms used in this specification and the appended claims of this application are also intended to include plural forms, unless otherwise specified in the context clearly. It should also be understood that the term “and/or” used in this application means and includes any or all possible combinations of one or more listed items.

The terms “first” and “second” below are used for descriptive purposes only, and cannot be construed as implying or implying relative importance or implicitly indicating a quantity of indicated technical features. Therefore, a feature defined with “first” and “second” may explicitly or implicitly includes one or more features. In the descriptions of embodiments of this application, unless otherwise stated, “a plurality of” means two or more.

1. A power delivery (power delivery, PD) protocol is a communication protocol used for electric energy delivery between a power adapter and a charger. In the PD protocol, communication is performed between the power adapter and the charger to implement intelligent power delivery management. A voltage and a current may be adjusted automatically based on a requirement of a device, to provide a charging capability most suitable for the device. The PD protocol further supports bidirectional communication, and allows the device to send a request to the power adapter, for example, adjusting power and obtaining device information. 2. USB Type-C is a USB port of a class C defined by the USB Implementers Forum, supports symmetrical plug and unplug of both front and back, may use any USB delivery protocol such as a USB2.0 protocol, a USB3.0 protocol, or a USB3.1 protocol, and supports functions of USB standard, for example, charging, data transmission, audio transmission, and display and output. For ease of understanding of embodiments of this application, terms or concepts that may be used in embodiments are described below.

A difference between a USB Type-C standard relative to an old standard is that a dual-role capability is introduced. Both ends of each USB Type-C cable are completely identical, which means two connected devices need to communicate with each other to determine whether the device is a host or peripheral. Role communication needs to be separately performed for data and a power supply. In terms of data, a host port used for data communication is referred to as a downstream facing port (downstream facing port, DFP), and a peripheral port is referred to as an upstream facing port (upstream facing port, UFP). In terms of a power supply, a power supply port is referred to as a Source (Source), and a power consumption port is referred to as a Sink (Sink). Some devices can have both a dual-role capability on data and a dual-role capability on a power supply.

3. A charging standard BC 1.2 uses a communication mode based on USB 2.0 D+/D− lines. Port types defined by the charging standard BC1.2 include the following three types: a standard downstream port (standard downstream port, SDP), a dedicated charging port (dedicated charging port, DCP), and a charging downstream port (charging downstream port, CDP). 0 5 4. A system sleep state (S-State) includes but is not limited to six levels: Sto S. 0 Scorresponds to a powered-on state. 1 2 1 2 Sand Scorrespond to sleep states. Scorresponds to a state in which a processor stops working but is still powered on, and Scorresponds to a state in which the processor is turned off and powered off, while a peripheral device like Bluetooth keeps running. 3 Scorresponds to a standby state during sleep, to be specific, a state in which all devices, including the processor, are powered off, while an internal memory keeps running. 4 Scorresponds to a sleep state. 5 Scorresponds to a powered-off state. The USB Type-C cable supports providing a maximum charging voltage/current/power of 5 V/3 A (that is, 15 W), and if the PD protocol is used, the maximum charging voltage/current/power may be increased to 20 V/5 A (that is, 100 W). The USB PD 3.0 protocol supports a programmable power supply (programmable power supply, PPS) protocol, allowing precise regulation of a voltage and a current.

2 Generally, a PC product having a USB Type-C port can charge a terminal device like a mobile phone or a tablet. After handshake between the PC product and the terminal device according to a charging protocol (for example, a PD protocol) succeeds, the PC product may provide a maximum charging voltage/current/power of 5 V/3 A (that is, 15 W), but a charging current is usually limited toA according to a specification. In addition, the terminal device identifies, by default, a port of the PC product as an SDP by using a BC2.1 protocol, and performs data communication with the PC product based on a USB2.0 protocol. It may be understood that the PC product can provide higher charging power for the terminal device based on a PD3.0 or a PD2.0. However, the current terminal device needs to identify a port of a Source (Source) as a DCP before supporting some charging levels of the PD protocol and a PPS. Because the current terminal device identifies by default, after establishing a connection to the PC product, that the port of the PC product is the SDP, charging levels that can be provided by the PC product for the terminal device are limited.

Based on this, this application provides a charging method, an electronic device, and a related apparatus. The electronic device includes one or more USB ports, and the electronic device is connected to a first external device through a first USB port in the one or more USB ports. The electronic device broadcasts supported external charging power to the first external device through the first USB port. The first external device first requests charging power of 5 V/2 A. The electronic device responds to the request, and outputs the charging power of 5 V/2 A to the first external device. Subsequently, if the first external device supports higher charging power (for example, 9 V/2 A), the first external device requests higher charging power (for example, 9 V/2 A) from the electronic device. The electronic device responds to a request, and outputs charging power of, for example, 9 V/2 A to the first external device. It can be learned that the electronic device may provide different charging levels for the first external device.

In a possible implementation, the electronic device further includes a switch switching circuit and a processor. The switch switching circuit corresponds to the one or more USB ports, and the switch switching circuit is connected to the processor and short-circuited to a 0-ohm resistor. When the electronic device performs fast charging for the first external device, the electronic device may control the switch circuit to switch to be connected to the 0-ohm resistor. The electronic device performs protocol interaction with the first external device through the first USB port, and it may be determined that the electronic device is a dedicated charging port DCP port. When the electronic device is identified as the DCP port, some charging levels of the PD protocol and a PPS may be supported.

First, an embodiment of this application provides an electronic device. The electronic device may be used as a power supply to charge a to-be-charged device. The electronic device/to-be-charged device provided in embodiments of this application may be, but is not limited to, a notebook computer (notebook or laptop), a tablet computer, a mobile phone, a desktop computer, an all-in-one computer, a personal digital assistant (personal digital assistant, PDA for short), and may alternatively be a vehicle-mounted computer, a smart wearable device, a smart home device, augmented reality (augmented reality, AR)/virtual reality (virtual reality, VR), or the like. A specific type of the foregoing electronic device and to-be-charged device is not limited in embodiments of this application.

1 FIG. First, a structure of the electronic device is described.is a schematic diagram of a structure of an electronic device according to an embodiment of this application.

100 110 120 121 130 140 141 142 1 2 150 160 170 170 170 170 170 180 190 191 192 193 194 195 180 180 180 180 180 180 180 180 180 180 180 180 180 The electronic devicemay include a processor, an external memory interface, an internal memory, a universal serial bus (universal serial bus, USB) port, a charging management module, a power supply management module, a battery, an antenna, an antenna, a mobile communication module, a wireless communication module, an audio module, a speakerA, a receiverB, a microphoneC, a headset jackD, a sensor module, a key, a motor, an indicator, a camera, a display screen, a subscriber identification module (subscriber identification module, SIM) card interface, and the like. The sensor modulemay include a pressure sensorA, a gyroscope sensorB, a barometric pressure sensorC, a magnetic sensorD, an acceleration sensorE, a distance sensorF, a proximity light sensorG, a fingerprint sensorH, a temperature sensorJ, a touch sensorK, an ambient light sensorL, a bone conduction sensorM, and the like.

100 100 1 1 It may be understood that a schematic structure in this embodiment of the present invention does not constitute a specific limitation on the electronic device. In some other embodiments of this application, the electronic devicemay include more or fewer components than those shown in the figure, or some components may be combined, or some components may be divided, or different component arrangements may be used. The components shown in the figure may be implemented by hardware, software, or a combination of software and hardware. For example, a desktop computer device or an all-in-one computer device may not include the SIM card interface, an antenna group, and the mobile communication module, and a notebook computer may not include the antenna groupand the mobile communication module.

110 110 The processormay include one or more processing units. For example, the processormay include an application processor (application processor, AP), a modem processor, a graphics processing unit (graphics processing unit, GPU), an image signal processor (image signal processor, ISP), a controller, a video codec, a digital signal processor (digital signal processor, DSP), a baseband processor, and/or a neural-network processing unit (neural-network processing unit, NPU). Different processing units may be independent devices, or may be integrated into one or more processors.

The controller may generate an operation control signal based on instruction operation code and a timing signal, to control instruction fetching and instruction execution.

110 110 110 110 110 110 A memory configured to store instructions and data may be further disposed in the processor. In some embodiments, the memory in the processoris a cache. The memory may store instructions or data recently used or cyclically used by the processor. If the processorneeds to use the instructions or the data again, the processormay directly invoke the instructions or the data from the memory. This avoids repeated access and reduces waiting time of the processor, thereby improving system efficiency.

110 2 In some embodiments, the processormay include one or more interfaces. The interface may include an inter-integrated circuit (inter-integrated circuit, IC) interface, an inter-integrated circuit sound (inter-integrated circuit sound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver/transmitter (universal asynchronous receiver/transmitter, UART) interface, a mobile industry processor interface (mobile industry processor interface, MIPI), a general-purpose input/output (general-purpose input/output, GPIO) interface, a subscriber identity module (subscriber identity module, SIM) interface, a universal serial bus (universal serial bus, USB) port, and/or the like.

110 110 180 193 110 180 110 180 100 The I2C interface is a bidirectional synchronous serial bus, including a serial data line (serial data line, SDA) and a derail clock line (derail clock line, SCL). In some embodiments, the processormay include a plurality of sets of I2C buses. The processormay be separately coupled to the touch sensorK, a charger, a flash, the camera, and the like through different I2C bus interfaces. For example, the processormay be coupled to the touch sensorK through the I2C interface, so that the processorcommunicates with the touch sensorK through the I2C bus interface, to implement a touch function of the electronic device.

110 110 170 110 170 170 160 The I2S interface may be configured to perform audio communication. In some embodiments, the processormay include a plurality of sets of I2S buses. The processormay be coupled to the audio modulethrough the I2S bus to implement communication between the processorand the audio module. In some embodiments, the audio modulemay transmit an audio signal to the wireless communication modulethrough the I2S interface, to implement a function of answering a call via a Bluetooth headset.

170 160 170 160 The PCM interface may also be used for audio communication to sample, quantize, and encode an analog signal. In some embodiments, the audio modulemay be coupled to the wireless communication modulethrough a PCM bus interface. In some embodiments, the audio modulemay alternatively transmit an audio signal to the wireless communication modulethrough the PCM interface, to implement a function of answering a call via a Bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.

110 160 110 160 170 160 The UART interface is a universal serial data bus used for asynchronous communication. The bus may be a bidirectional communication bus. The bus converts to-be-transmitted data between serial communication and parallel communication. In some embodiments, the UART interface is generally configured to be connected to the processorand the wireless communication module. For example, the processorcommunicates with a Bluetooth module in the wireless communication modulethrough the UART interface, to implement a Bluetooth function. In some embodiments, the audio modulemay transmit an audio signal to the wireless communication modulethrough the UART interface, to implement a function of music playback via a Bluetooth headset.

110 194 193 110 193 100 110 194 100 The MIPI interface may be configured to be connected to the processorand a peripheral device, for example, the display screenor the camera. The MIPI interface includes a camera serial interface (camera serial interface, CSI), a display serial interface (display serial interface, DSI), and the like. In some embodiments, the processorcommunicates with the camerathrough the CSI interface, to implement a photographing function of the electronic device. The processorcommunicates with the display screenthrough the DSI interface, to implement a display function of the electronic device.

110 193 194 160 170 180 The GPIO interface may be configured by software. The GPIO interface may be configured as a control signal or as a data signal. In some embodiments, the GPIO interface may be configured to be connected to the processorand the camera, the display screen, the wireless communication module, the audio module, the sensor module, and the like. The GPIO interface may alternatively be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, or the like.

130 130 100 100 The USB portis a port that complies with a USB standard specification, and may be specifically a Mini USB port, a Micro USB port, a USB Type C port, or the like. The USB portmay be configured to be connected to a charger to charge the electronic device, or may be configured to transmit data between the electronic deviceand a peripheral device, or may be configured to be connected to a headset to play back audio via the headset. The port may alternatively be configured to be connected to another electronic device, for example, an AR device.

The port may further include another port, for example, a Dock port or a Lighting port, configured to interact with another device.

100 100 It may be understood that an interface connection relationship between modules illustrated in this embodiment of the present invention is merely an example for description, and does not constitute a limitation on the structure of the electronic device. In some other embodiments of this application, the electronic devicemay alternatively use an interface connection manner different from that in the foregoing embodiment, or use a combination of a plurality of interface connection manners.

140 140 130 140 100 140 141 142 140 The charging management moduleis configured to receive charging input from a charger or provide a power supply for an external device. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management modulemay receive charging input from the wired charger through the USB port. In some wireless charging embodiments, the charging management modulemay receive wireless charging input via a wireless charging coil of the electronic device. The charging management modulemay further supply power to the electronic device by using the power supply management modulewhile charging the battery. For an electronic device in which a Type-C port is used, the charging management moduleof the electronic device supports a USB power delivery (PD) charging protocol.

141 142 140 110 141 142 140 110 121 194 193 160 141 141 110 141 140 The power supply management moduleis configured to be connected to the battery, the charging management module, and the processor. The power supply management modulereceives input from the batteryand/or the charging management module, and supplies power to the processor, the internal memory, the display screen, the camera, the wireless communication module, and the like. The power supply management modulemay be further configured to monitor a parameter like a battery capacity, a quantity of battery cycles, and a battery health state (electric leakage and impedance). In some other embodiments, the power supply management modulemay alternatively be disposed in the processor. In some other embodiments, the power supply management moduleand the charging management modulemay alternatively be disposed in a same device.

100 194 194 110 The electronic deviceimplements a display function by using the GPU, the display screen, the application processor, and the like. The GPU is a microprocessor for image processing and is connected to the display screenand the application processor. The GPU is configured to perform mathematical and geometric calculation for graphics rendering. The processormay include one or more GPUs that execute program instructions to generate or change display information.

194 194 100 194 The display screenis configured to display an image, a video, or the like. The display screenincludes a display panel. The display panel may be a liquid crystal display (liquid crystal display, LCD), an organic light-emitting diode (organic light-emitting diode, OLED), an active-matrix organic light emitting diode or an active-matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), a flexible light-emitting diode (flex light-emitting diode, FLED), a Miniled, a MicroLed, a Micro-oLed, a quantum dot light emitting diode (quantum dot light emitting diode, QLED), or the like. In some embodiments, the electronic devicemay include 1 or N display screens. N is a positive integer greater than 1.

100 The digital signal processor is configured to process a digital signal. In addition to processing a digital image signal, the digital signal processor may further process another digital signal. For example, when the electronic deviceperforms frequency selection, the digital signal processor is configured to perform Fourier transform and the like on frequency energy.

100 100 The video codec is configured to compress or decompress a digital video. The electronic devicesupports one or more video codecs. In this way, the electronic devicemay play back or record videos in a plurality of coding formats, for example, moving picture experts group (moving picture experts group, MPEG)1, MPEG2, MPEG3, and MPEG4.

100 The NPU is a neural-network (neural-network, NN) computing processor, and quickly processes input information with reference to a structure of a biological neural network, for example, a transfer mode between human brain neurons, and may further continuously perform self-learning. The NPU may be used to implement applications such as intelligent cognition of the electronic device, for example, image recognition, facial recognition, voice recognition, and text understanding.

121 The internal memorymay include one or more random access memories (random access memories, RAMs) and one or more non-volatile memories (non-volatile memories, NVMs).

The random access memory may include a static random access memory (static random access memory, SRAM), a dynamic random access memory (dynamic random access memory, DRAM), a synchronous dynamic random access memory (synchronous dynamic random access memory, SDRAM), a double data rate synchronous dynamic random access memory (double data rate synchronous dynamic random access memory, DDR SDRAM, for example, a 5th generation DDR SDRAM generally referred to as a DDR5 SDRAM), or the like. The non-volatile memory may include a magnetic disk storage device and a flash memory (flash memory).

According to division of an operating principle, the flash memory may include NOR FLASH, NAND FLASH, 3D NAND FLASH, and the like. According to division of potential levels of storage cells, the flash memory may include a single-level cell (single-level cell, SLC), a multi-level cell (multi-level cell, MLC), a triple-level cell (triple-level cell, TLC), a quad-level cell (quad-level cell, QLC), and the like. According to division of a storage specification, the flash memory may include universal flash storage (English: universal flash storage, UFS), an embedded multi media card (embedded multi media Card, eMMC), and the like.

110 The random access memory may be directly read and written by the processor, may be configured to store executable programs (for example, machine instructions) of an operating system or another running program, and may be configured to store data of a user and an application, and the like.

110 The non-volatile memory may also store executable programs, data of the user and the application, and the like, and may be loaded into the random access memory in advance, to be directly read and written by the processor.

120 100 110 120 The external memory interfacemay be configured to be connected to an external non-volatile memory, to expand a storage capability of the electronic device. The external non-volatile memory communicates with the processorthrough the external memory interface, to implement a data storage function. For example, a file like music or a video is stored in the external non-volatile memory.

A charging method and an electronic device provided in this application are described below by using a PD charging protocol and two Type-C ports as an example. It should be noted that the charging method provided in this application is also applicable to a device having two or more Type-C ports, and a protocol of a PD charging protocol type, for example, a charging protocol in which a CC signal is used for communication, a charging protocol in which a pin on the Type-C port is used for communication at a position corresponding to a CC signal, or a charging protocol in which a non-D+/D− signal defined by the Type-C port is used for communication.

100 100 2 FIG. First, a structure of an electronic deviceis described by taking the electronic device as, for example, a PC product.is a schematic diagram of an architecture of an electronic device according to an embodiment of this application. The electronic devicemay be used to implement the charging method provided in an embodiment of this application.

2 FIG. 100 101 205 101 2011 2012 202 203 204 As shown in, the electronic deviceincludes a first charging circuitand a processor. The first charging circuitincludes one or more of a first Type-C port, a second Type-C port, a power delivery module, a power supply module, and a control unit.

2011 2012 100 2011 2012 2011 2012 2 FIG. The first Type-C portand/or the second Type-C portare/is configured to be connected to an external device. When the electronic deviceprovides a power supply for the external device through the first Type-C portand/or the second Type-C port, the electronic device is a charging port (represented by a Source), and the external device is a power consumption device port (represented by a Sink). It can be learned fromthat the first Type-C portand/or the second Type-C portinclude/includes one or more of a VBUS pin, CC pins (including a CC 1 pin and a CC 2 pin), a DP (which may also be referred to as D+ or a data positive signal) pin, and a DM (which may also be referred to as D− or a data negative signal) pin that are configured to supply power.

The VBUS pin is a return path of a power supply, and a default VBUS voltage is 5 V. However, a standard allows a device to negotiate and select the VBUS voltage other than the default value, to support a larger voltage. A value of the supported VBUS voltage is not limited in this application.

The CC pin is configured to implement a configuration channel function defined in a USB Type-C specification and a function specified in a USB PD specification.

The DM pin and the DP pin are a differential pair used for USB2.0 connection, and a signal transmitted on the DM/DP pin may be used for identification of a private protocol.

202 202 204 202 204 2011 2012 2011 2012 The power delivery moduleis, for example, a USB-PD charging protocol integrated circuit (integrated circuit, IC). The USB-PD charging protocol IC may be an IC that communicates a protocol through a CC channel defined by a Type-C port, and supports a PD charging protocol or a charging protocol similar to the PD charging protocol. The power delivery modulemay further include one or more interfaces, for example, an I2C interface. A PD chip is electrically connected to an I2C interface of the control unitthrough an I2C interface and an I2C bus, to implement an electrical connection between the power delivery moduleand the control unitas well as transmission between signals. For example, the PD chip may be electrically connected to the CC pin (the CC 1 pin/CC 2 pin) of the first Type-C portand/or the second Type-C port, to identify, through a change of a voltage at the CC pin, an external device connected to the first Type-C portand/or the second Type-C port.

202 2011 2012 202 In some embodiments, one or more first switches and one or more second switches are disposed in the power delivery module, the first Type-C portseparately corresponds to the first switch and the second switch, and the second Type-C portseparately corresponds to the first switch and the second switch. It may be understood that, when there are two or more USB Type-C ports, two or more first switches and two or more second switches are disposed in the power delivery module, and respectively correspond to different USB Type-C ports.

203 The power supply moduleincludes one or more of a charger (charger) chip, a battery, and a buck (buck) circuit.

202 202 2011 2012 The buck (buck) circuit is configured to output a voltage, for example, output a fixed voltage of 5 V to the power delivery module, to output, through a pin that is in the power delivery moduleand that is electrically connected to the first switch, the voltage of 5 V to the VBUS pin of the first Type-C portand/or the VBUS pin of the second Type-C port.

202 202 202 2011 2012 It should be noted that the first switch may be located inside the power delivery moduleor outside the power delivery module, and the power delivery modulecontrols the first switch to be turned on or turned off, for example, controls whether to output the fixed voltage of 5 V to the VBUS pin of the first Type-C portand/or the second Type-C port. For example, the first switch may be, for example, a switch chip having an over current protection (OCP) function. Certainly, the first switch is not limited to this, and any module that may have a turn-on or turn-off function and an over current protection function is within the protection scope of embodiments of this application.

2011 2012 204 2011 2012 203 203 203 The charger (charger) chip is electrically connected to the VBUS pin of the first Type-C portand/or the second Type-C portthrough the second switch, and is further separately connected to the battery and the control unit. When the first Type-C portand/or the second Type-C portis connected to a charging power supply, for example, an adapter or a mobile power pack, the power supply moduleis configured to receive charging input through the second switch, charge the battery, and may further supply power to another module that needs power during working, so that positive charging of the electronic device is completed. In this embodiment, the power supply modulefurther has a power supply reverse output function, to be specific, a function of outputting a power supply to an external to-be-charged device. The power supply reverse output function may be implemented based on an on-the-go (on the go, OTG) function, and a voltage and a current reversely output by the power supply moduleare adjustable.

70 202 204 203 For example, the second switch may be, for example, a switch chip having an overvoltage protection (OVP) function. Certainly, the second switch moduleis not limited to this, and any module that may have a turn-on or turn-off function and an overvoltage protection function is within the protection scope of embodiments of this application. For example, the second switch may be controlled to be turned on or turned off by using the power delivery module, or the second switch may be controlled to be turned on or turned off by the control unitthrough a GPIO interface. It may be understood that, when there are two or more USB Type-C ports, two or more second switches are disposed in the power supply module.

204 204 205 204 204 204 The control unitmay be a single-chip microcomputer, for example, a microcontroller unit (microcontroller unit, MCU) or an embedded controller (embedded controller, EC). In an implementation, the control unitmay alternatively be integrated into the processor. The control unitmainly controls a power-on sequence and a keyboard, and processes work related to underlying hardware, for example, temperature measurement. The charging chip and the PD chip implement a function as an interface, and the like. The control unitdecompresses and includes software that independently runs, and stores the software in a non-volatile medium of the control unit.

204 100 204 202 203 In some embodiments, the control unitmay include one or more interfaces. The interface may include a general purpose input/output (GPIO) interface, an enhanced serial peripheral (enhanced serial peripheral, eSPI) interface, an integrated circuit I2C interface, or the like. An electrical connection to another module of the electronic deviceand communication between modules are implemented through the foregoing interface. In this embodiment of this application, for example, the control unitmay be electrically connected to and communicate with the power delivery modulethrough different I2C interfaces, and electrically connected to and communicate with the power supply modulethrough the GPIO interface.

2 FIG. It should be understood that the components shown inmay be implemented by hardware, software, or a combination of hardware and software including one or more signal processing and/or application-specific integrated circuits.

3 FIG. Next, a schematic diagram of a scenario provided in this application is introduced.is a schematic diagram of a charging scenario of a single Type-C port based on a first charging circuit according to an embodiment of this application.

3 FIG. 100 2011 2012 100 200 2011 100 100 200 100 200 200 200 200 100 100 200 100 0 100 200 200 In the scenario shown in, an electronic deviceis a notebook computer, and is configured with two Type-C ports: a first Type-C portand a second Type-C port. The electronic devicemay establish a connection to a first external device(for example, a mobile phone) through one of the two Type-C ports (for example, the first Type-C port). At a first moment after the connection is established, the electronic deviceconfirms that the electronic deviceis a Source device, and the connected first external deviceis a Sink device. First, the electronic devicemay provide power of, for example, 5 V/2 A (that is, 10 W), for the first external device. At a second moment after the first moment, the first external deviceconfirms that the first external devicesupports a protocol with higher power, for example, a PD3.0 protocol or a PD2.0 protocol, and the first external devicerequests higher power, for example, 9 V/2 A (that is, 18 W), from the electronic device. After the electronic devicereceives a request from the first external device, if a system of the electronic deviceis not in an Sstate and a battery level is not less than a preset threshold, the electronic deviceprovides higher charging power (for example, 18 W) for the first external device. Therefore, at the second moment, fast charging at power of, for example, 9 V/2 A (that is, 18 W), may be performed on the first external device.

4 FIG. is a schematic flowchart of a charging scenario of a single Type-C port based on a first charging circuit, including but not limited to the following steps. For ease of description in this application, the following sequence is used for description, and it is not intended to limit the steps to be performed in the sequence. A sequence of performing the foregoing one or more steps, time of performing the foregoing one or more steps, a quantity of times of performing the foregoing one or more steps, and the like are not limited in embodiments of this application.

401 200 100 S: A first external deviceestablishes a connection to a power delivery module in an electronic device.

200 100 200 202 100 200 100 200 Specifically, when the first external deviceis connected to the electronic devicethrough a first Type-C port (which may be briefly referred to as that the first external deviceis connected to a Type-C port), the power delivery modulein the electronic deviceand the first external deviceperform handshake through a CC pin of the Type-C port, and confirm that the electronic deviceis a Source device, and the connected first external deviceis a Sink device.

402 200 S: The power delivery module sends a first message to the first external device.

100 200 9 100 Specifically, the electronic deviceused as the Source device sends, by using the power delivery module, the first message to the first external deviceused as the Sink device. The first message includes one or more charging power of 5 V/2 A andV/2 A that can be provided by the electronic device. It may be understood that these values may alternatively be replaced with other values, and may be values corresponding to an interaction result determined after a protocol interaction is performed between the electronic device and the first external device.

403 200 S: The first external devicerequests charging power of 5 V/2 A from the power delivery module.

404 S: The power delivery module turns on a first switch.

3 FIG. Turning on the first switch means controlling the first switch to be turned on. Specifically, it can be learned fromthat the power delivery module may control the first switch to be turned on or turned off, and the first switch is electrically connected to a buck circuit in a power supply module, to control, through the first switch, whether to output a voltage of 5 V output by the buck circuit to the power delivery module.

405 S: The power supply module outputs the charging power of 5 V/2 A.

200 Specifically, the buck circuit in the voltage module is configured to output the voltage of 5 V. When the first switch is turned on, the power supply module outputs, through a pin that is in the power delivery module and that is electrically connected to the first switch, the voltage of 5 V to a VBUS pin of a USB Type-C port, to provide the charging power of 5 V/2 A for the first external device.

406 200 S: The first external devicerequests charging power of 9 V/2 A from the power delivery module.

200 200 Specifically, when the first external devicesupports a fast charging protocol, for example, PD 3.0 or PD 2.0, the first external devicerequests the charging power of 9 V/2 A from the power delivery module.

407 S: The power delivery module sends a first request to a control unit.

200 Specifically, after receiving the request from the first external deviceused as the Sink device, the power delivery module sends the first request for enabling (enable) an OTG function to the control unit through an I2C interface.

408 0 S: The control unit determines whether a system is in Sand whether a current battery level is less than a preset threshold.

100 0 Specifically, after receiving the request for enabling the OTG function, the control unit needs to ensure power supply of the control unit, and provides a power supply externally while ensuring the power supply of the control unit. Therefore, the control unit determines whether the current system of the electronic deviceis in the Sstate and whether the battery level is less than the preset threshold (for example, 20%).

100 0 Therefore, when it is determined that the current system of the electronic deviceis in the Sstate and the battery level is less than the preset threshold, the charging power of 5 V/2 A continues to be provided for the external device.

409 0 S: If the system is not in Sand the current battery level is not less than the preset threshold, the control unit sends a second message to the power delivery module.

100 0 Specifically, if it is determined that the current system of the electronic deviceis not in the Sstate and the circuit of the battery is greater than or equal to the preset threshold, the control unit sends, to the power delivery module, the second message indicating that the OTG function can be enabled.

410 0 S: If the system is not in Sand the current battery level is not less than the preset threshold, the control unit sends, to the power supply module, a message for enabling the OTG function.

411 S: The power supply module enables the OTG function.

412 S: The power delivery module turns off the first switch and turns on a second switch.

203 203 Specifically, after receiving the second message, the power delivery module turns off the first switch, so that the first switch is in an off state, to disable an OCP function of the power supply module and stop outputting the charging power of 5 V/2 A. The second switch is turned on, to enable the OVG function of the power supply module, and a related register of the power supply moduleis configured to reversely output a current and voltage of, for example, 9 V/2 A.

413 200 S: The power supply module outputs the charging power of 9 V/2 A to the first external device.

3 FIG. 200 Specifically, it can be learned fromthat a charger (charger) chip in the power supply module is electrically connected to the VBUS pin of the USB Type-C port through the second switch, and is further separately connected to a battery. Therefore, the power supply module may provide the charging power of 9 V/2 A for the first external devicethrough the charger chip and the battery.

It can be learned that the electronic device may negotiate with the first external device to determine different charging power, to meet a requirement of outputting higher charging power to the first external device.

5 FIG. 5 FIG. 100 2011 2012 100 200 300 2012 is a schematic diagram of a charging scenario of dual Type-C ports based on a first charging circuit according to an embodiment of this application. As shown in, an electronic deviceis configured with two Type-C ports, which are respectively a first Type-C portand a second Type-C port. The electronic devicemay establish a connection to a first external device(for example, a mobile phone) through the first Type-C port, and may establish a connection to a second external device(for example, a charger) through the second Type-C port.

5 FIG. 100 200 2011 100 100 200 100 200 As shown in, at a first moment after the electronic deviceestablishes the connection to the first external devicethrough the first Type-C port, the electronic deviceconfirms that the electronic deviceis a Source device, and the connected first external deviceis a Sink device. First, the electronic devicemay provide power of, for example, 5 V/2 A (that is, 10 W), for the first external device.

200 200 200 100 200 100 1 2012 300 100 2 100 0 200 100 200 After the first moment, the first external deviceconfirms that the first external devicesupports a protocol with higher power, for example, a PD3.0 protocol or a PD2.0 protocol, and the first external devicerequests higher power, for example, 9 V/2 A (that is, 18 W), from the electronic device. After receiving a request from the first external device, the electronic devicedetermines whether there are the following cases in which high power cannot be provided. Case: Whether the second Type-C portis connected to the second external device(for example, a charger), and the electronic deviceis identified as the Sink. Case: Whether a system of the electronic deviceis in an Sstate and a battery level is not less than a preset threshold. If there are one or more of the foregoing cases, the request of the first external deviceis rejected, and the electronic devicecontinues to output charging of 5 V/2 A. Therefore, at a second moment after the first moment, the first external devicecontinues to be charged at the power of 5 V/2 A.

200 100 200 200 If there is none of the foregoing cases, after receiving the request from the first external device, the electronic deviceprovides power of 9 V/2 A (that is, 18 W) for the first external device. Therefore, at the second moment, fast charging at the power of 9 V/2 A (that is, 18 W) may be performed on the first external device.

100 200 100 300 100 300 100 200 When the electronic deviceoutputs the power of 9 V/2 A (that is, 18 W) to the first external device, the electronic deviceestablishes the connection to the second external device(for example, a charger). When the electronic deviceis used as a Sink device, and the second external device(for example, the charger) is used as a Source device, the electronic devicestops outputting the power of 9 V/2 A (that is, 18 W), and starts outputting the power of 5 V/2 A (that is, 10 W). Therefore, at a third moment after the second moment, the first external devicerestores being charged at the power of 5 V/2 A.

6 FIG. is a schematic flowchart of a charging scenario of dual Type-C ports based on a first charging circuit, including but not limited to the following steps. For ease of description in this application, the following sequence is used for description, and it is not intended to limit the steps to be performed in the sequence. A sequence of performing the foregoing one or more steps, time of performing the foregoing one or more steps, a quantity of times of performing the foregoing one or more steps, and the like are not limited in embodiments of this application.

501 200 100 S: A first external deviceestablishes a connection to a power delivery module in an electronic device.

200 2011 202 100 200 2011 100 200 Specifically, when the first external deviceis connected to a first Type-C port, a power delivery modulein the electronic deviceand the first external deviceperform handshake through a CC pin of the first Type-C port, and confirm that the electronic deviceis a Source device, and the connected first external deviceis a Sink device.

502 200 S: The power delivery module sends a first message to the first external device.

100 200 9 100 Specifically, the electronic deviceused as the Source device sends, by using the power delivery module, the first message to the first external deviceused as the Sink device. The first message includes one or more charging power of 5 V/2 A andV/2 A that can be provided by the electronic device.

503 200 S: The first external devicerequests charging power of 5 V/2 A from the power delivery module.

504 S: The power delivery module turns on a first switch.

3 FIG. Specifically, it can be learned fromthat the power delivery module may control the first switch to be turned on or turned off, and the first switch is electrically connected to a buck circuit in a power supply module, to control, through the first switch, whether to output a voltage of 5 V output by the buck circuit to the power delivery module.

505 S: The power supply module outputs the charging power of 5 V/2 A.

200 Specifically, the buck circuit in the voltage module is configured to output the voltage of 5 V. When the first switch is turned on, the power supply module outputs, through a pin that is in the power delivery module and that is electrically connected to the first switch, the voltage of 5 V to a VBUS pin of a USB Type-C port, to provide the charging power of 5 V/2 A for the first external device.

506 200 S: The first external devicerequests charging power of 9 V/2 A from the power delivery module.

200 200 Specifically, when the first external devicesupports a fast charging protocol, for example, PD 3.0 or PD 2.0, the first external devicerequests the charging power of 9 V/2 A from the power delivery module.

507 S: The power delivery module sends a first request to a control unit.

200 Specifically, after receiving the request from the first external deviceused as the Sink device, the power delivery module sends, to the control unit through an I2C interface, the first request for enabling (enable) an OTG function.

508 100 S: The control unit determines whether there is a second external device charging the electronic device.

100 2012 202 100 300 2012 100 Specifically, the electronic devicehas two or more Type-C ports. When the second external device is connected to a second Type-C port, the power delivery modulein the electronic deviceand the second external deviceperform handshake through a CC pin of the second Type-C port, and determine whether the electronic deviceis a Source device, and the connected second external device is a Sink device.

100 100 100 2012 100 100 If the electronic devicedetermines that the electronic deviceis the Sink device and the connected second external device is the Source device, the electronic devicedetermines that the second Type-C portis in a state of charging the electronic device, and the electronic devicecontinues to provide the charging power of 5 V/2 A for the external device.

509 If it is determined that the second external device does not charge the electronic device through the second Type-C port, step Sis performed.

509 0 S: The control unit determines whether a system is in Sand whether a current battery level is less than a preset threshold.

100 0 Specifically, after receiving the request for enabling the OTG function, the control unit needs to ensure power supply of the control unit, and provides a power supply externally while ensuring the power supply of the control unit. Therefore, the control unit determines whether the current system of the electronic deviceis in the Sstate and whether the battery level is less than the preset threshold (for example, 20%).

100 0 Therefore, when it is determined that the current system of the electronic deviceis in the Sstate and the battery level is less than the preset threshold, the charging power of 5 V/2 A continues to be provided for the external device.

100 0 510 When it is determined that the current system of the electronic deviceis not in the Sstate and the circuit of the battery is greater than or equal to the preset threshold, step Sis performed.

510 S: The control unit sends a second message to the power delivery module.

100 100 0 Specifically, if it is determined that there is no second external device to charge the electronic devicethrough the Type-C port, the current system of the electronic deviceis not in the Sstate, and the circuit of the battery is greater than or equal to the preset threshold, the control unit sends, to the power delivery module, the second message indicating that the OTG function can be enabled.

511 0 S: If the system is not in Sand the current battery level is not less than the preset threshold, the control unit sends, to the power supply module, a message for enabling the OTG function.

512 S: The power supply module enables the OTG function.

513 S: The power delivery module turns off the first switch and turns on a second switch.

203 203 Specifically, after receiving the second message, the power delivery module turns off the first switch, so that the first switch is in an off state, to disable an OCP function of the power supply module and stop outputting the charging power of 5 V/2 A. The second switch is turned on, to enable the OVG function of the power supply module, and a related register of the power supply moduleis configured to reversely output a current and voltage of, for example, 9 V/2 A.

514 200 S: The power supply module provides the charging power of 9 V/2 A for the first external device.

3 FIG. 200 Specifically, it can be learned fromthat a charger (charger) chip in the power supply module is electrically connected to the VBUS pin of the USB Type-C port through the second switch, and is further separately connected to a battery. Therefore, the power supply module may provide the charging power of 9 V/2 A for the first external devicethrough the charger chip and the battery.

515 100 0 S: The control unit determines that there is the second external device charging the electronic deviceor the system is in the Sstate.

516 S: The control unit sends a second request to the power delivery module.

Specifically, the second request is used to request the power delivery module to turn off the second switch and turn on the first switch.

517 S: The power delivery module turns off the second switch and turns on the first switch.

518 200 S: The power supply module outputs the charging power of 5 V/2 A to the first external device.

Specifically, the power supply module stops outputting the charging power of 9 V/2 A and restores outputting the charging power of 5 V/2 A.

It can be learned that the electronic device may negotiate with the first external device to determine different charging power, to meet a requirement of outputting higher charging power to the first external device. When there is another USB port (for example, the second Type-C port) charging the electronic device, to ensure stable performance of the electronic device, the electronic device may stop outputting higher charging power to the first external device and normal charging power is restored.

7 FIG. 6 FIG. 100 102 205 102 2011 2012 202 203 204 2061 2062 is a schematic diagram of an architecture of another electronic device according to an embodiment of this application. As shown in, an electronic deviceincludes a second charging circuitand a processor. The second charging circuitincludes one or more of a first Type-C port, a second Type-C port, a power delivery module, a power supply module, a control unit, a first switch switching circuit, and a second switch switching circuit.

2061 2011 2061 2011 204 205 2061 The first switch switching circuitcorresponds to the first Type-C port. The first switch switching circuitis separately connected to the first Type-C port, the control unit, and the processor, and a 0-ohm (R) resistor is short-circuited on the first switch switching circuit.

204 2061 2011 205 2011 205 2061 100 2011 100 2011 In some embodiments, the control unitmay control the first switch switching circuitto respectively switch a DP signal line and a DM signal line that are connected to the first Type-C portto lines connected to the processor. In this way, the first Type-C portis connected to the processorthrough the first switch switching circuit. When an external device is connected to the electronic devicethrough the first Type-C port, USB2.0 identification may be performed. In other words, the electronic devicemay perform data transmission with the external device through the first Type-C port.

204 2061 2011 In some embodiments, the control unitmay control the first switch switching circuitto respectively switch the DP signal line and the DM signal line that are connected to the first Type-C portto lines connected to the 0 ohm (R).

2062 2012 2062 2012 204 205 2062 The second switch switching circuitcorresponds to the second Type-C port. The second switch switching circuitis separately connected to the second Type-C port, the control unit, and the processor, and a 0-ohm (R) resistor is short-circuited on the second switch switching circuit.

204 2062 2012 205 2012 205 2062 100 2012 100 2012 In some embodiments, the control unitmay control the second switch switching circuitto respectively switch the DP signal line and the DM signal line that are connected to the second Type-C portto lines connected to the processor. In this way, the second Type-C portis connected to the processorthrough the second switch switching circuit. When the external device is connected to the electronic devicethrough the second Type-C port, USB2.0 identification may be performed. In other words, the electronic devicemay perform data transmission with the external device through the second Type-C port.

204 2061 2011 In some embodiments, the control unitmay control the first switch switching circuitto respectively switch the DP signal line and the DM signal line that are connected to the first Type-C portto lines connected to the 0 ohm (R).

2011 2012 202 203 204 6 FIG. 2 FIG. For related descriptions of the first Type-C port, the second Type-C port, the power delivery module, the power supply module, and the control unitin, refer to, and details are not described herein again.

It should be noted that a quantity of switch switching circuits is consistent with a quantity of Type-C ports. This application is described by using two Type-C ports as an example, but is not limited to two Type-C ports and two switch switching circuits.

8 FIG. 7 FIG. 8 FIG. 102 100 is a schematic diagram of a charging scenario of a single Type-C port based on a second charging circuit according to an embodiment of this application. The second charging circuit is the second charging circuitshown in. In the scenario shown in, an electronic deviceis in a powered-on state and/or a sleep state.

8 FIG. 100 2011 2012 100 200 2011 100 100 200 100 200 100 200 100 200 100 200 As shown in, the electronic deviceis a notebook computer, and is configured with two Type-C ports: a first Type-C portand a second Type-C port. The electronic devicemay establish a connection to a first external device(for example, a mobile phone) through one of the two Type-C ports (for example, the first Type-C port). After establishing the connection, the electronic deviceconfirms that the electronic deviceis a Source device, and the connected first external deviceis a Sink device. The electronic devicemay broadcast, to the first external device, charging power provided by the electronic device, and display PPS support in a manner of, for example, a pop-up window, and at a first moment, the first external devicemay prioritize requesting 5 V/2 A. Therefore, at the first moment, the electronic deviceprovides power of, for example, 5 V/2 A (that is, 10 W), for the first external device, and the electronic devicemay perform data transmission with the first external device.

8 FIG. 100 100 100 200 200 It can be learned fromthat, after establishing the connection, the electronic devicemay display “Perform fast charging?” in a pop-up window, to prompt a user whether to select fast charging. If the user selects a “No” option, the electronic devicedetermines, in response to a user operation of a “No” functional control, that the user does not select fast charging, and therefore maintains current charging power unchanged. If the user selects a “Yes” option, the electronic devicedetermines, in response to a user operation of a “Yes” functional control, that the user selects fast charging, and therefore provides charging power higher than 5 V/2 A for the first external device. For example, at a second moment, fast charging at power of 12 V/3 A (that is, 36 W) may be performed on the first external device.

100 200 200 After the second moment, the electronic devicemay adjust, in real time, charging power delivered to the first external device. For example, at a third moment, fast charging at power of 9 V/2 A (that is, 18 W) may be performed on the first external device.

9 FIG. is a schematic flowchart of a charging scenario of a single Type-C port based on a second charging circuit, including but not limited to the following steps. For ease of description in this application, the following sequence is used for description, and it is not intended to limit the steps to be performed in the sequence. A sequence of performing the foregoing one or more steps, time of performing the foregoing one or more steps, a quantity of times of performing the foregoing one or more steps, and the like are not limited in embodiments of this application.

7 FIG. 100 2061 It can be learned fromthat, an electronic device may control, by using a control unit, a switch switching circuit to switch to a processor port. In this way, after an external device is connected to the electronic device through a Type-C port, it may be determined, based on a USB2.0 protocol, that the external device is an SDP port. When the electronic deviceis in a powered-on state and/or a sleep state, the control unit defaults to switching a first switch switching circuitto the processor port.

701 200 100 S: A first external deviceestablishes a connection to a power delivery module in the electronic device.

200 202 100 200 100 200 Specifically, when the first external deviceis connected to a Type-C port, a power delivery modulein the electronic deviceand the first external deviceperform handshake through a CC pin of the Type-C port, and confirm that the electronic deviceis a Source device, and the connected first external deviceis a Sink device.

702 200 S: The power delivery module sends a first message to the first external device.

100 200 9 12 100 100 Specifically, the electronic deviceused as the Source device sends, by using the power delivery module, the first message to the first external deviceused as the Sink device. The first message includes one or more charging power of 5 V/2 A,V/2 A,V/2 A, 15 V/3 A, 20V/3.5 , and the like that can be provided by the electronic device, and programmable power supply (PPS) support may be displayed. It should be noted that a voltage and current provided by the electronic deviceis not limited to that provided in embodiments of this application, and a higher or lower voltage and current may be provided.

703 200 S: The first external devicerequests charging power of 5 V/2 A from the power delivery module.

704 S: The power delivery module turns on a first switch.

7 FIG. Specifically, it can be learned fromthat the power delivery module may control the first switch to be turned on or turned off, and the first switch is electrically connected to a buck circuit in a power supply module, to control, through the first switch, whether to output a voltage of 5 V output by the buck circuit to the power delivery module.

705 S: The power supply module outputs the charging power of 5 V/2 A.

200 Specifically, the buck circuit in the voltage module is configured to output the voltage of 5 V. When the first switch is turned on, the power supply module outputs, through a pin that is in the power delivery module and that is electrically connected to the first switch, the voltage of 5 V to a VBUS pin of a USB Type-C port, to provide the charging power of 5 V/2 A for the first external device.

100 When the electronic deviceis in the powered-on state and/or the sleep state, the electronic device may control, by using the control unit, the switch switching circuit to be switched to the processor port. Therefore, after the electronic device establishes the connection to the external device, it may be confirmed, based on a BC1.2 protocol, that the electronic device is the SDP port, to support a function of performing data transmission with the external device.

706 S: The control unit controls the first switch switching circuit to switch to a 0-R resistor.

6 FIG. Specifically, in a UI interface of the electronic device, a user is prompted, in a manner of a pop-up window, whether to select fast charging. If the user selects fast charging, the control unit controls the first control switch switching circuit to switch from the processor port to a 0-R resistor port. It can be learned fromthat, after the 0-R resistor segment is switched to, the first Type-C port is disconnected from the processor. If the user does not select fast charging, the electronic device continues to output the charging power of 5 V/2 A.

707 S: The control unit sends a second message to the power delivery module.

Specifically, the second message is used to notify the power delivery module to turn off the first switch.

708 S: The power delivery module turns off the first switch.

Specifically, the power delivery module turns off the first switch in response to the second message.

709 S: The first external device re-establishes a connection to the power delivery module.

Specifically, after the power delivery module disables an OCP function by turning off the first switch, the first external device may re-establish a connection to the electronic device. For example, the electronic device is identified as a DCP port based on BC1.2 through the Type-C port.

710 S: The power delivery module sends a third message to the control unit.

Specifically, after the electronic device establishes the connection to the first external device based on BC1.2, the first external device requests, from the power delivery module, a charging capability at a highest level supported by the first external device, and the power delivery module sends the third message to the control unit through an I2C. The third message is used to request a voltage and current at a highest level supported by the first external device.

711 S: The control unit sends, to the power supply module, a message for enabling an OTG function.

Specifically, the control unit configures an OTG voltage and current of a charger chip in the power supply module based on a requirement from the power delivery module, and enables the OTG function.

712 S: The power supply module enables the OTG function.

Specifically, the power supply module enables the OTG function based on configuration of the control unit.

713 S: The control unit sends a fourth message to the power delivery module.

The fourth message indicates that configuration of the OTG function is completed.

714 S: The power delivery module turns off the first switch and turns on a second switch.

Specifically, after receiving the message indicating that the configuration of the OTG function is completed, the power delivery module turns on the second switch and turns off the first switch.

715 S: The power supply module outputs the voltage and current at the highest level supported by the first external device.

Specifically, after the second switch is turned on, the power supply module may output, through the charger chip to the first external device, the voltage and current at the highest level requested by the first external device.

716 S: The first external device sends a third request to the power delivery module.

Specifically, the first external device may send the third request, for example, get PPS state, to the electronic device. The third request is used to request to adjust a voltage and current.

717 S: The power delivery module sends a voltage and current adjustment request to the control unit.

718 S: The control unit adjusts the voltage and current.

Specifically, the control unit adjusts the OTG voltage and current of the charger chip in the power supply module in real time based on a requirement of the power delivery module.

719 S: The power supply module outputs a voltage and current corresponding to the third request to the first external device.

In some embodiments, after the first external device is disconnected from the electronic device, the power delivery module turns off the second switch, and sends, to the control unit, a message for turning off the second switch. The control unit controls the first switch switching circuit to switch to the processor port, to wait for a next connection of the external device.

It can be learned that in a power-on scenario and/or a sleep scenario, the control unit in the electronic device controls, by default, the switch switching circuit to switch to the processor port. Therefore, after the first external device is connected to the electronic device, the electronic device may perform data transmission based on USB2.0, or may output normal charging power to the first external device. When the first external device has a fast charging requirement, the electronic device responds to the requirement of the first external device and the switch switching circuit is switched to be short-circuited to the 0-ohm. Therefore, the electronic device is identified as a DCP port. After the first external device identifies the electronic device as the DCP port, some charging levels of a PD protocol and a PPS may be supported.

10 FIG. is a schematic flowchart of another charging scenario of a single Type-C port based on a second charging circuit, including but not limited to the following steps. For ease of description in this application, the following sequence is used for description, and it is not intended to limit the steps to be performed in the sequence. A sequence of performing the foregoing one or more steps, time of performing the foregoing one or more steps, a quantity of times of performing the foregoing one or more steps, and the like are not limited in embodiments of this application.

7 FIG. 100 2061 It can be learned fromthat, an electronic device may control, by using a control unit, a switch switching circuit to switch to be short-circuited to a 0 R. In this way, after an external device is connected to the electronic device through a Type-C port, it may be determined, based on a BC1.2 protocol, that the external device is a DCP port. When the electronic deviceis in a powered-off state, the control unit defaults to switching a first switch switching circuitto be short-circuited to the 0 R.

801 200 100 S: A first external deviceestablishes a connection to a power delivery module in the electronic device.

200 202 100 200 100 200 Specifically, when the first external deviceis connected to a first Type-C port, the power delivery modulein the electronic deviceand the first external deviceperform handshake through a CC pin of the Type-C port, and confirm that the electronic deviceis a Source device, and the connected first external deviceis a Sink device.

802 200 S: The power delivery module sends a first message to the first external device.

100 200 9 12 100 100 Specifically, the electronic deviceused as the Source device sends, by using the power delivery module, the first message to the first external deviceused as the Sink device. The first message includes one or more charging power of 5 V/2 A,V/2 A,V/2 A, 15 V/3 A, 20V/3.5 , and the like that can be provided by the electronic device, and programmable power supply (PPS) support may be displayed. It should be noted that a voltage and current provided by the electronic deviceis not limited to that provided in embodiments of this application, and a higher or lower voltage and current may be provided.

803 200 S: The first external devicerequests charging power of 5 V/2 A from the power delivery module.

804 S: The power delivery module turns on a first switch.

6 FIG. 100 Specifically, it can be learned fromthat the power delivery module may control the first switch to be turned on or turned off, and the first switch is electrically connected to a buck circuit in a power supply module, to control, through the first switch, whether to output a voltage of 5 V output by the buck circuit to the power delivery module. When the electronic deviceis in a powered-on state and/or a sleep state, the electronic device may control, by using the control unit, the switch switching circuit to be switched to a processor port. Therefore, after the electronic device establishes the connection to the external device, it may be confirmed, based on USB2.0, that the electronic device is an SDP port, to support a function of performing data transmission with the external device.

805 S: The power supply module outputs the charging power of 5 V/2 A.

200 Specifically, the buck circuit in the voltage module is configured to output the voltage of 5 V. When the first switch is turned on, the power supply module outputs, through a pin that is in the power delivery module and that is electrically connected to the first switch, the voltage of 5 V to a VBUS pin of a USB Type-C port, to provide the charging power of 5 V/2 A for the first external device.

In addition, based on USB2.0, the electronic device is identified as the DCP port, and may perform voltage and current adjustment and PPS adjustment.

806 S: The first external device sends a third message to the power delivery module.

The third message is used to request, from the electronic device, a voltage and current at a highest level supported by the first external device, for example, 12 V/2 A.

807 S: The power delivery module sends a third message to the control unit.

Specifically, the power delivery module sends the third message to the control unit through an I2C. The third message is used to request the control unit to configure the voltage and current at the highest level supported by the first external device.

808 S: The control unit sends, to the power supply module, a message for enabling an OTG function.

Specifically, the control unit configures an OTG voltage and current of a charger chip in the power supply module based on a requirement from the power delivery module, and enables the OTG function.

809 S: The power supply module enables the OTG function.

Specifically, the power supply module enables the OTG function based on configuration of the control unit.

810 S: The control unit sends a fourth message to the power delivery module.

The fourth message indicates that configuration of the OTG function is completed.

811 S: The power delivery module turns off the first switch and turns on a second switch.

Specifically, after receiving the message indicating that the configuration of the OTG function is completed, the power delivery module turns on the second switch and turns off the first switch.

812 S: The power supply module outputs the voltage and current at the highest level supported by the first external device.

Specifically, after the second switch is turned on, the power supply module may output, through the charger chip to the first external device, the voltage and current at the highest level requested by the first external device.

813 S: The first external device sends a third request to the power delivery module.

Specifically, the first external device may send the third request, for example, get PPS state, to the electronic device. The third request is used to request to adjust a voltage and current.

814 S: The power delivery module sends a voltage and current adjustment request to the control unit.

815 S: The control unit adjusts the voltage and current.

Specifically, the control unit adjusts the OTG voltage and current of the charger chip in the power supply module in real time based on a requirement of the power delivery module.

816 S: The power supply module outputs a voltage and current corresponding to the third request to the first external device.

In some embodiments, after the first external device is disconnected from the electronic device, the power delivery module turns off the second switch, and sends, to the control unit, a message for turning off the second switch. The control unit controls the first switch switching circuit to switch to the processor port, to wait for a next connection of the external device.

It can be learned that, in a power-off scenario, the control unit in the electronic device controls, by default, the switch switching circuit to switch to be short-circuited to a 0-ohm resistor. Therefore, after the first external device is connected to the electronic device, the electronic device is identified as the DCP port. After the first external device identifies the electronic device as the DCP port, some charging levels of a PD protocol and a PPS may be supported.

11 FIG. 7 FIG. 11 FIG. 102 100 is a schematic diagram of a charging scenario of dual Type-C ports based on a second charging circuit according to an embodiment of this application. The second charging circuit is the second charging circuitshown in. In the scenario shown in, an electronic deviceis in a powered-on state and/or a sleep state.

11 FIG. 100 2011 2012 100 200 2011 100 100 200 100 200 100 200 100 200 100 200 As shown in, the electronic deviceis a notebook computer, and is configured with two Type-C ports: a first Type-C portand a second Type-C port. The electronic devicemay establish a connection to a first external device(for example, a mobile phone) through one of the two Type-C ports (for example, the first Type-C port). After establishing the connection, the electronic deviceconfirms that the electronic deviceis a Source device, and the connected first external deviceis a Sink device. The electronic devicemay broadcast, to the first external device, charging power provided by the electronic device, and display PPS support in a manner of, for example, a pop-up window, and at a first moment, the first external devicemay prioritize requesting 5 V/2 A. Therefore, at the first moment, the electronic deviceprovides power of, for example, 5 V/2 A (that is, 10 W), for the first external device, and the electronic devicemay perform data transmission with the first external device.

11 FIG. 100 200 It can be learned fromthat, at the first moment, after the electronic deviceprovides the power of, for example, 5 V/2 A (that is, 10 W) for the first external device, there are the following several cases.

100 300 100 200 Case 1: After the first moment, if the electronic devicedetects that a second external devicecharges the electronic device through the second Type-C port, the electronic devicemaintains the current charging power of 5 V/2 A unchanged. In other words, at a second moment, the first external deviceis still charged at the power of 5 V/2 A.

2 100 300 100 100 200 Case: After the first moment, the electronic devicedetects that there is no second external devicecharging the electronic devicethrough the second Type-C port, and may display “Perform fast charging?” in a pop-up window, to prompt a user whether to select fast charging. If the user selects a “No” option, the electronic devicemaintains, in response to a user operation of a “No” functional control, current charging power unchanged. For example, at the second moment, fast charging at power of 12 V/3 A (that is, 36 W) is still performed on the first external device.

100 200 200 100 200 200 If the user selects a “Yes” option, the electronic deviceprovides, in response to a user operation of a “Yes” functional control, charging power (for example, 12 V/3 A) higher than 5 V/2 A for the first external device. Therefore, at the second moment, fast charging at the power of 12 V/3 A (that is, 36 W) may be performed on the first external device. After the second moment, the electronic devicemay adjust, in real time, charging power delivered to the first external device. For example, at a third moment, fast charging at power of 9 V/2 A (that is, 18 W) may be performed on the first external device.

3 100 300 100 100 200 200 100 200 200 100 300 2012 100 200 2011 200 Case: After the first moment, the electronic devicedetects that there is no second external devicecharging the electronic devicethrough the second Type-C port, and may display “Perform fast charging?” in a pop-up window, to prompt a user whether to select fast charging. If the user selects a “Yes” option, the electronic deviceprovides, in response to a user operation of a “Yes” functional control, charging power (for example, 12 V/3 A) higher than 5 V/2 A for the first external device. Therefore, at the second moment, fast charging at the power of 12 V/3 A (that is, 36 W) may be performed on the first external device. After the second moment, the electronic devicemay adjust, in real time, charging power delivered to the first external device. For example, at a third moment, fast charging at power of 9 V/2 A (that is, 18 W) may be performed on the first external device. After the second moment or the third moment, the electronic devicedetects that the second external devicecharges the electronic device through the second Type-C port, or the electronic devicedetects that the first external deviceperforms data transmission through the first Type-C port, and the charging power is restored to 5 V/2 A. Therefore, at a fourth moment after the second moment or the third moment, the first external devicerestores being charged at the power of 5 V/2 A.

12 FIG.A 12 FIG.C 901 922 toare a schematic flowchart of a charging scenario of dual Type-C ports based on a second charging circuit, including but not limited to the following steps. For ease of description in this application, the following sequence of Sto Sis used for description, and it is not intended to limit the steps to be performed in the sequence. A sequence of performing the foregoing one or more steps, time of performing the foregoing one or more steps, a quantity of times of performing the foregoing one or more steps, and the like are not limited in embodiments of this application.

7 FIG. 100 2061 2062 It can be learned fromthat, an electronic device may control, by using a control unit, a switch switching circuit to switch to a processor port. In this way, after an external device is connected to the electronic device through a Type-C port, it may be determined, based on a USB2.0 protocol, that the external device is an SDP port. When the electronic deviceis in a powered-on state and/or a sleep state, the control unit controls, by default, a first switch switching circuitand a second switch switching circuitto switch to the processor port.

901 200 100 S: A first external deviceestablishes a connection to a power delivery module in the electronic device.

200 202 100 200 100 200 Specifically, when the first external deviceis connected to a first Type-C port, the power delivery modulein the electronic deviceand the first external deviceperform handshake through a CC pin of the first Type-C port, and confirm that the electronic deviceis a Source device, and the connected first external deviceis a Sink device.

902 200 S: The power delivery module sends a first message to the first external device.

100 200 9 12 100 100 Specifically, the electronic deviceused as the Source device sends, by using the power delivery module, the first message to the first external deviceused as the Sink device. The first message includes one or more charging power of 5 V/2 A,V/2 A,V/2 A, 15 V/3 A, 20V/3.5 , and the like that can be provided by the electronic device, and programmable power supply (PPS) support may be displayed. It should be noted that a voltage and current provided by the electronic deviceis not limited to that provided in embodiments of this application, and a higher or lower voltage and current may be provided.

903 200 S: The first external devicerequests charging power of 5 V/2 A from the power delivery module.

904 S: The power delivery module turns on a first switch corresponding to the first Type-C port.

7 FIG. Specifically, it can be learned fromthat the power delivery module may control the first switch corresponding to the first Type-C port to be turned on or turned off, and the first switch is electrically connected to a buck circuit in a power supply module, to control, through the first switch, whether to output a voltage of 5 V output by the buck circuit to the power delivery module.

905 S: The power supply module outputs the charging power of 5 V/2 A.

200 Specifically, the buck circuit in the voltage module is configured to output the voltage of 5 V. When the first switch corresponding to the first Type-C port is turned on, the power supply module outputs, through a pin that is in the power delivery module and that is electrically connected to the first switch, the voltage of 5 V to a VBUS pin of the first Type-C port, to provide the charging power of 5 V/2 A for the first external device.

100 When the electronic deviceis in the powered-on state and/or the sleep state, the electronic device may control, by using the control unit, the switch switching circuit to be switched to the processor port. Therefore, after the electronic device establishes the connection to the external device, it may be confirmed, based on USB2.0, that the electronic device is the SDP port, to support a function of performing data transmission with the external device.

906 S: The control unit determines whether a second Type-C port is in a state of charging the electronic device.

100 2012 202 100 300 2012 100 Specifically, the electronic devicehas two or more Type-C ports. When the second external device is connected to a second Type-C port, the power delivery modulein the electronic deviceand the second external deviceperform handshake through a CC pin of the second Type-C port, and determine whether the electronic deviceis a Source device, and the connected second external device is a Sink device.

100 100 100 2012 100 100 If the electronic devicedetermines that the electronic deviceis the Sinke device and the connected second external device is the sourc device, the electronic devicedetermines that the second Type-C portis in the state of charging the electronic device, and the electronic devicecontinues to provide the charging power of 5 V/2 A for the external device.

2012 100 907 If it is determined that the second Type-C portis not in the state of charging the electronic device, step Sis performed.

907 S: The control unit determines whether to perform fast charging.

10 FIG. Specifically, as shown in, the electronic device may display “Perform fast charging?” in a pop-up window, and may determine, in response to a user operation on the pop-up window, to perform fast charging or not to perform fast charging.

After obtaining a message indicating not to perform fast charging, the electronic device maintains current output power and continues to provide the charging power of 5 V/2 A for the external device.

908 After a message indicating that fast charging is performed is obtained, step Sis performed.

908 S: The control unit controls the first switch switching circuit to switch to a 0-R resistor.

6 FIG. Specifically, in a UI interface of the electronic device, a user is prompted, in a manner of a pop-up window, whether to select fast charging. If the user selects fast charging, the control unit controls the first control switch switching circuit corresponding to the first Type-C port to switch from the processor port to a 0-R resistor port. It can be learned fromthat, after the 0-R resistor segment is switched to, the first Type-C port is disconnected from the processor. If the user does not select fast charging, the electronic device continues to output the charging power of 5 V/2 A.

909 S: The first external device re-establishes a connection to the power delivery module.

Specifically, after the power delivery module disables an OCP function by turning off the first switch corresponding to the first Type-C port, the first external device may re-establish a connection to the electronic device. For example, the electronic device is identified as a DCP port based on BC1.2 through the Type-C port.

910 S: The power delivery module sends a third message to the control unit.

Specifically, after the electronic device establishes the connection to the first external device based on BC1.2, the first external device requests, from the power delivery module, a charging capability at a highest level supported by the first external device, and the power delivery module sends the third message to the control unit through an I2C. The third message is used to request a voltage and current at a highest level supported by the first external device.

911 S: The control unit sends, to the power supply module, a message for enabling an OTG function.

Specifically, the control unit configures an OTG voltage and current of a charger chip in the power supply module based on a requirement from the power delivery module, and enables the OTG function.

912 S: The power supply module enables the OTG function.

Specifically, the power supply module enables the OTG function based on configuration of the control unit.

913 S: The control unit sends a fourth message to the power delivery module.

The fourth message indicates that configuration of the OTG function is completed.

914 S: The power delivery module turns off the first switch corresponding to the first Type-C port, and turns on a second switch corresponding to the first Type-C port.

Specifically, after receiving the message indicating that configuration of the OTG function is completed, the power delivery module turns on the second switch corresponding to the first Type-C port and turns off the first switch corresponding to the first Type-C port.

915 S: The power supply module outputs the voltage and current at the highest level supported by the first external device.

Specifically, after the second switch corresponding to the first Type-C port is turned on, the power supply module may output, through the charger chip to the first external device, the voltage and current at the highest level requested by the first external device.

916 S: The first external device sends a third request to the power delivery module.

Specifically, the first external device may send the third request, for example, get PPS state, to the electronic device. The third request is used to request to adjust a voltage and current.

917 S: The power delivery module sends a voltage and current adjustment request to the control unit.

918 S: The control unit adjusts the voltage and current.

Specifically, the control unit adjusts the OTG voltage and current of the charger chip in the power supply module in real time based on a requirement of the power delivery module.

919 S: The power supply module outputs a voltage and current corresponding to the third request to the first external device.

In some embodiments, after the first external device is disconnected from the electronic device, the power delivery module turns off the second switch, and sends, to the control unit, a message for turning off the second switch. The control unit controls the first switch switching circuit to switch to the processor port, to wait for a next connection of the external device.

910 919 920 926 12 FIG.A 12 FIG.B In some possible implementations, after any step between Sand Sshown in, one or more steps of Sto Sshown inare further included.

920 S: The second external device establishes a connection to the power delivery module.

Specifically, the second external device (for example, a charger) is connected to the electronic device through the second Type-C port, and establishes the connection to the power delivery module. It is identified that the second external device is a Source side, the electronic device is a Sink side, and the second external device may charge the electronic device.

921 S: The power delivery module sends a fifth message to the control unit.

The fifth message is used to notify the control unit that the second external device is connected to the electronic device.

922 S: The control unit sends, to the power supply module, a message for disabling the OTG function.

923 S: The power supply module disables the OTG function.

924 S: The control unit controls the first switch switching circuit to switch to the processor port.

The first switch switching circuit is connected to the first Type-C port. After the first switch switching circuit is switched to the processor port, the first Type-C port may be connected to the processor through the first switch switching circuit. Therefore, a data transmission function of the electronic device is restored, and the first external device may perform data transmission with the electronic device.

925 S: The control unit turns off the second switch and turns on the first switch.

Turning off the second switches indicates that the power supply module cannot output high power to the first external device through the charger chip, and turning on the first switch indicates that the power supply can output power of 5 V/2 A to the first external device through the buck circuit.

926 S: The power supply module outputs the charging power of 5 V/2 A to the first external device.

910 919 927 931 12 FIG.A 12 FIG.C In some possible implementations, after any step between Sand Sshown in, Sto Sshown inare further included.

927 S: The first external device sends a sixth message to a processor.

Specifically, the first external device may select to restore the data transmission function on the UI interface of the electronic device, to send the sixth message for restoring the data transmission function to the processor.

928 S: The processor sends the sixth message to the control unit.

The sixth message is used to notify the control unit that the first external device needs to switch back to the SDP port.

929 S: The control unit controls the first switch switching circuit to switch to the processor port.

The first switch switching circuit is connected to the first Type-C port. After the first switch switching circuit is switched to the processor port, the first Type-C port may be connected to the processor through the first switch switching circuit. Therefore, a data transmission function of the electronic device is restored, and the first external device may perform data transmission with the electronic device.

930 S: The control unit turns off the second switch and turns on the first switch.

Turning off the two switches indicates that the power supply module cannot output high power to the first external device through the charger chip, and turning on the first switch indicates that the power supply can output power of 5 V/2 A to the first external device through the buck circuit.

931 S: The power supply module outputs the charging power of 5 V/2 A to the first external device.

13 FIG.A 13 FIG.C 1001 1017 toare a schematic flowchart of another charging scenario of dual Type-C ports based on a second charging circuit, including but not limited to the following steps. For ease of description in this application, the following sequence of Sto Sis used for description, and it is not intended to limit the steps to be performed in the sequence. A sequence of performing the foregoing one or more steps, time of performing the foregoing one or more steps, a quantity of times of performing the foregoing one or more steps, and the like are not limited in embodiments of this application.

7 FIG. 100 2061 2062 It can be learned fromthat, an electronic device may control, by using a control unit, a switch switching circuit to switch to be short-circuited to a 0 R. In this way, after an external device is connected to the electronic device through a Type-C port, it may be determined, based on a USB2.0 protocol, that the external device is a DCP port. When the electronic deviceis powered-off, the control unit controls, by default, a first switch switching circuitand a second switch switching circuitto switch to be short-circuited to the 0 R.

1001 200 100 S: A first external deviceestablishes a connection to a power delivery module in an electronic device.

200 202 100 200 100 200 Specifically, when the first external deviceis connected to a first Type-C port, the power delivery modulein the electronic deviceand the first external deviceperform handshake through a CC pin of the first Type-C port, and confirm that the electronic deviceis a Source device, and the connected first external deviceis a Sink device.

1002 200 S: The power delivery module sends a first message to the first external device.

100 200 9 12 100 100 Specifically, the electronic deviceused as the Source device sends, by using the power delivery module, the first message to the first external deviceused as the Sink device. The first message includes one or more charging power of 5 V/2 A,V/2 A,V/2 A, 15 V/3 A, 20V/3.5 , and the like that can be provided by the electronic device, and programmable power supply (PPS) support may be displayed. It should be noted that a voltage and current provided by the electronic deviceis not limited to that provided in embodiments of this application, and a higher or lower voltage and current may be provided.

1003 200 S: The first external devicerequests charging power of 5 V/2 A from the power delivery module.

1004 S: The power delivery module turns on a first switch corresponding to the first Type-C port.

7 FIG. Specifically, it can be learned fromthat the power delivery module may control the first switch corresponding to the first Type-C port to be turned on or turned off, and the first switch is electrically connected to a buck circuit in a power supply module, to control, through the first switch, whether to output a voltage of 5 V output by the buck circuit to the power delivery module.

1005 S: The power supply module outputs the charging power of 5 V/2 A.

200 Specifically, the buck circuit in the voltage module is configured to output the voltage of 5 V. When the first switch corresponding to the first Type-C port is turned on, the power supply module outputs, through a pin that is in the power delivery module and that is electrically connected to the first switch, the voltage of 5 V to a VBUS pin of the first Type-C port, to provide the charging power of 5 V/2 A for the first external device.

100 When the electronic deviceis powered-off, the electronic device may control, by using the control unit, the switch switching circuit to switch to a processor port. Therefore, after the electronic device establishes a connection to the external device, it may be determined, based on USB2.0, that the electronic device is the DCP port, and voltage adjustment or PPS adjustment may be performed.

1006 S: The control unit determines whether a second Type-C port is in a state of charging the electronic device.

100 2012 202 100 300 2012 100 Specifically, the electronic devicehas two or more Type-C ports. When the second external device is connected to a second Type-C port, the power delivery modulein the electronic deviceand the second external deviceperform handshake through a CC pin of the second Type-C port, and determine whether the electronic deviceis a Source device, and the connected second external device is a Sink device.

100 100 100 2012 100 100 If the electronic devicedetermines that the electronic deviceis the Sink device and the connected second external device is the Source device, the electronic devicedetermines that the second Type-C portis in the state of charging the electronic device, and the electronic devicecontinues to provide the charging power of 5 V/2 A for the external device.

2012 100 1007 If it is determined that the second Type-C portis not in the state of charging the electronic device, step Sis performed.

1007 S: The first external device sends a third message to the power delivery module.

The third message is used to request, from the electronic device, a voltage and current at a highest level supported by the first external device, for example, 12 V/2 A.

1008 S: The power delivery module sends a third message to the control unit.

Specifically, the power delivery module sends the third message to the control unit through an I2C. The fourth message is used to request the control unit to configure the voltage and current at the highest level supported by the first external device.

1009 S: The control unit sends, to the power supply module, a message for enabling an OTG function.

Specifically, the control unit configures an OTG voltage and current of a charger chip in the power supply module based on a requirement from the power delivery module, and enables the OTG function.

1010 S: The power supply module enables the OTG function.

Specifically, the power supply module enables the OTG function based on configuration of the control unit.

1011 S: The control unit sends a fourth message to the power delivery module.

The fourth message indicates that configuration of the OTG function is completed.

1012 S: The power delivery module turns off the first switch corresponding to the first Type-C port, and turns on a second switch corresponding to the first Type-C port.

Specifically, after receiving the message indicating that configuration of the OTG function is completed, the power delivery module turns on the second switch corresponding to the first Type-C port and turns off the first switch corresponding to the first Type-C port.

1013 S: The power supply module outputs the voltage and current at the highest level supported by the first external device.

Specifically, after the second switch corresponding to the first Type-C port is turned on, the power supply module may output, through the charger chip to the first external device, the voltage and current at the highest level requested by the first external device.

1014 S: The first external device sends a third request to the power delivery module.

Specifically, the first external device may send the third request, for example, get PPS state, to the electronic device. The third request is used to request to adjust a voltage and current.

1015 S: The power delivery module sends a voltage and current adjustment request to the control unit.

1016 S: The control unit adjusts the voltage and current.

Specifically, the control unit implements and adjusts the OTG voltage and current of the charger chip in the power supply module based on a requirement of the power delivery module.

1017 S: The power supply module outputs a voltage and current corresponding to the third request to the first external device.

In some embodiments, after the first external device is disconnected from the electronic device, the power delivery module turns off the second switch, and sends, to the control unit, a message for turning off the second switch. The control unit controls the first switch switching circuit to switch to the processor port, to wait for a next connection of the external device.

1007 1017 1018 1023 13 FIG.A 13 FIG.B In some possible implementations, after any step between Sand Sshown in, one or more steps of Sto Sshown inare further included.

1018 S: The second external device establishes a connection to the power delivery module.

Specifically, the second external device (for example, a charger) is connected to the electronic device through the second Type-C port, and establishes the connection to the power delivery module. It is identified that the second external device is a Source side, the electronic device is a Sink side, and the second external device may charge the electronic device.

1019 S: The power delivery module sends a fifth message to the control unit.

The fifth message is used to notify the control unit that the second external device is connected to the electronic device.

1020 S: The control unit sends, to the power supply module, a message for disabling the OTG function.

1021 S: The power supply module disables the OTG function.

1022 S: The control unit turns off the second switch corresponding to the first Type-C port, and turns on the first switch corresponding to the first Type-C port.

Turning off the second switch indicates that the power supply module cannot output high power to the first external device through the charger chip, and turning on the first switch indicates that the power supply can output power of 5 V/2 A to the first external device through the buck circuit.

1023 S: The power supply module outputs the charging power of 5 V/2 A to the first external device.

1007 1017 1024 1030 13 FIG.A 13 FIG.C In some possible implementations, after any step between Sand Sshown in, Sto Sshown inare further included.

1024 S: The control unit detects that the electronic device is in a powered-on state.

Specifically, the electronic device responses to a user operation on a power-on key, and a detection unit may detect that the electronic device is in the powered-on state.

1025 S: The control unit sends, to the power supply module, a message for disabling the OTG function.

1026 S: The power supply module disables the OTG function.

1027 S: The control unit turns off the second switch corresponding to the first Type-C port.

1028 S: The control unit configures the switch switching circuit to switch to the processor port.

Specifically, the control unit configures the first switch switching circuit to switch to the processor port, and configures the second switch circuit to switch to the processor port.

1029 S: The control unit turns on the first switch corresponding to the first Type-C port.

1030 S: The power supply module outputs the charging power of 5 V/2 A to the first external device.

Because the first Type-C port may be connected to the processor through the first switch switching circuit, after the electronic device is powered-on, the first external device may perform data communication with the electronic device through the first Type-C port. Similarly, the second external device connected to the second Type-C port may perform data communication with the electronic device through the second switch switching circuit.

14 FIG. 1 FIG. 2 FIG. 7 FIG. 100 is a schematic flowchart of a charging method according to an embodiment of this application. The method is applied to an electronic device, for example, the electronic deviceshown in,, or. The method includes but is not limited to the following steps:

1401 S: The electronic device sends a first message to a first external device through a first USB port.

401 402 501 502 701 702 801 802 901 902 1001 1002 4 FIG. 6 FIG. 9 FIG. 10 FIG. 12 FIG.A 13 FIG.A Specifically, for detailed descriptions, refer to Sand Sshown in, Sand Sshown in, Sand Sshown in, Sand Sshown in, Sand Sshown in, or Sand Sshown in.

1402 S: The electronic device receives, from the first external device, a request for charging power of a first specification.

403 503 703 803 903 1003 4 FIG. 6 FIG. 9 FIG. 10 FIG. 12 FIG.A 13 FIG.A Specifically, for detailed descriptions, refer to Sshown in, Sshown in, Sshown in, Sshown in, Sshown in, or Sshown in.

1403 S: The electronic device outputs the charging power of the first specification to the first external device through the first USB port.

404 405 504 505 704 705 804 805 904 905 1004 1005 4 FIG. 6 FIG. 9 FIG. 10 FIG. 12 FIG.A 13 FIG.A For detailed descriptions, refer to Sand Sshown in, Sand Sin, Sand Sshown in, Sand Sshown in, Sand Sshown in, or Sand Sshown in.

1404 S: The electronic device receives, from the first external device, a request for charging power of a second specification.

406 506 4 FIG. 6 FIG. Specifically, for detailed descriptions, refer to Sshown inor Sshown in.

7 FIG. In a possible implementation, the electronic device further includes a switch switching circuit and a processor. The switch switching circuit corresponds to one or more USB ports, and the switch switching circuit is connected to the processor and short-circuited to a 0-ohm resistor. For detailed descriptions, refer to.

706 709 907 911 9 FIG. 12 FIG.A In an implementation, the switch switching circuit is configured to be connected to the first USB port and the processor. After outputting the charging power of the first specification to the first external device through the first USB port and before receiving, from the first external device, the request for the charging power of the second specification, the electronic device may further receive a fast charging request from the first external device, control, in response to the fast charging request, the switch switching circuit to switch from being connected to the processor to being connected to the 0-ohm resistor, and perform protocol interaction with the first external device through the first USB port, to determine that the electronic device is a dedicated charging port DCP port. For detailed descriptions, refer to Sto Sshown inor Sto Sshown in.

906 907 1006 1007 12 FIG.A 13 FIG.A In an implementation, the electronic device is connected to a second external device through a second USB port in the one or more USB ports, and when it is determined that the second external device located at the second USB port does not charge the electronic device, the electronic device receives the fast charging request from the first external device. For detailed descriptions, refer to Sand Sshown inor Sand Sshown in.

806 807 1007 1008 10 FIG. 13 FIG.A In a possible implementation, when the switch switching circuit is connected to the first USB port and the 0-ohm resistor, the electronic device is the DCP port. For detailed descriptions, refer to Sand Sshown inor Sand Sshown in.

1405 S: The electronic device outputs the charging power of the second specification to the first external device through the first USB port.

In a possible implementation, the electronic device includes one or more of a power delivery module, a control unit, and a power supply module. An on-the-go OTG function of the power supply module is enabled by using the control unit. A second switch of the power supply module is enabled by using the power delivery module. The second switch is configured to connect the first USB port and a charger chip in the power supply module, and the charger chip in the power supply module is configured to provide the charging power of the second specification. The charging power of the second specification is output, based on the OTG function and the second switch in an on state, to the first external device through the first USB port.

407 413 4 FIG. In a possible implementation, when it is determined that a system of the electronic device is not in a working state and/or a battery level of the electronic device is greater than or equal to a preset threshold, the electronic device outputs the charging power of the second specification to the first external device through the first USB port. For detailed descriptions, refer to Sto Sshown in.

507 518 6 FIG. In a possible implementation, the electronic device is connected to a second external device through a second USB port in the one or more USB ports, and when it is determined that the second external device located at the second USB port does not charge the electronic device, or when it is determined that a system of the electronic device is not in a working state and/or a battery level of the electronic device is greater than or equal to a preset threshold, outputs the charging power of the second specification to the first external device through the first USB port. For detailed descriptions, refer to Sto Sshown in.

710 715 9 FIG. In a possible implementation, the switch switching circuit is configured to be connected to the first USB port and the processor. The electronic device is connected to a second external device through a second USB port in the one or more USB ports, and outputs the charging power of the second specification to the first external device through the first USB port. For detailed descriptions, refer to Sto Sshown in.

807 812 10 FIG. In a possible implementation, when the switch switching circuit is connected to the first USB port and the 0-ohm resistor, the electronic device is the DCP port and outputs the charging power of the second specification to the first external device through the first USB port. For detailed descriptions, refer to Sto Sshown in.

912 917 1008 1013 12 FIG.A 13 FIG.A In a possible implementation, the switch switching circuit is configured to be connected to the first USB port and the processor. The electronic device is connected to a second external device through a second USB port in the one or more USB ports, and when it is determined that the second external device located at the second USB port does not charge the electronic device, outputs the charging power of the second specification to the first external device through the first USB port. For detailed descriptions, refer to Sto Sshown in. In a possible implementation, when the switch switching circuit is connected to the first USB port and the 0-ohm resistor, the electronic device is the DCP port. The electronic device is connected to a second external device through a second USB port in the one or more USB ports, and when it is determined that the second external device located at the second USB port does not charge the electronic device, outputs the charging power of the second specification to the first external device through the first USB port. For detailed descriptions, refer to Sto Sshown in.

716 719 813 816 918 921 1014 1017 9 FIG. 10 FIG. 12 FIG.A 13 FIG.A In a possible implementation, after outputting the charging power of the second specification to the first external device through the first USB port, the electronic device receives, from the electronic device, a request for charging power of a third specification, adjusts a voltage and current based on the request for the charging power of the third specification, and outputs a voltage and current corresponding to the request for the charging power of the third specification. For detailed descriptions, refer to Sto Sshown in, Sto Sshown in, Sto Sshown in, or Sto Sshown in.

The term “user interface (user interface, UI)” in the specification, the claims, and the accompanying drawings of this application is a medium interface for interaction and information exchange between an application or an operating system and a user, and conversion between an internal form of information and a form of the information acceptable to the user is implemented by using the user interface. A user interface of an application is Source code written in a specific computer language such as java or an extensible markup language (extensible markup language, XML). The interface Source code is parsed and rendered on a terminal device, and finally presented as user-recognizable content, for example, a control such as a picture, text, or a button. A control (control), also referred to as a widget (widget), is a basic element of a user interface. Typical controls include a toolbar (toolbar), a menu bar (menu bar), a text box (text box), a button (button), a scrollbar (scrollbar), a picture, and text. An attribute and content of the control on the interface are defined by using a label or a node. For example, the control included on the interface is defined in an XML by using a node such as <Textview>, <ImgView>, or <VideoView>. One node corresponds to one control or attribute on the interface. After being parsed and rendered, the node is presented as user-visible content. In addition, interfaces of many applications, for example, a hybrid application (hybrid application), usually include a webpage. A webpage, also referred to as a page, may be understood as a special control embedded in an application interface. The webpage is Source code written in specific computer languages such as a hyper text markup language (hyper text markup language, HTML), a cascading style sheet (cascading style sheets, CSS), and a javascript (JavaScript, JS). The Source code of the webpage may be loaded and displayed by a browser or a webpage display component with similar functions to the browser as content that can be recognized by the user. Specific content included in the webpage is also defined by using a label or a node in the Source code of the webpage. For example, an element and an attribute of the webpage are defined in an HTML by using <p>, <img>, <video>, or <canvas>.

The user interface is usually represented in a form of a graphical user interface (graphic user interface, GUI), and is a user interface that is related to a computer operation and that is displayed in a graphic manner. The graphical user interface may be an interface element such as an icon, a window, or a control that is displayed on a display screen of an electronic device. The control may include visible interface elements such as an icon, a button, a menu, a tab, a text box, a dialog box, a status bar, a navigation bar, and a widget.

It should be understood that the steps in the foregoing method embodiments provided in this application may be completed by using an integrated logic circuit of hardware or instructions in a form of software in a processor. The steps of the method disclosed with reference to embodiments of this application may be directly performed and completed by a hardware processor, or may be performed and completed by a combination of hardware in the processor and a software module.

This application further provides an electronic device. The electronic device may include a memory and a processor. The memory may be configured to store a computer program, and the processor may be configured to invoke the computer program in the memory to enable the electronic device to perform the method in any one of the foregoing embodiments.

This application further provides a chip system. The chip system includes at least one processor, configured to implement the functions in the method performed by the electronic device in any one of the foregoing embodiments.

In a possible design, the chip system further includes a memory. The memory is configured to store program instructions and data, and the memory is located inside or outside the processor.

The chip system may include a chip, or may include a chip and another discrete device.

Optionally, there may be one or more processors in the chip system. The processor may be implemented by using hardware, or may be implemented by using software. When the processor is implemented by using the hardware, the processor may be a logic circuit, an integrated circuit, or the like. When the processor is implemented by using the software, the processor may be a general-purpose processor, and is implemented by reading software code stored in the memory.

Optionally, there may also be one or more memories in the chip system. The memory may be integrated with the processor, or may be disposed separately from the processor. This is not limited in embodiments of this application. For example, the memory may be a non-transitory processor, for example, a read-only memory ROM. The memory and the processor may be integrated into a same chip, or may be separately disposed on different chips. A type of the memory and a manner of disposing the memory and the processor are not specifically limited in embodiments of this application.

For example, the chip system may be a field programmable gate array (field programmable gate array, FPGA), an application-specific integrated chip (application specific integrated circuit, ASIC), a system on chip (system on chip, SoC), a central processing unit (central processing unit, CPU), a network processor (network processor, NP), a digital signal processing circuit (digital signal processor, DSP), a micro controller unit (micro controller unit, MCU), a programmable controller (programmable logic device, PLD), or another integrated chip.

This application further provides a computer program product. The computer program product includes a computer program (which may also be referred to as code or an instruction). When the computer program is run, a computer is enabled to perform the method performed by the electronic device in any one of the foregoing embodiments.

This application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program (which may also be referred to as code or an instruction). When the computer program is run, a computer is caused to perform the method performed by the electronic device in any one of the foregoing embodiments.

Various implementations of this application may be combined randomly to achieve different technical effects.

All or a part of the foregoing embodiments may be implemented by using software, hardware, firmware, or any combination thereof. When software is used to implement embodiments, all or a part of embodiments may be implemented in a form of a computer program product. The computer program product includes one or more computer instructions. When computer program instructions are loaded and executed on the computer, all or a part of the procedures or functions according to this application are generated. The computer may be a general-purpose computer, a dedicated computer, a computer network, or another programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or may be transmitted from a computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center to another website, computer, server, or data center in a wired (for example, a coaxial cable, an optical fiber, or a digital subscriber line) or wireless (for example, infrared, radio, or microwave) manner. The computer-readable storage medium may be any usable medium accessible by the computer, or a data storage device, for example, a server or a data center, integrating one or more usable media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk drive, or a magnetic tape), an optical medium (for example, a DVD), a semiconductor medium (for example, a solid-state drive (Solid State Disk)), or the like.

A person of ordinary skill in the art may understand that all or some of the processes of the methods in embodiments may be implemented by a computer program instructing relevant hardware. The program may be stored in a computer-readable storage medium. When the program is executed, the processes of the foregoing method embodiments may be performed. The foregoing storage medium includes: any medium that can store program code, such as a ROM, a random access memory RAM, a magnetic disk, or an optical disc.

In conclusion, the foregoing descriptions are merely embodiments of the technical solution of the present invention, but are not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, and the like made based on the disclosure of the present invention still fall within the scope of protection of the present invention.

Classification Codes (CPC)

Cooperative Patent Classification codes for this invention. Click any code to explore related patents in that topic.

Patent Metadata

Filing Date

April 18, 2026

Publication Date

August 27, 2026

Inventors

Tingwei Zhang
MU WANG
Zhongming Li
Hengliang Qin
Pengfei Ma
Ke Xu

Want to explore more patents?

Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.

Citation & reuse

Analysis on this page is generated by Patentable — an AI-powered patent intelligence platform. AI-generated summaries, explanations, and analysis may be reused with attribution and a visible link back to the canonical URL below. Patent abstracts and claims are USPTO public domain.

Cite as: Patentable. “CHARGING METHOD, ELECTRONIC DEVICE, AND RELATED APPARATUS” (US-20260254262-A1). https://patentable.app/patents/US-20260254262-A1

© 2026 Patentable. All rights reserved.

Patentable is a research and drafting-assistant tool, not a law firm, and does not provide legal advice. Documents we generate are drafts for review by a licensed patent attorney.

CHARGING METHOD, ELECTRONIC DEVICE, AND RELATED APPARATUS — Tingwei Zhang | Patentable