Loudspeaker protection method, electronic equipment and computer readable storage medium

By adjusting the amplification factor of the power amplifier according to the operating status of the protection algorithm, the problem of failure of the speaker protection algorithm is solved, and speaker protection and optimized playback of audio data are achieved when the algorithm fails.

CN120602879APending Publication Date: 2025-09-05HONOR DEVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410236242.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-29
Publication Date
2025-09-05

AI Technical Summary

Technical Problem

In the prior art, the protection algorithm of the speaker is easily modified or deleted, causing it to become invalid and unable to effectively protect the speaker, resulting in damage to the speaker when the operating power exceeds the safe range.

Method used

By adjusting the amplification factor of the power amplifier and according to the operating status of the protection algorithm, the audio data input strength of the speaker is automatically adjusted to protect the speaker from being damaged when the protection algorithm fails.

Benefits of technology

In the event that the protection algorithm fails, it effectively protects the speakers from damage while optimizing the playback performance of audio data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120602879A_ABST
    Figure CN120602879A_ABST
Patent Text Reader

Abstract

The invention provides a loudspeaker protection method, electronic equipment and a computer readable storage medium, and relates to the technical field of terminals, the method is applied to the electronic equipment comprising a power amplifier and a loudspeaker, and the power amplifier is connected with the loudspeaker. The loudspeaker protection method specifically comprises the following steps: displaying a first interface, wherein the first interface comprises a first control used for triggering and starting a loudspeaker to play audio data; in response to the operation on the first control, starting the loudspeaker; in response to the change of the operation state of a protection algorithm for protecting the loudspeaker, adjusting the amplification factor of the power amplifier; wherein under the condition that the protection algorithm is changed from normal operation to abnormal operation, the amplification factor of the power amplifier is reduced, and under the condition that the protection algorithm is changed from abnormal operation to normal operation, the amplification factor of the power amplifier is increased; and a loudspeaker is adopted to play the audio data amplified by the power amplifier. Therefore, the performance of the loudspeaker can be ensured, and meanwhile, the loudspeaker is prevented from being damaged.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of terminal technology, and in particular to a speaker protection method, an electronic device, and a computer-readable storage medium. Background Art

[0002] Nowadays, users often use the audio playback function of electronic devices. For example, laptops with built-in speakers can use these speakers to play audio, allowing users to hear sound. While the speakers are operating, if the actual operating power exceeds the safe operating power, the speakers may be damaged. To address this issue, the prior art proposes a protection algorithm that can detect and adjust the speaker's operating conditions to ensure that the actual operating power does not exceed the safe operating power.

[0003] However, in some electronic devices, such as laptops, the configuration files related to the protection algorithm can be modified or deleted. If the configuration files are modified or deleted, the protection algorithm will become ineffective, and the actual operating power of the speaker may exceed the safe operating power, causing damage to the speaker.

[0004] In addition, due to external attacks such as viruses, the protection algorithm may not operate normally, resulting in damage to the speaker. Summary of the Invention

[0005] In view of this, the present application provides a speaker protection method, an electronic device, and a computer-readable storage medium, so as to ensure that the speaker is not damaged even when the protection algorithm fails.

[0006] In a first aspect, the present application provides a speaker protection method, which is applied to an electronic device, the electronic device including a power amplifier and a speaker, the power amplifier being connected to the speaker, the method comprising: displaying a first interface, the first interface including a first control for triggering the speaker to play audio data; starting the speaker in response to an operation on the first control; adjusting the amplification factor of the power amplifier in response to a change in the operating state of a protection algorithm for protecting the speaker; wherein, when the protection algorithm changes from normal operation to abnormal operation, the amplification factor of the power amplifier is reduced, and when the protection algorithm changes from abnormal operation to normal operation, the amplification factor of the power amplifier is increased; and using the speaker to play the audio data amplified by the power amplifier.

[0007] In response to the operation of the first control, the electronic device can activate the speaker to play audio data. Because the speaker may be damaged during the audio data playback process, the electronic device can adjust the amplification factor of the power amplifier when the operating state of the protection algorithm used to protect the speaker changes, so that the amplification factor of the power amplifier adapts to the change in the operating state of the protection algorithm, thereby better protecting the speaker.

[0008] In some embodiments, when the protection algorithm changes from normal operation to abnormal operation, it indicates that the protection algorithm fails during the execution of the speaker protection method, that is, the protection algorithm cannot protect the speaker. Therefore, the electronic device can reduce the amplification factor of the power amplifier, so that the signal of the audio data input to the speaker remains at a low level, thereby ensuring that the speaker will not be damaged without the protection of the protection algorithm. When the protection algorithm in the electronic device changes from abnormal operation to normal operation, the electronic device increases the amplification factor of the power amplifier, which can ensure that the signal of the audio data input to the speaker remains at a high level, ensuring that the speaker can maximize the performance of playing audio data under the protection of the protection algorithm. When the protection algorithm in the electronic device changes from normal operation to abnormal operation, it indicates that the electronic device can reduce the amplification factor of the power amplifier.

[0009] In the above embodiment, each time the electronic device receives an operation on the first control, the speaker protection algorithm is executed and activated. When the electronic device completes execution of the speaker protection algorithm, the protection algorithm is also deactivated, thereby preventing the protection algorithm from running for an extended period of time, wasting computing resources, and increasing power consumption.

[0010] It can be understood that the electronic device can increase the amplification factor of the power amplifier according to a preset first amplification factor, or reduce the amplification factor of the power amplifier according to a preset second amplification factor, wherein the first amplification factor is greater than the second amplification factor.

[0011] In one possible implementation of the first aspect, the method further includes: executing a protection algorithm in response to an operation on the first control; wherein the protection algorithm is executed only when the speaker is activated and needs to play audio data, thereby avoiding prolonged execution of the protection algorithm, which would waste computing resources and increase power consumption. Based on the current execution status of the protection algorithm and the previous execution status of the protection algorithm, determining whether the execution status of the protection algorithm has changed.

[0012] In the above implementation, in response to an operation on the first control, the electronic device initiates the protection algorithm. Subsequently, the electronic device may determine the current operating status of the protection algorithm based on the return value of the protection algorithm's initialization interface. The electronic device stores the previous operating status of the protection algorithm, and the previous operating status of the protection algorithm and the current operating status of the protection algorithm are obtained in the same manner.

[0013] In a possible implementation of the first aspect, based on the running status of the current protection algorithm and the running status of the last protection algorithm, it is determined whether the running status of the protection algorithm has changed, including: based on whether the key value of the key value item used to represent the running status of the protection algorithm in the registry of the electronic device has changed, it is determined whether the running status of the protection algorithm has changed.

[0014] In the above implementation method, the key value of the key value item used to represent the running status of the protection algorithm in the registry of the electronic device changes, indicating that the running status of the protection algorithm has changed. Therefore, whether the running status of the protection algorithm has changed can be more accurately judged by whether the key value has changed.

