A charging method and related device

By adjusting the adapter's peak current and delay time, combined with the battery discharge response time, the working mode of the charging management module is optimized, solving the problems of electronic device power loss and battery discharge under high load scenarios, and improving the adapter's output power and the reliability of mode switching.

CN120749929BActive Publication Date: 2026-05-12HONOR DEVICE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HONOR DEVICE CO LTD
Filing Date
2024-08-20
Publication Date
2026-05-12

AI Technical Summary

Technical Problem

Under high load conditions, electronic devices are prone to issues such as power loss, exiting performance mode, and the charging icon switching back and forth, affecting user experience.

Method used

By adjusting the adapter's peak current and delay time, combined with the battery discharge response time, the operating mode of the charging management module is optimized, reducing the frequency of system power outages and mode switching, and preventing continuous battery discharge.

Benefits of technology

It effectively reduces the frequency of system power outages, avoids continuous battery discharge, increases the maximum output power of the adapter, protects the adapter from damage, and ensures that the charging management module switches working modes in a timely manner.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120749929B_ABST
    Figure CN120749929B_ABST
Patent Text Reader

Abstract

The application discloses a charging method and related equipment. According to the charging method, in the case of power failure of an electronic device, the electronic device can adaptively adjust adapter-related parameters, such as a parameter for indicating an adapter peak current, a delay duration for determining the adapter peak current, and the like, based on an adapter specification, thereby improving the maximum output power of the adapter and delaying the determination of the adapter peak current. The electronic device can also adaptively adjust the response duration of battery discharge, so that the adapter delays switching from a charging mode to a discharging mode, to a certain extent, avoiding the case that the maximum output power of the adapter is less than the overall power consumption, reducing the frequency of the charging management module switching to the discharging mode, and thereby avoiding continuous battery discharge.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of charging technology, and in particular to a charging method and related equipment. Background Technology

[0002] When electronic devices such as personal computers (PCs) are charged via an adapter, they are prone to power loss under heavy load scenarios such as heavy-load (or high-load) games. This may cause the electronic device to fail to charge, exit performance mode, and the displayed charging icon to switch back and forth, thus affecting the user experience. Summary of the Invention

[0003] This application provides a charging method and related equipment. Through this method, an electronic device can adaptively adjust adapter-related parameters, such as parameters indicating the adapter's peak current and the delay duration for determining the adapter's peak current, thereby increasing the adapter's maximum output power and delaying the determination of the adapter's peak current. The electronic device can also adaptively adjust the battery discharge response time, thereby delaying the adapter's switch from charging mode to discharging mode, reducing the frequency of system power outages and the frequency of the charging management module switching to discharging mode, thus preventing continuous battery discharge.

[0004] In a first aspect, this application provides an electronic device. The electronic device may include a charging management module, a controller, and a battery. The charging management module in the electronic device can be connected to both the controller and the battery. The charging management module can also be connected to an adapter. The charging management module can be used to receive power output from the adapter to charge the battery in the electronic device. The controller can be used to send at least one of a first current parameter and a first duration, and to send first information, to the charging management module when the adapter is in operation and the system loses power (i.e., the electronic device experiences a power outage). The charging management module can also be used to maintain its operating mode in charging mode when, based on the first information, the duration of the system power outage is determined to be less than the first duration. The first current parameter can be used to indicate the peak current of the adapter, and the peak current of the adapter can be used to determine the maximum output power of the adapter. The peak current of the adapter indicated by the first current parameter is greater than the current peak current of the adapter. The first duration can be used to indicate the waiting time between receiving the indication of a system power outage and switching the operating mode to a discharging mode. The first duration is greater than the current waiting time, i.e., the first duration can be greater than the currently set waiting time of the electronic device. The first information can be used to indicate a system power outage.

[0005] In the solution provided in this application, when the charging management module in the electronic device is in charging mode (i.e., the charging management module receives power output from the adapter to charge the battery), if the adapter is in operation and the system loses power, the adapter can adjust at least one of a first current parameter and a first duration, and then send the obtained first current parameter and / or first duration to the charging management module. The charging management module can increase the peak current of the adapter based on the first current parameter, thereby increasing the adapter's maximum output power and reducing the frequency of system power outages. This can, to some extent, reduce the frequency and probability of the charging management module switching its operating mode to a discharging mode, thus preventing continuous battery discharge. The charging management module can also increase the waiting time between receiving the system power outage indication and switching the operating mode to a discharging mode based on the first duration, ensuring that the electronic device does not experience power outages before the charging management module begins switching operating modes.

[0006] It should be noted that when the controller both adjusts the first current parameter to increase the adapter's peak current and extends the first duration, on the one hand, the increased first duration provides sufficient time for the controller to adjust the first current parameter before the charging management module switches to the discharging mode. This ensures the adapter's peak current is increased promptly, resulting in the overall power consumption of the electronic device being less than the adapter's maximum output power, thus resolving the system power loss issue in a timely manner. On the other hand, compared to adjusting only the first current parameter or only the first duration, adjusting both the first current parameter and the first duration requires only a smaller adjustment to resolve the issue of continuous battery discharge. In other words, when the controller only adjusts the first current parameter, a larger adjustment is required. The issue of system power loss can only be resolved by adjusting the first duration parameter. However, this leads to a higher peak current setting for the adapter, which can easily damage the adapter. If the controller only adjusts the first duration parameter, a larger adjustment is needed to reduce the frequency of the charging management module switching operating modes. While this can stop the system from losing power before the charging management module switches to the discharge mode, thus preventing continuous battery discharge, it also prevents the charging management module from responding promptly when it needs to switch to the discharge mode. In contrast, when the controller adjusts both the first current parameter and the first duration parameter, both parameters only need to be adjusted by a smaller amount to solve the problem of continuous battery discharge. This avoids damaging the adapter due to a higher peak current setting and prevents the charging management module from failing to switch to the discharge mode in time when the battery needs to be discharged.

[0007] In some embodiments of this application, system power failure may also refer to electronic device power failure, i.e., the electronic device experiencing a power outage. In one possible implementation, system power failure refers to the system power consumption (or total power consumption) exceeding the adapter's maximum output power. The specific methods for determining system power failure are detailed below and will not be repeated here.

[0008] In some embodiments of this application, the controller may be an EC as mentioned below.

[0009] In some embodiments of this application, the first current parameter may be the percentage of the adapter peak current, as mentioned below.

[0010] In some other embodiments of this application, the first current parameter may be the adapter peak current mentioned below.

[0011] In some other embodiments of this application, the first current parameter may be the ratio of the adapter's peak current to the adapter's rated current, as mentioned below.

[0012] In some embodiments of this application, the first duration may be the first response duration mentioned below.

[0013] In some other embodiments of this application, the first duration may be the first de-jitter duration mentioned below.

[0014] In some embodiments of this application, the first duration may include the first response duration and the first de-jitter duration mentioned below. The controller may adjust the first response duration and the first de-jitter duration separately. In one possible implementation, the first duration may be the sum of the first response duration and the first de-jitter duration.

[0015] It is understandable that the current waiting time refers to the waiting time taken by the charging management module before receiving the first waiting time.

[0016] In some embodiments of this application, the controller can determine whether the system has lost power at a preset frequency, and if it determines that the system has lost power, send a system power loss indication message to the charging management module. It is understood that the preset frequency can be set according to actual needs, and this application does not limit it in this regard. The specific method for setting the preset frequency can be referred to the relevant description below, and will not be repeated here.

[0017] In some embodiments of this application, when the controller determines that the system has changed from not being powered down to being powered down, it can send a system power-down indication message (i.e., the system power-down indication message that the controller sends to the charging management module for the first time during this system power-down process) to the charging management module. After determining that the system is powered down and adjusting the first duration, the controller starts timing. When the timing duration reaches the first duration, it can determine again whether the system is powered down. If the system is powered down again, the controller can send the system power-down indication message (i.e., the system power-down indication message that the controller finally sends to the charging management module during this system power-down process, or the system power-down indication message that the controller sends to the charging management module for the last time) to the charging management module again.

[0018] In some embodiments of this application, during the aforementioned timing process, the controller can determine whether the system has lost power at a preset frequency. In one possible implementation, if a system power failure is determined, a system power failure indication message is sent to the charging management module. In another possible implementation, if a system power failure is determined, no system power failure indication message is sent to the charging management module; if a system power failure is determined, a system not power failure indication message is sent to the charging management module.

[0019] It is understood that the first information is a system power-down indication. In some embodiments of this application, the first information may be a system power-down indication sent by the controller to the charging management module when the system determines that it has changed from a power-down state to a power-down state. In still other embodiments of this application, the first information may be a system power-down indication sent again by the controller to the charging management module when the aforementioned timing duration reaches a first duration and the system power-down is determined again.

[0020] In some embodiments of this application, the controller sends corresponding indication information to the charging management module only when the system power failure status changes. That is, the controller only sends a system-not-power-down indication to the charging management module when the system changes from a power failure to a power-on state, and a system-power-down indication to the charging management module when the system changes from a power-on state to a power failure. In this case, the charging management module can also be used to maintain its operating mode as charging mode when the duration of the system power failure, determined based on the first information, is less than a first duration. Specifically, this can include: the charging management module can also start timing upon receiving the first information, and maintain its operating mode as charging mode even when it receives a system-not-power-down indication if the timing duration is less than the first duration.

[0021] In some embodiments of this application, the charging management module can also be used to maintain the charging mode when the duration of the system power outage is less than a first duration based on the first information. Specifically, the charging management module can also be used to start timing when the first information is received, and maintain the charging mode when the system no longer loses power after the timing duration is less than the first duration.

[0022] In some embodiments of this application, the charging management module can also be used to switch its operating mode to a discharging mode after a system power outage lasting for a first duration. For example, if the first duration is a first response duration and the first debounce duration is set to 0, the charging management module can switch its operating mode from charging mode to discharging mode after a system power outage lasting for a first duration. As another example, if the first duration is a first debounce duration and the first response duration is set to 0, the charging management module can switch its operating mode from charging mode to discharging mode after a system power outage lasting for a first duration. Yet another example, if the first duration is the sum of the first debounce duration and the first response duration, the charging management module can switch its operating mode from charging mode to discharging mode after a system power outage lasting for a first duration.

[0023] Understandably, the first current parameter sent by the controller to the charging management module is an regulated parameter, as mentioned above, indicating that the peak current of the adapter is greater than the current peak current of the adapter.

[0024] It should be noted that before the charging management module receives the first current parameter sent by the controller, the parameter used by the charging management module to indicate the adapter's peak current is the originally set current parameter (e.g., the original adapter peak percentage mentioned below), or the initial value of the first current parameter for this adjustment. This originally set current parameter is the current peak current of the adapter as described in the first aspect above. Only after the charging management module receives the first current parameter sent by the controller is the parameter used to indicate the adapter's peak current set to this first current parameter. In other words, the charging management module applies the first current parameter only after receiving it from the controller; previously, the originally set current parameter was used.

[0025] Similarly, before the charging management module receives the first duration sent by the controller, it uses the originally set waiting duration, or the initial value of the first duration for this adjustment. This originally set waiting duration is the current waiting duration mentioned in the first aspect above. Only after the charging management module receives the first duration sent by the controller is the waiting duration set to this first duration. In other words, the first duration is applied only after the charging management module receives the first duration sent by the controller; before that, the originally set waiting duration is used. It can be understood that the waiting duration mentioned here refers to the waiting time between receiving the system power-down indication information and switching the operating mode to discharge mode, as mentioned above.

[0026] It is understood that the "current" mentioned in the first aspect above refers to the moment when the controller sends at least one of the first current parameter and the first duration to the charging management module. The current peak current of the adapter can refer to the peak current of the adapter when the controller sends the first current parameter to the charging management module. Similarly, the current waiting duration can refer to the waiting duration adopted by the charging management module when the controller sends the first duration to the charging management module.

[0027] It is understood that "this adjustment" refers to the adjustment of other parameters such as the first current parameter and / or the first duration after the system power failure. For example, "this adjustment" may refer to the adjustment of one or more parameters by the electronic device during the execution of steps S101-S109.

[0028] In conjunction with the first aspect, in one possible implementation, the controller can also be used to adjust the first current parameter when the adapter is in operation and the system is powered off, and to send the first current parameter obtained from this adjustment to the charging management module. It is understood that the peak current of the adapter indicated by the first current parameter obtained from this adjustment is greater than the peak current of the adapter indicated by the first current parameter obtained from the previous adjustment.

[0029] In the solution provided in this application, when the adapter is in operation and the system is powered off, the controller can adjust a first current parameter and then send the adjusted first current parameter to the charging management module. Upon receiving the first current parameter, the charging management module can increase the peak current of the adapter based on this parameter. After the controller performs the above adjustment, if the adapter is in operation but the system is still powered off, the controller can continue to adjust the first current parameter and then send the adjusted first current parameter to the charging management module. Upon receiving the first current parameter, the charging management module can again increase the peak current of the adapter based on this parameter. It is understood that the controller can adjust the first current parameter multiple times until the adapter is in operation and the system stops being powered off. This method allows for adaptive adjustment based on the specifications of the adapter currently used by the electronic device; that is, the controller's adjustment of the first current parameter is constrained by the adapter, thus solving the system power-off problem without affecting the adapter's operation. In other words, when the adapter stops working, the controller can stop adjusting the first current parameter in time. Conversely, when the adapter is working, if the system still loses power, the controller can continue adjusting the first current parameter. In this way, for adapters of different specifications, the controller can adjust the first current parameter to a reasonable value. That is, regardless of whether the maximum output power that the adapter can withstand is high or low, the controller can adjust the first current parameter accordingly.

