Patent Description:
This application relates to the field of technologies for controlling electronic devices, and in particular, to an electronic device.

With the development of technologies, performance of electronic devices is becoming higher. Not only performance of CPUs and internal memories is becoming higher, but also performance of storage devices is becoming higher. For example, a universal flash storage (universal flash storage, UFS) is a high-performance storage device having high read and write speeds. However, when an electronic device uses a UFS, a problem of probabilistic file system damage occurs.

<CIT> discloses a protection method executed by an electronic device that is powered by a supply voltage of a power source.

An electronic device is provided, to reduce probability of file system damage when using a UFS.

According to a first aspect, an electronic device is provided in accordance with appended claim <NUM>.

When the voltage of the battery drops to a value less than the preset voltage value x and continues to be less than the preset voltage value x for more than the preset duration t, the battery is controlled to stop supplying power for the UFS, where <NUM> V<x<<NUM> V, and <NUM><t<<NUM>. Because x is about <NUM> V, probability of file system damage caused by operation of the UFS below the voltage threshold for a long time can be effectively reduced. In addition, because t is greater than <NUM>, a problem that the UFS frequently cannot be used normally due to erroneous triggering can be alleviated.

The control device includes: a power management module, electrically connected to the UFS and the battery, and configured to receive an input from the battery and supply power for the UFS; a coulometer, electrically connected to the battery, and configured to collect the voltage of the battery, and report an interrupt when the voltage of the battery is less than the preset voltage value x; and a control module, electrically connected to the coulometer and the power management module, and configured to obtain the interrupt reported by the coulometer, and when determining based on the interrupt reported by the coulometer that the duration for which the voltage of the battery is less than the preset voltage value x is greater than or equal to the preset duration t, control the power management module to stop supplying power for the UFS. For the electronic device, monitoring the voltage of the battery through the interrupt-based manner can provide a more timely response to protect the UFS, to avoid a problem that the voltage of the battery cannot be continuously detected when the electronic device is dormant or in other scenarios.

In a possible implementation, the reporting the interrupt includes: setting a value in an interrupt register to an interrupt indication; and the control module is specifically configured to: when the value in the interrupt register changes from a non-interrupt indication to the interrupt indication, determine that one interrupt is obtained; set the value in the interrupt register to the non-interrupt indication after a preset interval time A; and when total duration of B consecutive interrupts obtained is less than or equal to the preset duration t, control the power management module to stop supplying power for the UFS, where B><NUM>.

In a possible implementation, (B - <NUM>) × A ≤ t < B × A. This can improve accuracy of determining the voltage of the battery.

In a possible implementation, <NUM> V<x<<NUM> V. Through the setting of x to be closer to <NUM> V, the problem of file system damage caused by operation of the UFS below <NUM> V for a long time can be further alleviated.

In a possible implementation, x=<NUM> V.

In a possible implementation, the electronic device includes a system load, and the system load includes the UFS; the power management module is electrically connected to the system load, and the power management module is configured to supply power for the system load; and the controlling the power management module to stop supplying power for the UFS comprises: controlling the power management module to stop supplying power for the system load. Because <NUM><t<<NUM>, the power management module is not triggered to stop supplying power for the system load, even if the voltage of the battery drops for a short period of less than <NUM>. In other words, a problem that the system load frequently cannot be used due to erroneous triggering is avoided.

In a possible implementation, the controlling the power management module to stop supplying power for the system load comprises: triggering the electronic device to enter a shutdown process. Because <NUM><t<<NUM>, shutdown of the electronic device is not triggered, even if the voltage of the battery drops for a short period of less than <NUM>. In other words, frequent shutdown of the electronic device caused by erroneous triggering is avoided.

In a possible implementation, the controlling the power management module to stop supplying power for the system load comprises: triggering the electronic device to enter a shipping mode, wherein in the shipping mode, the battery does not supply power for the system load.

Terms used in the description of embodiments of this application are merely used to explain specific embodiments of this application, and are not intended to limit this application.