[0015] In a possible implementation of the first aspect, after running the protection algorithm, the method also includes: obtaining the return value of the initialization interface corresponding to the protection algorithm; the return value is used to indicate the running status of this protection algorithm; wherein, the return value is a first value, used to indicate that the running status of this protection algorithm is abnormal operation; the return value is a second value, used to indicate that the running status of this protection algorithm is normal operation; the first value is different from the second value; according to the return value, the key value of the key-value item is set; different return values ​​result in different key values ​​of the set key-value item.

[0016] After the electronic device starts the protection algorithm, it can determine the operating status of the protection algorithm through the return value of the protection algorithm's initialization interface. In this way, the actual status of the protection algorithm after it is started can be accurately obtained, avoiding the situation where the electronic device believes that the operating status of the protection algorithm is abnormal when the protection algorithm is not fully running.

[0017] In a possible implementation of the first aspect, the electronic device also includes a processor and an embedded controller, the processor is connected to the embedded controller, and the embedded controller is connected to the power amplifier; adjusting the amplification factor of the power amplifier includes: the processor sends a control instruction to the embedded controller; and the embedded controller adjusts the amplification factor of the power amplifier accordingly based on the control instruction.

[0018] In the above implementation, the processor can control the power amplifier through embedded control.

[0019] In a possible implementation of the first aspect, when the protection algorithm changes from normal operation to abnormal operation, the control instruction is specifically a first control instruction, which is used to instruct the embedded controller to reduce the amplification factor of the power amplifier; when the protection algorithm changes from abnormal operation to normal operation, the control instruction is specifically a second control instruction, which is used to instruct the embedded controller to increase the amplification factor of the power amplifier.

[0020] The first control instruction and the second control instruction are control instructions that can be recognized and executed by the embedded controller. When the protection algorithm changes from normal operation to abnormal operation, the electronic device needs to reduce the amplification factor of the power amplifier. Therefore, the processor of the electronic device can send a first control instruction to the embedded controller to instruct the embedded controller to reduce the amplification factor of the power amplifier. When the protection algorithm changes from abnormal operation to normal operation, the electronic device needs to increase the amplification factor of the power amplifier. Therefore, the processor of the electronic device can send a first control instruction to the embedded controller to instruct the embedded controller to increase the amplification factor of the power amplifier.

[0021] In a possible implementation of the first aspect, when the protection algorithm changes from normal operation to abnormal operation, the method also includes: determining whether a configuration file of the protection algorithm is stored in a preset path; if the configuration file of the protection algorithm is not stored in the preset path, configuring the configuration file of the protection algorithm in the preset path based on the installation package of the protection algorithm.

[0022] In the above process, the electronic device can determine whether the configuration file of the protection algorithm is stored in the preset path by determining whether the configuration file of the protection algorithm has been deleted or modified. In this way, the configuration file of the protection algorithm can continue to be configured in the preset path based on the installation package of the protection algorithm to ensure the integrity of the protection algorithm configuration file.

[0023] In some examples, when a configuration file of a partial protection algorithm, that is, an incomplete protection algorithm configuration file, is stored in the preset path, the electronic device may determine that the configuration file of the protection algorithm is not stored in the preset path.

[0024] In a possible implementation of the first aspect, the process of obtaining the installation package of the protection algorithm includes: when the operating system of the electronic device is started for the first time, backing up and storing the installation package of the protection algorithm.

[0025] In the above implementation process, the initial startup of the operating system refers to the initial startup of the electronic device after the operating system is installed. For example,

[0026] In some examples, during the initial startup of the operating system, the electronic device performs an initialization configuration process of the operating system. During this initialization process, the electronic device can back up the installation package of the protection algorithm and store it in a designated storage path, so that when the configuration file of the protection algorithm is not stored in the preset path, the configuration file of the protection algorithm can be configured in the preset path based on the installation package of the protection algorithm.

[0027] In a second aspect, the present application provides an electronic device, comprising a speaker, a power amplifier, a memory, and one or more processors; the speaker is coupled to the power amplifier, and the speaker, the power amplifier, the memory, and the processor are coupled; the memory is used to store computer program code, and the computer program code includes computer instructions; when the processor executes the computer instructions, the electronic device executes the method described in the first aspect above and any possible design method thereof.

[0028] In a third aspect, the present application provides a computer-readable storage medium comprising computer instructions. When the computer instructions are executed on an electronic device, the electronic device executes the method described in the first aspect and any possible design thereof.

[0029] In a fourth aspect, the present application provides a computer program product, comprising a computer program / instruction, which, when executed by a processor, enables the electronic device to execute the method described in the first aspect above and any possible design method thereof.

[0030] In a fifth aspect, the present application provides a device, which is included in an electronic device, and has the function of implementing the electronic device behavior in any of the above aspects and possible implementation methods. This function can be implemented by hardware, or by hardware executing corresponding software implementation. The hardware or software includes at least one module or unit corresponding to the above function. For example, an allocation module or unit, a scanning module or unit, a recycling module or unit, a movement module or unit, and a storage module or unit, etc.

[0031] In a sixth aspect, an embodiment of the present application provides a chip system, which includes a processor and may also include a memory, for implementing any one of the methods provided in aspects 3 to 5 above. The chip system may be composed of a chip or may include a chip and other discrete devices.

[0032] It can be understood that the electronic device described in the second aspect and any possible design method provided above, the computer-readable storage medium described in the third aspect, and the computer program product described in the fourth aspect are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0034] Figure 2 A schematic diagram of a speaker protection method provided in an embodiment of the present application Figure 1 ;

[0035] Figure 3 A structural block diagram of a loudspeaker protection system provided in an embodiment of the present application;

[0036] Figure 4 A schematic diagram of a speaker protection method provided in an embodiment of the present application Figure 2 ;

[0037] Figure 5 A schematic diagram of a speaker protection method provided in an embodiment of the present application Figure 3 . DETAILED DESCRIPTION

[0038] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, "at least one" refers to one or more, and "plurality" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0039] It should be noted that in the embodiments of this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.

[0040] Before introducing the embodiments of the present application, the technologies involved in the embodiments of the present application are first introduced in detail.

[0041] 1. A loudspeaker, also known as a horn, is a commonly used electroacoustic transducer that converts audio signals into sound. The principle of electroacoustic conversion in a loudspeaker is to convert the audio signal into diaphragm vibrations through electromagnetic, piezoelectric, or electrostatic effects. This vibration resonates with the surrounding air, producing sound.

[0042] 2. Power amplifier (PA). In the field of audio playback, the PA's task is to amplify weak audio signals to drive the speakers to produce sound.

[0043] Amplification factor is a parameter used to describe the PA's ability to amplify signals. A higher PA amplification factor indicates a stronger signal amplification capability. When the PA amplifies an audio signal and inputs it into a speaker, the speaker's diaphragm vibrates with a larger amplitude, resulting in a louder sound. Conversely, a lower PA amplification factor indicates a weaker PA amplification capability. In this case, the speaker's diaphragm vibrates with a smaller amplitude, resulting in a quieter sound.

[0044] The following describes a protection algorithm for protecting the speaker.

[0045] According to current research, factors that lead to speaker damage include excessive speaker temperature, excessive vibration amplitude of the speaker diaphragm, etc. Different protection algorithms are proposed according to the different factors that lead to speaker damage.