[0030] It is understood that the peak current indicated by the first current parameter obtained from the previous adjustment mentioned here may refer to the peak current of the adapter indicated by the first current parameter sent by the controller to the charging management module as described in the first aspect above.

[0031] It is understood that the specific adjustment method of the first current parameter can be referred to the relevant descriptions of steps S104 and S107-S109 shown below, which will not be elaborated here.

[0032] In some embodiments of this application, if the first current parameter obtained in this adjustment is greater than the corresponding threshold (e.g., threshold 3 mentioned below), the controller can stop the adjustment and restore the first current parameter to the state before the adjustment.

[0033] In some embodiments of this application, the controller adjusts the first current parameter, which may specifically include: the controller adding a first value based on the first current parameter obtained in the previous adjustment or the initial value of the first current parameter. It is understood that the first value can be set according to actual needs, and this application does not limit this. For example, the first current parameter can be a percentage of the adapter's peak current, and the first value can be 'a' mentioned below.

[0034] In conjunction with the first aspect, in one possible implementation, the controller can also be used to adjust the first duration when the adapter is in operation and the system is powered off, and to send the adjusted first duration to the charging management module. It can be understood that the first duration obtained in this adjustment is longer than the first duration obtained in the previous adjustment.

[0035] In the solution provided in this application, when the adapter is in working condition and the system is powered off, the controller can increase the waiting time (e.g., a first duration) between the time the charging management module receives the system power-off indication and the time it switches the working mode to the discharging mode. Then, the controller sends the adjusted waiting time (e.g., the first duration obtained in the previous adjustment) to the charging management module. Upon receiving this waiting time, the charging management module can use it to determine when to switch the working mode to the discharging mode. After the controller performs the above adjustment, if the adapter is in working condition but the system is still powered off, the controller can continue to increase the waiting time and then send the re-adjusted waiting time (e.g., the first duration obtained in this adjustment) to the charging management module. Similarly, upon receiving this re-adjusted waiting time, the charging management module can use it to determine when to switch the working mode to the discharging mode. It is understood that the controller can adjust the waiting time multiple times until the adapter is in working condition and the system stops being powered off. This method delays the switching of the charging management module from the operating mode to the discharging mode by increasing the waiting time, thus preventing the electronic device from losing power before the charging management module starts switching operating modes.

[0036] It is understood that the first duration obtained from the previous adjustment mentioned here may refer to the first duration sent by the controller to the charging management module as described in the first aspect above.

[0037] It is understood that the specific adjustment method of the first duration can be referred to the relevant descriptions of steps S103, S105 and S107-S109 shown below, which will not be elaborated here.

[0038] In some embodiments of this application, if the first duration obtained by this adjustment is greater than the corresponding threshold (e.g., threshold 1, threshold 5, etc. mentioned below), the controller can stop the adjustment and restore the first duration to the state before the adjustment.

[0039] In some embodiments of this application, the first duration is greater than a first duration threshold. It is understood that the first duration threshold can be set according to actual needs, and this application does not impose any limitations on it. For example, the first duration can be a first response duration, in which case the first duration threshold can be the original discharge response duration mentioned below. As another example, the first duration can be a first de-jitter duration, in which case the first duration threshold can be the original de-jitter duration mentioned below.

[0040] In some embodiments of this application, the controller adjusts the first duration, which may specifically include: the controller adding a second value to the first duration obtained in the previous adjustment or the initial value of the first duration. It is understood that the second value can be set according to actual needs, and this application does not limit this. For example, the first duration can be a first response duration, and the second value can be t1 mentioned below. As another example, the first duration can be a first dejittering duration, and the second value can be t2 mentioned below. Yet another example, the first duration can be the sum of the first response duration and the first dejittering duration, and the second value can be t1+t2 mentioned below.

[0041] In some embodiments of this application, the increase of the first duration does not directly affect the state of the adapter. For example, increasing the first duration does not directly cause the adapter to change from the working state to the stopped state. Therefore, if the adapter changes from the working state to the stopped state after the controller adjusts multiple parameters, including the first duration, the controller can stop adjusting other parameters among the multiple parameters, but continue to adjust the first duration.

[0042] In some embodiments of this application, the first duration adjusted by the controller can be greater than a first threshold. It is understood that the first threshold can be set according to actual needs, and this application does not limit it. For example, the first threshold can be 50 microseconds. Another example is 75 microseconds. Yet another example is 100 microseconds. Another example is 150 microseconds. Yet another example is 200 microseconds. In some embodiments of this application, the first threshold can be an initial value of the first duration, or it can be greater than the initial value of the first duration. In some embodiments of this application, the first threshold can be less than or equal to threshold 1. In still other embodiments of this application, the first threshold can be less than or equal to threshold 5.

[0043] In conjunction with the first aspect, in one possible implementation, the controller can also be used to perform any one or more of the following:

[0044] After sending the first current parameter to the charging management module, and when the adapter is in a stopped state, a second current parameter is sent to the charging management module. The second current parameter is used to indicate the peak current of the adapter, and the peak current of the adapter indicated by the second current parameter is less than the current peak current of the adapter.

[0045] After sending the first duration to the charging management module, and while the adapter is in a stopped state, a second duration is sent to the charging management module. The second duration is used to indicate the waiting time between receiving the system power failure indication information and switching the working mode to the discharge mode. The second duration is less than the current waiting time.

[0046] In the solution provided in this application, if the adapter changes from the working state to the stopped state after the controller sends the first current parameter, it means that the peak current of the adapter indicated by the first current parameter obtained by the controller exceeds the carrying capacity of the adapter currently connected to the electronic device. In this case, the controller can reduce the peak current of the adapter indicated by the first current parameter to obtain a second current parameter with a smaller peak current, and send the second current parameter to the charging management module. In this way, the peak current of the adapter can be adaptively controlled by the charging management module without affecting the normal operation of the adapter, so that the adapter will not stop working due to the large set peak current, thereby causing the adapter to be damaged.

[0047] Similarly, if the adapter changes from working to stopped after the controller sends the first duration, it means that the first duration adjusted by the controller may affect the normal operation of the adapter. For example, if the peak current of the adapter is high, and the waiting time for the charging management module to switch to the discharge mode is long, it will take a long time for the battery to change from charging to discharging. During this process, the battery can only be powered through the adapter it is connected to. If the power consumption of the whole device is continuously greater than the peak current of the adapter, the peak current of the adapter will remain at a high level, which will lead to the damage of the adapter.

[0048] In this scenario, the controller can reduce the first duration, i.e., reduce the waiting time between the charging management module receiving the system power failure indication and switching the operating mode to the discharge mode, to obtain a second duration. This second duration is then sent to the charging management module. This approach, while avoiding the impact of increased waiting time on adapter operation, minimizes the time required for the charging management module to switch the operating mode during a system power failure, reducing the probability of the charging management module switching to the discharge mode. This, in turn, prevents the battery from continuously discharging due to the charging management module's difficulty in switching from the discharge mode to the charging mode.

[0049] It is understandable that the current peak current of the adapter mentioned here refers to the peak current of the adapter when the controller sends the second current parameter to the charging management module. Similarly, the current waiting time mentioned here refers to the waiting time used by the charging management module when the controller sends the second duration to the charging management module.

[0050] It is understood that the waiting time mentioned in this application may be the waiting time between the charging management module receiving the system power failure indication information and switching the working mode to the discharge mode, as mentioned above.

[0051] In some embodiments of this application, the second current parameter can be the first current parameter obtained from the previous adjustment.

[0052] In some embodiments of this application, when the controller adjusts the first current parameter multiple times, the second current parameter can be any of the first current parameters after any adjustment.

[0053] In some embodiments of this application, the second current parameter can be the originally set current parameter, or the initial value of the first current parameter to be adjusted this time.

[0054] In some embodiments of this application, the second duration can be the first duration obtained from the previous adjustment.

[0055] In some embodiments of this application, when the controller adjusts the first duration multiple times, the second duration can be any of the first durations after the first adjustment.

[0056] In some embodiments of this application, the second duration can be the originally set waiting duration, or the initial value of the first duration of this adjustment.

[0057] In conjunction with the first aspect, in one possible implementation, the electronic device may further include a display screen that can be connected to a controller. The controller may also be used to adjust the brightness of the display screen when the adapter is active and the system is powered off, such that the adjusted brightness is less than the original brightness of the display screen.

[0058] In the solution provided in this application, when the charging management module in the electronic device is in charging mode (i.e., the charging management module receives power output from the adapter to charge the battery), if the adapter is in working state and the system is powered off, the controller can reduce the brightness of the display screen to reduce the overall power consumption of the electronic device. This can reduce the duration during which the overall power consumption exceeds the maximum output power of the adapter, i.e., reduce the duration of system power loss, so that the system stops powering off before the charging management module switches the working mode to the discharging mode, thereby avoiding continuous battery discharge. Furthermore, when the controller adjusts at least two of the following three parameters—the first current parameter, the first duration, and the display brightness—the problem of continuous battery discharge can be resolved with a smaller adjustment range compared to adjusting only one parameter. In other words, when the controller adjusts only the first current parameter, a larger adjustment is needed to resolve the system power-off issue, resulting in a higher adapter peak current and potential damage to the adapter. Similarly, when the controller adjusts only the first duration, a larger adjustment is needed to reduce the frequency of the charging management module switching operating modes. While this can prevent the system from losing power before the charging management module switches to discharge mode, thus avoiding continuous battery discharge, it also leads to issues with the charging management module. The module cannot respond promptly when switching to discharge mode is required. When the controller only adjusts the display brightness, the brightness needs to be reduced significantly, resulting in a dim display that may affect user experience. However, when the controller adjusts the first current parameter, the first duration, and the display brightness, only these three parameters need to be adjusted by a small margin to solve the problem of continuous battery discharge. This avoids damaging the adapter due to a high peak current setting, prevents the charging management module from failing to switch to discharge mode in time when battery discharge is required, and avoids dimming the display that may affect user experience. Furthermore, this approach addresses the system power failure issue from two perspectives: reducing overall power consumption and increasing the adapter's maximum output power. This provides a more comprehensive solution to the problem of continuous battery discharge caused by frequent system power failures.

[0059] In conjunction with the first aspect, in one possible implementation, after adjusting the display brightness, the controller can also be used to adjust the display brightness when the adapter is in operation and the system is powered off, or when the adapter is stopped. It is understood that the brightness of the display obtained in this adjustment is less than the brightness obtained in the previous adjustment.

[0060] In the solution provided in this application, when the charging management module in the electronic device is in charging mode (i.e., the charging management module receives power from the adapter to charge the battery), if the adapter is in operation and the system is powered off, the controller can reduce the brightness of the display screen to reduce the overall power consumption of the electronic device. After the controller makes the above adjustment, if the adapter is in operation but the system is still powered off, the controller can continue to reduce the brightness of the display screen. It is understood that the controller can reduce the brightness of the display screen multiple times until the adapter is in operation and the system stops powering off. In this way, the controller can adaptively adjust based on the current power outage status of the electronic device. Furthermore, since changes in display brightness do not affect the state of the adapter—for example, reducing the display brightness does not cause the adapter to change from an operating state to a stopped state—if the adapter changes from an operating state to a stopped state after the controller adjusts multiple parameters, including the display brightness, the controller can stop adjusting other parameters among these multiple parameters but continue to adjust the display brightness.

[0061] It is understood that the specific method for adjusting the brightness of the display screen can be referred to in the relevant descriptions of steps S106 and S107-S109 below, which will not be elaborated here.

[0062] In some embodiments of this application, if the brightness of the display screen obtained by the current adjustment is less than the corresponding threshold (e.g., threshold 7 mentioned below), the controller can stop the current adjustment and restore the brightness of the display screen to the state before the current adjustment.

[0063] In some embodiments of this application, the controller reduces the brightness of the display screen, specifically by decreasing a third value based on the previously adjusted display screen brightness or the initial value of the display screen brightness. It is understood that the third value can be set according to actual needs, and this application does not limit this. For example, the third value can be b, as mentioned below.

[0064] Secondly, this application provides a charging method. This method can be applied to a controller in an electronic device. The electronic device may include a controller, a charging management module, and a battery. The charging management module in the electronic device is connected to the controller and the battery, as well as an adapter connected to the electronic device. The method may include: when the adapter is in operation and the system is powered off, the controller may send at least one of a first current parameter and a first duration to the charging management module, and send first information. The first current parameter may be used to indicate the peak current of the adapter, and the peak current of the adapter may be used to determine the maximum output power of the adapter. The peak current of the adapter indicated by the first current parameter is greater than the current peak current of the adapter. The first duration may be used to indicate the waiting time between receiving the indication information that the system is powered off and switching the operating mode to the discharge mode by the charging management module. The first duration is greater than the current waiting time. The first information is used to indicate that the system is powered off.

