A method and system for automatically configuring the headphone jack type of a 2-Jack SDCA UAJ device.
Patent Information
- Application Number
- CN202611495941.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-09-24
- Publication Date
- 2026-10-30
AI Technical Summary
[0026]第四方面,本申请实施例提供了一种计算机存储介质,存储用于电子数据交换的计算机程序,其中,所述计算机程序使得计算机执行如本实施例第一方面中所描述的部分或全部步骤。
Smart Images

Figure CN123011185A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of audio device control technology, and in particular to a method and system for automatically configuring the headphone jack type of a 2-Jack SDCA UAJ device. Background Technology
[0002] Computers and other electronic devices can connect to external accessories such as headphones and microphones via audio codecs. Dual-jack audio devices provide connection points for different accessories and enable playback or recording through interface identification and internal signal path configuration. In practice, accessories may be inserted simultaneously, or they may be inserted or removed in different orders.
[0003] When headphones with microphones and independent microphones are connected to two separate jacks, configuring audio functions independently based on the recognition results of each jack can easily overlook the recording resource usage of the other jack. If the accessories for one jack change, the original functional configuration may no longer be compatible with the current accessory combination, leading to abnormal switching of recording sources or malfunctions in function recovery. Therefore, how to achieve a compatible interface configuration when the accessory combination for two jacks changes is a technical problem that needs to be solved. Summary of the Invention
[0004] This application proposes a method and system for automatically configuring the headphone jack type of a 2-Jack SDCA UAJ device, aiming to solve the problem of inconsistency between the interface function mode and the recording source configuration during the plugging and unplugging of dual-jack accessories. This facilitates maintaining coordination of dual-jack recording and playback functions regardless of the order of plugging and unplugging.
[0005] In a first aspect, embodiments of this application provide a method for automatically configuring the headphone jack type of a 2-Jack SDCA UAJ device, executed by an audio host connected to an audio codec, wherein the second jack corresponding to the audio codec is used only for microphone input. The method includes: in response to a plugging / unplugging event of either jack, obtaining the current detection mode of the first jack and the second jack in the audio codec; determining the dual-jack function allocation based on the current detection mode, wherein when the first jack is identified as a headset and the second jack is identified as a microphone, the dual-jack function allocation indicates that the first jack is responsible for playback and the second jack exclusively occupies the recording path; constructing linkage configuration data based on the dual-jack function allocation, wherein the linkage configuration data indicates that the target selection mode corresponding to the headset is a binaural headphone mode when the second jack exclusively occupies the recording path; and writing selection mode control values of the corresponding group entities of the two jacks to the audio codec based on the linkage configuration data, wherein the selection mode control values are group-level control codes for audio selector on / off combinations.
[0006] As can be seen, in this embodiment, compared to the processing method of configuring the interface function mode according to the detection results of a single jack, this application adopts a dual-jack linkage configuration method executed by the audio host. First, in response to the insertion / removal event of any jack, the current detection modes of the first and second jacks in the audio codec are obtained. Second, the dual-jack function allocation is determined according to the current detection modes. Then, linkage configuration data is constructed according to the dual-jack function allocation. Finally, the selection mode control values of the corresponding group entities of the two jacks are written to the audio codec according to the linkage configuration data. Because the dual-jack function allocation ensures that the recording source has a unique attribution when an independent microphone is connected, and makes headphones with microphones correspond to a dual-ear headphone mode that only plays sound in this case, the jack function mode is kept consistent with the actual selection relationship of the audio selector. This avoids recording source conflicts caused by configuring the two jacks separately, and is beneficial for maintaining the coordination of dual-jack recording and playback functions under different insertion / removal sequences.
[0007] In one possible example, the step of constructing the linkage configuration data based on the dual-jack function allocation includes: determining a selector control combination based on the dual-jack function allocation, wherein the selector control combination represents the selection state of the recording input branch and the playback output branch; determining a target selection mode combination based on the selector control combination, wherein the target selection mode combination is a pairing of two jack group entity modes that matches the selector control combination, and the target selection mode corresponding to the second jack when recording is the microphone input mode; and constructing the linkage configuration data based on the target selection mode combination, wherein the linkage configuration data represents the correspondence between the selection mode control address and the target mode code of each group of entities.
[0008] As can be seen in this example, the selector control combination is first formed based on the functional relationship, and then the target modes of the two sets of entities are matched, so that the mode selection has a specific path state as the basis. The correspondence between the control address and the target mode code further transforms the functional judgment into configuration data that the host can submit, which helps to reduce the disconnect between the mode name and the internal path configuration.
[0009] In one possible example, the step of determining the selector control combination based on the dual jack function allocation includes: determining a recording input branch allocation based on the dual jack function allocation, the recording input branch allocation representing the signal source accessing the common recording processing chain; determining a recording selector control combination based on the recording input branch allocation; determining a playback output branch allocation based on the dual jack function allocation, the playback output branch allocation representing the transmission path of playback data to the first jack output contact; determining a playback selector control combination based on the playback output branch allocation; and determining the selector control combination based on the recording selector control combination and the playback selector control combination.
[0010] As can be seen, in this example, the recording source and playback destination are determined separately and then merged, allowing the switching of the shared recording input source and the output function of the first jack to be expressed separately. The merged selector control combination simultaneously constrains both the input and output sides, which helps maintain the integrity of the dual-jack configuration.
[0011] In one possible example, the step of determining the recording selector control combination based on the recording input branch allocation includes: determining an entry selector control combination based on the recording input branch allocation, the entry selector control combination representing the selection state of the entry selectors located in the two jack microphone input branches respectively; determining a recording junction control combination based on the recording input branch allocation and the entry selector control combination, the recording junction control combination representing the selection relationship between the output side of the entry selector and the common recording processing chain; and determining the recording selector control combination based on the entry selector control combination and the recording junction control combination.
[0012] As can be seen, in this example, the entry selector control combination and the recording aggregation control combination constrain the access end of the recording branch and the subsequent transmission path, so that the target recording source is not only available at the entry point, but can also reach the common recording processing chain, which helps to reduce inconsistencies between entry selection and subsequent aggregation.
[0013] In one possible example, the step of determining the entry selector control combination based on the recording input branch allocation includes: determining a first jack input enable state based on the recording input branch allocation, wherein the first jack input enable state is enabled when the first jack is a recording source, and disabled in other cases; determining a second jack input enable state based on the recording input branch allocation and the first jack input enable state, wherein the second jack input enable state is enabled when the second jack is a recording source and the first jack input enable state is disabled, and disabled in other cases; determining the entry selector control combination based on the first jack input enable state and the second jack input enable state, wherein the corresponding enabled control value in the entry selector control combination indicates that the microphone input branch is on, and the corresponding disabled control value indicates that the microphone input branch is off.
[0014] As can be seen, in this example, the input enable state of the second jack is constrained by both the recording source and the input enable state of the first jack, so that the two input enable states correspond to a single recording source. This helps to avoid simply changing the downstream source while retaining unnecessary input branches.
[0015] In one possible example, the step of determining the recording merge control combination based on the recording input branch allocation and the entry selector control combination includes: determining a recording source selection value based on the recording input branch allocation and the entry selector control combination, wherein the recording source selection value is a second selection value when the second jack is recording and the corresponding entry selector is on, and a first selection value in other cases; determining the control code of the recording merge selector based on the recording source selection value, wherein the recording merge selector is SU136, the control code corresponding to the first selection value is 1, and the control code corresponding to the second selection value is 2; constructing the recording merge control combination based on the control code, wherein the recording merge control combination indicates that SU137 and SU136 both select the first input path when the control code is 1, and both select the second input path when the control code is 2.
[0016] As can be seen, in this example, the recording source selection value is mapped to the pairing state of two junction selectors through explicit control coding, so that the logical recording source can be mapped to the specific selection position, which helps to avoid the path being disconnected due to configuring only one selector.
[0017] In one possible example, after the step of writing the selection mode control value of the corresponding group entity of the two jacks to the audio codec according to the linkage configuration data, the method further includes: in response to the unplugging event of the second jack, obtaining the update detection mode of the two jacks in the audio codec; determining the recovery function allocation according to the update detection mode, wherein the recovery function allocation indicates that both playback and recording belong to the first jack when the first jack is still identified as a headphone; constructing recovery configuration data according to the recovery function allocation, wherein the recovery configuration data indicates that the group entity corresponding to the first jack is in headphone mode and the group entity corresponding to the second jack is in safe mode when both playback and recording belong to the first jack; and writing the selection mode control value of the corresponding group entity of the two jacks to the audio codec according to the recovery configuration data.
[0018] As can be seen in this example, after the second jack is unplugged, the detection modes of both jacks are reread, allowing the restored configuration to depend on the actual functionality of the remaining accessories. When the first jack is still connected to the headphones, its playback and recording functions can be reverted to the first jack, which helps avoid retaining the binaural headphone mode and thus neglecting the microphone function.
[0019] In one possible example, after the step of writing the selection mode control values of the two jack corresponding group entities to the audio codec according to the recovery configuration data, the method further includes: determining recording and playback port control data according to the recovery configuration data, wherein the recording and playback port control data indicates that the recording port PortB of the second jack is closed, the recording port PortD of the first jack is open, and the playback port PortA of the first jack remains open when the group entity corresponding to the first jack is in headphone mode and the group entity corresponding to the second jack is in security mode; and outputting a recording and playback port control command to the audio codec according to the recording and playback port control data.
[0020] As can be seen in this example, the group entity mode recovery is integrated with the recording and playback port control, allowing changes in the microphone source to be further reflected in the opening and closing of the recording port. Keeping the playback port of the first jack open helps reduce irrelevant operations on the playback port that is still needed when resuming recording.
[0021] In one possible example, after the step of writing the selection mode control value of the corresponding group entity of the two jacks to the audio codec according to the linkage configuration data, the method further includes: in response to the unplugging event of the first jack, obtaining the update detection mode of the two jacks in the audio codec; constructing exit configuration data according to the update detection mode, the exit configuration data indicating that the group entity corresponding to the first jack is in safe mode, the group entity corresponding to the second jack is in microphone input mode when the second jack is still identified as a microphone, and the group entity corresponding to the second jack is in safe mode when the second jack is not plugged in; writing the selection mode control value of the corresponding group entity of the two jacks to the audio codec according to the exit configuration data; and outputting a recording / playback port control command to the audio codec according to the exit configuration data, the recording / playback port control command indicating that the playback port and recording port of the first jack are closed, the recording port of the group entity corresponding to the second jack remains open when the group entity is in microphone input mode, and the recording port of the group entity corresponding to the second jack is closed when the group entity is in safe mode.
[0022] As can be seen, in this example, both the mode exit and port exit after the first jack is unplugged are constrained by the update detection mode, which ensures that when the relevant port of the first jack is closed, the recording port of the second jack, which is still in use, can be retained. This helps to prevent the error of unplugging one jack from causing the entire recording and playback function to exit.
[0023] Secondly, this application provides a system for automatically configuring the headphone jack type of a 2-Jack SDCA UAJ device, set in an audio host connected to an audio codec. The second jack corresponding to the audio codec is used only for microphone input. The system includes: a detection mode acquisition unit, used to acquire the current detection mode of the first jack and the second jack in the audio codec in response to the insertion / removal event of any jack; a function allocation determination unit, used to determine the dual-jack function allocation according to the current detection mode. When the first jack is identified as a headset and the second jack is identified as a microphone, the dual-jack function allocation indicates that the first jack is responsible for sound playback and the second jack exclusively occupies the recording path; a linkage configuration construction unit, used to construct linkage configuration data according to the dual-jack function allocation. When the second jack exclusively occupies the recording path, the linkage configuration data indicates that the target selection mode corresponding to the headset is a binaural headphone mode; and a selection mode writing unit, used to write selection mode control values of the corresponding group entities of the two jacks to the audio codec according to the linkage configuration data. The selection mode control values are group-level control codes of audio selector on / off combinations.
[0024] The system achieves the above method through data connection between detection mode acquisition, function allocation determination, linkage configuration construction, and selection mode writing. Its functional units can be implemented by software executed by the audio host.
[0025] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, a communication interface, and one or more programs, the one or more programs being stored in the memory and configured to be executed by the processor, the programs including instructions for performing the steps in the first aspect of embodiments of this application.
[0026] Fourthly, embodiments of this application provide a computer storage medium storing a computer program for electronic data interchange, wherein the computer program causes a computer to perform some or all of the steps described in the first aspect of this embodiment.
[0027] As can be seen, in this embodiment, compared to the method of configuring interface function modes based on single jack detection results, this application adopts a dual-jack linkage configuration method executed by the audio host. First, in response to the insertion / removal event of any jack, the current detection modes of the first and second jacks in the audio codec are obtained. Second, the dual-jack function allocation is determined based on the current detection modes. Then, linkage configuration data is constructed based on the dual-jack function allocation. Finally, the selection mode control values of the corresponding group entities of the two jacks are written to the audio codec based on the linkage configuration data. Because the dual-jack function allocation ensures a unique recording source when an independent microphone is connected, and makes headphones with microphones correspond to a dual-ear headphone mode that only plays sound in this case, the jack function mode remains consistent with the actual selection relationship of the audio selector. This avoids recording source conflicts caused by configuring the two jacks separately, and is beneficial for maintaining the coordination of dual-jack recording and playback functions under different insertion / removal sequences. Attached Figure Description
[0028] Figure 1 This is a schematic diagram of the hardware architecture provided for an embodiment of this application; Figure 2 A schematic diagram of the software architecture provided for an embodiment of this application; Figure 3 This application provides schematic diagrams of dual-socket insertion / removal application scenarios and five types of insertion / removal timing. Figure 4 This is a schematic diagram of the internal selector association topology of the audio codec provided in the embodiments of this application; Figure 5 This is a schematic diagram of the main process for automatically configuring the headphone jack type provided in an embodiment of this application; Figure 6 A flowchart illustrating the linkage configuration data construction process provided in this application embodiment; Figure 7 A schematic diagram illustrating the matching of target selection mode combinations and path constraints provided in an embodiment of this application; Figure 8 A flowchart illustrating the selector control combination determination process provided in an embodiment of this application; Figure 9 A schematic diagram illustrating the relationship between the adjustment of the recording branch and the maintenance of the playback port, provided in an embodiment of this application; Figure 10 A flowchart illustrating the process of determining the recording selector control combination provided in an embodiment of this application; Figure 11 A schematic diagram illustrating the path reachability verification between the entry point and the aggregation selector provided in an embodiment of this application; Figure 12 A flowchart illustrating the process of determining the entry selector control combination provided in an embodiment of this application; Figure 13 A schematic diagram illustrating the mutual exclusion verification of the two jack input enable states provided in an embodiment of this application; Figure 14 A flowchart illustrating the process of determining the recording convergence control combination provided in an embodiment of this application; Figure 15 This is a schematic diagram of the function recovery process after the second socket is unplugged, provided in an embodiment of this application. Figure 16 This is a schematic diagram of the recording and playback port control flow corresponding to the recovery configuration provided in this application embodiment; Figure 17 A schematic diagram of the exit control process after the first socket is unplugged, provided in an embodiment of this application; Figure 18 This is a schematic diagram of a system function module for automatically configuring headphone jack type, provided in an embodiment of this application.
[0029] Figure label: 110. Audio host; 111. Processor; 112. Memory; 113. Bus interface; 120. Audio codec; 130. First jack; 140. Second jack; 150. SoundWire bus; 160. Headphones; 170. Independent microphone; 181. First jack playback port PortA; 182. Second jack recording port PortB; 183. First jack recording port PortD; 210. First group of physical components GE35; 220. Second group of physical components GE135; 231. First entry selector SU35; 232. Second entry selector SU135; 233. Intermediate selector SU137; 234. Recording junction selector SU136; 241. Binoculars Headphone output selector SU43; 242, Line output selector SU44; 243, Headphone output selector SU45; 251, First microphone input IT33; 252, Second microphone input IT131; 261, Binocular headphone output OT43; 262, Line output OT44; 263, Headphone output OT45; 270, Common recording processing chain; 280, Playback processing chain; 300, Automatic configuration system; 310, Detection mode acquisition unit; 320, Function allocation determination unit; 330, Linkage configuration construction unit; 331, Selector combination generation subunit; 332, Pattern matching subunit; 333, Address encoding subunit; 340, Selection mode writing unit. Detailed Implementation
[0030] The following implementation methods focus on the dual-socket linkage configuration.
[0031] 2-Jack refers to a dual-jack structure with a first jack and a second jack, where the first jack is a general audio jack and the second jack is a separate microphone input jack.
[0032] SDCA is short for SoundWire Device Class for Audio, and UAJ is short for Universal AudioJack.
[0033] The detection mode corresponds to Detected_Mode, which is used to express the codec's recognition result of the jack not being connected or the accessory's functional type; The selected mode corresponds to Selected_Mode, which is used to express the currently configured audio functions.
[0034] A group entity is a functional entity that associates multiple control objects. Its selection mode control value affects multiple audio selectors through the mapping relationship provided by the chip. The group entity itself is not equivalent to a single register.
[0035] This embodiment selects hardware where the first jack supports a headset microphone branch, and the second jack only supports independent microphone input. The first jack does not need to support independent microphone input mode or line-in input mode, but it should have a usable matching microphone branch in Headset mode. This condition is used to support recording recovery after the second jack is unplugged; this recovery embodiment is not applicable to hardware where the first jack has no microphone input circuitry at all.
[0036] In this article, "Headset mode" refers to Headset mode, which simultaneously handles playback and microphone input; "Headphone mode" refers to Headphone mode, which only handles playback. The two modes are not distinguished by the shape of the headphones. Line output mode is used for line-level output. Safety mode is used to deactivate the effective function selection of the corresponding accessory; it does not necessarily require turning off the power or clock of the entire codec.
[0037] "Exclusive recording path" means that the public recording processing chain controlled by this method has only one valid accessory source under the current configuration, and does not mean that the electronic device does not have other independent recording chains. "Input disconnected" means that the corresponding microphone data branch does not participate in the recording chain, and is not necessarily equivalent to mechanical contact disconnection or microphone power off.
[0038] In one possible example, see Figure 1The audio host 110 is connected to the audio codec 120 via a bus interface 113 and a SoundWire bus 150. The audio codec 120 is connected to the first jack 130 and the second jack 140. The audio host 110 has a processor 111 and a memory 112. The processor 111 executes the configuration program in the memory 112. The first jack 130 supports headphone playback and Headset microphone input, while the second jack 140 is only used for microphone input. The audio codec 120 provides an accessory detection result and group entity selection mode control interface, and the audio host 110 is responsible for determining and submitting the linkage configuration.
[0039] In one possible example, see Figure 2 The automatic configuration system 300 is located in the audio host 110. Its components—detection mode acquisition unit 310, function allocation determination unit 320, linkage configuration construction unit 330, and selection mode writing unit 340—sequentially transmit detection mode, function allocation, and configuration data. Within the linkage configuration construction unit 330, the selector combination generation subunit 331, mode matching subunit 332, and address encoding subunit 333 are responsible for path state generation, group entity mode matching, and control address encoding, respectively. Recovery and exit processing reuse the above processing chain, and port control is handled by the selection mode writing unit 340. Each unit is a program functional division and can be deployed within the same driver process.
[0040] In one possible example, see Figure 3 The headset 160 is connected to the first jack 130, and the independent microphone 170 is connected to the second jack 140. The audio host 110 controls the first jack playback port (PortA 181), the second jack recording port (PortB 182), and the first jack recording port (PortD 183) in the audio codec 120. The figure shows five sets of timing sequences to represent simultaneous plugging and unplugging, as well as different first-in-first-out and first-out-later relationships. The component connection relationship remains consistent across the five sets of timing sequences.
[0041] The port names mentioned above are used to distinguish between playback data ports and recording data ports from different microphone sources, and do not represent the addition of three physical jacks. As shown in Table 1, the following scenarios assume the existence of corresponding playback and recording service requests; opening a port indicates that the required audio service path for that scenario is valid: Table 1
[0042] When the second jack is inserted first, any accessory inserted subsequently into the first jack, even if recognized as a Headset, will be configured as a Headphone based on the current dual-jack combination. The order of insertion will not affect the retention of a separate recording source rule. The content in the table is an example of configuration logic and should not be considered as actual test results regarding switching latency or sound quality.
[0043] In one possible example, see Figure 4 The audio codec 120 includes a first group of entities GE35 210, a second group of entities GE135 220, a first entry selector SU35 231, a second entry selector SU135 232, an intermediate selector SU137 233, and a recording merge selector SU136 234. The first microphone input IT33 251 is connected to the first entry selector SU35 231, the second microphone input IT131 252 is connected to the second entry selector SU135 232, and the recording merge selector SU136 234 is connected to the common recording processing chain 270.
[0044] In the logical topology of this embodiment, the output of the first entry selector SU35 231 is connected to the first input of the intermediate selector SU137 233 and the first input of the recording aggregation selector SU136 234, respectively. The output of the second entry selector SU135 232 is connected to the second input of the intermediate selector SU137 233, and the output of the intermediate selector SU137 233 is connected to the second input of the recording aggregation selector SU136 234. This topology is used to illustrate the pairing relationship between the two selectors and does not mean that the input sequence numbers of each selector correspond to the same physical node.
[0045] The playback processing chain 280 is connected to the binaural headphone output terminal OT43 261, the line output terminal OT44 262, and the headphone output terminal OT45 263 via the binaural headphone output selector SU43 241, the line output selector SU44 242, and the headphone output selector SU45 243, respectively. These output terminals are mapped to the first jack 130 according to the selected mode. The second jack 140 provides input through the second microphone input terminal IT131 252 and is not used as a playback output location.
[0046] The first group of entities, GE35 210, is associated with the mode mapping of the first input selector SU35 231 and three output selectors (headphone output selector SU43 241, line output selector SU44 242, and headset output selector SU45 243). The second group of entities, GE135 220, is associated with the mode mapping of the second input selector SU135 232, intermediate selector SU137 233, and recording junction selector SU136 234. The gain, processing, and clocking functions in the actual signal processing chain can be provided by the codec; only the functional topology related to jack type linkage is shown in the diagram.
[0047] The above topology is expressed according to the functional relationships of this embodiment. The selector control combination computed by the host is a target state description, which is then implemented through group entity pattern mapping. It does not require the host to directly write to the selector control interface, which is defined as read-only.
[0048] In one possible example, see Figure 5 The audio host 110 executes steps S101 to S104 for the first jack 130 and the second jack 140 connected to the audio codec 120. This process covers detection result acquisition, function allocation, linkage configuration, and selection mode writing. Executed by the audio host connected to the audio codec, the second jack corresponding to the audio codec is used only for microphone input. The method includes: S101, in response to the insertion / removal event of any jack, obtain the current detection mode of the first jack and the second jack in the audio codec; The plug / unplug event is the trigger information for the audio host to initiate the current round of configuration processing. It can originate from a detection interrupt reported by the codec via the SoundWire bus. When processing this event, the host reads the detection modes of the two group entities to form the current accessory combination. It does not directly use the detection result cached from the previous processing of one jack as the pairing result of the other jack in this event. Here, "current" refers to the result read in this round of event processing, and it is not required that both registers be read in the same bus cycle.
[0049] For example, the detection mode of the first jack is for over-ear headphones, and the detection mode of the second jack is for microphone input. The detection value and subsequent selection value are managed separately. Even if the first jack is configured as a binaural headphone, the detection value can still indicate over-ear headphones.
[0050] S102, determine the dual-jack function allocation according to the current detection mode. When the first jack is identified as a headset and the second jack is identified as a microphone, the dual-jack function allocation indicates that the first jack is responsible for sound playback and the second jack exclusively occupies the recording path. The dual-jack function allocation is a configuration record with source and destination semantics, recording the playback function category of the first jack and the source of the common recording processing chain. The playback function category can be binaural headphone output, over-ear headphone output, line output, or no output, and the recording source can be the first jack, the second jack, or no source.
[0051] As shown in Table 2, when a standalone microphone is effectively connected, the recording source is determined to be the second jack, and the Headset accessory in the first jack only retains its output function. When the standalone microphone is not connected and the first jack is the Headset, the first jack handles both playback and recording. The singularity of the source comes from the selector's gating constraint on the input branch, and is not achieved by modifying the accessory identification result. Table 2
[0052] For accessories that have not yet been identified or are not supported by this embodiment, new recording sources will not be opened based on their uncertain results. Instead, we can wait for valid detection results or use a configuration that does not enable the corresponding accessory's function.
[0053] S103, construct linkage configuration data according to the dual-jack function allocation, wherein the linkage configuration data indicates that the target selection mode corresponding to the over-ear headphones is the binaural headphone mode when the second jack occupies the recording path exclusively; The linkage configuration data connects function judgment with actual group entity control, expressing at least the selection modes required by each of the two group entities. The output category and recording source in function allocation are used to match control combinations, while the address and mode encoding will be developed in subsequent detailed implementations.
[0054] For example, when a Headset and a standalone microphone coexist, the target mode for the first group of entities is Headphone, and the target mode for the second group of entities is Microphone Input. In this case, "Detect as Headset" and "Select as Headphone" respectively represent the accessory's capabilities and its current function; a difference between the two does not indicate a configuration error.
[0055] S104, Write the selection mode control value of the corresponding group entity of the two jacks to the audio codec according to the linkage configuration data. The selection mode control value is the group-level control code of the audio selector on / off combination.
[0056] The write object is the selection mode control interface for two group entities. The host submits the target mode encoding via bus control transmission, and the codec acts on the relevant audio selector according to the group entity mode mapping. This write can be completed by multiple bus transmissions in a configuration process, which does not mean that the two group entities necessarily support an atomic write.
[0057] This step completes the jack function mode configuration. For implementations requiring independent flow port activation / deactivation, the recording data channel should also be processed according to the corresponding port control procedure; simply selecting the mode does not presume that all service flows have been established.
[0058] The technical advantage of this embodiment lies in that, compared to the processing method of configuring interface function modes based on the detection results of a single jack, this application adopts a dual-jack linkage configuration method executed by the audio host. First, in response to the insertion / removal event of any jack, the current detection modes of the first and second jacks in the audio codec are obtained. Second, the dual-jack function allocation is determined based on the current detection modes. Then, linkage configuration data is constructed based on the dual-jack function allocation. Finally, the selection mode control values of the corresponding group entities of the two jacks are written to the audio codec based on the linkage configuration data. Because the dual-jack function allocation ensures a unique recording source when an independent microphone is connected, and makes headphones with microphones correspond to a dual-ear headphone mode that only plays sound in this case, the jack function mode remains consistent with the actual selection relationship of the audio selector. This avoids recording source conflicts caused by configuring the two jacks separately, and is beneficial for maintaining the coordination of dual-jack recording and playback functions under different insertion / removal sequences.
[0059] In one possible example, see Figure 6 Step S103 is implemented by the linkage configuration construction unit 330 through steps S201 to S203. The input is the dual-jack function allocation, and the output is still the linkage configuration data.
[0060] The step of constructing linkage configuration data based on the dual-socket function allocation includes: S201, determine the selector control combination according to the dual jack function allocation, the selector control combination characterizes the selection state of the recording input branch and the playback output branch; The selector control combination is a set of target states categorized by the controlled object, recording the target states of the microphone input branch, recording junction position, and playback function branch. The selection state of the controlled object belongs to logic control information and is not directly equivalent to the host writable register list.
[0061] For example, when both accessories are present, the combination requires that the second jack input branch is available, the first jack microphone branch does not participate in recording, the common recording processing chain source is the second jack, and the first jack has a binaural headphone output function.
[0062] S202, determine the target selection mode combination according to the selector control combination, the target selection mode combination is a pairing of two jack group physical modes that match the selector control combination, and the target selection mode corresponding to the second jack when recording is the microphone input mode; The target selection mode combination is a mode pairing of two group entities. The host uses the group entity mode mapping description of the specific codec to find a pairing that can generate a target selector control combination, not just selecting modes according to individual accessory names. This mapping description can be provided with the driver or firmware configuration.
[0063] This embodiment employs a mode mapping that allows the Headset mode to correspond to the corresponding microphone input branch, while preventing the Headphone mode from introducing the microphone recording source. As shown in Table 3, the following mode codes are only used to illustrate the encoding relationship of this device instance: Table 3
[0064] As an optional extension of this step, see [link to relevant documentation]. Figure 7 The pattern matching subunit 332 selects the target state filtering pattern pairing provided by the selector combination generation subunit 331 and provides the matching result to the address encoding subunit 333. This diagram expresses the relationship between the target pattern and the path constraint according to the following three processing stages.
[0065] S2021, determine the path constraint record according to the selector control combination. The path constraint record represents the recording source, the first jack output category and the unused branch.
[0066] S2022, determine candidate mode pairings based on the path constraint record. Candidate mode pairings are combinations of modes with corresponding input / output capabilities in the device mode mapping.
[0067] S2023, determine the target selection pattern combination based on the selector state and path constraint record corresponding to the candidate pattern pairing.
[0068] This extension addresses the specific issue that "two individually available modes may not form a compatible path configuration." Candidate pairings must satisfy the same path constraints; for example, even with a separate microphone, pairings originating from the first jack microphone are not considered targets. If no matching pairing is found, the failed pairing state can be retained, and a safe configuration that does not open conflicting recording branches can be used; the target function cannot be claimed to have been achieved.
[0069] S203, construct the linkage configuration data according to the target selection mode combination, wherein the linkage configuration data represents the correspondence between the selection mode control address and the target mode code of each group of entities.
[0070] In this embodiment, the control address is expressed by the SDCA control addressing field, and the mode code is the data value written to that address; the two have different functions. The first group of entities and the second group of entities in this embodiment use entity fields 0x1F and 0x24 respectively, the control field for selecting the mode is 0x01, the control field for detecting the mode is 0x02, the function group field is 0x1, and the control channel field is 0x00.
[0071] For example, dual-accessory configuration data can include 011 pointing to the control address for selecting the mode of the first group of entities and 011 pointing to the control address for selecting the mode of the second group of entities. Although the two codes are the same, they belong to different entity groups, representing Headphone and Microphone inputs respectively. Security mode 000 and Detect Unplugged 000 must also be distinguished in conjunction with control fields; the success or failure of the configuration is not determined by directly comparing the values of different control fields.
[0072] The technical advantage of this embodiment lies in that, based on the functional relationship, a selector control combination is first formed, and then the target modes of the two sets of entities are matched, so that the mode selection has a specific path state as the basis. The correspondence between the control address and the target mode code further transforms the functional judgment into configuration data that the host can submit, which helps to reduce the disconnect between the mode name and the internal path configuration.
[0073] In one possible example, see Figure 8 Step S201 is achieved by combining the selector to generate subunit 331 through steps S301 to S305, and the recording and playback branches are merged after forming control results respectively.
[0074] The step of determining the selector control combination based on the dual-jack function allocation includes: S301, the recording input branch allocation is determined according to the dual jack function allocation, and the recording input branch allocation represents the signal source connected to the common recording processing chain; The recording input branch assignment is a projection related to recording in the dual-jack function assignment. Its function is to specify the microphone input branch of the first jack, the microphone input branch of the second jack, or no valid input. This assignment does not re-determine the recording priority relationship, but rather takes over the already determined recording source.
[0075] S302, determine the recording selector control combination according to the recording input branch allocation; The recording selector control combo simultaneously covers both input gating and post-amplifier connection. When the first jack is the recording source, the combo points to its Headset microphone branch; when the second jack is the recording source, the combo points to an independent microphone branch. When there is no source, neither input provides valid recording input, and the post-amplifier can retain its default position.
[0076] S303, determine the playback output branch allocation according to the dual jack function allocation, the playback output branch allocation represents the transmission path of playback data to the first jack output contact; The output branch assignment takes into account the output assignment and output function category in the dual-jack function assignment. When the first jack is responsible for playback, the output destination is still the corresponding contact of the first jack. The specific function category is determined by the current function assignment. It cannot be directly inferred from "the first jack is responsible for playback" that all output modes use the same selector.
[0077] S304, determine the playback selector control combination according to the playback output branch allocation; In this embodiment, the target state of the corresponding selector is determined according to the functional output branch: Headphone output uses the binaural headphone output branch, Line out uses the line output branch, and Headset uses the over-ear headphone output branch. When not inserted, the above accessory output branches are not selected. Changes in mode may alter the internal output selector, but it is not necessary to change the physical jacks and playback data ports.
[0078] S305, determine the selector control combination based on the recording selector control combination and the playback selector control combination.
[0079] The two parts are combined into a single selector control combination based on the controlled object. Control values for different objects retain their individual identities and cannot be merged into one object simply because their values are identical. The merged result serves as input for pattern matching, thereby simultaneously constraining recording and playback.
[0080] As an optional extension of this step, see [link to relevant documentation]. Figure 9 The selector combination generation subunit 331 distinguishes between the adjustment of the recording input branch and the enable and hold of the first jack playback port PortA 181. The first input selector SU35 231, the second input selector SU135 232, the intermediate selector SU137 233 and the recording junction selector SU136 234 adjust the target state according to the change of the recording source. The binaural headphone output selector SU43 241 and the over-ear headphone output selector SU45 243 determine the state according to the target output mode.
[0081] S3051, determine the target control object list based on the recording selector control combination and the playback selector control combination.
[0082] S3052, determine the recording adjustment record and playback hold record based on the target control object list and the currently effective configuration.
[0083] S3053, construct a selector control combination with port hold attribute based on the recording adjustment record and the playback hold record.
[0084] This extension addresses the specific issue of "unnecessary playback port reopening triggered by changes in recording source." The currently effective configuration is a record of the host's previously successfully configured state, which can be obtained from the driver configuration context before comparison in this step. The record is maintained only when playback is still required from the first jack and the physical output endpoint and channel mapping are consistent. The internal output selector remains configured in the new mode; keeping PortA open is not interpreted as the states of the binaural headphone output selector SU43 and the over-ear headphone output selector SU45 remaining unchanged. This reduces irrelevant port operations but does not guarantee continuous audio sampling during switching.
[0085] The technical advantage of this embodiment is that by determining the recording source and playback destination separately before merging them, the source switching of the shared recording input and the output function of the first jack can be expressed separately. The merged selector control combination simultaneously constrains both the input and output sides, which helps maintain the integrity of the dual-jack configuration.
[0086] In one possible example, see Figure 10 Step S302 is achieved by generating sub-unit 331 by the selector combination through steps S401 to S403. First, the entry target is determined, then the junction target is determined, and finally a complete recording selector control combination is formed.
[0087] The step of determining the recording selector control combination based on the recording input branch allocation includes: S401, determine the entry selector control combination according to the recording input branch allocation, the entry selector control combination represents the selection state of the entry selectors located in the microphone input branches of the two jacks respectively; The input selector control group distinguishes the access status of the two microphone sources. When the first jack is used for recording, the first input selector connects to the Headset's matching microphone branch, while the second input selector does not connect to the independent microphone branch; when the second jack is used for recording, the input status is reversed. When there is no recording source, neither input provides valid input to the common recording processing chain.
[0088] S402, the recording junction control combination is determined according to the recording input branch allocation and the entry selector control combination. The recording junction control combination characterizes the selection relationship between the output side of the entry selector and the common recording processing chain. The recording aggregation control unit is used to express the path selection after the input output. The input status is used to determine whether the target source has been included in the target configuration of this round, and it is not required to pre-write it to the hardware during the configuration data generation stage. The subsequent path must correspond to the input selection result of the same round.
[0089] As an optional extension of this step, see [link to relevant documentation]. Figure 11The first entry selector SU35 231, the second entry selector SU135 232, the intermediate selector SU137 233, the recording aggregation selector SU136 234, and the common recording processing chain 270 constitute the path verification object. The diagram also indicates the direct branch of the first source (illustrated as the first source candidate path) and the intermediate selection branch of the second source (illustrated as the second source candidate path). Steps S4021 to S4024 are used to verify whether the target source can reach the processing chain.
[0090] S4021, determines the valid entry record based on the combination of recording input branch allocation and entry selector control.
[0091] S4022, determine the candidate path from the target source to the public recording processing chain based on the valid entry records and the preset selector connection relationship.
[0092] S4023, determine the path verification result based on the selected position on the candidate path.
[0093] S4024, determine the recording aggregation control combination based on the path verification result.
[0094] The preset selector connection relationship describes the device topology of this embodiment, limiting the upstream outputs that each selector input receives. When the second jack is used for recording, the candidate path sequentially passes through the second input selector, the second input of the intermediate selector, and the second input of the recording aggregation selector; if only the final selector is placed at the second input while the intermediate selector remains at the first input, the desired source cannot be obtained.
[0095] When there is no recording source, the verification target is that neither of the two inputs introduces a valid signal. The subsequent stage retains the default selection position and does not require that there is a connected microphone on the default path.
[0096] This extension addresses the issue of a usable entry point but a mismatch in the subsequent selection location. If verification passes, the required pairing value is used; if verification fails, the selection location corresponding to the target source is redefined. If the device topology does not support the target path, a security configuration that does not open the invalid path or a configuration failure result is generated, and it is not distributed as a successful configuration.
[0097] S403, determine the recording selector control combination based on the entry selector control combination and the recording junction control combination.
[0098] The recording selector control combination is a joint objective of ingress control and convergence control. During merging, the correspondence between each controlled object and its control value is preserved, enabling the pattern matching process to check the entire recording path, rather than just the final selection position.
[0099] The technical advantage of this embodiment is that the entry selector control combination and the recording aggregation control combination respectively constrain the access end of the recording branch and the subsequent transmission path, so that the target recording source is not only available at the entry point, but can also reach the common recording processing chain, which helps to reduce inconsistencies between entry selection and subsequent aggregation.
[0100] In one possible example, see Figure 12 Step S401, which generates subunit 331 by combining selectors, is implemented through steps S501 to S503.
[0101] The steps for determining the input selector control combination based on the recording input branch allocation include: S501, determine the first jack input enable state according to the recording input branch allocation. The first jack input enable state is enabled when the first jack is a recording source, and disabled in other cases. The first jack's input enable state is either logically enabled or disabled, indicating whether the Headset microphone branch participates in the current recording chain, and is managed separately from the playback port state. Even if the first jack continues to play, its input enable state can be disabled due to the connection of an independent microphone.
[0102] S502, determine the second jack input enable state based on the recording input branch allocation and the first jack input enable state. The second jack input enable state is enabled when the second jack is the recording source and the first jack input enable state is disabled, and disabled in other cases. The enable state of the second jack requires that it has been assigned as a recording source and that the input of the first jack is disabled. This step inherits the same recording input branch assignment and the result of the previous step, and does not read inconsistent enable values from another processing round.
[0103] As an optional extension of this step, see [link to relevant documentation]. Figure 13 The selector combination generation subunit 331 performs mutual exclusion verification on the target enable states of the first entry selector SU35 231 and the second entry selector SU135 232, and then provides entry selector control combination.
[0104] S5021, determine the candidate enable state of the second jack based on the recording input branch allocation.
[0105] S5022, determine the input mutual exclusion verification result based on the candidate enable state of the second jack and the input enable state of the first jack.
[0106] Valid pairings are: first allowed and second prohibited, first prohibited and second allowed, and both prohibited. Both allowed is not considered a valid recording configuration in this embodiment. If a candidate result conflicts with the state of the first jack, the second jack input remains prohibited, triggering a recalculation of the allocation for the same source. The second jack allowed value is not output when the first jack is still allowed.
[0107] S5023, determine the second jack input enable state based on the input mutual exclusion check result.
[0108] This extension addresses the issue of simultaneous dual-entry requirements that may occur when merging branch results, by verifying the single-source constraint during the configuration data generation phase. This verification is a logical data consistency check and is not equivalent to the physical writes of the two groups of entities having atomicity.
[0109] S503, determine the input selector control combination based on the first jack input enable state and the second jack input enable state. The corresponding enabled control value in the input selector control combination indicates that the microphone input branch is turned on, and the corresponding disabled control value indicates that the microphone input branch is turned off.
[0110] Here, "allow" and "disallow" are mapped to access or disconnect descriptions applicable to each entry selector. Different entry selectors can have different control codes, and the logic allows that two entries do not need to use the same value. The first entry selector may also have other functional input positions; in this embodiment, "allow" only corresponds to the Headset microphone input branch.
[0111] The technical advantage of this embodiment is that the input enable state of the second jack is constrained by both the recording source and the input enable state of the first jack, so that the two input enable states correspond to a single recording source, which helps to avoid simply changing the downstream source while retaining unnecessary input branches.
[0112] In one possible example, see Figure 14 Step S402, which controls the pairing of intermediate selector SU137 233 and recording junction selector SU136 234, is implemented through steps S601 to S603.
[0113] The steps for determining the recording aggregation control combination based on the recording input branch allocation and inlet selector control combination include: S601, the recording source selection value is determined according to the recording input branch allocation and the entry selector control combination. The recording source selection value is the second selection value when the second jack is responsible for recording and the corresponding entry selector is turned on, and the first selection value is the first selection value in other cases. The recording source selection value is used to express the selection direction of the merging path. The corresponding "On" input represents the target state in the input selector control combination during the configuration calculation phase, and corresponds to the actual hardware selection state after the configuration takes effect. Therefore, this step does not require writing the input selector separately before generating the overall configuration.
[0114] When the second jack is not used for recording or its input is not permitted, the first selection value is used as the default position in this embodiment. The default position only specifies the selector direction and cannot prove that the first jack has a valid recording signal.
[0115] S602, determine the control code of the recording merge selector according to the recording source selection value. The recording merge selector is SU136. The control code corresponding to the first selection value is 1, and the control code corresponding to the second selection value is 2. In this embodiment, control codes 1 and 2 represent the first and second input positions of the selector, respectively, and are not the number of microphones, gain, or port number. The first input connects to the first jack input branch, and the second input connects to the output of the intermediate selector.
[0116] S603, construct a recording convergence control combination based on the control code. The recording convergence control combination indicates that SU137 and SU136 both select the first input path when the control code is 1, and both select the second input path when the control code is 2.
[0117] As shown in Table 4, when two selectors use the same value, their corresponding physical inputs are still interpreted according to their respective topologies. When the first source is selected, the common recording processing chain obtains the first input output through the first input of the final selector, while the intermediate selectors simultaneously maintain the first input position. When the second source is selected, a complete path is formed through the second inputs of both the intermediate and final selectors. Table 4
[0118] The control values in Table 4 participate in target mode matching as part of the recording aggregation control combination, and are implemented by the group entity selection mode mapping. When there is no recording source, both inputs are disconnected; therefore, the default selection value of 1 does not indicate that the recording service of the first jack is enabled.
[0119] The technical advantage of this embodiment is that the recording source selection value is mapped by a clear control code to form a pairing state of two junction selectors, so that the logical recording source can be mapped to a specific selection position, which helps to avoid path disconnection caused by configuring only one selector.
[0120] In one possible example, see Figure 15After the second jack 140 is unplugged, the audio host 110 restores the configuration by steps S701 to S704 based on the updated status of the first jack 130 and the second jack 140.
[0121] After the step of writing the selection mode control values of the corresponding group entities of the two jacks to the audio codec based on the linkage configuration data, the method further includes: S701, in response to the unplugging event of the second jack, obtains the update detection mode of the two jacks in the audio codec; The update detection mode involves rereading the accessory identification result after the second jack is unplugged. The first jack may have previously been selected as Headphone, and its accessory identification result could still be Headset. The recovery judgment should use this identification result, and it cannot be inferred that the first jack does not have a microphone based solely on the current selection mode.
[0122] S702, determine the recovery function allocation according to the update detection mode. The recovery function allocation means that both playback and recording belong to the first jack when the first jack is still identified as a headset. The "Restore Function Assignment" refers to the re-establishment of function assignments after the second jack is disconnected. When the first jack is still in Headset mode, both playback and recording are assigned to the first jack. If the first jack only supports playback, the restoration assignment does not add the recording capability it lacks. When neither jack is plugged in, accessory input / output functions are not assigned.
[0123] S703, construct recovery configuration data according to recovery function allocation, when both playback and recording belong to the first jack, the recovery configuration data indicates that the group entity corresponding to the first jack is headphone mode and the group entity corresponding to the second jack is safety mode. The recovery configuration data and the linkage configuration data use the same address and mode encoding method, but correspond to the new target after the second jack exits. When the first jack is a Headset, the first group of entities uses 101, and the second group of entities uses 000, the latter indicating that the second jack is in safe mode.
[0124] The recovery configuration can continue to be implemented using a step-by-step approach, employing selector control combinations, target mode pairing, and address encoding. This approach applies to the overall method as well as any of its refined implementations, and does not require that all refined levels be completed before the recovery process can proceed.
[0125] S704, writes the selection mode control value of the corresponding group entity of the two jacks to the audio codec based on the restored configuration data.
[0126] The host writes the recovery configuration data to the selection mode control interface of the two sets of entities, enabling the microphone branch of the first jack to regain access conditions, while the microphone branch of the second jack is deactivated. Devices that require independent control of the audio stream port will continue to perform port recovery control after this mode configuration is completed.
[0127] The technical advantage of this embodiment is that after the second jack is unplugged, the detection modes of both jacks are reread, allowing the restored configuration to depend on the actual functions of the remaining accessories. When the first jack is still connected to the headphones, its playback and recording functions can be reverted to the first jack, which helps to avoid omitting the microphone function by continuing to retain the binaural headphone mode.
[0128] In one possible example, after mode recovery, the selection mode writing unit 340 performs port control via steps S801 to S802 for the second jack recording port PortB 182, the first jack recording port PortD 183, and the first jack playback port PortA 181. See also Figure 16 After the step of writing the selection mode control value of the corresponding group entity of the two jacks to the audio codec according to the recovery configuration data, the method further includes: S801, determine the recording and playback port control data according to the restored configuration data. The recording and playback port control data indicates that the recording port PortB of the second jack is closed, the recording port PortD of the first jack is open, and the playback port PortA of the first jack remains open when the group entity corresponding to the first jack is in headphone mode and the group entity corresponding to the second jack is in safe mode. This embodiment addresses the operational phase where the first jack playback port is already open and playback needs to continue. The recording and playback port control data expresses the switching relationship between recording ports from different sources, as well as the maintenance relationship of the playback port.
[0129] After the microphone in the second jack is disconnected, Port B will no longer be used for recording of valid accessories. When the first jack is still in the Headset state, Port D will be used for recording of its microphone. Keeping Port A open indicates that the playback port will not be closed and reopened due to changes in the recording source, but does not mean that the internal output selector will not adjust its mode.
[0130] S802, output recording and playback port control instructions to the audio codec according to the recording and playback port control data.
[0131] Port control commands can be mapped by the driver to stream enable or routing control operations for the corresponding audio data ports. In the implementation of a shared recording chain, the old recording port can be deenabled first, and then the new recording port can be enabled, while the enable state of PortA remains unchanged during this process.
[0132] The above sequence is used to reduce the chance of old and new recording ports simultaneously referencing the same recording chain. Whether buffering, clock holding, or other stream switching operations are needed is determined by the specific audio interface implementation; this embodiment does not provide unverified seamless switching metrics based on this.
[0133] The technical advantage of this embodiment lies in the integration of group entity mode recovery with recording and playback port control, allowing changes in microphone source to be further reflected in the opening and closing of the recording port. Keeping the playback port of the first jack open helps reduce irrelevant operations on the playback port that still needs to be used when resuming recording.
[0134] In one possible example, after the first jack 130 is unplugged, the audio host 110, based on the remaining accessory status of the second jack 140, controls the mode exit and port exit of the audio codec 120 via steps S901 to S904. See also Figure 17 After the step of writing the selection mode control values of the corresponding group entities of the two jacks to the audio codec according to the linkage configuration data, the method further includes: S901, in response to the unplugging event of the first jack, obtain the update detection mode of the two jacks in the audio codec; The first jack unplugging event triggers a reread of the two-jack detection mode, and whether the second jack retains its recording function is determined by the result of this read. Even if the two jack unplugging events occur sequentially, the processing result is still based on the accessory combination read at the corresponding processing time.
[0135] S902, construct exit configuration data according to the update detection mode, wherein the exit configuration data represents that the group entity corresponding to the first jack is in safe mode (GE35 210: safe mode), the group entity corresponding to the second jack is in microphone input mode (GE135 220: microphone input mode) when the second jack is still identified as a microphone, and the group entity corresponding to the second jack is in safe mode (GE135 220: safe mode) when the second jack is not inserted. The exit configuration data expresses the target status of the group entity when the first jack is out of service and the second jack is retained or out of service. When the second jack is still recognized as a microphone, the target mode is paired as security mode and microphone input mode; when neither jack is inserted, the target mode is paired as two security modes.
[0136] This data serves as the basis for both mode writing and port control, preventing the mode processing branch and the port processing branch from making different judgments on whether the second jack is still usable.
[0137] S903, Write the selection mode control value of the corresponding group entity of the two jacks to the audio codec according to the exit configuration data; The host writes the exit configuration data to the target mode. The first group of entities in safe mode revokes the function of the first jack accessory, while the second group of entities either maintains microphone input mode or enters safe mode depending on the remaining accessories. The exit of one group of entities does not necessarily cause the exit of the other group of entities simultaneously.
[0138] S904, output recording and playback port control instructions to the audio codec according to the exit configuration data. The recording and playback port control instructions indicate that the playback port and recording port of the first jack are closed, the recording port of the second jack is kept open when the group entity corresponding to the second jack is in microphone input mode, and the recording port of the second jack is closed when the group entity corresponding to the second jack is in safe mode.
[0139] Specifically, the port control command corresponds to shutting down the playback and recording ports of the first jack, and retaining or shutting down the recording port of the second jack according to its target state. For example, if recording was originally done through the second jack, Port B is retained after the first jack is unplugged; if recording was originally done through the first jack and the second jack was not plugged in, Port D and Port A are shut down after the first jack is unplugged. The exit target is determined based on the actual port affiliation, and a specific recording port name is not used to represent all recording exit situations.
[0140] The technical advantage of this embodiment is that both mode exit and port exit after the first jack is unplugged are constrained by the update detection mode, so that when the relevant port of the first jack is closed, the recording port of the second jack that is still in use can be retained, which helps to avoid the error of unplugging one jack from causing the entire recording and playback function to exit.
[0141] In one possible example, see Figure 18 The automatic configuration system 300 is located in the audio host 110 and includes a detection mode acquisition unit 310, a function allocation determination unit 320, a linkage configuration construction unit 330, and a selection mode writing unit 340. These units are connected in sequence. The selection mode writing unit 340 outputs group entity selection mode control values to the audio codec 120. The selector combination generation subunit 331, the mode matching subunit 332, and the address encoding subunit 333 within the linkage configuration construction unit 330 are responsible for path state generation, group entity mode matching, and control address encoding, respectively.
[0142] The system includes an audio host connected to an audio codec, wherein the second jack corresponding to the audio codec is used only for microphone input. The detection mode acquisition unit 310 is used to acquire the current detection mode of the first jack and the second jack in the audio codec in response to the plugging and unplugging event of any jack; This unit is responsible for receiving insertion / removal events and obtaining the accessory identification results for the two sockets in this round. Its output is the current detection mode. The detection results and the configured selection mode are managed separately to avoid changes in the selection mode overwriting the accessory capability information required for subsequent recovery.
[0143] The function allocation determination unit 320 is used to determine the dual-jack function allocation according to the current detection mode. When the first jack is identified as a headset and the second jack is identified as a microphone, the dual-jack function allocation indicates that the first jack is responsible for sound playback and the second jack exclusively occupies the recording path. This unit converts the current detection mode into playback category, playback affiliation, and recording source, and its output is a dual-jack function assignment. The functions of the two jacks are determined in the same assignment result, for use by subsequent path configurations.
[0144] Linkage configuration construction unit 330 is used to construct linkage configuration data according to the dual jack function allocation. When the second jack occupies the recording path exclusively, the linkage configuration data indicates that the target selection mode corresponding to the over-ear headphones is the binaural headphone mode. This unit generates linked configuration data through selector control combinations, target selection mode combinations, and address encoding. Its internal implementation can employ the aforementioned entry enable, aggregation path, and mode matching processes. The configuration target and failure status should be consistent with the actual supported paths.
[0145] The selection mode writing unit 340 is used to write the selection mode control value of the corresponding group entity of the two jacks to the audio codec according to the linkage configuration data. The selection mode control value is the group-level control code of the audio selector on / off combination.
[0146] This unit converts the linked configuration data into a group entity selection mode write operation, and can further handle configuration recovery, configuration exit, and corresponding port control commands. Each unit can be implemented by software executed on the same processor, or it can be divided into a driver layer and a control service layer; functional division does not require an independent hardware enclosure.
[0147] In this embodiment, the output of the detection mode acquisition unit serves as the input of the function allocation determination unit, the output of the function allocation determination unit serves as the input of the linkage configuration construction unit, and the output of the linkage configuration construction unit serves as the input of the selection mode writing unit. Thus, accessory identification, function assignment, path configuration, and group entity control form a complete processing chain, which is beneficial for achieving compatible headphone jack type configurations when the combination of dual-jack accessories changes.
[0148] This application also provides a computer storage medium storing a computer program for electronic data interchange, which causes a computer to perform some or all of the steps of any of the methods described in the above method embodiments, wherein the computer includes an electronic device.
[0149] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0150] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0151] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.
[0152] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0153] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0154] If the aforementioned integrated units are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, 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. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, electronic device, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0155] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage device, which may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc.
[0156] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for automatically configuring the headphone jack type of a 2-Jack SDCA UAJ device, characterized in that, Performed by an audio host connected to an audio codec, wherein the second jack corresponding to the audio codec is used only for microphone input, the method includes: In response to a plugging or unplugging event of any jack, the current detection modes of the first jack and the second jack in the audio codec are obtained; The dual-jack function allocation is determined according to the current detection mode. When the first jack is identified as a headset and the second jack is identified as a microphone, the dual-jack function allocation indicates that the first jack is responsible for sound playback and the second jack exclusively occupies the recording path. Based on the dual-jack function allocation, linkage configuration data is constructed. When the second jack exclusively occupies the recording path, the linkage configuration data indicates that the target selection mode corresponding to the over-ear headphones is the binaural headphone mode. According to the linkage configuration data, the selection mode control value of the corresponding group entity of the two jacks is written to the audio codec. The selection mode control value is the group-level control code of the audio selector on / off combination.
2. The method as described in claim 1, characterized in that, The step of constructing linkage configuration data based on the dual-socket function allocation includes: The selector control combination is determined based on the dual jack function allocation, and the selector control combination represents the selection state of the recording input branch and the playback output branch. The target selection mode combination is determined according to the selector control combination. The target selection mode combination is a pairing of two jack group physical modes that match the selector control combination. When the second jack is used for recording, the target selection mode is the microphone input mode. The linkage configuration data is constructed based on the target selection mode combination, and the linkage configuration data represents the correspondence between the selection mode control address and the target mode code of each group of entities.
3. The method as described in claim 2, characterized in that, The step of determining the selector control combination based on the dual-jack function allocation includes: The recording input branch allocation is determined based on the dual jack function allocation, and the recording input branch allocation represents the signal source accessing the common recording processing chain; The recording selector control combination is determined based on the recording input branch allocation; The playback output branch allocation is determined based on the dual jack function allocation, and the playback output branch allocation represents the transmission path of playback data to the first jack output contact. The playback selector control combination is determined based on the playback output branch allocation; The selector control combination is determined based on the recording selector control combination and the playback selector control combination.
4. The method as described in claim 3, characterized in that, The step of determining the recording selector control combination based on the recording input branch allocation includes: The entry selector control combination is determined according to the recording input branch allocation, and the entry selector control combination represents the selection state of the entry selectors located in the microphone input branches of the two jacks respectively. The recording aggregation control combination is determined based on the recording input branch allocation and the entry selector control combination, wherein the recording aggregation control combination characterizes the gating relationship between the output side of the entry selector and the common recording processing chain; The recording selector control combination is determined based on the entry selector control combination and the recording junction control combination.
5. The method as described in claim 4, characterized in that, The step of determining the entry selector control combination based on the recording input branch allocation includes: The first jack input enable state is determined according to the recording input branch allocation. The first jack input enable state is enabled when the first jack is a recording source, and disabled in other cases. The second jack input enable state is determined based on the recording input branch allocation and the first jack input enable state. The second jack input enable state is enabled when the second jack is a recording source and the first jack input enable state is disabled, and disabled in other cases. The input selector control combination is determined based on the first jack input enable state and the second jack input enable state. The corresponding enabled control value in the input selector control combination indicates that the microphone input branch is turned on, and the corresponding disabled control value indicates that the microphone input branch is turned off.
6. The method as described in claim 4, characterized in that, The step of determining the recording convergence control combination based on the recording input branch allocation and the entry selector control combination includes: The recording source selection value is determined based on the recording input branch allocation and the inlet selector control combination. The recording source selection value is the second selection value when the second jack is recording and the corresponding inlet selector is turned on, and the first selection value in other cases. The control code of the recording merge selector is determined according to the recording source selection value. The recording merge selector is SU136. The control code corresponding to the first selection value is 1, and the control code corresponding to the second selection value is 2. The recording convergence control combination is constructed according to the control code, wherein the recording convergence control combination indicates that SU137 and SU136 both select the first input path when the control code is 1 and both select the second input path when the control code is 2.
7. The method according to any one of claims 1-6, characterized in that, After the step of writing the selection mode control values of the corresponding group entities of the two jacks to the audio codec according to the linkage configuration data, the method further includes: In response to the unplugging event of the second jack, the update detection mode of the two jacks in the audio codec is obtained; The recovery function allocation is determined according to the update detection mode. The recovery function allocation indicates that both playback and recording belong to the first jack when the first jack is still identified as a headset. Based on the recovery function allocation, recovery configuration data is constructed. When both playback and recording belong to the first jack, the recovery configuration data indicates that the group entity corresponding to the first jack is in headphone mode and the group entity corresponding to the second jack is in security mode. The selected mode control value of the corresponding group entity of the two jacks is written to the audio codec according to the recovery configuration data.
8. The method as described in claim 7, characterized in that, After the step of writing the selection mode control value of the corresponding group entity of the two jacks to the audio codec according to the recovery configuration data, the method further includes: Based on the restored configuration data, the recording and playback port control data is determined. When the group entity corresponding to the first jack is in headphone mode and the group entity corresponding to the second jack is in security mode, the recording port PortB of the second jack is closed, the recording port PortD of the first jack is open, and the playback port PortA of the first jack remains open. The audio recording and playback port control command is output to the audio codec based on the audio recording and playback port control data.
9. The method as described in claim 1, characterized in that, After the step of writing the selection mode control values of the corresponding group entities of the two jacks to the audio codec according to the linkage configuration data, the method further includes: In response to the unplugging event of the first jack, the update detection mode of the two jacks in the audio codec is obtained; Exit configuration data is constructed based on the update detection mode. The exit configuration data indicates that the group entity corresponding to the first jack is in safe mode, the group entity corresponding to the second jack is in microphone input mode when the second jack is still identified as a microphone, and the group entity corresponding to the second jack is in safe mode when the second jack is not inserted. Based on the exit configuration data, the selection mode control value of the corresponding group entity of the two jacks is written to the audio codec; According to the exit configuration data, the audio codec outputs a recording and playback port control command. The recording and playback port control command indicates that the playback port and recording port of the first jack are closed, the recording port of the second jack remains open when the group entity corresponding to the second jack is in microphone input mode, and the recording port of the second jack is closed when the group entity corresponding to the second jack is in safe mode.
10. A system for automatically configuring the headphone jack type of a 2-Jack SDCA UAJ device, characterized in that, The system includes an audio host connected to an audio codec, wherein the second jack corresponding to the audio codec is used only for microphone input. The detection mode acquisition unit is used to acquire the current detection mode of the first jack and the second jack in the audio codec in response to the plugging and unplugging event of any jack; The function allocation determination unit is used to determine the dual-jack function allocation according to the current detection mode. When the first jack is identified as a headset and the second jack is identified as a microphone, the dual-jack function allocation indicates that the first jack is responsible for sound playback and the second jack exclusively occupies the recording path. A linkage configuration construction unit is used to construct linkage configuration data according to the dual-jack function allocation. When the second jack exclusively occupies the recording path, the linkage configuration data indicates that the target selection mode corresponding to the over-ear headphones is the binaural headphone mode. The selection mode writing unit is used to write the selection mode control value of the corresponding group entity of the two jacks to the audio codec according to the linkage configuration data. The selection mode control value is the group-level control code of the audio selector on / off combination.
Citation Information
Patent Citations
photoelectric method for detecting defects in optical surfaces
SU135232A1
conveyor belt slip prevention device
SU136234A1
installation for moving logs in packages
SU136241A1
a method for the treatment of pustular diseases and some dental diseases of microbial etiology
SU137233A1
how to get serotonin
SU137234A1