[0046] In some embodiments, since the speaker is an electroacoustic transducer, an audio signal flows through it when the speaker is operating. This means that when the speaker is operating, current flows through it, generating a thermal effect. Based on the principle of thermal effects of current, as the speaker's operating time increases or the audio signal flowing through it increases, the speaker's temperature rises. If heat cannot be dissipated in a timely manner, the speaker may burn out due to the high temperature.

[0047] To address this, the related art proposes a temperature-based protection algorithm, which can be executed by electronic devices to determine whether protection measures need to be taken for the speaker by detecting the temperature, operating current, and operating time of the speaker.

[0048] In some examples, for example, determining whether protective measures are needed for a speaker by detecting its temperature is used. When executing a protection algorithm, the electronic device can monitor the speaker's temperature and then determine whether the speaker's temperature exceeds a preset temperature threshold. If the speaker's temperature exceeds the preset threshold, indicating a risk of burnout, the electronic device can reduce the current flowing through the speaker to reduce heat generation and prevent burnout.

[0049] In other embodiments, since the sound-generating principle of the loudspeaker is that the vibration of the diaphragm resonates with the surrounding air, if the vibration amplitude of the loudspeaker diaphragm is too large, the diaphragm may rupture.

[0050] To address this, related art proposes a protection algorithm based on the vibration amplitude of the diaphragm. Electronic equipment can execute this protection algorithm to determine whether protective measures need to be taken for the speaker by detecting the vibration amplitude of the speaker diaphragm.

[0051] In some examples, for example, determining whether protective measures are needed for a speaker by detecting the vibration amplitude of the speaker diaphragm is used. When executing this protection algorithm, the electronic device can monitor the vibration amplitude of the speaker diaphragm and determine whether the vibration amplitude of the speaker diaphragm exceeds a preset vibration amplitude threshold. If the vibration amplitude of the speaker diaphragm exceeds the preset vibration amplitude threshold, indicating that the speaker is at risk of damage, the electronic device can reduce the vibration amplitude of the diaphragm to prevent damage to the speaker.

[0052] Of course, other similar protection algorithms are also provided in the related art to prevent the speaker from being damaged, and the embodiments of the present application will not list them one by one here.

[0053] Most electronic devices have both external audio circuits that use speakers to produce sound and internal audio circuits that use headphones to produce sound, to meet users' playback needs in different scenarios. For example, when the electronic device is not connected to headphones, the external audio circuit uses a high-voltage analog PA to drive the speakers to play sound, and the user can directly listen to the sound played by the speakers. When the electronic device is connected to headphones, the internal audio circuit uses the headphones to play sound, and the user can wear the headphones to listen to the sound.

[0054] To ensure the proper functioning of speakers when playing audio externally, electronic devices often employ protection algorithms to ensure the speakers operate at higher power levels without damaging them, thus maximizing their audio playback performance. However, if the protection algorithms fail, prolonged operation of the speakers at higher power levels can easily lead to damage.

[0055] That is, if the electronic device can normally execute the above protection algorithm, the speaker can be effectively prevented from being damaged. However, if the electronic device cannot normally execute the above protection algorithm, if the temperature is too high or the diaphragm vibration amplitude is large as described in the above embodiment, the speaker will be damaged.

[0056] Among them, electronic devices cannot normally execute protection algorithms due to the following reasons:

[0057] First, configuration files related to the protection algorithm are stored in the electronic device and are visible and modifiable to the user. If a user modifies or deletes these configuration files, the electronic device will not be able to properly execute the protection algorithm. For example, the file system of a laptop operating system is open, allowing users to modify or delete configuration files stored in the file system, such as those related to the protection algorithm. Configuration files related to the protection algorithm can be referred to as dependencies.

[0058] Second, the protection algorithm becomes ineffective when the electronic device's operating system is replaced. For example, if the original operating system of the electronic device includes a configuration file related to the protection algorithm, and the user reinstalls the operating system of the electronic device, only the new operating system remains on the electronic device, and the new operating system may not include the configuration file related to the protection algorithm, then the protection algorithm will also become ineffective.

[0059] 3. The protection algorithm itself has problems and cannot run properly. For example, after configuring the protection algorithm in the operating system, or after the original protection algorithm is updated or modified, some configurations in the protection algorithm conflict with other configurations of the current operating system, resulting in the electronic device being unable to execute the protection algorithm normally.

[0060] To this end, an embodiment of the present application provides a speaker protection method, which adjusts the amplification factor of the PA by changing the running state of the protection algorithm in the electronic device before the electronic device uses the speaker to play audio data, thereby adjusting the size of the audio data input to the speaker. Specifically: when the protection algorithm in the electronic device changes from abnormal operation to normal operation, the amplification factor of the PA can be increased, so that the signal of the audio data input to the speaker remains at a high level, ensuring that the speaker can maximize the performance of playing audio data under the protection of the protection algorithm. When the protection algorithm in the electronic device changes from normal operation to abnormal operation, it indicates that the protection algorithm has failed. The electronic device can reduce the amplification factor of the PA, so that the signal of the audio data input to the speaker remains at a low level, thereby ensuring that the speaker will not be damaged without the protection of the protection algorithm. In this way, using this speaker protection method, it can be ensured that the speaker is not damaged when the protection algorithm fails.

[0061] The audio electrical signal is also referred to as audio data.

[0062] In order to better understand the embodiments of the present application, the electronic device provided by the embodiments of the present application is first introduced.

[0063] The speaker protection method provided in the embodiment of the present application can be applied to electronic devices, which can specifically be terminal devices with speakers such as laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). In addition, the electronic device can also be a mobile phone, tablet computer, smart screen, vehicle-mounted device, wearable device (such as a smart watch), artificial intelligence (artificial intelligence) device, and other terminal devices with speakers. The embodiment of the present application does not limit the specific type of electronic device or the installed operating system. In addition, in the operating systems provided by these electronic devices, the configuration files or dependencies of the protection algorithm for protecting the speaker are visible to the user and allow the user to modify / delete them.

[0064] Figure 1 1 shows a schematic structural diagram of an electronic device 100. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, an antenna 1, a wireless communication module 160, an audio module 170, a speaker 170A, an indicator 192, a camera 193, and a display screen 194.

[0065] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

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

[0067] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.

[0068] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

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

[0070] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0071] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the wireless communication module 160, the modem processor and the baseband processor.

[0072] Antenna 1 is used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antenna can be used in conjunction with a tuning switch.

[0073] The wireless communication module 160 can provide wireless communication solutions for application on the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.

[0074] Wireless communication module 160 can be one or more devices that integrate at least one communication processing module. Wireless communication module 160 receives electromagnetic waves via antenna 1, frequency-modulates and filters the electromagnetic wave signals, and transmits the processed signals to processor 110. Wireless communication module 160 can also receive signals to be transmitted from processor 110, frequency-modulate and amplify them, and then convert them into electromagnetic waves for radiation via antenna 2.

[0075] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency signal. The demodulator then transmits the demodulated low-frequency signal to the processor 110 for processing. After being processed by the processor 110, the low-frequency signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, etc.) or displays an image or video through the display screen 194.