Before embodiments of this application are described, conventional technologies and problems of the conventional technologies in embodiments of this application are first described. Occurrence of probabilistic file system damage when a UFS is used is due to operation of the UFS at a low operating voltage for a long time. For example, when operating below <NUM> V for more than <NUM>, the UFS will have problems in this operating environment, and file system damage may occur. In addition, an electronic device is equipped with an under voltage lock out (Under Voltage Lock Out, UVLO) mechanism configured to protect hardware in the electronic device. A UVLO threshold voltage is <NUM> V, and UVLO threshold duration is <NUM>. To be specific, when a battery voltage drops below <NUM> V for <NUM>, power failure protection is immediately triggered for system hardware. In addition, a soft shutdown threshold of <NUM> V and a shutdown threshold of <NUM> V are further set in the electronic device. If the battery voltage drops to <NUM> V or <NUM> V for a long time, a corresponding shutdown or soft shutdown operation is performed. The soft shutdown threshold of <NUM> V and the shutdown threshold of <NUM> V are for purpose of implementing automatic shutdown at a low battery level, and the UVLO mechanism is for purpose of protecting the hardware when the battery voltage drops. The occurrence of probabilistic file system damage when the UFS is used is exactly due to a drop of the battery voltage. Therefore, to resolve the problem of file system damage caused by the UFS, UVLO can be used to protect the UFS. For example, the UVLO threshold voltage is increased to <NUM> V. To be specific, when the battery voltage drops below <NUM> V for <NUM>, power failure protection is triggered for the system hardware, so that the hardware protection function of UVLO can protect the UFS. In other words, when the battery voltage drops, operation of the UFS is directly stopped. However, this brings about a new problem. Some normal device functions such as a speaker SPEAKER or a global system for mobile communications (Global System for Mobile communications, GSM) in a mobile phone may cause a battery to drop below <NUM> V and above <NUM> V for duration of about a hundred µs. Although the voltage is lower than <NUM> V, the UFS does not experience file system damage, because the duration is short. However, in this case, shutdown of the electronic device is still erroneously triggered. In other words, this manner is likely to erroneously trigger the shutdown of the electronic device, affecting user experience.

To resolve the above problems, technical solutions provided in embodiments of this application are described below.

First, the electronic device in embodiments of this application is described. <FIG> is a schematic structural diagram of an electronic device <NUM>.

The electronic device may include a processor <NUM>, a power management module <NUM>, a battery <NUM>, a universal flash storage (universal flash storage, UFS), and the like. It may be understood that the structure shown in this embodiment of the present invention does not constitute a specific limitation on the electronic device. In some other embodiments of this application, the electronic device may include more or fewer components than those shown in the figure, or some components may be combined, or some components may be divided, or different component arrangements may be used. The components shown in the figure may be implemented by hardware, software, or a combination of software and hardware.

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

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

A memory configured to store instructions and data may be further disposed in the processor <NUM>. In some embodiments, the memory in the processor <NUM> is a cache. The memory may store an instruction or data that is recently used or to be cyclically used by the processor <NUM>. When needing to use the instruction or the data again, the processor <NUM> may directly call the instruction or the data from the memory. This avoids repeated accessing and reduces a wait time for the processor <NUM>, thereby improving system efficiency.

The power management module <NUM> is configured to connect to the battery <NUM> and the processor <NUM>. The power management module <NUM> receives an input from the battery <NUM> and/or other inputs, to supply power for the processor <NUM> and the like. The power management module <NUM> may further be configured to monitor parameters such as a battery capacity, a quantity of battery cycles, and a battery health status (power leakage and impedance). In some other embodiments, the power management module <NUM> may alternatively be disposed in the processor <NUM>.

The UFS or other memories may be configured to store computer-executable program code. The executable program code includes instructions. The UFS or other memories may include a program storage area and a data storage area. The program storage area may store an operating system, an application program required by at least one function (for example, a sound playback function and an image display function), and the like. The data storage area may store data (for example, audio data or an address book) and the like created during use of the electronic device. The processor <NUM> runs the instructions stored in the UFS or other memories, and/or the instructions stored in the memory disposed in the processor, to execute various functional applications and data processing of the electronic device.

An embodiment of this application provides an electronic device, including: a universal flash memory UFS; a battery <NUM>, where the battery <NUM> is configured to supply power for the UFS; and a control device <NUM>. The control device <NUM> is configured to control the battery <NUM> to stop supplying power for the UFS when duration for which a voltage of the battery <NUM> is less than a preset voltage value x is greater than or equal to preset duration t, where <NUM> V<x<<NUM> V, and <NUM><t<<NUM>.

