Example #1
0
static int i2s_gpio_set(struct snd_soc_card *card)
{
    struct aml_audio_private_data *p_aml_audio;
    const char *str=NULL;
    int ret;
    

    p_aml_audio = snd_soc_card_get_drvdata(card);
    if(p_aml_audio->pin_ctl)
        devm_pinctrl_put(p_aml_audio->pin_ctl);
    ret = of_property_read_string(card->dev->of_node, "I2S_MCLK", &str);
    if (ret < 0) {
        printk("I2S_MCLK: faild to get gpio I2S_MCLK!\n");
    }else{
        p_aml_audio->gpio_i2s_m = amlogic_gpio_name_map_num(str);
        amlogic_gpio_request_one(p_aml_audio->gpio_i2s_m,GPIOF_OUT_INIT_LOW,"low_mclk");
        amlogic_set_value(p_aml_audio->gpio_i2s_m, 0, "low_mclk");
    }

    ret = of_property_read_string(card->dev->of_node, "I2S_SCLK", &str);
    if (ret < 0) {
        printk("I2S_SCLK: faild to get gpio I2S_SCLK!\n");
    }else{
        p_aml_audio->gpio_i2s_s = amlogic_gpio_name_map_num(str);
        amlogic_gpio_request_one(p_aml_audio->gpio_i2s_s,GPIOF_OUT_INIT_LOW,"low_sclk");
        amlogic_set_value(p_aml_audio->gpio_i2s_s, 0, "low_sclk");
    }

    ret = of_property_read_string(card->dev->of_node, "I2S_LRCLK", &str);
    if (ret < 0) {
        printk("I2S_LRCLK: faild to get gpio I2S_LRCLK!\n");
    }else{
        p_aml_audio->gpio_i2s_r = amlogic_gpio_name_map_num(str);
        amlogic_gpio_request_one(p_aml_audio->gpio_i2s_r,GPIOF_OUT_INIT_LOW,"low_lrclk");
        amlogic_set_value(p_aml_audio->gpio_i2s_r, 0, "low_lrclk");
    }

    ret = of_property_read_string(card->dev->of_node, "I2S_ODAT", &str);
    if (ret < 0) {
        printk("I2S_ODAT: faild to get gpio I2S_ODAT!\n");
    }else{
        p_aml_audio->gpio_i2s_o = amlogic_gpio_name_map_num(str);
        amlogic_gpio_request_one(p_aml_audio->gpio_i2s_o,GPIOF_OUT_INIT_LOW,"low_odata");
        amlogic_set_value(p_aml_audio->gpio_i2s_o, 0, "low_odata");
    }
    //mute spk
    amlogic_set_value(p_aml_audio->gpio_mute, 0, "mute_spk");
    return 0;
}
Example #2
0
static int speaker_events(struct snd_soc_dapm_widget *w,
	struct snd_kcontrol *kcontrol, int event)
{
	switch (event) {
	case SND_SOC_DAPM_POST_PMU:
		amlogic_set_value(p_audio->gpio_mute, 1, "mute_spk");
        msleep(50);
		break;
	case SND_SOC_DAPM_PRE_PMD:
		amlogic_set_value(p_audio->gpio_mute, 0, "mute_spk");
		break;
	}

	return 0;
}
Example #3
0
static void aml_m8_pinmux_init(struct snd_soc_card *card)
{
    struct aml_audio_private_data *p_aml_audio;
    const char *str=NULL;
    int ret;
    p_aml_audio = snd_soc_card_get_drvdata(card);
    p_aml_audio->pin_ctl = devm_pinctrl_get_select(card->dev, "aml_snd_m8");



#if USE_EXTERNAL_DAC
#ifndef CONFIG_MESON_TRUSTZONE
    //aml_write_reg32(P_AO_SECURE_REG1,0x00000000);
    aml_clr_reg32_mask(P_AO_SECURE_REG1, ((1<<8) | (1<<1)));
#else
    /* Secure reg can only be accessed in Secure World if TrustZone enabled. */
    //meson_secure_reg_write(P_AO_SECURE_REG1, 0x00000000);
	meson_secure_reg_write(P_AO_SECURE_REG1, meson_secure_reg_read(P_AO_SECURE_REG1) & (~((1<<8) | (1<<1))));
#endif /* CONFIG_MESON_TRUSTZONE */
#endif
    ret = of_property_read_string(card->dev->of_node, "mute_gpio", &str);
    if (ret < 0) {
        printk("aml_snd_m8: faild to get mute_gpio!\n");
    }else{
        p_aml_audio->gpio_mute = amlogic_gpio_name_map_num(str);
        p_aml_audio->mute_inv = of_property_read_bool(card->dev->of_node,"mute_inv");
        amlogic_gpio_request_one(p_aml_audio->gpio_mute,GPIOF_OUT_INIT_HIGH,"mute_spk");
        amlogic_set_value(p_aml_audio->gpio_mute, 0, "mute_spk");

        spk_gpio_mute = p_aml_audio->gpio_mute;
        printk(KERN_INFO"pinmux set : spk_gpio_mute=%d\n",spk_gpio_mute);
    }

    printk("=%s==,aml_m8_pinmux_init done,---%d\n",__func__,p_aml_audio->det_pol_inv);
}
Example #4
0
void meson_power_off(void)
{
	printk("meson power off \n");
	amlogic_set_value(po_gpio, 0, "gpio_poweroff");
	mdelay(20000);
	WARN_ON(1);
}
Example #5
0
static int aml_m8_set_spk(struct snd_kcontrol *kcontrol,
    struct snd_ctl_elem_value *ucontrol)
{
    aml_m8_spk_enabled = ucontrol->value.integer.value[0];
    printk(KERN_INFO "aml_m8_set_spk: aml_m8_spk_enabled=%d\n",aml_m8_spk_enabled);

    msleep_interruptible(10);
    amlogic_set_value(p_audio->gpio_mute, aml_m8_spk_enabled, "mute_spk");

    if(aml_m8_spk_enabled ==1)
        msleep_interruptible(100);

    return 0;
}