[0076] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the wireless communication module 160 so that the electronic device 100 can communicate with a network and other devices through wireless communication technology.

[0077] Electronic device 100 implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.

[0078] Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), a light-emitting diode (LED), or the like, with no limitation to the type of LED used. In some embodiments, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.

[0079] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0080] The ISP processes data fed back by camera 193. For example, when taking a photo, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and skin tone. It can also optimize parameters such as exposure and color temperature of the captured scene.

[0081] Camera 193 is used to capture still images or videos. The lens generates an optical image of an object and projects it onto a photosensitive element. The photosensitive element converts the optical signal into an electrical signal, which is then transmitted to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, or other format. In some embodiments, electronic device 100 may include one or N cameras 193, where N is a positive integer greater than one.

[0082] Digital signal processors are used to process digital signals. In addition to processing digital image signals, they can also process other digital signals.

[0083] The video codec is used to compress or decompress digital video. The electronic device 100 may support one or more video codecs.

[0084] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.

[0085] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

[0086] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area can store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.

[0087] The electronic device 100 can implement audio functions such as music playback and recording through the audio module 170, the speaker 170A, the microphone, the headphone jack, and the application processor.

[0088] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0089] Speaker 170A, also known as a "horn," converts audio electrical signals into sound signals. Electronic device 100 can listen to music or make hands-free calls through speaker 170A. Microphone, also known as a "microphone" or "microphone," converts sound signals into electrical signals. The headphone jack is used to connect wired headphones. The headphone jack can be a USB port 130 or another standard port.

[0090] In some embodiments, the speaker 170A is connected to a power amplifier that can amplify the audio data input to the speaker 170A. For example, the audio signal input to the speaker 170A can be amplified to varying degrees by adjusting the amplification factor of the power amplifier.

[0091] In some embodiments, if the protection algorithm is operating normally in the electronic device, the electronic device can utilize the normal operation of the protection algorithm to monitor the operating status of speaker 170A and execute corresponding protection measures based on the operating status of speaker 170A. In other embodiments, if the protection algorithm is abnormal, the amplification factor of the power amplifier can be controlled to be lower, thereby reducing the audio signal input to speaker 170A, thereby ensuring that speaker 170A is not damaged in the absence of the protection algorithm.

[0092] In some embodiments, the processor of the electronic device is equipped with an audio driver. The audio driver can send audio data to speaker 170A, thereby enabling audio playback by speaker 170A. In some examples, the audio driver can be a personal computer (PC) driver. The PC driver can control the amplification factor of a power amplifier. In addition, the PC driver can also send audio data to the power amplifier, so that the power amplifier amplifies the audio data according to the set amplification factor and then sends it to speaker 170A.

[0093] The specific implementation of the loudspeaker protection method provided in the embodiment of the present application is described below with reference to the accompanying drawings.

[0094] like Figure 2 The figure shows a process flow of a speaker protection method provided by an embodiment of the present application. Figure 1 .

[0095] S201: In response to receiving an operation from a user to start an audio playback service, the electronic device starts a protection algorithm.

[0096] In this embodiment, the operation of starting the audio playback service is used to trigger the speaker of the electronic device to play the audio data corresponding to the audio playback service. For example, the operation of starting the audio playback service can be an operation in which the user clicks the play control on the playback interface of a video application, clicks the play control on the playback interface of a music application, or clicks the hands-free control on the display interface of a call application.

[0097] Among them, the music application playback interface and the call application display interface can both refer to the "first interface" in this application, and the playback controls in the music application playback interface and the hands-free controls in the call application display interface can both refer to the "first control" in this application.

[0098] When the electronic device receives a user's request to activate the audio playback service, it indicates that the speaker needs to play audio data. Therefore, the electronic device can activate a protection algorithm to maximize the performance of the speaker while protecting it from damage. For details about the protection algorithm, please refer to the aforementioned related technology introduction.

[0099] In some examples, such as Figure 3 As shown, after receiving a user's operation to enable audio playback, the electronic device can activate the protection algorithm execution module to begin executing the protection algorithm, allowing the electronic device to take appropriate protective measures for the speaker based on the speaker's operating parameters to prevent the speaker from burning out. For example, if the speaker's operating parameter is the speaker's temperature, and the speaker temperature exceeds a preset threshold, the protection algorithm execution module can reduce the current flowing through the speaker to ensure that the speaker is not damaged by the excessive current.

[0100] In the above embodiment, if a temperature sensor is provided at the speaker, the electronic device can also take appropriate protective measures for the speaker based on the temperature detected by the temperature sensor. If a temperature sensor is not provided at the speaker, the electronic device can estimate the speaker temperature based on the relationship between the speaker's operating parameters and the temperature, and then take appropriate protective measures for the speaker based on the estimated speaker temperature.

[0101] In some embodiments, the protection algorithm can be pre-configured within the electronic device. When the electronic device needs to execute the protection algorithm, the configured protection algorithm is activated. For example, if the electronic device is a laptop computer, an executable program for the protection algorithm is installed within the laptop computer, meaning the protection algorithm is already configured within the laptop computer. At this point, if a user clicks the play control of a music playback application, the laptop computer may receive the operation to activate the audio playback service and the audio data generated by the music playback application. At this point, the laptop computer may activate the protection algorithm, causing it to execute the protection algorithm and prevent damage to the speakers.

[0102] In the above embodiment, the electronic device starts the protection algorithm only after receiving the user's operation to start the audio playback service, which can avoid the protection algorithm running for a long time and causing waste of computing resources and power consumption.

[0103] After receiving an operation from a user to start an audio playback service, the electronic device can obtain audio data generated by the application corresponding to the audio playback service. For example, after a user clicks the play control on the playback interface of a video application, the electronic device begins to obtain audio data generated by the video application. For another example, after a user clicks the play control on the playback interface of a music application, the electronic device begins to obtain audio data generated by the music application. For another example, during a call, the call application is running, and after the user clicks the hands-free control on the call application display interface, the electronic device begins to obtain audio data generated by the call application during the call. The electronic device can then send this audio data to the speaker to cause the speaker to produce sound.

[0104] In some embodiments, the electronic device can pre-process the audio data generated by the application so that the processed audio data is sent to the speaker, so that the speaker plays the sound to achieve better playback sound effects.

[0105] For example, Figure 3 As shown, in response to receiving an operation by a user to start the audio playback service, the application running in the processor generates audio data. Subsequently, this audio data can be first transmitted to the audio data processing module so that the audio data processing module can pre-process the audio data. Exemplarily, the processing performed by the audio data processing module on the audio data may include one or more processing such as low-frequency enhancement and spatial audio.

[0106] It is understandable that the user's operation of turning on the audio playback service is an operation of turning on the external audio playback service. The external audio playback service refers to the service of an electronic device using a speaker to play audio data. In this case, the working speaker is subject to the damage problem described in the above-mentioned related art. Therefore, it is necessary to use the speaker protection method provided in the embodiment of the present application to protect the speaker. In other words, the speaker protection method provided in the embodiment of the present application can be implemented in a scenario where an electronic device receives audio data played using a speaker.