Specifically, as shown in <FIG>, an embodiment of this application provides a UFS protection mechanism independent of UVLO to protect the UFS. A voltage threshold of the UFS protection mechanism is the preset voltage value x, and the preset voltage value x is <NUM> V to <NUM> V. This can avoid file system damage caused by operation of the UFS below the voltage threshold for a long time. Because the preset voltage value x is lower than a shutdown threshold of <NUM> V and a soft shutdown threshold of <NUM> V, the UFS protection mechanism does not conflict with an existing shutdown mechanism. In addition, because the preset voltage value x is higher than <NUM> V, the UFS protection mechanism does not conflict with the existing UVLO mechanism. Threshold duration of the UFS protection mechanism is greater than <NUM>. Therefore, during normal operation of the electronic device, even if the voltage of the battery <NUM> drops for a short period of less than <NUM>, protection for the UFS is not erroneously triggered. In other words, frequent power-off of the UFS caused by erroneous triggering is avoided.

According to the electronic device in this embodiment of this application, when the voltage of the battery drops to a value less than the preset voltage value x and continues to be less than the preset voltage value x for more than the preset duration t, the battery is controlled to stop supplying power for the UFS, where <NUM> V<x<<NUM> V, and <NUM><t<<NUM>. Because x is about <NUM> V, probability of file system damage caused by operation of the UFS below the voltage threshold for a long time can be effectively reduced. In addition, because t is greater than <NUM>, a problem that the UFS frequently cannot be used normally due to erroneous triggering can be alleviated.

In a possible implementation, the control device <NUM> includes a power management module <NUM>. The power management module <NUM> is electrically connected to the UFS and the battery <NUM>. The power management module <NUM> is configured to receive an input from the battery <NUM>, to supply power for the UFS. The control device <NUM> further includes a coulometer <NUM>. The coulometer <NUM> is electrically connected to the battery <NUM>. The coulometer <NUM> is configured to collect the voltage of the battery <NUM>, and report an interrupt when the voltage of the battery <NUM> is less than the preset voltage value x. The control device <NUM> further includes a control module. The control module is electrically connected to the coulometer <NUM> and the power management module <NUM>. The control module is configured to obtain the interrupt reported by the coulometer <NUM>, and when determining based on the interrupt reported by the coulometer <NUM> that the duration for which the voltage of the battery <NUM> is less than the preset voltage value x is greater than or equal to the preset duration t, control the power management module <NUM> to stop supplying power for the UFS. The coulometer <NUM> continuously collect the voltage of the battery <NUM>. When determining that the voltage of the battery <NUM> is lower than the preset voltage value x, the coulometer <NUM> reports an interrupt, and then continues to collect the voltage of the battery <NUM>. Therefore, the control module may determine based on the interrupt reported by the coulometer <NUM> whether the duration for which the voltage of the battery <NUM> is less than the preset voltage value x is greater than or equal to the preset time t. For the electronic device, monitoring the voltage of the battery <NUM> through the interrupt-based manner can provide a more timely response to protect the UFS, to avoid a problem that the voltage of the battery cannot be continuously detected when the electronic device is dormant or in other scenarios.

In a possible implementation, the reporting the interrupt comprises: setting a value in an interrupt register to an interrupt indication. The control module is specifically configured to: when the value in the interrupt register changes from a non-interrupt indication to the interrupt indication, determine that one interrupt is obtained; set the value in the interrupt register to the non-interrupt indication after a preset interval time A; and when total duration of B consecutive interrupts obtained is less than or equal to the preset duration t, control the power management module <NUM> to stop supplying power for the UFS, where B><NUM>.

