Hardware and software analysis of audio input channel for Android bottom-line development

Source: Internet
Author: User

Hardware and software analysis of audio input channel for Android bottom-line development

We all know that headphone mic is integrated in the always-on kind of four-segment headphone mic plug that is more commonly used on Android devices. However, there will be separate cases, compared with the normal PC -mounted Android System, then this is the case. Therefore, it is necessary to the audio input channel software hardware for a unified analysis, the next analysis of an instance.

The device's hardware connection is: Channel switching based on the 3157 analog switch.

The device is completely hardware-implemented, then there is no software to what work. But this is not an ideal implementation method, the real implementation method should be all the mic is parallel, each mic channel has a enable PIN. Let the system control which Mic to use as input. In fact , the rk616 audio Code has the switch code:

static int rk616_capture_path_put (struct Snd_kcontrol *kcontrol,

struct Snd_ctl_elem_value *ucontrol)

{

struct Rk616_codec_priv *rk616 = Rk616_priv;

long int pre_path;

if (!rk616) {

PRINTK ("%s:rk616_priv is null\n", __func__);

Return-einval;

}

if (Rk616->capture_path = = Ucontrol->value.integer.value[0]) {

DBG ("%s:capture_path is not changed!\n", __func__);

return 0;

}

Pre_path = rk616->capture_path;

Rk616->capture_path = ucontrol->value.integer.value[0];

DBG ("%s:set capture_path%ld, Pre_path%ld\n", __func__,

Rk616->capture_path, Pre_path);

Switch (Rk616->capture_path) {

Case Mic_off:

if (pre_path! = Mic_off)

Rk616_codec_power_down (rk616_codec_capture);

Break

Case main_mic:

if (Pre_path = = Mic_off)

RK616_CODEC_POWER_UP (rk616_codec_capture);

#ifdef Rk616_hpmic_from_linein

Snd_soc_write (codec, 0x848, 0x06); Mixinl power up and Unmute, mininl from Micmux, Micmux from bst_l

#endif

Rk616_set_gpio (rk616_codec_set_mic, gpio_High);

Break

Case hands_free_mic:

if (Pre_path = = Mic_off)

RK616_CODEC_POWER_UP (rk616_codec_capture);

#ifdef Rk616_hpmic_from_linein

Snd_soc_write (codec, 0x848, 0x03); Mixinl power up and Unmute, mininl from Micmux, Micmux from in3l

#endif

Rk616_set_gpio (rk616_codec_set_mic, Gpio_Low);

Break

Case bt_sco_mic:

Break

Default

Return-einval;

}

return 0;

}

Hardware implementation will have this problem, when using the BT SCO as input,the Main mic or hands mic will be input.


This can be achieved if needed:

@@ -796,6 +796,7 @@ -796,6 struct Rk616_platform_data rk616_pdata = {

. HDMI_IRQ = Rk30_pin2_pd6,

. Spk_ctl_gpio = Rk30_pin2_pd7,

. Hp_ctl_gpio = Invalid_gpio,

+. Mic_sel_gpio = Rk30_pin0_pd5,

};

#endif

The level of the rk30_pin0_pd5 after switching the Capture MIC Path will change.

I think the ideal way to handle Mic input is to:

Text description: All Mic channels are parallel , and maintain a enable PIN, theCPU can freely control the various channels of the pass-off.

Any channel adjustment on the hardware is superfluous .

Android for the individual Mic 3.5mm Jack is not yet accurately handled because the Wiredaccessorymanager.java The supported methods shown are not yet available for the individual Mic 3.5mm Jack. This means that the kernel detects what individual Mic insertions do not know how to tell the Android System, or whether it is useless to tell.

Headset +mic Bit_headset = (1 << 0);

Headset-mic bit_headset_no_mic = (1 << 1);

Other BIT_USB_HEADSET_ANLG = (1 << 2);

Other BIT_USB_HEADSET_DGTL = (1 << 3);

Other Bit_hdmi_audio = (1 << 4);

The use of split headphones means that:

Insert Miconlyand do not insert headphones.

What I'm saying about support imperfections is that even if your kernel determines that a single mic is inserted into the hardware, you don't know what number to fill in the/sys/class/switch/h2w/state to indicate this state .

Hardware and software analysis of audio input channel for Android bottom-line development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.