[0107] In the scenario where an electronic device receives audio data played by a built-in speaker device such as headphones, since the working power of the built-in speaker device is low and the sound of the audio data played by the built-in speaker device itself is not loud, it will not be damaged. Therefore, in this scenario, the electronic device does not need to implement the speaker protection method provided in the embodiment of the present application.

[0108] In some embodiments, when the electronic device is not connected to an external speaker (such as headphones) and the internal speaker set inside the electronic device is not enabled, when the electronic device receives an operation from the user, it can default the operation to the operation of starting the audio playback service. Therefore, after the electronic device obtains the audio data generated by the application corresponding to the external audio playback service, it can send the audio data to the speaker so that the speaker can play the sound externally.

[0109] Accordingly, when an external speaker (such as headphones) is connected to the electronic device, or the internal speaker is enabled, when the electronic device receives a user operation, it can assume that the operation is not an operation by the user to start the audio playback service. In this case, the electronic device does not need to implement the speaker protection method provided in the embodiment of the present application.

[0110] In other embodiments, before the electronic device executes the above S201, the electronic device may, in response to receiving a user operation, determine whether the operation is an operation for the user to activate an audio playback service. If so, the electronic device may execute the speaker protection method provided in the embodiment of the present application. If the user operation is not an operation for the user to activate an audio playback service, the electronic device does not execute the speaker protection method provided in the embodiment of the present application.

[0111] That is, the embodiment of the present application can be executed when it is determined that the user has triggered the electronic device to play sound using the speaker, but not executed when the user has not triggered the electronic device to use the speaker but instead uses the built-in speaker to play sound. The electronic device can determine whether to trigger the use of the speaker to play sound based on the user's operation, and the embodiment of the present application does not specifically limit the basis for determining whether to trigger the use of the speaker to play sound.

[0112] S202, the electronic device determines whether the operating state of the protection algorithm has changed;

[0113] In S202, the electronic device determines whether the operating state of the protection algorithm has changed by comparing the operating state of the protection algorithm during the current implementation of the speaker protection method with the operating state of the protection algorithm during the previous implementation of the speaker protection method.

[0114] For example, if the protection algorithm is operating normally during the current execution of the speaker protection method, but was operating abnormally during the previous execution of the speaker protection method, the electronic device may determine that the protection algorithm's operating state has changed. For another example, if the protection algorithm is operating normally during the current execution of the speaker protection method, but was also operating normally during the previous execution of the speaker protection method, the electronic device may determine that the protection algorithm's operating state has not changed.

[0115] Exemplarily, the processor of the electronic device may determine whether the operating state of the protection algorithm has changed. For example, the processor may include a PC driver, which may determine whether the operating state of the protection algorithm has changed. In some examples, if the electronic device is a laptop computer, the PC driver may be a computer manager.

[0116] The registry is a crucial database in a laptop operating system, used to store operating system and application settings. The settings stored in the registry can control the startup of operations, the loading of hardware drivers, and the execution of certain other applications. In some embodiments, the registry may include a key-value entry indicating the operational status of a protection algorithm. Specifically, the value of the key-value entry in the registry indicating the operational status of the protection algorithm corresponds to the operational status of the protection algorithm. For example, if the protection algorithm is operating normally, the value of the key-value entry in the registry indicating the operational status of the protection algorithm may be a first value, such as 1. If the protection algorithm is operating abnormally, the value of the key-value entry in the registry indicating the operational status of the protection algorithm may be a second value, different from the first value, such as 0. Thus, the electronic device can determine the operational status of the protection algorithm based on the value of the key-value entry in the registry indicating the operational status of the protection algorithm. Therefore, the PC driver can detect whether the value of the key-value entry in the registry indicating the operational status of the protection algorithm has changed, thereby determining whether the operational status of the protection algorithm has changed.

[0117] For example, the PC driver can register a callback function in the registry to determine whether the key value of the key-value item in the registry that indicates the running status of the protection algorithm has changed. After the callback function is registered, if the key value of the key-value item in the registry that indicates the running status of the protection algorithm has changed, the PC driver can send a message to inform the PC driver of the change in the key-value item in the registry that indicates the running status of the protection algorithm.

[0118] For example, the PC driver stores a key value of 1 in the registry for indicating the running status of the protection algorithm during the last execution of the speaker protection method, indicating that the protection algorithm is running normally. Afterwards, during this execution of the speaker protection method, the key value of 0 in the registry for indicating the running status of the protection algorithm is running abnormally. At this time, the PC driver can determine that the running status of the protection algorithm has changed.

[0119] In some embodiments, after the electronic device initiates a protection algorithm in response to receiving a user's operation to activate an audio playback service, the electronic device may determine the operating status of the protection algorithm based on the return value of the protection algorithm's initialization interface. For example, if the return value of the initialization interface is a first value, it may indicate that the operating status of the protection algorithm during the current execution of the speaker protection method is abnormal; if the return value of the initialization interface is a second value, it may indicate that the operating status of the protection algorithm during the current execution of the speaker protection method is normal; wherein the first value and the second value are different.

[0120] The return value of the initialization interface can be a number or character with a preset meaning. For example, when the protection algorithm execution module successfully starts to execute the protection algorithm, the return value of the initialization interface is 0. When the protection algorithm execution module fails to execute the protection algorithm, that is, when the protection algorithm is operating abnormally, the return value of the initialization interface is 1. For another example, when the protection algorithm execution module successfully starts to execute the protection algorithm, the return value of the initialization interface is 0. When the protection algorithm execution module starts to execute the protection algorithm, but the execution process of the protection algorithm is abnormally interrupted, the return value of the initialization interface is false. Among them, the situation where the execution process of the protection algorithm is abnormally interrupted also belongs to the situation of abnormal operation.

[0121] In some examples, the protection algorithm used to protect the speaker is called a membrane excursion control (MEC) algorithm. Then, the return value of the initialization interface of the protection algorithm can be represented by MEC-init. The meaning represented by the value of MEC-init is generally pre-set. For example, in some settings, the value of MEC-init is 0 to indicate that the protection algorithm is running normally, and the value of MEC-init is false to indicate that the protection algorithm has not started running, or is running abnormally. For example, in some settings, the value of MEC-init is 1 to indicate that the protection algorithm cannot be started, and the value of MEC-init is 2 to indicate that the protection algorithm stops abnormally after starting. The embodiment of the present application does not impose specific restrictions on the return value of the initialization interface.

[0122] In some embodiments, the electronic device can determine the running status of the protection algorithm based on the return value of the initialization interface of the protection algorithm, and then the electronic device can modify the key value of the key-value item in the registry used to represent the running status of the protection algorithm based on the running status of the protection algorithm. For example, in the case where the return value of the initialization interface of the protection algorithm indicates that the protection algorithm is not running normally, the electronic device can determine that the protection algorithm is not running normally, and then the electronic device sets the key value of the key-value item in the registry used to represent the running status of the protection algorithm to a second key value, such as 0. In the case where the return value of the initialization interface of the protection algorithm indicates that the protection algorithm is running normally, the electronic device can determine that the protection algorithm is running normally, and then the electronic device can set the key value of the key-value item in the registry used to represent the running status of the protection algorithm to a first key value, such as 1.