For example, x=<NUM> V, t=<NUM>, B=<NUM>, and A=<NUM>. As shown in <FIG>, Z is used for representing the value in the interrupt register. Z=<NUM> means that the value in the interrupt register is the interrupt indication. Z=<NUM> means that the value in the interrupt register is the non-interrupt indication. Assuming that the voltage of the battery is <NUM> V between <NUM> and <NUM>, the coulometer <NUM> does not report an interrupt during this period. Therefore, Z=<NUM>. At <NUM>, the voltage of the battery drops to <NUM> V. At this moment, a battery voltage sampled by the coulometer <NUM> is less than <NUM> V. Therefore, the coulometer <NUM> reports an interrupt, and Z is set to <NUM>. In other words, the value in the interrupt register is changed from the non-interrupt indication to the interrupt indication. In this case, the control module determines that one interrupt is obtained. Assuming that the preset interval time A is <NUM>, the control module performs an interrupt clearing operation after an interval of <NUM>, that is, at <NUM>, to be specific, resets the value in the interrupt register to the non-interrupt indication, in other words, sets Z to <NUM>. At this moment, because the battery sampled by the coulometer <NUM> is at a microsecond level, and the voltage of the battery is still <NUM> V, the coulometer <NUM> immediately reports another interrupt, and Z is set to <NUM>. In other words, the value in the interrupt register is changed from the non-interrupt indication to the interrupt indication again. In this case, the control module determines that a second interrupt is obtained. After the preset interval of <NUM>, that is, at <NUM>, the control module performs the interrupt clearing operation, to be specific, sets Z to <NUM>. At this moment, because the voltage of the battery is still <NUM> V, the coulometer <NUM> reports an interrupt, and Z is set to <NUM>. In other words, the value in the interrupt register is changed from the non-terminal indication to the interrupt indication for the third time. The control module determines that a third interrupt is obtained. The three consecutive interrupts are obtained at <NUM>, <NUM>, and <NUM> respectively. Total duration of the three interrupts is <NUM>, which is less than the preset duration of <NUM>. That is, it is considered that duration for which the voltage of the battery is less than <NUM> V is greater than or equal to <NUM>. Specific values of A and B may be set as required. A and B are negatively correlated. To be specific, a smaller A indicates a larger B.

A larger B indicates more accurate determining of the voltage of the battery. This can reduce the probability of erroneous determining. For example, as shown in <FIG>, the following setting is still used: x=<NUM> V, t=<NUM>, A=<NUM>, and B=<NUM>. The voltage of the battery is <NUM> V between <NUM> and <NUM>, and the coulometer <NUM> does not report an interrupt during this period. Therefore, Z=<NUM>. At <NUM>, the voltage of the battery drops to <NUM> V. At this moment, a battery voltage sampled by the coulometer <NUM> is less than <NUM> V. Therefore, the coulometer <NUM> reports an interrupt, and Z is set to <NUM>. In other words, the value in the interrupt register is changed from the non-interrupt indication to the interrupt indication. In this case, the control module determines that one interrupt is obtained. The voltage of the battery changes to <NUM> V during a period between <NUM> and <NUM>, and then changes back to <NUM> V. Because interrupt clearing is not performed in this period, the value in the interrupt register remains unchanged. After an interval of <NUM> since the value in the interrupt register is changed from the non-interrupt indication to the interrupt indication, that is, at <NUM>, the control module performs the interrupt clearing operation, to be specific, resets the value in the interrupt register to the non-interrupt indication, in other words, sets Z to <NUM>. At this moment, because the battery sampled by the coulometer <NUM> is at a microsecond level, and the voltage of the battery is still <NUM> V, the coulometer <NUM> immediately reports another interrupt, and Z is set to <NUM>. In other words, the value in the interrupt register is changed from the non-interrupt indication to the interrupt indication again. In this case, the control module determines that a second interrupt is obtained. After the preset interval of <NUM>, that is, at <NUM>, the control module performs the interrupt clearing operation, to be specific, sets Z to <NUM>. At this moment, because the voltage of the battery is still <NUM> V, the coulometer <NUM> reports an interrupt, and Z is set to <NUM>. In other words, the value in the interrupt register is changed from the non-terminal indication to the interrupt indication for the third time. The control module determines that a third interrupt is obtained. The three consecutive interrupts are obtained at <NUM>, <NUM>, and <NUM> respectively. Total duration of the three interrupts is <NUM>, which is less than the preset duration of <NUM>. Therefore, this case is erroneously determined as that the duration for which the voltage of the battery is less than <NUM> V is greater than or equal to <NUM>.

