/* * OLPC has an additional feature on top of the regular AD1888 codec features. * It has an Analog Input mode that is switched into (after disabling the * High Pass Filter) via GPIO. It is supported on B2 and later models.
*/ void olpc_analog_input(struct snd_ac97 *ac97, int on)
{ int err;
if (!machine_is_olpc()) return;
/* update the High Pass Filter (via AC97_AD_TEST2) */
err = snd_ac97_update_bits(ac97, AC97_AD_TEST2,
1 << AC97_AD_HPFD_SHIFT, on << AC97_AD_HPFD_SHIFT); if (err < 0) {
dev_err(ac97->bus->card->dev, "setting High Pass Filter - %d\n", err); return;
}
/* set Analog Input through GPIO */
gpio_set_value(OLPC_GPIO_MIC_AC, on);
}
/* * OLPC XO-1's V_REFOUT is a mic bias enable.
*/ void olpc_mic_bias(struct snd_ac97 *ac97, int on)
{ int err;
if (!machine_is_olpc()) return;
on = on ? 0 : 1;
err = snd_ac97_update_bits(ac97, AC97_AD_MISC,
1 << AC97_AD_VREFD_SHIFT, on << AC97_AD_VREFD_SHIFT); if (err < 0)
dev_err(ac97->bus->card->dev, "setting MIC Bias - %d\n", err);
}
/* invert EAPD if on an OLPC B3 or higher */ if (olpc_board_at_least(olpc_board_pre(0xb3)))
ac97->scaps |= AC97_SCAP_INV_EAPD;
}
int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
{ struct snd_ctl_elem_id elem; int i, err;
if (!machine_is_olpc()) return 0;
if (gpio_request(OLPC_GPIO_MIC_AC, DRV_NAME)) {
dev_err(card->dev, "unable to allocate MIC GPIO\n"); return -EIO;
}
gpio_direction_output(OLPC_GPIO_MIC_AC, 0);
/* drop the original AD1888 HPF control */
memset(&elem, 0, sizeof(elem));
elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strscpy(elem.name, "High Pass Filter Enable", sizeof(elem.name));
snd_ctl_remove_id(card, &elem);
/* drop the original V_REFOUT control */
memset(&elem, 0, sizeof(elem));
elem.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strscpy(elem.name, "V_REFOUT Enable", sizeof(elem.name));
snd_ctl_remove_id(card, &elem);
/* add the OLPC-specific controls */ for (i = 0; i < ARRAY_SIZE(olpc_cs5535audio_ctls); i++) {
err = snd_ctl_add(card, snd_ctl_new1(&olpc_cs5535audio_ctls[i],
ac97->private_data)); if (err < 0) return err;
}
/* turn off the mic by default */
olpc_mic_bias(ac97, 0); return 0;
}
void olpc_quirks_cleanup(void)
{ if (machine_is_olpc())
gpio_free(OLPC_GPIO_MIC_AC);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.