[0123] In other embodiments, the electronic device may also directly modify the key value of the key value item in the registry that indicates the running status of the protection algorithm based on the return value of the initialization interface of the protection algorithm. For example, if the return value of the initialization interface is 0, it indicates that the protection algorithm is running normally, and if the return value of the initialization interface is 1, it indicates that the protection algorithm is not running normally. In this case, if the electronic device determines that the return value of the initialization interface is 0, the electronic device may directly set the key value of the key value item in the registry that indicates the running status of the protection algorithm to a first key value, such as 1; if the electronic device determines that the return value of the initialization interface is 1, the electronic device may directly set the key value of the key value item in the registry that indicates the running status of the protection algorithm to a second key value, such as 0.

[0124] In other examples, if the EC can recognize the key value, the electronic device can send the key value to the EC via a PC driver. If the key value is 0, it indicates that the protection algorithm is not operating normally. In this case, the EC controls the power amplifier to reduce the amplification factor to prevent the audio data amplified by the power amplifier from being too high and damaging the speaker. If the key value is 1, it indicates that the protection algorithm is operating normally. In this case, the EC controls the power amplifier to increase the amplification factor to prevent the audio data amplified by the power amplifier from being too high and damaging the speaker.

[0125] If the electronic device determines that the operating state of the protection algorithm has changed, it can be considered that the current protected state of the speaker has changed. In other words, the protection algorithm may be operating in an abnormal state and cannot currently protect the speaker. Alternatively, if the operating state of the protection algorithm has changed to a normal state, the power amplifier has a low amplification factor and cannot maximize the speaker's playback performance. Therefore, if the electronic device determines that the operating state of the protection algorithm has changed, it continues to execute S203:

[0126] S203: The electronic device adjusts the amplification factor of the power amplifier.

[0127] If the operating state of the protection algorithm changes from normal operation to abnormal operation, the electronic device reduces the amplification factor of the power amplifier. If the operating state of the protection algorithm changes from abnormal operation to normal operation, the electronic device increases the amplification factor of the power amplifier.

[0128] If the protection algorithm's operating status changes from normal to abnormal, it indicates that the protection algorithm was operating normally during the previous speaker protection method run. Therefore, the power amplifier's amplification factor should have been increased. If the protection algorithm changes to abnormal during the current speaker protection method run, it indicates that the power amplifier's amplification factor is no longer suitable for maintaining a high value. Therefore, the electronic device can reduce the power amplifier's amplification factor to prevent the audio data signal amplified by the power amplifier from being too strong, which could damage the speaker.

[0129] The protection algorithm's operating status has changed from abnormal to normal, indicating that the protection algorithm was operating abnormally during the previous speaker protection method run. Therefore, the power amplifier's amplification factor should have been reduced. The protection algorithm's change to normal during the current speaker protection method run indicates that the power amplifier's amplification factor is no longer suitable for maintaining a low value. Therefore, the electronic device can increase the power amplifier's amplification factor to improve the audio data signal amplified by the power amplifier, allowing the speaker to maximize its performance without damaging it.

[0130] In the above embodiment, if the key value of the key-value item used to indicate the running status of the protection algorithm changes, it indicates that the running status of the protection algorithm has changed. Therefore, the electronic device can determine whether the amplification factor of the power amplifier needs to be adjusted by detecting whether the key value of the key-value item used to indicate the running status of the protection algorithm in the registration table has changed.

[0131] Exemplarily, the electronic device detects whether the key value of the key value item for indicating the running state of the protection algorithm in the registration table has changed.

[0132] When the key value of the key value item for indicating the running state of the protection algorithm in the registry does not change, it indicates that the running state of the protection algorithm does not change. Then, the electronic device does not need to adjust the amplification factor of the power amplifier.

[0133] When the key value of the key-value item for indicating the running state of the protection algorithm in the registration table changes, the electronic device may execute the above S203.

[0134] In the case of a laptop computer, the electronic device is generally equipped with an embedded controller (EC), which can control the laptop computer's keyboard, touchpad, power management module, cooling fan, indicator light, etc., thereby achieving the laptop computer's portability and intelligence. Figure 3 As shown, an embedded controller (EC) is provided between the processor and the power amplifier.

[0135] In this case, the electronic device may perform S203 through the following process: the electronic device sends a control instruction to the embedded controller based on the key value, so that the embedded controller adjusts the amplification factor of the power amplifier accordingly based on the control instruction.

[0136] For example, Figure 3 As shown, when an electronic device is equipped with an EC, the audio driver in the processor is connected to the embedded controller. Therefore, when the processor detects a change in the key value in the registry that indicates the operating status of the protection algorithm, the audio driver in the processor can send a control instruction to the EC based on the key value. The EC is connected to a power amplifier, so the EC can increase or decrease the power amplifier's amplification factor based on the control instruction.

[0137] in, Figure 3 The power amplifier shown in can be an analog high-voltage power amplifier, an analog power amplifier, or the like.

[0138] It should be noted that the audio data processing process in the above embodiment is performed by a processor in the electronic device. The processor processes digital data (or digital signals), while the audio data input to the power amplifier and the speaker is analog data (or analog signals). Therefore, a codec can be set between the processor and the power amplifier, such as Figure 3 The processor inputs the digital audio data into the codec, so that the codec can convert the digital audio data into analog audio data. In this way, the power amplifier can amplify the analog audio data and input it into the speaker, ensuring that the speaker can play the audio data.

[0139] Some examples, such as Figure 3 As shown, after the EC adjusts the amplification factor of the power amplifier, the audio data generated by the application is processed by the audio data processing module and the codec, and then sent to the power amplifier. The power amplifier amplifies the audio data according to the adjusted amplification factor, so that the speaker can play the audio data without being damaged.

[0140] When the key value in the registry changes and the changed key value is 1, the electronic device can send an instruction to the EC to increase the amplification factor of the power amplifier; when the key value in the registry changes and the changed key value is 0, the electronic device can send an instruction to the EC to reduce the amplification factor of the power amplifier.

[0141] In the above embodiment, when adjusting the amplification factor of the power amplifier, the electronic device may adjust the amplification factor according to a preset amplification factor. For example, a first amplification factor and a second amplification factor are preset, and the first amplification factor is greater than the second amplification factor. Then, when the electronic device increases the amplification factor of the power amplifier, the amplification factor of the power amplifier may be adjusted to the first amplification factor, and when the electronic device decreases the amplification factor of the power amplifier, the amplification factor of the power amplifier may be adjusted to the second amplification factor.

[0142] Specifically, by changing the signal at the pin connecting the EC to the power amplifier, the power amplifier's amplification factor can be adjusted. For example, if the GPIO signal at the pin connecting the EC to the power amplifier is lowered, the power amplifier's amplification factor will be reduced, and if the GPIO signal at the pin connecting the EC to the power amplifier is lowered, the power amplifier's amplification factor will be increased.