Therefore, to improve accuracy of determining the voltage of the battery, the value of A may be decreased. A smaller value of A indicates more accurate determining. For example, as shown in <FIG>, the following setting is used: x=<NUM> V, t=<NUM>, A=<NUM>, and B=<NUM>. When a battery voltage curve is the same as a battery voltage curve shown in <FIG>, a value of Z changes from <NUM> to <NUM> at six positions: <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, and <NUM>. To be specific, total duration of six consecutive interrupts obtained is <NUM>, which is equal to the preset duration of <NUM>. Therefore, it is still determined that the duration for which the battery voltage is less than <NUM> V is greater than or equal to <NUM>. As shown in <FIG>, when a battery voltage curve is the same as a battery voltage curve shown in <FIG>, a value of Z changes from <NUM> to <NUM> at six positions: <NUM>, <NUM>, <NUM>, <NUM>, <NUM>, and <NUM>. To be specific, total duration of six consecutive interrupts obtained is <NUM>, which is greater than the preset duration of <NUM>. Therefore, it is determined that the duration for which the battery voltage is less than <NUM> V is not greater than or equal to <NUM>. Therefore, the accuracy of determining the voltage of the battery can be improved by decreasing the value of A.

In addition, it can be seen that as the value of A decreases, that is, as the interrupt clearing operation is performed at a shorter interval, the value of Z changes from <NUM> to <NUM> more frequently within the duration for which the voltage of the battery is <NUM> V, in other words, more interrupts may be obtained within the same duration. Therefore, if the value of A decreases and the value of t remains unchanged, the value of B should be increased, to improve the accuracy of determining the voltage of the battery. When B, A, and t satisfy a relationship of (B - <NUM>) × A ≤ t < B × A, high accuracy of determining the voltage of the battery is achieved.

In a possible implementation, as shown in <FIG>, the electronic device includes a system load <NUM>. The system load <NUM> includes the UFS. In addition to the UFS, the system load <NUM> may include a display and other load devices. The power management module <NUM> is electrically connected to the system load <NUM>, and the power management module <NUM> is configured to supply power for the system load <NUM>. The controlling the power management module <NUM> to stop supplying power for the UFS comprises: controlling the power management module <NUM> to stop supplying power for the system load <NUM>.

Specifically, in the electronic device, due to specific circuit setting requirements, the power management module <NUM> may need to supply power for the system loads <NUM> including the UFS at the same time. In this case, when it is determined that the duration for which the voltage of the battery <NUM> is less than the preset voltage value x is greater than or equal to the preset time t, the battery <NUM> is controlled to stop supplying power for the system loads <NUM>, thereby protecting the UFS.

In a possible implementation, the controlling the power management module <NUM> to stop supplying power for the system load <NUM> comprises: triggering the electronic device to enter a shutdown process. In other words, the protection of the UFS may be achieved by triggering shutdown of the electronic device. Because <NUM><t<<NUM>, shutdown of the electronic device is not triggered, even if the voltage of the battery <NUM> drops for a short period of less than <NUM>. In other words, frequent shutdown of the electronic device caused by erroneous triggering is avoided.

In a possible implementation, the controlling the power management module <NUM> to stop supplying power for the system load <NUM> comprises: triggering the electronic device to enter a shipping mode shipmode. In the shipping mode, the battery <NUM> no longer supplies power for the system load <NUM>, thereby reducing power consumption of the battery. Therefore, the protection of the UFS may be achieved by triggering the shipping mode.

The electronic device <NUM> in embodiments of this application may be, for example, a mobile phone, a tablet computer, a watch, a band, or other electronic products.

Claim 1:
An electronic device, comprising:
a universal flash storage UFS;
a battery (<NUM>), configured to supply power for the UFS; and
a control device (<NUM>), configured to control the battery (<NUM>) to stop supplying power for the UFS when duration for which a voltage of the battery (<NUM>) is less than a preset voltage value x is greater than or equal to preset duration t, wherein <NUM> V<x<<NUM> V, and <NUM><t<<NUM>, wherein
the control device (<NUM>) comprises:
a power management module (<NUM>), electrically connected to the UFS and the battery (<NUM>), and configured to receive an input from the battery (<NUM>) and supply power for the UFS;
a coulometer (<NUM>), electrically connected to the battery (<NUM>), and configured to collect the voltage of the battery (<NUM>), and report an interrupt when the voltage of the battery (<NUM>) is less than the preset voltage value x; and
a control module, electrically connected to the coulometer (<NUM>) and the power management module (<NUM>), and configured to obtain the interrupt reported by the coulometer (<NUM>), and when determining based on the interrupt reported by the coulometer (<NUM>) that the duration for which the voltage of the battery (<NUM>) is less than the preset voltage value x is greater than or equal to the preset duration t, control the power management module (<NUM>) to stop supplying power to the UFS.