[0065] Optionally, the charging method provided in this application can be applied to an electronic device. The electronic device may include a controller, a charging management module, and a battery. The charging management module in the electronic device is connected to the controller and battery, as well as an adapter connected to the electronic device. The method may include: the electronic device receiving power output from the adapter through the charging management module to charge the battery; the electronic device may also send at least one of a first current parameter and a first duration, and send first information to the charging management module when the adapter is in operation and the system is powered off; the electronic device may also maintain the charging management module in charging mode when the duration of the system power failure, determined based on the first information, is less than the first duration. The first current parameter may be used to indicate the peak current of the adapter, and the peak current of the adapter may be used to determine the maximum output power of the adapter. The peak current of the adapter indicated by the first current parameter is greater than the current peak current of the adapter. The first duration may be used to indicate the waiting time between receiving the system power failure indication information and switching the operating mode to discharge mode by the charging management module. The first duration is greater than the current waiting time. The first information indicates the system power failure.

[0066] In conjunction with the second aspect, in one possible implementation, when the controller sends the first current parameter to the charging management module, the method may further include: after the controller sends the first current parameter to the charging management module, and while the adapter is in operation and the system is powered off, the controller may adjust the first current parameter and send the adjusted first current parameter to the charging management module. Wherein, the peak current indicated by the adjusted first current parameter is greater than the peak current indicated by the previously adjusted first current parameter.

[0067] In conjunction with the second aspect, in one possible implementation, when the controller sends a first duration to the charging management module, the method may further include: after the controller sends the first duration to the charging management module, and while the adapter is in operation and the system is powered off, the controller may adjust the first duration and send the adjusted first duration to the charging management module. The first duration obtained in this adjustment is greater than the first duration obtained in the previous adjustment.

[0068] In conjunction with the second aspect, in one possible implementation, the method may further include any one or more of the following: after sending a first current parameter to the charging management module and while the adapter is in a stopped state, the controller may send a second current parameter to the charging management module, the second current parameter being used to indicate the peak current of the adapter, and the peak current of the adapter indicated by the second current parameter being less than the current peak current of the adapter; after sending a first duration to the charging management module and while the adapter is in a stopped state, the controller may send a second duration to the charging management module, the second duration being used to indicate the waiting time between receiving the system power-down indication information and switching the working mode to the discharge mode, and the second duration being less than the current waiting time.

[0069] In conjunction with the second aspect, in one possible implementation, the electronic device may further include a display screen. The display screen is connected to a controller; the method may further include: when the adapter is in operation and the system is powered off, the controller may adjust the brightness of the display screen, wherein the brightness of the display screen adjusted in this manner is less than the original brightness of the display screen.

[0070] In conjunction with the second aspect, in one possible implementation, after adjusting the brightness of the display screen, the method may further include: when the adapter is in a working state and the system is powered off, or when the adapter is in a stopped state, the controller may adjust the brightness of the display screen, wherein the brightness of the display screen obtained in this adjustment is less than the brightness of the display screen obtained in the previous adjustment.

[0071] Thirdly, this application provides a computer storage medium. The computer storage medium includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method described in the second aspect or any implementation thereof.

[0072] Fourthly, embodiments of this application provide a chip. This chip can be applied to an electronic device, and the chip includes one or more processors configured to invoke computer instructions to cause the electronic device to perform the methods described in the second aspect or any possible implementation thereof.

[0073] Fifthly, embodiments of this application provide a chip system that can be applied to an electronic device. The chip system includes one or more processors that invoke computer instructions to cause the electronic device to perform the methods described in the second aspect or any possible implementation thereof.

[0074] In some embodiments of this application, the chip system may be an application processor (AP) or a system on chip (SoC) including an AP, and the method described in the second aspect or any implementation thereof may be implemented by an AP.

[0075] In some other embodiments of this application, the chip system may include an access point (AP) and other modules. These other modules may be a modem (also known as a baseband processor).

[0076] Sixthly, embodiments of this application provide a computer program product including instructions. When the computer program product is run on an electronic device, it causes the electronic device to perform the method described in the second aspect or any possible implementation thereof.

[0077] It is understood that the beneficial effects achieved by the charging method provided in the second aspect, the computer storage medium provided in the third aspect, the chip provided in the fourth aspect, the chip system provided in the fifth aspect, and the computer program product provided in the sixth aspect can be referred to with reference to the beneficial effects of any possible implementation in the first aspect, and will not be repeated here. Attached Figure Description

[0078] Figure 1A A schematic diagram of the battery current provided in an embodiment of this application;

[0079] Figure 1B A schematic diagram of the transient current of the whole machine and the current entering the battery provided for an embodiment of this application;

[0080] Figure 2 A schematic diagram of a charging system provided in an embodiment of this application;

[0081] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;

[0082] Figure 4 This is a schematic diagram illustrating the connection between an electronic device and an adapter, provided in an embodiment of this application.

[0083] Figure 5 A schematic diagram of the software structure of an electronic device provided in an embodiment of this application;

[0084] Figure 6 A flowchart illustrating a charging method provided in an embodiment of this application;

[0085] Figure 7 A schematic diagram of another battery current provided in an embodiment of this application;

[0086] Figure 8 This is a schematic diagram of response time and dejitter time provided in an embodiment of this application. Detailed Implementation

[0087] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.

[0088] It should be understood that the terms "first," "second," etc., in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.

[0089] It should be understood that the term "user interface" in the specification, claims, and drawings of this application refers to the medium interface through which an application or operating system interacts and exchanges information with the user. A common form of user interface is the graphical user interface (GUI), which refers to a user interface related to computer operation displayed graphically. It can be an icon, window, control, or other interface element displayed on the screen of an electronic device. Controls can include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, and widgets.

[0090] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a mutually exclusive, independent, or alternative embodiment. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described in this application can be combined with other embodiments.

[0091] The overall power consumption of an electronic device mainly consists of three parts: small system power consumption, screen power consumption, and peripheral power consumption. Small system power consumption includes the power consumption of the processor and memory, with the processor accounting for the majority. In some embodiments of this application, the processor can be a System on Chip (SoC), which mainly includes a Central Processing Unit (GPU) and a Graphics Processing Unit (GPU). The memory can include a Solid State Disk (SSD) and Double Data Rate Synchronous Dynamic Random Access Memory (DDR). In this case, the small system power consumption includes the power consumption of the SoC, SSD, and DDR, and its small system power consumption is mainly determined by the power consumption of the SoC. This means that the overall power consumption of the electronic device is mainly determined by the SoC, the display screen, and the peripherals.

[0092] Currently, electronic devices are primarily powered by adapters and batteries. Generally, adapters are used first, but batteries can be used when the adapter's maximum output power is insufficient for the system's needs. An adapter, also known as a power adapter, is a power conversion device for small portable electronic devices and appliances, also called an external power supply. It is commonly found in small electronic products such as mobile phones, LCD monitors, and laptops. A power adapter typically consists of a casing, transformer, inductor, capacitor, integrated circuit (IC), and printed circuit board (PCB). Its working principle is to convert AC input to DC output. Based on the connection method, it can be divided into wall-mounted and desktop types.

[0093] In some embodiments of this application, the maximum output power of the adapter may refer to its maximum transient power (or instantaneous power). In this case, if the maximum output power of the adapter does not meet the system requirements, it may specifically include: the maximum transient power that the adapter can withstand does not meet the system requirements.

[0094] It should be noted that transient output power refers to the output power over a short period of time. In some embodiments of this application, transient can refer to the millisecond level, such as 10 milliseconds (ms). Similarly, the short time mentioned below can refer to the millisecond level, such as less than or equal to 10 ms.

[0095] As mentioned above, when PCs and other electronic devices are charged via an adapter, power loss is likely to occur under high load conditions. Analysis suggests the following two possible causes: (1) The adapter's maximum output power does not meet system requirements, for example, the adapter's maximum output power is too low; (2) The CPU or GPU consumes excessive power and switches too frequently in a short period. If the adapter's maximum output power is low and the CPU or GPU consumes excessive power, the adapter's maximum output power may be less than the CPU or GPU's power consumption in a short period. In this case, the adapter cannot charge the battery, and the battery discharges. Furthermore, if the CPU or GPU power consumption fluctuates significantly (or the power consumption switching frequency is too fast), meaning the CPU or GPU power consumption only reaches a high value in a short time and remains relatively stable most of the time, this may result in the adapter's maximum output power being less than the CPU or GPU's power consumption only in a short period.

[0096] When electronic devices run heavy software (such as games, large data processing software, etc.), the CPU or GPU primarily handles most of the work. To improve performance, electronic devices can temporarily increase CPU or GPU power consumption during heavy software operation, resulting in a significant increase in the transient power of the CPU or GPU. For example, the CPU power can be increased to power limit level 4, or Central Processing Unit Power Limit 4, or simply CPU PL4. Another example is the increased power consumption of GPU-powered electrical data peak processing (EDPP).

[0097] During the operation of heavy-load software, the power consumption of the electronic device frequently exceeds the adapter's maximum output power. However, the duration of each instance of power consumption exceeding the adapter's maximum output power is short, and the power consumption remains within the adapter's maximum output power for the rest of the time. It can be understood that when the electronic device's power consumption exceeds the adapter's maximum output power, the electronic device can be powered by the battery (i.e., the battery is discharging). Conversely, when the electronic device's power consumption is within the adapter's maximum output power, the electronic device can charge the battery through the adapter (i.e., the battery is charging) and then power the electronic device through the adapter. However, the battery's transition from discharging to charging requires a change in the adapter's operating mode. In charging mode, the electronic device powers itself through the adapter and charges the battery (i.e., the battery is charging). In discharging mode, the electronic device powers itself through the battery (i.e., the battery is discharging). In some embodiments of this application, the adapter's charging mode can be a boost mode, meaning the adapter uses a boost circuit to charge the battery, and the adapter's discharging mode can be a buck mode, meaning the adapter uses a buck circuit to discharge the battery. However, if the switching time of the adapter's operating mode exceeds the time during which the overall power consumption exceeds the adapter's maximum output power, it may happen that when the battery is discharging, the adapter has not yet completed the switch from discharging mode to charging mode, and the overall power consumption of the electronic device exceeds the adapter's maximum output power again. This causes the adapter to stop switching from discharging mode to charging mode and continue to remain in discharging mode, meaning the battery continues to discharge. Since the overall power consumption of the electronic device frequently exceeds the adapter's maximum output power, the above process may continue to occur, thus causing the electronic device's battery to continuously discharge (or remain in a discharging state).

[0098] Taking a heavily powered game application running on an electronic device as an example, during the operation of this application, the time interval between the last time the device's power consumption exceeds the adapter's maximum output power and the next time it exceeds the adapter's maximum output power is T1. The duration for which the device's power consumption continuously exceeds the adapter's maximum output power is T2, where T2 is less than T1. It can be understood that T2 can change each time the device's power consumption exceeds the adapter's maximum output power. The duration for the adapter to switch its operating mode in response to the aforementioned situation where the device's power consumption exceeds its maximum output power is T3, where T3 is greater than T1. When the power consumption of the electronic device exceeds the adapter's maximum output power, the adapter can switch its operating mode from charging to discharging. Correspondingly, the battery can switch from charging to discharging. During battery discharging, after only T2, the power consumption of the electronic device drops below the adapter's maximum output power. At this point, the adapter can switch its operating mode from discharging to charging, and the battery can switch from discharging to charging. However, this process takes T3. The power consumption of the electronic device then exceeds the adapter's maximum output power again after only T1. Since T3 is greater than T1, the adapter does not complete the switch from discharging to charging, thus remaining in discharging mode, and the battery continues to discharge. After T2, the power consumption of the electronic device drops below the adapter's maximum output power again. In this case, the adapter can switch its operating mode from discharging to charging, and for the reasons mentioned above, the battery continues to discharge. Because the power consumption of the electronic device frequently exceeds the adapter's maximum output power, this process continues, leading to continuous battery discharge.

[0099] For example, the charging architecture currently used in electronic devices can be a Hybrid PowerBoost (HPB) architecture, in which case T3 can be 5ms. Figure 1A This illustrates the battery current input during the adapter's switch from discharge mode to charge mode. It can be understood that a negative battery current input indicates battery discharge, while a positive battery current input indicates battery charging. Figure 1A As shown, it takes 5ms for the battery to switch from discharging to charging during the discharge process. In other words, the process of the battery switching from discharging to charging takes 5ms.

[0100] For example, T1 can be 2.5ms, and T2 is less than 2.5ms. Figure 1B This diagram illustrates the system-wide transient current (e.g., CPU transient current, GPU transient current, etc.) and battery current during the operation of a heavy-load gaming application on an electronic device. During this operation, the system-wide transient current frequently exceeds the adapter's maximum output current (or the maximum transient current the adapter can withstand), such as... Figure 1B As shown, the transient current of the electronic device reaches its peak approximately every 2.5ms, exceeding the adapter's maximum output current (i.e., the output current when the adapter is operating at maximum power). However, the transient current only exceeds the adapter's maximum withstand current for a duration less than 2.5ms. For example, at time X, the electronic device's transient current exceeds the adapter's maximum output current. In this case, the battery can discharge. Within a short time, the transient current drops below the adapter's maximum output current, allowing the adapter to switch from discharge mode to charging mode, meaning the battery can switch from discharging to charging. However, 2.5ms later, the transient current again exceeds the adapter's maximum withstand current. Since the adapter hasn't yet completed the switch from discharge to charging mode, it doesn't switch back and continues in discharge mode, allowing the battery to continue discharging. Figure 1B As shown, since the transient current of the electronic device frequently exceeds the maximum output current of the adapter, the above process will continue to occur, which means that the battery current will frequently be negative, i.e., the battery will continue to discharge.