[0143] Optionally, if the electronic device determines that the operating status of the protection algorithm has not changed, or if the key value of the key-value item representing the operating status of the protection algorithm in the registry has not changed, the electronic device may determine whether a configuration file for the protection algorithm exists in a preset path. Subsequently, if the configuration file for the protection algorithm does not exist in the preset path, the electronic device configures the configuration file for the protection algorithm in the preset path based on the backup installation package of the protection algorithm. The preset path is used to store the configuration file for the protection algorithm.

[0144] In this way, when the user mistakenly deletes the configuration file of the protection algorithm configured in the preset path, the electronic device can also reconfigure the configuration file of the protection algorithm in the preset path to ensure the operation of the protection algorithm.

[0145] The backup installation package of the protection algorithm may be backed up when the operating system is installed on the electronic device. Alternatively, the backup installation package of the protection algorithm may be backed up via an initialization program when the electronic device first boots up the installed operating system. Alternatively, the backup installation package of the protection algorithm may be downloaded by the electronic device from a download address.

[0146] The backup installation package of the protection algorithm may be installed in a designated storage path of the electronic device.

[0147] In some embodiments, when the configuration file of the protection algorithm does not exist under the preset path, the electronic device may further display a protection algorithm installation prompt message to prompt the user to install an application related to the protection algorithm, or to prompt the user to re-download and install the application related to the protection algorithm to ensure that the electronic device can operate the protection algorithm normally. For example, the protection algorithm installation prompt message may include the content "Please try to reinstall the protection algorithm" and an installation control. In response to the user clicking the installation control, the electronic device may configure the configuration file of the protection algorithm under the preset path based on the backup installation package of the protection algorithm. For another example, the protection algorithm installation prompt message may include the content "Please try to reinstall the protection algorithm. The download website is XXX", where the download website is a clickable download control. In response to the user clicking the download control, the electronic device may access the download website and start the download program to download the backup installation package of the protection algorithm. After the backup installation package of the protection algorithm is downloaded, the electronic device starts the installation program of the backup installation package of the protection algorithm.

[0148] In some embodiments, the electronic device can also periodically determine whether a configuration file for the protection algorithm exists in a preset path. For example, the electronic device may be installed with a management application that can periodically determine whether a configuration file for the protection algorithm exists in a preset path. In this way, the electronic device can use the management application to periodically determine whether a configuration file for the protection algorithm exists in the preset path. If the configuration file for the protection algorithm does not exist in the preset path, the electronic device can configure the configuration file for the protection algorithm in the preset path based on a backup installation package for the protection algorithm, or display a protection algorithm installation prompt to prompt the user to re-download and install the application related to the protection algorithm to ensure that the electronic device can properly operate the protection algorithm.

[0149] In the case that a configuration file of the protection algorithm exists under the preset path, it means that the protection algorithm is not running normally due to an abnormality in the configuration file of the protection algorithm. For example, after the operating system of the electronic device is reinstalled, the operating system is not configured with the protection algorithm and cannot be configured. At this time, the electronic device cannot ensure the normal operation of the protection algorithm by reconfiguration. At this time, the electronic device can display a prompt message to prompt the user that the protection algorithm in the current electronic device cannot run normally and cannot be restored to normal operation by reconfiguration. At this time, the electronic device can display an abnormality prompt message to prompt the user that there is an unresolvable abnormality in the protection algorithm of the current electronic device. In this way, when the configuration file of the protection algorithm is not deleted by mistake, but the protection algorithm cannot run normally due to other reasons, the electronic device can still ensure that the speaker is not damaged.

[0150] The following, combined Figure 4 A schematic diagram of the process of a speaker protection method provided in an embodiment of the present application is introduced Figure 2 .

[0151] Figure 4 The loudspeaker protection method shown includes the following steps:

[0152] S401: In response to receiving an operation from a user to start an audio playback service, the electronic device starts a protection algorithm to reduce the amplification factor of a power amplifier.

[0153] When the electronic device executes the process of starting the protection algorithm in response to receiving the user's operation of starting the audio playback service in S401, the process is the same as S201. Please refer to the above embodiment and will not be repeated here.

[0154] When the electronic device receives the user's operation to start the audio playback service, it can reduce the amplification factor of the power amplifier. When the operating status of the protection algorithm is not determined, the amplification factor of the power amplifier is small, and the signal of the audio data amplified by the power amplifier is also small, thereby ensuring that the speaker is not damaged.

[0155] S402: The electronic device determines whether the operating status of the protection algorithm is normal through the return value of the initialization interface of the protection algorithm.

[0156] When it is determined that the protection algorithm is operating normally, the electronic device may perform the following steps (S403-S404):

[0157] S403: The electronic device sets the key value of the key value item in the registration table for indicating the running state of the protection algorithm to 1.

[0158] S404: The electronic device increases the amplification factor of the power amplifier based on the key value.

[0159] In some embodiments, after the electronic device receives a user's operation to activate the audio playback service, it activates the protection algorithm and reduces the amplification factor of the power amplifier. Subsequently, the electronic device determines that the protection algorithm is operating normally through the return value of the initialization interface of the protection algorithm. At this time, since the electronic device has already reduced the amplification factor of the power amplifier during the execution of S401, the electronic device can continue to execute S404 after executing S403 to increase the amplification factor of the power amplifier. For example, the processor of the electronic device can send a control instruction to increase the amplification factor to the embedded controller based on the key value, so that the embedded controller increases the amplification factor of the power amplifier based on the control instruction.

[0160] When it is determined that the operating state of the protection algorithm is abnormal, the following steps (S405-S406) are performed:

[0161] S405: The electronic device sets the key value of the key value item in the registration table for indicating the running state of the protection algorithm to 0.

[0162] It is understandable that, when it is determined that the operating state of the protection algorithm is abnormal, the electronic device may also keep the amplification factor of the power amplifier unchanged at the amplification factor reduced by the electronic device in S401 .

[0163] In some embodiments, when the electronic device lowers the amplification factor of the power amplifier by setting the key value in the registry to 0 during the execution of S401, and the electronic device determines after S402 that the operating status of the protection algorithm is abnormal, then the electronic device may not perform any operation and keep the amplification factor of the power amplifier still reduced, and the electronic device keeps the key value of the key value item in the registry used to represent the operating status of the protection algorithm as 0.

[0164] In some embodiments, the electronic device may adjust the amplification factor of the power amplifier to a preset second amplification factor to reduce the amplification factor of the power amplifier.

[0165] Alternatively, as Figure 4 As shown, when it is determined that the operating state of the protection algorithm is abnormal, the electronic device may further perform the following steps (S406):

[0166] S406: The electronic device determines whether there is a configuration file of the protection algorithm in a preset path.

[0167] In some examples, when the electronic device determines that the protection algorithm is operating in an abnormal state, the electronic device determines whether there is a configuration file of the protection algorithm in a preset path.

[0168] If it is determined that there is no configuration file of the protection algorithm in the preset path, the electronic device may continue to perform the following steps (S407):

[0169] S407: The electronic device configures a configuration file of the protection algorithm in a preset path based on the backup installation package of the protection algorithm.

[0170] The specific implementation of S406 and S407 can be found in the above Figure 2 The relevant embodiments will not be described in detail here.