[0101] Based on the above, this application provides a charging method and related equipment. According to this charging method, when an electronic device experiences a power outage, the device can adaptively adjust relevant adapter parameters based on the adapter specifications, such as parameters indicating the adapter's peak current and the delay time for determining the adapter's peak current. This increases the adapter's maximum output power and delays the determination of the adapter's peak current. Furthermore, the electronic device can adaptively adjust the battery discharge response time, thus delaying the adapter's switch from charging mode to discharging mode. This, to some extent, avoids situations where the adapter's maximum output power is less than the overall device power consumption, reduces the frequency of the charging management module switching to discharging mode, and consequently prevents continuous battery discharge.

[0102] The charging system provided in the embodiments of this application will be introduced first below.

[0103] like Figure 2 As shown, the charging system may include electronic devices and an adapter. The electronic devices can connect to the adapter via an interface for charging. In some embodiments of this application, the interface may be a Universal Serial Bus (USB) interface, such as a Type-C interface. Of course, the interface can also be other interfaces, and this application does not limit this.

[0104] It is understood that electronic devices can be terminal devices, specifically laptops, mobile phones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), or dedicated cameras (e.g., SLR cameras, point-and-shoot cameras), etc. This application does not impose any restrictions on the specific type of electronic device.

[0105] It is understood that the relevant description of the adapter can be found above, and will not be repeated here. In some embodiments of this application, the adapter can be a constant voltage and constant current power supply device, which can be used to continuously power electronic devices. In some embodiments of this application, the adapter can also be referred to as a charger.

[0106] Understandable Figure 2 The electronic devices, adapters, and their connections in the charging system shown are merely examples provided in this application and should not be considered as limitations on this application.

[0107] The hardware structure of the electronic device provided in the embodiments of this application is described below.

[0108] Please see Figure 3 , Figure 3 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application.

[0109] like Figure 3 As shown, electronic devices may include: processors, batteries, charging management modules (Chargers), embedded controllers (ECs), basic input output systems (BIOS), power management modules, displays, etc.

[0110] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device. It is understood that the illustrated components can be implemented in hardware, software, or a combination of both. In some embodiments of this application, the electronic device may include more components than illustrated. For example, the electronic device may also include an external memory interface, internal memory, a USB interface, a power management module, an audio module, antenna 1, antenna 2, a mobile communication module, a wireless communication module, a sensor module, buttons, a motor, an indicator, a camera, and a Subscriber Identity Module (SIM) card slot, etc. The audio module may include a speaker, receiver, microphone, headphone jack, etc., and the sensor module may include a pressure sensor, gyroscope sensor, barometric pressure sensor, magnetic sensor, accelerometer, distance sensor, proximity sensor, fingerprint sensor, temperature sensor, touch sensor, ambient light sensor, bone conduction sensor, etc. In still other embodiments of this application, the electronic device may include fewer components than illustrated (e.g., an electronic device). For example, the electronic device does not include... Figure 2 The BIOS and IMVP are shown. In some embodiments of this application, the electronic device may include components that can be combined or separated from certain components shown in the illustrations. In some other embodiments of this application, the electronic device may include a different arrangement of components than shown in the illustrations. The interface connection relationships between the modules illustrated in the embodiments of this application are merely illustrative and do not constitute a limitation on the structure of the electronic device.

[0111] A processor may include one or more processing units. For example, a processor may include a CPU, GPU, application processor (AP), modem (also known as a baseband processor), image signal processor (ISP), controller, video codec, digital signal processor (DSP), and / or neural network processing unit (NPU), etc. Among these, the AP is the processor responsible for running the operating system and applications.

[0112] In some embodiments of this application, such as Figure 3 As shown, the processor of an electronic device may include two processing units: a CPU and a GPU. In some embodiments of this application, the processor of the electronic device may also include only one of the CPU and GPU processing units.

[0113] As described above, in some embodiments of this application, the processor of the electronic device can be a System-on-a-Chip (SoC). An SoC, also known as a system-on-a-chip, is an integrated circuit with a specific purpose, containing a complete system and all embedded software. In some embodiments of this application, an SoC can be a chip integrating modules such as a CPU, GPU, and communication modules.

[0114] Batteries can be used to power other modules in electronic devices.

[0115] The charging management module receives charging input from the adapter. In some embodiments of this application, the charging management module can receive charging input from the adapter via a USB interface. In some embodiments of this application, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device. While charging the battery, the charging management module can also supply power to the electronic device via the power management module.

[0116] The charging management module is responsible for controlling the charging and discharging of the battery, that is, for switching the battery between charging and discharging states. In some embodiments of this application, the charging management module can control the charging and discharging of the battery by controlling a charging metal-oxide-semiconductor (MOS) field-effect transistor (hereinafter referred to as a MOS transistor) and a discharging MOS transistor.

[0117] In essence, a charging management module delivers electrical energy to a device by converting it into the required voltage and current, thus providing the device with the necessary power. The charging management module can be a transformer (or voltage converter) used to change the power supply voltage. It can convert high voltage to low voltage or vice versa. The charging management module can provide the appropriate voltage according to the device's needs.

[0118] The charging management module also handles rectification and filtering. During rectification, it converts alternating current (AC) to direct current (DC), specifically using a rectifier. The rectifier can cut off either the positive or negative half-cycle of the current, ensuring it maintains a single direction. During filtering, the module uses capacitors or inductors to smooth the output current and eliminate ripples.

[0119] The EC (Electronic Control Unit) is a separate processing module that plays a global management role over the entire system before and during power-on. The EC can be used to implement some power management functions of electronic devices, such as battery power detection, charging and discharging tasks, and power scheduling of the external power system after the electronic device is in standby or powered off. It can also be used to implement practical shortcut buttons and temperature monitoring. In some embodiments of this application, the EC can be a 16-bit microcontroller. After the electronic device is powered off, the EC can remain running, waiting for the user's power-on notification.

[0120] An EC (Extended Memory Organizer) may contain storage modules, such as flash memory. Flash memory is a non-volatile memory that can be erased, written to, and reprogrammed in blocks of memory cells called blocks. Write operations on any flash device can only be performed in empty or erased cells, so in most cases, an erase operation must be performed before a write operation can be performed. The storage modules within the EC can be used to store the EC's executable program (e.g., machine instructions).

[0121] In some embodiments of this application, the EC can be used to detect whether the adapter is inserted, read the battery current, adjust relevant charging and discharging parameters, and adjust the brightness of the display screen.

[0122] In some embodiments of this application, the code implementing the methods described in the embodiments of this application may be stored in a storage module within the electronic device (EC). During electronic device operation, the electronic device may load the executable code stored in the storage module into random access memory.

[0123] In some embodiments of this application, the EC can connect to the charging management module via an Inter-Integrated Circuit (I2C) bus, and the EC can also connect to the battery via I2C.

[0124] It should be noted that this application uses EC as an example for illustration, but EC in electronic devices can also be replaced by other controllers, and this application does not limit this.

[0125] The BIOS is a set of programs embedded in a read-only memory (ROM) chip on the computer's motherboard. It stores the computer's most important basic input / output programs, power-on self-test (POST) programs, and system startup programs. It can read and write specific system settings information from the Complementary Metal-Oxide Semiconductor (CMOS). The main function of the BIOS is to provide the lowest-level, most direct hardware settings and control for the computer. In some embodiments of this application, the BIOS can receive charging strategies sent from higher layers. For example, the BIOS can receive messages from intelligent charging management applications (such as PC management software) to enable or disable intelligent charging mode.

[0126] The power management module is used to connect the battery, charging management module, processor, and EC. The power management module receives input from the battery and / or charging management module to power modules such as the processor, EC, and display. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some embodiments of this application, the power management module can also be located within the processor. In still other embodiments of this application, the power management module and the charging management module can be located in the same device.

[0127] The power management module may include an Intel Mobile Voltage Positioning (IMVP) module. The IMVP can be used to dynamically adjust the processor voltage according to the processor's operating state, thereby automatically reducing processor power consumption, such as dynamically adjusting the CPU power supply core voltage. In some embodiments of this application, the IMVP can be used to read the transient power consumption of the SoC.

[0128] In some embodiments of this application, the IMVP can be connected to the processor via a Serial Voltage Identification (SVID) bus. More precise voltage control can be achieved by communicating with the Voltage Regulator Module (VRM) (e.g., the IMVP) via the CPU's own SVID bus.

[0129] Electronic devices can achieve display functions through GPUs, displays, and application processors.

[0130] A GPU is a microprocessor for image processing, connected to a display screen and an application processor. A GPU performs mathematical and geometric calculations for graphics rendering. A processor may include one or more GPUs, which execute program instructions to generate or modify display information. A display screen is used to display images, videos, etc. In some embodiments, an electronic device may include one or more displays screens.

[0131] In some embodiments of this application, the connection relationships of the modules in the electronic device can be as follows: Figure 3 As shown. Figure 3 As shown. The EC can be connected to the BIOS, display, and charging management module respectively. In addition to connecting to the EC, the charging management module can also be connected to the power management module and the battery. In addition to connecting to the charging management module, the power management module can also be connected to the processor. The other end of the processor is connected to the connection line between the charging management module and the battery.

[0132] In some embodiments of this application, the electronic device may include an interface. For example... Figure 4 As shown, this interface can connect to a charging management module, and the adapter can connect to an electronic device through this interface, allowing the charging management module to receive charging input from the adapter. In some embodiments of this application, this interface can be a USB interface as mentioned above.

[0133] The software structure of the electronic device provided in the embodiments of this application is described below.

[0134] The operating system of an electronic device can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application uses a layered operating system as an example to illustrate the software structure of an electronic device. It is understood that the operating system of the electronic device can be Android, iOS, Windows, macOS, or Linux, etc.

[0135] Please see Figure 5 , Figure 5 This is a schematic diagram of the software structure of an electronic device provided in an embodiment of this application.

[0136] The software architecture of electronic devices adopts a layered architecture, dividing the software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments of this application, the software architecture of the electronic device may include three layers, from top to bottom: the application layer, the operating system software layer, and the driver layer.

[0137] The application layer may include a series of application packages. These application packages may include applications such as camera, gallery, calendar, call, map, WLAN, Bluetooth, music, video, and SMS. The application layer may also include a smart charging management application. This application can be used to manage the activation and deactivation of the smart charging mode. In some embodiments of this application, the activation and deactivation of the smart charging mode can be triggered by the user. It is understood that the smart charging management application can be the PC management software mentioned above. It is understood that "smart charging management application" is an exemplary name given in this application; the application can also have other names, and this application does not limit its use.

[0138] The operating system software layer manages computer hardware and software resources; it is the core and foundation of a computer system. On electronic devices, the operating system manages and schedules hardware resources, providing a stable and consistent operating environment for upper-layer applications.

[0139] The driver layer is responsible for hardware drivers, such as those for graphics cards, sound cards, and network cards. The kernel layer is an intermediary layer between hardware and software, enabling the operating system to communicate with hardware devices.

[0140] It should be noted that the application provided Figure 5 The software architecture diagram of the electronic device shown is only an example and does not limit the number of layers in the operating system or the specific module divisions in different layers.

[0141] The following describes a charging method provided by an embodiment of this application.

[0142] Please see Figure 6 , Figure 6 This is a flowchart illustrating a charging method provided in an embodiment of this application. This charging method can be applied to electronic devices and may include, but is not limited to, the following steps:

[0143] S101: Detect whether power is connected through the adapter.

[0144] In some embodiments of this application, the user can plug an adapter connected to a power supply (e.g., AC mains power) into the external interface of the electronic device. It is understood that this application does not limit the type of external interface of the electronic device. In some embodiments of this application, the external interface of the electronic device can be a USB interface, such as a Type-C interface.

[0145] The electronic device checks whether it is powered on via an adapter. If the electronic device is powered on via an adapter, it can continue to step S102. If the electronic device is not powered on via an adapter, it can skip the subsequent steps.

[0146] Optionally, the electronic device can detect whether it is connected to the adapter. If the electronic device is connected to the adapter, it can continue to step S102. If the electronic device is not connected to the adapter, it can skip the subsequent steps.

[0147] Optionally, the electronic device detects whether the adapter is inserted. If the adapter is inserted into the electronic device, the electronic device can continue to step S102. If the adapter is not inserted into the electronic device, the electronic device may not perform the subsequent steps.

[0148] It is understandable that the above-mentioned electronic devices being powered by an adapter, electronic devices being connected to an adapter, and adapters being plugged into electronic devices all have the same meaning: one end of the adapter is powered on, and the other end is connected to the electronic device.

[0149] In some embodiments of this application, the electronic device detects whether it is powered on through an adapter. Specifically, this may include: the electronic device detecting whether the adapter flag bit is a first value. If the adapter flag bit is the first value, it indicates that the electronic device is powered on through the adapter. If the adapter flag bit is not the first value, it indicates that the electronic device is not powered on through the adapter.

[0150] It is understood that the first content can be set according to actual needs, and this application does not impose any restrictions on it. For example, the adapter flag can be represented by AC, and the first content can be 1. In this case, if the electronic device detects AC=1, the electronic device can determine that it is powered on through the adapter, or that the electronic device is connected to an adapter, or that the adapter is plugged into the electronic device.

[0151] In some embodiments of this application, the electronic device can continuously monitor the adapter flag bit. When the adapter flag bit is at its first value, the electronic device can execute subsequent steps. If the electronic device detects that the adapter flag bit changes from its first value to another value, the electronic device stops executing subsequent steps, that is, the electronic device ends the execution of the charging method provided in the embodiments of this application. When the adapter flag bit is not at its first value, the electronic device does not execute subsequent steps. If the electronic device detects that the adapter flag bit changes from another value to its first value, the electronic device can continue executing subsequent steps, that is, the electronic device continues to execute the charging method provided in the embodiments of this application.

[0152] S102: Determine if the system has lost power.

[0153] When the electronic device is powered on via an adapter, it can determine whether the system has experienced a power outage. If the system has lost power, the electronic device can proceed to the next step. If the system has not lost power, the electronic device can continue monitoring for a power outage, meaning it can continue to execute step S102.

[0154] In some embodiments of this application, the electronic device executes step S102 at a preset frequency. It is understood that this preset frequency can be set according to actual needs, and this application does not impose any limitations on it. In one possible implementation, the electronic device can determine the frequency of executing step S102 based on the current scenario. For example, when the electronic device is running a specific application (such as a game application), it can execute step S102 at a first frequency, while when the electronic device is running other applications, it can execute step S102 at a second frequency. The first frequency is greater than the second frequency. As another example, during a specific time period (e.g., from 4:00 AM to 7:00 AM), the electronic device can execute step S102 at a second frequency, while during other time periods, the electronic device can execute step S102 at a first frequency.

[0155] In some embodiments of this application, the electronic device determines whether the system has lost power, specifically by: the electronic device determining whether its total power consumption is greater than the adapter's maximum output power. If the total power consumption of the electronic device is greater than the adapter's maximum output power, it indicates that the system has lost power, and the electronic device can proceed with subsequent steps. If the total power consumption of the electronic device is less than or equal to the adapter's maximum output power, it indicates that the system has not lost power, and the electronic device can continue to detect whether the system has lost power, i.e., continue to execute step S102.

[0156] In some embodiments of this application, the total power consumption of the electronic device can be the power consumption of the processor. Of course, as described above, the total power consumption of the electronic device can also include the power consumption of other modules, such as the power consumption of the display screen, the power consumption of peripherals, etc.

[0157] In one possible implementation, the power consumption of an electronic device can be the power consumption of its processor (e.g., CPU power consumption, GPU power consumption, etc.) as the total power consumption of the electronic device.

[0158] In another possible implementation, the electronic device can use the sum of the power consumption of the processor and other modules (e.g., the display screen) in the electronic device as the total power consumption of the electronic device.

[0159] It should be noted that the adapter's current output power is less than or equal to its maximum output power. The adapter's output power increases as the overall power consumption of the electronic device increases, until it reaches the adapter's maximum output power. This means that when the adapter's output power is less than the overall power consumption of the electronic device, the adapter's output power has increased to its upper limit, i.e., its maximum output power.

[0160] In some embodiments of this application, the electronic device determines whether the system has lost power, which may specifically include steps S1021-S1023, as shown below:

[0161] S1021: Reads battery current and total power consumption.

[0162] When an electronic device is powered on via an adapter, the battery current and total power consumption can be read.

[0163] In some embodiments of this application, the electronic device can read the battery current via an EC (Electronic Control Unit). The battery current is the current flowing from the electronic device to the battery. In one possible implementation, such as... Figure 7 As shown, the battery input current is the current flowing from node A to the battery. Node A can be understood as a node on the connection line between the charging management module and the battery, and the charging management module connects to both the battery and the processor through node A. In other words, the battery input current is the current on the connection line between node A and the battery, and its direction is from node A to the battery.

[0164] In some embodiments of this application, the electronic device can read the battery current via the EC (Electronic Current Reading). As described above, in some embodiments of this application, the electronic device can read the processor's power consumption via a power management module, such as through an IMVP (Integrated Product Manager) within the power management module. When the processor's power consumption is used as the overall system power consumption, the processor's power consumption read by the electronic device through the power management module is the overall system power consumption. However, when the overall system power consumption includes not only the processor's power consumption but also the power consumption of other modules, the electronic device can still read the processor's power consumption and the power consumption of those other modules through the power management module, and determine that the sum of the processor's power consumption and the power consumption of those other modules is the overall system power consumption.

[0165] It is understood that electronic devices can also read the overall power consumption through other modules, and this application does not impose any restrictions on this.

[0166] S1022: Determine if the battery current is less than 0.

[0167] After reading the battery current, the electronic device can determine whether the battery current is less than 0. If the battery current is less than 0, it means that the current flow between the charging management module and the battery is from the battery to node A. At this time, the battery is in a discharging state, and the electronic device can continue to execute step S1023, that is, the electronic device can continue to determine whether the overall power consumption is greater than the adapter's rated power. If the battery current is not less than 0, it means that the current flow between the charging management module and the battery is from node A to the battery. At this time, the battery is in a charging state, the system has not lost power, and the electronic device can continue to monitor the battery current.

[0168] In some embodiments of this application, after the electronic device reads the battery current through the EC, it can determine whether the battery current is less than 0 through the EC.

[0169] S1023: Determine whether the total power consumption of the device is greater than the rated power of the adapter.

[0170] When the battery current is less than 0, the electronic device can determine whether the total power consumption is greater than the adapter's rated power. If the total power consumption of the electronic device is greater than the adapter's rated power, it indicates that the system has lost power, and the electronic device can continue to execute subsequent steps. If the total power consumption of the electronic device is less than or equal to the adapter's rated power, it indicates that the system has not lost power, and the electronic device can choose not to continue executing subsequent steps, but instead continue executing step S1021. In other words, the electronic device can continue to read (or monitor) the battery current and can also continue to monitor the total power consumption.

[0171] As we understand it, the rated power of an adapter refers to the maximum power it can continuously output under normal operating conditions. This power value needs to be greater than or equal to the rated power of the connected device to ensure that the device can operate normally. The rated power setting takes into account the range of ambient temperature and input voltage. Typically, the ambient temperature is between -5 and 50 degrees Celsius, and the input voltage is between 180V and 264V, allowing the power supply to output power stably for extended periods. Choosing an appropriate rated power is crucial for ensuring the stable operation of electronic equipment and extending its lifespan.

[0172] It is understandable that the rated power of an adapter is less than its maximum output power, that is, the maximum transient power the adapter can withstand. For example, the rated power of an adapter may be 65 watts (W), and the maximum output power may be 80W.

[0173] In some embodiments of this application, if the overall power consumption of the electronic device is less than or equal to the rated power of the adapter, the electronic device can continue to monitor the overall power consumption. If the electronic device detects that the overall power consumption is greater than the rated power of the adapter, the electronic device can then read the battery current. If the battery current is less than 0, the electronic device can continue to perform subsequent steps.

[0174] It is understood that this application does not restrict the order in which the electronic device executes steps S1022 and S1023. That is, when the electronic device is powered on via an adapter, it can determine whether the battery current is less than 0 and whether the total power consumption is greater than the adapter's rated power. If the battery current is less than 0 and the total power consumption is greater than the adapter's rated power, the electronic device can execute the subsequent steps. It should be noted that if the battery current is less than 0 and the total power consumption is greater than the adapter's rated power, it indicates a power outage, i.e., a system power outage. In simple terms, a power outage refers to a decrease in the electronic device's battery power. In some embodiments of this application, a system power outage indicates that the adapter connected to the electronic device has stopped working. In some embodiments of this application, a system power outage cannot determine whether the adapter is in a working state; that is, a system power outage may occur even when the adapter is in a working state.

[0175] In some embodiments of this application, the electronic device may first execute step S1023, and then execute step S1022 if the total power consumption of the device is greater than the rated power of the adapter.

[0176] In some embodiments of this application, the electronic device may read the battery current before executing step S1022 and the total power consumption before executing step S1023. This application does not limit the order in which the electronic device reads the battery current and executes step S1023, nor does it limit the order in which the electronic device reads the total power consumption and executes step S1022.

[0177] In some embodiments of this application, the electronic device may first read the battery current. If the battery current is less than 0, the electronic device may then determine whether the overall power consumption is greater than the rated power of the adapter. If the overall power consumption of the electronic device is greater than the rated power of the adapter, the electronic device may continue to execute subsequent steps; otherwise, the electronic device may continue to monitor the battery current and / or overall power consumption. If the battery current is detected to be less than 0 and the overall power consumption is greater than the rated power of the adapter, the electronic device may execute subsequent steps.

[0178] In some embodiments of this application, the electronic device may first read the total power consumption. If the total power consumption is greater than the rated power of the adapter, the electronic device may then determine whether the battery current is less than 0. If the total power consumption of the electronic device is greater than the rated power of the adapter, the electronic device may continue to execute subsequent steps; otherwise, the electronic device may continue to monitor the battery current and / or the total power consumption. If the battery current is detected to be less than 0 and the total power consumption is greater than the rated power of the adapter, the electronic device may execute subsequent steps.

[0179] In some embodiments of this application, the electronic device can obtain the total power consumption through the power management module, obtain the rated power of the adapter through the EC, and determine whether the total power consumption is greater than the rated power of the adapter through the EC.

[0180] In some embodiments of this application, electronic devices can use EC to determine whether the system has lost power.

[0181] In one possible implementation, the electronic device can obtain the overall power consumption through a power management module (PLM), such as obtaining the processor power consumption through the IMVP within the PLM and using it as the overall power consumption. The electronic device can also obtain the adapter's maximum output power through a charging management module. After obtaining the overall power consumption through the PLM, the electronic device can send it to the power management module (EC). Similarly, after obtaining the adapter's maximum output power through the charging management module, the electronic device can send the adapter's maximum output power to the EC. Furthermore, the electronic device can use the EC to determine whether the overall power consumption exceeds the adapter's maximum output power. If the EC determines that the overall power consumption exceeds the adapter's maximum output power, the system shuts down; otherwise, the system does not shut down.

[0182] In one possible implementation, on the one hand, the electronic device can obtain the battery current and determine whether the battery current is less than 0 through the power management module (EC). On the other hand, the electronic device can obtain the total power consumption through the power management module (Power Management Module) and the rated power of the adapter through the EC. After obtaining the total power consumption through the power management module, the electronic device can send the obtained total power consumption to the EC, and then the EC can determine whether the total power consumption is greater than the rated power of the adapter. If the electronic device determines through the EC that the battery current is less than 0 and the total power consumption is greater than the rated power of the adapter, the system will power down; otherwise, the system will not power down.

[0183] In some embodiments of this application, the electronic device mentioned in step S102 performs subsequent steps, which may specifically include: the electronic device may perform at least one of steps S104 and S105.

[0184] In some embodiments of this application, the electronic device mentioned in step S102 performs subsequent steps, which may specifically include: the electronic device may perform at least one of the steps S103-S106.

[0185] In some embodiments of this application, the electronic device mentioned in step S102 performs subsequent steps, which may specifically include: the electronic device may perform at least two of the steps in steps S103-S106.

[0186] S103: Increase the first response time.

[0187] In the event of a system power failure, the electronic device can increase the first response time. After increasing the first response time, the electronic device can continue to execute step S107 and subsequent steps. The first response time refers to the response time from battery charging to battery discharging in response to a system power failure. In other words, the first response time refers to the response time of battery discharging.

[0188] In some embodiments of this application, the first response duration is used to indicate the time from when the electronic device determines that the system has lost power to when the electronic device begins to switch the operating mode of the charging management module from the charging mode to the discharging mode. In some embodiments of this application, the first response duration is used to indicate the time from when the charging management module receives the indication information that the system has lost power to when it begins to switch the operating mode to the discharging mode.

[0189] It should be noted that the first response time differs from the switching time mentioned above, and also from the first debouncing time mentioned below. It can be understood that when the charging management module is operating in charging mode, and the battery is charging, if the system loses power (for example, the total power consumption exceeds the adapter's maximum output power, or the battery current is less than 0 and the total power consumption exceeds the adapter's rated power), the electronic device can respond by switching the charging management module's operating mode from charging mode to discharging mode. The first response time is the time taken for the electronic device to make this response. For example, as shown... Figure 8 As shown, at time k2, the electronic device determines that the system has lost power. At time k3, the electronic device begins to switch the operating mode of the charging management module from charging mode to discharging mode. In other words, time k2 is the moment the electronic device finally determines that the system has lost power, and time k3 is the start moment when the charging management module begins to switch from charging mode to discharging mode. The duration between time k2 and time k3 is the first response duration. This means that the first response duration is the time between the moment the electronic device determines that the system has lost power and the moment the electronic device begins to switch the operating mode of the charging management module from charging mode to discharging mode.

[0190] In some embodiments of this application, the electronic device may set the first response duration to 0, or may not set this parameter. In this case, when the electronic device determines that the system has lost power, it can directly switch the operating mode of the charging management module from charging mode to discharging mode.

[0191] In some embodiments of this application, the increased first response time is less than or equal to threshold 1. It is understood that threshold 1 can be set according to actual needs, and this application does not impose any limitations on it. For example, threshold 1 can be 0.25ms, or 250 microseconds.

[0192] In some embodiments of this application, the electronic device can obtain the original first response duration (which may be simply referred to as the original discharge response duration) used by the battery. Specifically, increasing the first response duration can include adding a duration t1 to the original discharge response duration. That is, the electronic device can increase the first response duration from the original discharge response duration to (original discharge response duration + t1). The increased first response duration is the sum of the original discharge response duration and t1.