[0171] The following, combined Figure 5 A schematic diagram of the process of introducing a speaker protection method provided in an embodiment of the present application Figure 3 .

[0172] Figure 5 The loudspeaker protection method shown includes the following steps:

[0173] S501: In response to receiving an operation from a user to start an audio playback service, the electronic device starts a protection algorithm.

[0174] S502: The electronic device determines whether the operation status of the protection algorithm is normal through the return value of the initialization interface of the protection algorithm.

[0175] When it is determined that the protection algorithm is operating normally, the following steps (S503-S504) are performed:

[0176] S503: The electronic device sets the key value of the key value item in the registration table for indicating the running state of the protection algorithm to 1.

[0177] S504: The electronic device sends a control instruction for increasing the amplification factor to the embedded controller according to the key value, so that the embedded controller increases the amplification factor of the power amplifier based on the control instruction.

[0178] When it is determined that the operating state of the protection algorithm is abnormal, the following steps (S505-S506) are performed:

[0179] S505: The electronic device sets the key value of the key value item in the registration table that is used to represent the running state of the protection algorithm to 0.

[0180] S506: The electronic device sends a control instruction for reducing the amplification factor to the embedded controller according to the key value, so that the embedded controller reduces the amplification factor of the power amplifier based on the control instruction.

[0181] The specific implementation of the above S503-S506 can be found in the above Figure 2 The relevant embodiments will not be described in detail here.

[0182] It should be noted that each time the electronic device receives an operation from the user to activate the audio playback service, the electronic device executes steps S201-S203, or executes steps S401-S407, or executes steps S501-S506. Each time the electronic device receives an operation from the user to activate the audio playback service, the electronic device only executes the above-described speaker protection method process once, and during this process, the electronic device only executes the step of activating the protection algorithm once. After the electronic device activates the protection algorithm, the relevant operating parameters of the protection algorithm are loaded into the electronic device's memory, and the electronic device activates the audio playback service. If the electronic device has not yet terminated the audio playback service, the relevant operating parameters of the protection algorithm remain in the electronic device's memory. Therefore, even if the user deletes the relevant configuration file for the protection algorithm before the electronic device has terminated the audio playback service, the relevant operating parameters already loaded into the electronic device's memory will not be affected, nor will the normal operation of the currently loaded protection algorithm be affected. Therefore, the electronic device can execute the above-described speaker protection algorithm only once upon receiving an operation from the user to activate the audio playback service.

[0183] However, if the user deletes the configuration file for the protection algorithm during or after the audio playback service is received by the electronic device, the electronic device will still activate the protection algorithm the next time the user initiates the audio playback service. However, since the configuration file has been deleted, the electronic device can determine that the protection algorithm is operating abnormally based on the return value of the protection algorithm's initialization interface. The electronic device can then modify the key value in the registry key representing the protection algorithm's operating status. When the key value changes, the electronic device can send a control instruction to the EC based on the key value via the PC driver, causing the EC to control the power amplifier to reduce the amplification factor based on the control value, thereby protecting the speaker.

[0184] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned electronic device, the electronic device executes each function or step in the above-mentioned method embodiment.

[0185] An embodiment of the present application further provides a computer program product, including a computer program. When the computer program runs on an electronic device, the electronic device executes each function or step in the above method embodiment.

[0186] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0187] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely schematic. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0188] The units described as separate components may or may not be physically separate, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0189] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0190] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0191] The above content is only a specific embodiment of this application, but the scope of protection of this application is not limited to this. Any changes or replacements within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.

Claims

1. A speaker protection method, characterized in that: Applied to an electronic device, the electronic device includes a power amplifier and a speaker, the power amplifier is connected to the speaker, and the method includes: Displaying a first interface, wherein the first interface includes a first control for triggering the speaker to start playing audio data; In response to an operation on the first control, activating the speaker; In response to a change in the operating state of a protection algorithm for protecting the loudspeaker, adjusting the amplification factor of the power amplifier; wherein, if the protection algorithm changes from normal operation to abnormal operation, the amplification factor of the power amplifier is reduced, and if the protection algorithm changes from abnormal operation to normal operation, the amplification factor of the power amplifier is increased; The loudspeaker is used to play the audio data amplified by the power amplifier.

2. The method according to claim 1, characterized in that The method further comprises: In response to an operation on the first control, executing the protection algorithm; Based on the current running state of the protection algorithm and the last running state of the protection algorithm, it is determined whether the running state of the protection algorithm has changed.

3. The method according to claim 2, characterized in that The determining, based on the current operating state of the protection algorithm and the last operating state of the protection algorithm, whether the operating state of the protection algorithm has changed includes: Whether the running state of the protection algorithm has changed is determined based on whether a key value of a key-value item representing the running state of the protection algorithm in a registration table of the electronic device has changed.

4. The method according to claim 3, characterized in that After running the protection algorithm, the method further includes: Obtaining a return value of the initialization interface corresponding to the protection algorithm; the return value is used to indicate the operating status of the protection algorithm this time; wherein the return value is a first value, which is used to indicate that the operating status of the protection algorithm this time is abnormal operation; the return value is a second value, which is used to indicate that the operating status of the protection algorithm this time is normal operation; the first value is different from the second value; The key value of the key-value item is set according to the return value; different return values ​​set the key value of the key-value item differently.

5. The method according to any one of claims 1 to 4, characterized in that The electronic device further comprises a processor and an embedded controller, wherein the processor is connected to the embedded controller, and the embedded controller is connected to the power amplifier; The adjusting the amplification factor of the power amplifier includes: The processor sends a control instruction to the embedded controller; The embedded controller adjusts the amplification factor of the power amplifier accordingly based on the control instruction.

6. The method according to claim 5, characterized in that In a case where the protection algorithm changes from normal operation to abnormal operation, the control instruction is specifically a first control instruction, and the first control instruction is used to instruct the embedded controller to reduce the amplification factor of the power amplifier; In a case where the protection algorithm changes from abnormal operation to normal operation, the control instruction is specifically a second control instruction, and the second control instruction is used to instruct the embedded controller to increase the amplification factor of the power amplifier.

7. The method according to any one of claims 1 to 6, characterized in that In the case where the protection algorithm changes from normal operation to abnormal operation, the method further includes: Determine whether a configuration file of the protection algorithm is stored in a preset path; In a case where the configuration file of the protection algorithm is not stored in the preset path, the configuration file of the protection algorithm is configured in the preset path based on the installation package of the protection algorithm.

8. The method according to claim 7, characterized in that The process of obtaining the installation package of the protection algorithm includes: When the operating system of the electronic device is started for the first time, the installation package of the protection algorithm is backed up and stored.

9. An electronic device, characterized in that: The electronic device includes a speaker, a power amplifier, a memory and one or more processors; the speaker is coupled to the power amplifier, and the speaker, the power amplifier, the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code includes computer instructions; when the processor executes the computer instructions, the electronic device executes the method as described in any one of claims 1-8.

10. A computer-readable storage medium, characterized in that The method comprises computer instructions, which, when executed on an electronic device, cause the electronic device to execute the method according to any one of claims 1 to 8.

11. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the electronic device is caused to perform the method according to any one of claims 1 to 8.