[0193] In some embodiments of this application, the original discharge response duration can be the default discharge response duration. For example, when the electronic device executes step S103 for the first time after powering on, the original discharge response duration obtained by the electronic device can be the default discharge response duration. Here, the default discharge response duration refers to the first response duration set at the factory when the electronic device leaves the factory. It is understood that the default discharge response duration can be set according to actual needs, and this application does not impose any restrictions on it. For example, the default discharge response duration can be 50 microseconds.

[0194] It is understood that the specific value of t1 can be set according to actual needs, and this application does not impose any restrictions on it. For example, t1 can be 0.050ms, or 50 microseconds.

[0195] In some embodiments of this application, t1 is a fixed value. That is, t1 is the same every time the electronic device executes step S103. For example, t1 is always 0.050ms.

[0196] In some embodiments of this application, t1 is not a fixed value. That is, the t1 used by the electronic device when executing step S103 this time may be different from the t1 used in the previous execution of step S103. For example, the t1 used by the electronic device when executing step S103 this time may be 0.1ms, and the t1 used in the next execution of step S103 may be 0.05ms.

[0197] In some embodiments of this application, t1 is less than or equal to threshold 2. It is understood that threshold 2 can be set according to actual needs, and this application does not impose any limitations on it. For example, threshold 2 can be 0.1 ms, i.e., 100 microseconds.

[0198] It is understandable that the electronic device can repeatedly execute step S103. In this case, the original discharge response duration obtained when the electronic device executes step S103 for the (n+1)th time is the sum of the original discharge response duration obtained when the electronic device executes step S103 for the nth time and t1, that is, the original discharge response duration obtained when the electronic device executes step S103 for the (n+1)th time = the original discharge response duration obtained when the electronic device executes step S103 for the nth time + t1. This also means that the original discharge response duration obtained when the electronic device executes step S103 for the (n+1)th time is the increased first response duration determined when the electronic device executes step S103 for the nth time.

[0199] It is understandable that when the electronic device repeatedly executes step S103, the original discharge response duration obtained when the electronic device executes step S103 for the first time can be referred to as the initial value of the first response duration. This initial value of the first response duration only applies to the electronic device's execution of steps S101-S109 this time, and is not necessarily equal to the first response duration set when the electronic device is powered on.

[0200] In some embodiments of this application, the electronic device increases the first response duration, specifically by increasing the first response duration by one level from the original level. It is understood that the first response duration represented by the increased level is greater than the first response duration represented by the original level.

[0201] It is understood that the number of tiers used to represent the duration of the first response, and the specific duration represented by each tier, can be set according to actual needs, and this application does not impose any restrictions on this.

[0202] In some embodiments of this application, there are a total of 3 levels corresponding to the first response duration, as shown in Table 1 below:

[0203] Table 1

[0204] Serial Number Gear indicator First response time 1 1X 50 microseconds 2 00 150 microseconds 3 01 250 microseconds

[0205] As shown in Table 1, the smaller the serial number, the lower the gear level, and the shorter the corresponding first response time. In some embodiments of this application, each gear level can correspond to a gear level identifier. As shown in Table 1, the gear level identifier corresponding to the first gear level is 1X, and the corresponding first response time is 50 microseconds; the gear level identifier corresponding to the second gear level is 00, and the corresponding first response time is 150 microseconds; the gear level identifier corresponding to the third gear level is 01, and the corresponding first response time is 250 microseconds. It can be understood that the electronic device can set the corresponding register according to the gear level identifier to complete the gear level adjustment. For example, if the electronic device is currently using the first response time level 1, with a corresponding first response time of 50 microseconds, and the target gear level identifier is 00, then the electronic device can set the corresponding register to 00, thereby adjusting from the first gear level to the second gear level, that is, adjusting the first response time from 50 microseconds to 150 microseconds.

[0206] It is understood that registers used to adjust different parameters (e.g., first response time, adapter peak current percentage, first debouncing time, and display brightness) can be set according to actual needs, and this application does not impose any restrictions on this.

[0207] In some embodiments of this application, when the gear corresponding to the first response time has not been adjusted to the third gear, the adapter changes from the working state to the stopped state, that is, the adapter stops working. Then the electronic device can be adjusted down by one or more gears (or lowered by one or more gears), such as adjusted to the second gear.

[0208] It is understood that Table 1 is only an example given in this application. The number of levels corresponding to the first response duration can be set to more or fewer, and the first response duration corresponding to each level can also be set to different values. This application does not impose any restrictions on this.

[0209] S104: Increase the percentage of peak current of the adapter.

[0210] In the event of a system power failure, the electronic device can increase the adapter's peak current percentage. After increasing the adapter's peak current percentage, the electronic device can continue to execute step S107 and subsequent steps. The adapter's peak current percentage is the percentage of the adapter's peak current to its rated current (or rated output current). The adapter's peak current refers to the maximum transient current the adapter can withstand, or its maximum output current, as mentioned above. The adapter's peak current is used to determine its maximum output power. The adapter's maximum output power is the product of its peak current and its output voltage. The adapter's rated current refers to the maximum continuous current it can provide when normally used (or operating normally). The adapter's rated current can also be referred to as its maximum load current. It is understood that the adapter's rated current is related to the adapter's specific specifications. For an adapter, its rated current is constant and does not change.

[0211] In some embodiments of this application, the increased percentage of the adapter peak current is less than or equal to threshold 3. It is understood that threshold 3 can be set according to actual needs, and this application does not limit this. For example, threshold 3 can be 150%. Exemplarily, if the adapter's rated current is 5 amps (A), and the adapter's peak current percentage is 150%, then the adapter's peak current can be 7.5 A.

[0212] In some embodiments of this application, the adapter peak current percentage is greater than or equal to 100%.

[0213] In some embodiments of this application, the electronic device can obtain its original adapter peak current percentage (hereinafter referred to as the original adapter peak current percentage). Increasing the adapter peak current percentage can specifically include: the electronic device can increase the original adapter peak current percentage by 'a'. That is, the electronic device can increase the adapter peak current percentage from the original adapter peak current percentage to (original adapter peak current percentage + a). The increased adapter peak current percentage is the sum of the original adapter peak current percentage and 'a'.

[0214] In some embodiments of this application, the original adapter peak current percentage can be the default adapter peak current percentage. For example, when the electronic device is powered on and step S104 is executed for the first time, the original adapter peak current percentage obtained by the electronic device can be the default adapter peak current percentage. Here, the default adapter peak current percentage refers to the adapter peak current percentage set at the factory of the electronic device. It is understood that the default adapter peak current percentage can be set according to actual needs, and this application does not impose any restrictions on this. For example, the default adapter peak current percentage can be 110%. Generally, at the factory of the electronic device, the default adapter peak current percentage is set in the charging management module, and to ensure the safe use of the adapter, the default adapter peak current percentage is generally set to a relatively small value.

[0215] It is understood that the specific value of 'a' can be set according to actual needs, and this application does not impose any restrictions on it. For example, 'a' can be 10%. Or, for another example, 'a' can be 5%.

[0216] In some embodiments of this application, 'a' is a fixed value. That is, 'a' is the same every time the electronic device executes step S104. For example, 'a' is always 10%.

[0217] In some embodiments of this application, 'a' is not a fixed value. That is, the 'a' used by the electronic device in the current execution of step S104 may be different from the 'a' used in the previous execution of step S104. For example, the 'a' used by the electronic device in the current execution of step S104 may be 10%, and the 'a' used in the next execution of step S104 may be 5%.

[0218] In some embodiments of this application, 'a' is less than or equal to threshold 4. It is understood that threshold 4 can be set according to actual needs, and this application does not limit this. For example, threshold 4 can be 50%.

[0219] It is understandable that the electronic device can repeatedly execute step S104. In this case, the original adapter peak current percentage obtained when the electronic device executes step S104 for the (n+1)th time is the sum of the original adapter peak current percentage obtained when the electronic device executes step S104 for the nth time and 'a', that is, the original adapter peak current percentage obtained when executing step S104 for the (n+1)th time = the original adapter peak current percentage obtained when executing step S104 for the nth time + 'a'. This also means that the original adapter peak current percentage obtained when the electronic device executes step S104 for the (n+1)th time is the improved adapter peak current percentage determined when the electronic device executes step S104 for the nth time.

[0220] It is understandable that when the electronic device repeatedly executes step S104, the original peak current percentage of the adapter obtained when the electronic device executes step S104 for the first time can be referred to as the initial value of the adapter peak current percentage. This initial value of the adapter peak current percentage only applies to the electronic device's execution of steps S101-S109 this time, and is not necessarily equal to the adapter peak current percentage set when the electronic device is powered on.

[0221] In some embodiments of this application, the electronic device increases the percentage of peak current of the adapter, specifically by increasing the level of the adapter peak current by one level. It is understood that the percentage of peak current represented by the increased level is greater than the percentage of peak current represented by the original level.

[0222] It is understood that the number of levels used to represent the percentage of peak current of the adapter, and the specific duration represented by each level, can be set according to actual needs, and this application does not impose any restrictions on this.

[0223] In some embodiments of this application, there are a total of 32 levels corresponding to the peak current percentage of the adapter, as shown in Table 2 below:

[0224] Table 2

[0225]

[0226] As shown in Table 2, the smaller the serial number, the lower the gear level, and the smaller the corresponding peak current percentage of the adapter. In some embodiments of this application, each gear level can correspond to a gear level identifier, as shown in Table 2. The first gear level can represent the default peak current percentage of the adapter. The peak current percentage of the adapter represented by the first and second gear levels is 110%. From the second to the 26th gear level, the difference in the peak current percentage of the adapter between any two adjacent gear levels is 5%, that is, from the second to the 26th gear level, each increase in gear level corresponds to an increase in the corresponding peak current percentage of the adapter by 5%. Compared to the peak current percentage of the adapter corresponding to the 26th gear level, the peak current percentage of the adapter corresponding to the 27th gear level has increased by 20%. From the 27th to the 31st gear level, the difference in the peak current percentage of the adapter between any two adjacent gear levels is 50%, that is, from the 27th to the 31st gear level, each increase in gear level corresponds to an increase in the corresponding peak current percentage of the adapter by 50%. The 32nd setting indicates that the adapter's peak current percentage is out of range.

[0227] Understandably, electronic devices can set the corresponding registers according to the gear indicator to adjust the gear level. For example, if the electronic device is currently using the first gear level of the adapter peak current percentage, which corresponds to 110%, and the gear indicator for the target gear level is 00110, then the electronic device can set the corresponding register to 00110, thereby adjusting from the first gear level to the seventh gear level, that is, adjusting the adapter peak current percentage from 110% to 135%.

[0228] In some embodiments of this application, when the adapter peak current percentage is not adjusted to the 32nd level, the adapter changes from the working state to the stopped state, that is, the adapter stops working. Then the electronic device can be adjusted down one or more levels (or lowered one or more levels), for example, adjusted to the 20th level.

[0229] It is understood that Table 2 is only an example given in this application. The number of levels corresponding to the peak current percentage of the adapter can be set to more or fewer, and the peak current percentage of the adapter corresponding to each level can also be set to different values. This application does not limit this.

[0230] Alternatively, in the event of a system power failure, the electronic device can directly increase the peak current of the adapter. The specific implementation method can refer to the implementation method of increasing the percentage of the adapter's peak current described above.

[0231] Optionally, in the event of a system power failure, the electronic device can increase the ratio of the adapter's peak current to the adapter's rated current. This ratio can be the percentage mentioned above, or it can be expressed in other forms. For specific implementation methods, please refer to the implementation methods for increasing the percentage of the adapter's peak current described above.

[0232] S105: Increase the duration of the first de-shake.

[0233] In the event of a system power failure, the electronic device can extend the first de-jitter duration. After extending the first de-jitter duration, the electronic device can continue to execute step S107 and subsequent steps. The first de-jitter duration refers to the time spent determining whether the power failure state is stable after detecting a system power failure. It can be understood that when the charging management module is in charging mode, if the electronic device determines that the system has lost power, it can wait a certain period of time before re-determining whether the system has lost power, thereby avoiding battery damage caused by frequent switching between charging and discharging due to unstable system power failure. This interval is the first de-jitter duration. This also means that the first de-jitter duration is the time between the moment the electronic device first determines that the system has lost power and the moment the electronic device finally determines whether the system has lost power. In other words, in some embodiments of this application, the electronic device can only finally determine that the system has lost power after repeatedly determining it within a certain period of time, and respond accordingly.

[0234] It is understandable that "the electronic device first determines that the system has lost power" can refer to the first time the electronic device determines that the system has lost power during the current execution of steps S101-S109. In other words, "the electronic device first determines that the system has lost power" does not necessarily mean that the electronic device has lost power for the first time after being powered on; it could also mean that the electronic device encounters the system power loss problem again after the previous execution of steps S101-S109.

[0235] For example, such as Figure 8 As shown, the electronic device can determine whether the system has lost power (as shown in step S102). At time k1, the electronic device first determines that the system has lost power. After a certain period of time, at time k2, the electronic device again determines that the system has lost power. Therefore, the electronic device can finally determine that the system has lost power and, in response to the power loss, switch the operating mode of the charging management module, as shown... Figure 8 As shown, after the electronic device finally determines that the system has lost power and responds within the specified interval, at time k3, the electronic device begins to switch the operating mode of the charging management module from charging mode to discharging mode. In other words, time k1 is the moment the electronic device first determines that the system has lost power, and time k2 is the moment the electronic device finally determines that the system has lost power. The duration between time k1 and time k2 is the first debouncing duration.

[0236] In some embodiments of this application, the charging management module can start timing when it receives a system power-down indication message from the EC. If it receives another system power-down indication message from the EC when the timing duration is equal to the first de-jitter duration, it indicates a system power-down. In other words, the electronic device can determine the system power-down moment when the charging management module receives the system power-down indication message from the EC. In this case, the charging management module can start timing when it receives the system power-down indication message from the EC again. If the system does not power down again during the timing duration which is less than or equal to the first response duration, the charging management module does not need to switch operating modes. However, if the system still power down during the timing duration which is less than or equal to the first response duration (i.e., the duration of the system power-down is not less than the first response duration), the charging management module can start switching the operating mode from charging mode to discharging mode when the timing duration reaches the first response duration.

[0237] In some embodiments of this application, the electronic device determines through EC that the interval of system power failure is not greater than the first de-jittering duration.

[0238] In some embodiments of this application, the first debouncing duration may be referred to as the debouncing duration of the adapter peak current (ICRIT) and is denoted as T. ICRIT Debounce time .

[0239] In some embodiments of this application, the electronic device may set the first de-jitter duration to 0, or may not set this parameter. In this case, the electronic device only needs to determine that the system has lost power once, without needing to determine that the system has lost power again.

[0240] In some embodiments of this application, the increased first dejitter duration is less than or equal to a threshold of 5. It is understood that the threshold of 5 can be set according to actual needs, and this application does not impose any limitations on it. For example, the threshold of 5 can be 0.25 ms, or 250 microseconds. In some embodiments of this application, the threshold of 5 can be determined based on circuit design requirements, component characteristics, and safety standards.

[0241] In some embodiments of this application, the electronic device can obtain the original first de-shake duration (hereinafter referred to as the original de-shake duration) used by the battery. Specifically, increasing the first de-shake duration can include adding t2 to the original de-shake duration. That is, the electronic device can increase the first de-shake duration from the original de-shake duration to (original de-shake duration + t2). The increased first de-shake duration is the sum of the original de-shake duration and t2.

[0242] In some embodiments of this application, the original de-jitter duration can be the default de-jitter duration. For example, when the electronic device is powered on and step S105 is executed for the first time, the original de-jitter duration obtained by the electronic device can be the default de-jitter duration. Here, the default de-jitter duration refers to the first de-jitter duration set at the factory of the electronic device. It is understood that the default de-jitter duration can be set according to actual needs, and this application does not impose any restrictions on it. For example, the default de-jitter duration can be 50 microseconds. Generally, at the factory of the electronic device, the default de-jitter duration is set in the charging management module, and the default de-jitter duration is generally set to a relatively small value, such as 10 microseconds.

[0243] It is understood that the specific value of t2 can be set according to actual needs, and this application does not impose any restrictions on it. For example, t2 can be 0.050ms, that is, 50 microseconds.

[0244] In some embodiments of this application, t2 is a fixed value. That is, t2 is the same each time the electronic device executes step S105. For example, t2 is always 0.050ms.

[0245] In some embodiments of this application, t2 is not a fixed value. That is, the t2 used by the electronic device when executing step S105 this time may be different from the t2 used in the previous execution of step S105. For example, the t2 used by the electronic device when executing step S105 this time may be 0.1ms, and the t2 used in the next execution of step S105 may be 0.05ms.

[0246] In some embodiments of this application, t2 is less than or equal to the threshold 6. It is understood that the threshold 6 can be set according to actual needs, and this application does not impose any limitations on it. For example, the threshold 6 can be 0.1 ms, i.e., 100 microseconds.

[0247] It is understandable that the electronic device can repeatedly execute step S105. In this case, the original dejitter duration obtained when the electronic device executes step S105 for the (n+1)th time is the sum of the original dejitter duration obtained when the electronic device executes step S105 for the nth time and t2, that is, the original dejitter duration obtained when the electronic device executes step S105 for the (n+1)th time = the original dejitter duration obtained when the electronic device executes step S105 for the nth time + t2. This also means that the original dejitter duration obtained when the electronic device executes step S105 for the (n+1)th time is the increased first dejitter duration determined when the electronic device executes step S105 for the nth time.

[0248] It is understandable that when the electronic device repeatedly executes step S105, the original de-jitter duration obtained when the electronic device executes step S105 for the first time can be referred to as the initial value of the first de-jitter duration. This initial value of the first de-jitter duration only applies to the electronic device's current execution of steps S101-S109, and is not necessarily equal to the first de-jitter duration set when the electronic device is powered on.

[0249] In some embodiments of this application, the electronic device increases the first de-shaking duration, which specifically includes: the electronic device can increase the duration by one level based on the original level corresponding to the first de-shaking duration. It is understood that the first de-shaking duration represented by the increased level is greater than the first de-shaking duration represented by the original level.

[0250] It is understood that the number of levels used to represent the first shaking duration, and the specific duration represented by each level, can be set according to actual needs, and this application does not impose any restrictions on this.

[0251] In some embodiments of this application, there are a total of 4 levels corresponding to the first shading duration, as shown in Table 3 below:

[0252] Table 3

[0253] Serial Number Gear indicator First deshake duration 1 00 10 microseconds 2 01 100 microseconds 3 10 400 microseconds 4 11 800 microseconds

[0254] As shown in Table 3, the smaller the serial number, the lower the gear level, and the shorter the corresponding first de-jitter duration. In some embodiments of this application, each gear level can correspond to a gear level identifier. As shown in Table 3, the gear level identifier corresponding to the first gear level is 00, and the corresponding first de-jitter duration is 10 microseconds; the gear level identifier corresponding to the second gear level is 01, and the corresponding first de-jitter duration is 100 microseconds; the gear level identifier corresponding to the third gear level is 10, and the corresponding first de-jitter duration is 400 microseconds; and the gear level identifier corresponding to the fourth gear level is 11, and the corresponding first de-jitter duration is 800 microseconds.

[0255] Understandably, electronic devices can set the corresponding registers according to the gear indicator to adjust the gear level. For example, if the electronic device is currently using the first de-jitter duration gear 1, which corresponds to a first de-jitter duration of 10 microseconds, and the gear indicator for the target gear level is 01, then the electronic device can set the corresponding register to 01, thereby adjusting from the first gear level to the second gear level, that is, adjusting the first de-jitter duration from 10 microseconds to 100 microseconds.

[0256] In some embodiments of this application, when the level corresponding to the first de-shaking duration has not been adjusted to the fourth level, the adapter changes from the working state to the stopped state, that is, the adapter stops working, and the electronic device can be adjusted down by one or more levels (or lowered by one or more levels), such as adjusted to the third level.

[0257] In some embodiments of this application, the electronic device can execute steps S103-S105 via EC, and after executing steps S103-S105, send the adjusted parameters to the charging management module, and the charging management module applies the adjusted parameters. It is understood that Table 3 is merely an example provided in this application; the number of levels corresponding to the first de-shaking duration can be set to more or fewer, and the first de-shaking duration corresponding to each level can also be set to different values; this application does not impose any limitations on this.

[0258] S106: Reduce display brightness.

[0259] In the event of a system power failure, the electronic device can reduce the brightness of the display screen. After reducing the brightness of the display screen, the electronic device can continue to execute step S107 and subsequent steps.

[0260] In some embodiments of this application, the display brightness can be expressed as a percentage. The maximum value of the display brightness can be 100%, and the minimum value can be 0%. When the display brightness is 100%, it means that the brightness setting of the display has reached its maximum value. It is understood that this maximum value can be set according to actual needs, and this application does not limit it.

[0261] In some embodiments provided in this application, the reduced display brightness is greater than or equal to threshold 7. It is understood that threshold 7 can be set according to actual needs, and this application does not limit this setting. For example, threshold 7 can be 10%.

[0262] In some embodiments of this application, the electronic device can obtain the original brightness of the display screen (hereinafter referred to as the original display screen brightness). Reducing the display screen brightness can specifically include: the electronic device can further reduce the original display screen brightness by b. That is, the electronic device can reduce the display screen brightness from the original display screen brightness to (original display screen brightness - b). The reduced display screen brightness is the difference between the original display screen brightness and b.

[0263] In some embodiments of this application, the original display screen brightness can be the default display screen brightness. For example, when the electronic device is powered on and step S106 is executed for the first time, the original display screen brightness obtained by the electronic device can be the default display screen brightness. Here, the default display screen brightness refers to the display screen brightness set at the factory when the electronic device leaves the factory. It is understood that the default display screen brightness can be set according to actual needs, and this application does not limit this. For example, the default display screen brightness can be 50%.

[0264] It is understood that the specific value of b can be set according to actual needs, and this application does not impose any restrictions on it. For example, b can be 5%. Or, for another example, b can be 2%.

[0265] In some embodiments of this application, b is a fixed value. That is, b is the same each time the electronic device executes step S106. For example, b is always 2%.

[0266] In some embodiments of this application, b is not a fixed value. That is, the b used by the electronic device in the current execution of step S106 may be different from the b used in the previous execution of step S106. For example, the b used by the electronic device in the current execution of step S106 may be 5%, and the b used in the next execution of step S106 may be 2%.

[0267] In some embodiments of this application, b is less than or equal to the threshold 8. It is understood that the threshold 8 can be set according to actual needs, and this application does not impose any limitations on it. For example, the threshold 8 can be 20%.

[0268] It is understandable that the electronic device can repeatedly execute step S106. In this case, the original display brightness obtained when the electronic device executes step S106 for the (n+1)th time is the difference between the original display brightness obtained when the electronic device executes step S106 for the nth time and b. That is, the original display brightness obtained when the electronic device executes step S106 for the (n+1)th time = the original display brightness obtained when the electronic device executes step S106 for the nth time - b. This also means that the original display brightness obtained when the electronic device executes step S106 for the (n+1)th time is the reduced display brightness determined when the electronic device executes step S106 for the nth time.

[0269] In some embodiments of this application, the electronic device reduces the brightness of the display screen, specifically by reducing the brightness by one level from the original level. The specific implementation method can be found above, and will not be repeated here.

[0270] As described above, in some embodiments of this application, in the event of a system power failure, the electronic device can perform at least one of steps S104 and S105, and after completing its execution, it can continue to perform step S107.

[0271] As described above, in some embodiments of this application, in the event of a system power failure, the electronic device can perform at least one of steps S103-S106, and after completing its execution, it can continue to perform step S107.

[0272] As described above, in some embodiments of this application, in the event of a system power failure, the electronic device can perform at least one of steps S104-S106, and after completing its execution, it can continue to perform step S107.

[0273] As described above, in some embodiments of this application, in the event of a system power failure, the electronic device can perform at least two of steps S103-S106, and after completing these steps, it can continue to perform step S107.

[0274] S107: Determine if the adapter has stopped working.

[0275] After the electronic device completes the adjustment of one or more of the above parameters (e.g., the first response time, adapter peak current percentage, first de-jitter time, and display brightness as shown in steps S103-S106), it can determine whether the adapter has stopped working, that is, whether the adapter is in a stopped state. If the adapter has not stopped working, that is, the adapter is in a working state, the electronic device can continue to execute step S108, that is, the electronic device can determine whether there is a power failure.

[0276] In some embodiments of this application, if the adapter stops working, the electronic device can initialize the adjusted parameters, that is, restore the adjusted parameters to their state before adjustment, and no longer execute subsequent steps, that is, end the execution of the charging method provided in the embodiments of this application.

[0277] For example, when the battery current is less than 0 and the total power consumption is greater than the adapter's rated power, the electronic device can increase the first response time from 50 microseconds to 100 microseconds and increase the adapter's peak current percentage from 110% to 115%. The electronic device can then determine if the adapter has stopped working. If the adapter has stopped working, the electronic device can restore the first response time to 50 microseconds and the adapter's peak current percentage to 110%, and then stop adjusting these two parameters.

[0278] For example, when the battery current is less than 0 and the overall power consumption is greater than the adapter's rated power, the electronic device can increase the adapter's peak current percentage from 110% to 115% and increase the first de-jitter duration by one level. Then, the electronic device can determine if the adapter has stopped working. If the adapter has not stopped working, the electronic device can continue to determine if it has lost power. If the electronic device is still losing power, it can continue to increase the adapter's peak current percentage from 115% to 120% and increase the first de-jitter duration by another level. Then, the electronic device can again determine if the adapter has stopped working. If the adapter has stopped working, the electronic device can restore the adapter's peak current percentage to 110% and restore the first de-jitter duration to its previous level.

[0279] In some embodiments of this application, if the adapter stops working, and the number of times the electronic device adjusts the parameter is greater than 1, the electronic device can undo the most recent adjustment of the parameter, that is, restore the adjusted parameter to the value before the most recent adjustment, and instead of executing step S108, directly execute step S109. In other words, the electronic device can write the parameter before the most recent adjustment into the EC.

[0280] For example, when the battery current is less than 0 and the overall power consumption is greater than the adapter's rated power, the electronic device can increase the adapter's peak current percentage from 110% to 115% and increase the first de-jitter duration by one level. Then, the electronic device can determine if the adapter has stopped working. If the adapter has not stopped working, the electronic device can continue to determine if it has lost power. If the electronic device is still losing power, it can continue to increase the adapter's peak current percentage from 115% to 120% and increase the first de-jitter duration by another level. Then, the electronic device can again determine if the adapter has stopped working. If the adapter has stopped working, the electronic device can restore the adapter's peak current percentage to 115% and restore the first de-jitter duration to the level increased the first time.

[0281] In some embodiments of this application, if the adapter stops working, and the number of parameters adjusted by the electronic device is greater than 1, the electronic device can undo the most recent adjustment to some of the adjusted parameters, that is, restore the adjusted parameters to their values ​​before the most recent adjustment, and then execute step S107 again, that is, determine again whether the adapter has stopped working. If the adapter has not stopped working, the electronic device can write the adjusted parameters into the EC. It is understood that the adjusted parameters mentioned here refer to the parameters obtained after the electronic device undoes the most recent adjustment to some parameters.

[0282] In one possible implementation, if the adapter still stops working, the electronic device can undo the most recent adjustment of all parameters, that is, restore all the adjusted parameters to the state before the most recent adjustment, and no longer execute subsequent steps, that is, end the execution of the charging method provided in the embodiments of this application.

[0283] For example, when the battery current is less than 0 and the total power consumption is greater than the adapter's rated power, the electronic device can increase the first response time from 50 microseconds to 100 microseconds, increase the adapter peak current percentage from 110% to 115%, and increase the first debounce duration by one level. Then, the electronic device can determine if the adapter has stopped working. If the adapter has stopped working, the electronic device can restore the first debounce duration to its unadjusted level, while maintaining the first response time at 100 microseconds and the adapter peak current percentage at 115%. The electronic device can then determine again if the adapter has stopped working. If the adapter has stopped working, the electronic device can restore the first response time to 50 microseconds and the adapter peak current percentage to 110%. In other words, the first response time, adapter peak current percentage, and first debounce duration are all restored to their initial values ​​(i.e., the values ​​before adjustment).

[0284] In one possible implementation, if the adapter remains inoperable and the number of currently adjusted parameters is still greater than one, the electronic device can undo the most recent adjustment of some or all of the currently adjusted parameters, restoring them to their state before the most recent adjustment, and then cease executing subsequent steps, thus ending the charging method provided in this application embodiment. It is understood that the currently adjusted parameters mentioned herein refer to those parameters whose most recent adjustment has not been undone.

[0285] For example, when the battery current is less than 0 and the total power consumption exceeds the adapter's rated power, the electronic device can increase the first response time from 50 microseconds to 100 microseconds, increase the adapter peak current percentage from 110% to 115%, and increase the first debounce duration by one level. Then, the electronic device can determine if the adapter has stopped working. If the adapter has stopped working, the electronic device can restore the first debounce duration to its initial value, while maintaining the first response time at 100 microseconds and the adapter peak current percentage at 115%. The electronic device can then determine again if the adapter has stopped working. If the adapter has stopped working, the electronic device can restore the first response time to 50 microseconds. That is, both the first response time and the first debounce duration are restored to their initial values, while the adapter peak current percentage remains at 115%.

[0286] Similarly, in some embodiments of this application, if the adapter stops working, and the number of parameters that the electronic device has adjusted is greater than 2, the electronic device can undo the recent adjustments to some of the adjusted parameters, that is, restore the adjusted parameters to their values ​​before the recent adjustments. The specific implementation method can be referred to above, and will not be repeated here.

[0287] In some embodiments of this application, the electronic device determines whether the adapter has stopped working. Specifically, this may include: the electronic device determining whether the adapter flag bit is a first value. If the adapter flag bit is the first value, it indicates that the adapter is working normally and has not stopped working. In this case, the electronic device can continue to execute step S108. If the adapter flag bit is not the first value, it indicates that the adapter has stopped working. In this case, the electronic device restores the adjusted parameters to their state before adjustment, or restores the adjusted parameters to their state before the most recent adjustment.

[0288] In some embodiments of this application, the electronic device can determine whether the adapter has stopped working via an EC (Electronic Control Unit). In one possible implementation, the EC can determine whether the adapter is currently in a working state or a stopped state via a specific signal line.

[0289] S108: Determine if the system has lost power.

[0290] While the adapter is still functioning, the electronic device can continue to determine whether it has lost power. If the system loses power, the electronic device can readjust the parameters, i.e., cyclically execute one or more of steps S103-S106. If the system does not lose power, the electronic device can write the adjusted parameters to the EC. In some embodiments of this application, if the system does not lose power and the adjusted parameters include a first response duration, the electronic device can send the adjusted first response duration to the charging management module via the EC. Similarly, if the system does not lose power and the adjusted parameters include the adapter peak current percentage, the electronic device can send the adjusted adapter peak current percentage to the charging management module via the EC. Similarly, if the system does not lose power and the adjusted parameters include a first debouncing duration, the electronic device can send the adjusted first debouncing duration to the charging management module via the EC.

[0291] It is understood that the specific implementation of step S108 can be referred to the relevant content of step S102, and will not be repeated here.

[0292] In some embodiments of this application, the parameter adjusted by the electronic device is the same as the parameter previously adjusted; that is, the parameter adjusted by the electronic device each time is the same. In other words, if the electronic device executes step S102 and then step S103, and then executes step S108 and determines that the power is still off, step S103 can be executed again. Similarly, if the electronic device executes step S102 and then step S104, and then executes step S108 and determines that the power is still off, step S104 can be executed again. Similarly, if the electronic device executes step S102 and then step S105, and then executes step S108 and determines that the power is still off, step S105 can be executed again. Similarly, if the electronic device executes step S102 and then step S106, and then executes step S108 and determines that the power is still off, step S106 can be executed again.

[0293] In some embodiments of this application, the parameters that the electronic device adjusts again are different from those that it adjusted before. For example, the parameters that the electronic device adjusts for the first time include the adapter peak current percentage and the first debouncing duration, that is, the electronic device executes steps S104 and S105 for the first time. However, after executing steps S107 and S108 and determining that the electronic device is still powered down, the electronic device may adjust only the adapter peak current percentage or the first debouncing duration, that is, the electronic device executes only one of steps S104 and S105 for the second time.

[0294] S109: Write the adjusted parameters into EC.

[0295] After the electronic device completes adjustments to one or more of the above parameters, it can write the adjusted parameters to the EC (Electronic Control Unit). It can be understood that the electronic device can not only write the adjusted parameters to the EC, but also write the unadjusted parameters to the EC. This way, when the EC determines the system has lost power again, the currently set parameters (i.e., first response time, adapter peak current percentage, first debounce time, and display brightness) can be directly obtained from the EC and adjusted via the EC. This eliminates the need to first obtain the currently set parameters from the charging management module via the EC and then adjust them via the EC, simplifying the process and saving time to some extent.

[0296] It is understandable that writing to the EC specifically refers to writing to the EC's storage module. In other words, electronic devices can save adjusted parameters to the EC's storage module, and they can also save unadjusted parameters to the EC's storage module.

[0297] In some embodiments of this application, the above-described charging method can be specifically executed by an EC in an electronic device.

[0298] In some embodiments of this application, when the electronic device is powered on via an adapter and the smart charging mode is enabled, the electronic device can execute steps S102-S109.

[0299] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.

Claims

1. An electronic device, characterized in that, include: The system includes a charging management module, a controller, and a battery, wherein the charging management module is connected to the adapter, the controller, and the battery, respectively. The charging management module is used to receive the power output from the adapter and charge the battery; The controller is used to send a first current parameter and a first duration, as well as send a first message, to the charging management module when the adapter is in working state and the system is powered off. The first current parameter is used to indicate the peak current of the adapter, and the peak current of the adapter is used to determine the maximum output power of the adapter; The first current parameter indicates that the peak current of the adapter is greater than the current peak current of the adapter. The first duration is used to indicate the waiting time between when the charging management module receives the system power failure indication information and when it switches the working mode to the discharge mode; The first duration is longer than the current waiting duration; the first information is used to indicate a system power failure; The charging management module is also used to maintain the charging mode of the charging management module when it is determined based on the first information that the duration of the system power outage is less than the first duration. Wherein, the first current parameter is used to indicate that the peak current of the adapter is less than a preset peak current, and the preset peak current is the peak current of the adapter sent by the controller to the charging management module when the adapter is in working state and the system is powered off, without sending the waiting time to the charging management module; The first duration is less than the preset waiting duration, which is the waiting duration that the controller sends to the charging management module when the adapter is in working state and the system is powered off, without sending the peak current of the adapter to the charging management module.

2. The electronic device as claimed in claim 1, characterized in that, The controller is further configured to adjust the first current parameter when the adapter is in operation and the system is powered off, and to send the first current parameter obtained in this adjustment to the charging management module; the peak current of the adapter indicated by the first current parameter obtained in this adjustment is greater than the peak current of the adapter indicated by the first current parameter obtained in the previous adjustment.

3. The electronic device as described in claim 1 or 2, characterized in that, The controller is further configured to adjust the first duration when the adapter is in working state and the system is powered off, and to send the first duration obtained in this adjustment to the charging management module; the first duration obtained in this adjustment is greater than the first duration obtained in the previous adjustment.

4. The electronic device as described in claim 1 or 2, characterized in that, The controller is also configured to perform one or more of the following: After sending the first current parameter to the charging management module, and when the adapter is in a stopped state, a second current parameter is sent to the charging management module. The second current parameter is used to indicate the peak current of the adapter, and the peak current of the adapter indicated by the second current parameter is less than the current peak current of the adapter. After sending the first duration to the charging management module, and when the adapter is in a stopped state, a second duration is sent to the charging management module. The second duration is used to indicate the waiting time between the charging management module receiving the system power failure indication information and switching the working mode to the discharge mode. The second duration is less than the current waiting time.

5. The electronic device as described in claim 1 or 2, characterized in that, The electronic device also includes a display screen connected to the controller; The controller is also used to adjust the brightness of the display screen when the adapter is in operation and the system is powered off, wherein the brightness of the display screen adjusted in this adjustment is less than the original brightness of the display screen.

6. The electronic device as claimed in claim 5, characterized in that, After adjusting the brightness of the display screen, the controller is further configured to adjust the brightness of the display screen when the adapter is in working state and the system is powered off, or when the adapter is in a stopped state, wherein the brightness of the display screen obtained in this adjustment is less than the brightness of the display screen obtained in the previous adjustment.

7. A charging method, characterized in that, The method is applied to a controller in an electronic device, the electronic device including the controller, a charging management module, and a battery, wherein the charging management module is connected to an adapter, the controller, and the battery respectively; the method includes: When the adapter is in working state and the system is powered off, the controller sends a first current parameter, a first duration, and a first message to the charging management module. The first current parameter indicates the peak current of the adapter, which determines the adapter's maximum output power. The first current parameter indicates that the adapter's peak current is less than a preset peak current, which is the peak current sent by the controller to the charging management module when the adapter is in working state and the system is powered off, without sending a waiting duration. The first current parameter indicates that the adapter's peak current is greater than the adapter's current peak current. The first duration indicates the waiting time from receiving the system power-off indication information to switching the operating mode to the discharge mode. The first duration is less than a preset waiting duration, which is the waiting duration sent by the controller to the charging management module when the adapter is in working state and the system is powered off, without sending the adapter's peak current. The first duration is greater than the current waiting duration. The first message indicates a system power-off.

8. The method as described in claim 7, characterized in that, When the controller sends the first current parameter to the charging management module, the method further includes: After the controller sends the first current parameter to the charging management module, and when the adapter is in working state and the system is powered off, the controller adjusts the first current parameter and sends the first current parameter obtained in this adjustment to the charging management module; the peak current indicated by the first current parameter obtained in this adjustment is greater than the peak current indicated by the first current parameter obtained in the previous adjustment.

9. The method as described in claim 7 or 8, characterized in that, When the controller sends the first duration to the charging management module, the method further includes: After the controller sends the first duration to the charging management module, and when the adapter is in working state and the system is powered off, the controller adjusts the first duration and sends the first duration obtained in this adjustment to the charging management module; the first duration obtained in this adjustment is greater than the first duration obtained in the previous adjustment.

10. The method as described in claim 7 or 8, characterized in that, The method further includes any one or more of the following: After sending the first current parameter to the charging management module, and when the adapter is in a stopped state, the controller sends a second current parameter to the charging management module. The second current parameter is used to indicate the peak current of the adapter, and the peak current of the adapter indicated by the second current parameter is less than the current peak current of the adapter. After sending the first duration to the charging management module, and when the adapter is in a stopped state, the controller sends a second duration to the charging management module. The second duration is used to indicate the waiting time between the charging management module receiving the system power failure indication information and switching the working mode to the discharge mode. The second duration is less than the current waiting time.

11. The method as described in claim 7 or 8, characterized in that, The electronic device further includes a display screen connected to the controller; the method further includes: When the adapter is in operation and the system is powered off, the controller adjusts the brightness of the display screen. The brightness of the display screen adjusted in this adjustment is less than the original brightness of the display screen.

12. The method as described in claim 11, characterized in that, After adjusting the brightness of the display screen, the method further includes: When the adapter is in working condition and the system is powered off, or when the adapter is in a stopped state, the controller adjusts the brightness of the display screen. The brightness of the display screen obtained in this adjustment is less than the brightness of the display screen obtained in the previous adjustment.

13. A computer-readable storage medium, characterized in that, Used to store computer instructions that, when executed on an electronic device, cause the electronic device to perform the method described in any one of claims 7-12.