Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 15932
b: refs/heads/master
c: 0948e3c
h: refs/heads/master
v: v3
  • Loading branch information
Takashi Iwai authored and Jaroslav Kysela committed Jan 3, 2006
1 parent 6ca48d9 commit a7f1865
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 162 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c8714ba160a498e249dbd32c637b85a1efa1013b
refs/heads/master: 0948e3c8bb187b3dea38be1e1ffd1797866014f1
107 changes: 1 addition & 106 deletions trunk/include/sound/uda1341.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* features support
*/

/* $Id: uda1341.h,v 1.6 2004/05/03 17:36:50 tiwai Exp $ */
/* $Id: uda1341.h,v 1.7 2005/11/17 10:25:22 tiwai Exp $ */

#define UDA1341_ALSA_NAME "snd-uda1341"

Expand All @@ -37,11 +37,6 @@ enum uda1341_onoff {
ON,
};

const char *onoff_names[] = {
"Off",
"On",
};

enum uda1341_format {
I2S=0,
LSB16,
Expand All @@ -53,139 +48,39 @@ enum uda1341_format {
LSB20MSB,
};

const char *format_names[] = {
"I2S-bus",
"LSB 16bits",
"LSB 18bits",
"LSB 20bits",
"MSB",
"in LSB 16bits/out MSB",
"in LSB 18bits/out MSB",
"in LSB 20bits/out MSB",
};

enum uda1341_fs {
F512=0,
F384,
F256,
Funused,
};

const char *fs_names[] = {
"512*fs",
"384*fs",
"256*fs",
"Unused - bad value!",
};

enum uda1341_peak {
BEFORE=0,
AFTER,
};

const char *peak_names[] = {
"before",
"after",
};

enum uda1341_filter {
FLAT=0,
MIN,
MIN2,
MAX,
};

const char *filter_names[] = {
"flat",
"min",
"min",
"max",
};

const char*bass_values[][16] = {
{"0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB", "0 dB",
"0 dB", "0 dB", "0 dB", "0 dB", "undefined", }, //flat
{"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
"18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
{"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "18 dB",
"18 dB", "18 dB", "18 dB", "18 dB", "undefined",}, // min
{"0 dB", "2 dB", "4 dB", "6 dB", "8 dB", "10 dB", "12 dB", "14 dB", "16 dB", "18 dB", "20 dB",
"22 dB", "24 dB", "24 dB", "24 dB", "undefined",}, // max
};

enum uda1341_mixer {
DOUBLE,
LINE,
MIC,
MIXER,
};

const char *mixer_names[] = {
"double differential",
"input channel 1 (line in)",
"input channel 2 (microphone)",
"digital mixer",
};

enum uda1341_deemp {
NONE,
D32,
D44,
D48,
};

const char *deemp_names[] = {
"none",
"32 kHz",
"44.1 kHz",
"48 kHz",
};

const char *mic_sens_value[] = {
"-3 dB", "0 dB", "3 dB", "9 dB", "15 dB", "21 dB", "27 dB", "not used",
};

const unsigned short AGC_atime[] = {
11, 16, 11, 16, 21, 11, 16, 21,
};

const unsigned short AGC_dtime[] = {
100, 100, 200, 200, 200, 400, 400, 400,
};

const char *AGC_level[] = {
"-9.0", "-11.5", "-15.0", "-17.5",
};

const char *ig_small_value[] = {
"-3.0", "-2.5", "-2.0", "-1.5", "-1.0", "-0.5",
};

/*
* this was computed as peak_value[i] = pow((63-i)*1.42,1.013)
*
* UDA1341 datasheet on page 21: Peak value (dB) = (Peak level - 63.5)*5*log2
* There is an table with these values [level]=value: [3]=-90.31, [7]=-84.29
* [61]=-2.78, [62] = -1.48, [63] = 0.0
* I tried to compute it, but using but even using logarithm with base either 10 or 2
* i was'n able to get values in the table from the formula. So I constructed another
* formula (see above) to interpolate the values as good as possible. If there is some
* mistake, please contact me on tomas.kasparek@seznam.cz. Thanks.
* UDA1341TS datasheet is available at:
* http://www-us9.semiconductors.com/acrobat/datasheets/UDA1341TS_3.pdf
*/
const char *peak_value[] = {
"-INF dB", "N.A.", "N.A", "90.31 dB", "N.A.", "N.A.", "N.A.", "-84.29 dB",
"-82.65 dB", "-81.13 dB", "-79.61 dB", "-78.09 dB", "-76.57 dB", "-75.05 dB", "-73.53 dB",
"-72.01 dB", "-70.49 dB", "-68.97 dB", "-67.45 dB", "-65.93 dB", "-64.41 dB", "-62.90 dB",
"-61.38 dB", "-59.86 dB", "-58.35 dB", "-56.83 dB", "-55.32 dB", "-53.80 dB", "-52.29 dB",
"-50.78 dB", "-49.26 dB", "-47.75 dB", "-46.24 dB", "-44.73 dB", "-43.22 dB", "-41.71 dB",
"-40.20 dB", "-38.69 dB", "-37.19 dB", "-35.68 dB", "-34.17 dB", "-32.67 dB", "-31.17 dB",
"-29.66 dB", "-28.16 dB", "-26.66 dB", "-25.16 dB", "-23.66 dB", "-22.16 dB", "-20.67 dB",
"-19.17 dB", "-17.68 dB", "-16.19 dB", "-14.70 dB", "-13.21 dB", "-11.72 dB", "-10.24 dB",
"-8.76 dB", "-7.28 dB", "-5.81 dB", "-4.34 dB", "-2.88 dB", "-1.43 dB", "0.00 dB",
};

enum uda1341_config {
CMD_READ_REG = 0,
CMD_RESET,
Expand Down
38 changes: 18 additions & 20 deletions trunk/sound/arm/sa11xx-uda1341.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* merged HAL layer (patches from Brian)
*/

/* $Id: sa11xx-uda1341.c,v 1.23 2005/09/09 13:22:34 tiwai Exp $ */
/* $Id: sa11xx-uda1341.c,v 1.24 2005/11/17 10:25:22 tiwai Exp $ */

/***************************************************************************************************
*
Expand Down Expand Up @@ -141,8 +141,6 @@ typedef struct snd_card_sa11xx_uda1341 {
audio_stream_t s[2]; /* playback & capture */
} sa11xx_uda1341_t;

static struct snd_card_sa11xx_uda1341 *sa11xx_uda1341 = NULL;

static unsigned int rates[] = {
8000, 10666, 10985, 14647,
16000, 21970, 22050, 24000,
Expand Down Expand Up @@ -411,8 +409,8 @@ static int audio_dma_request(audio_stream_t *s, void (*callback)(void *))

static void audio_dma_free(audio_stream_t *s)
{
sa1100_free_dma((s)->dma_regs);
(s)->dma_regs = 0;
sa1100_free_dma(s->dma_regs);
s->dma_regs = 0;
}

#endif
Expand Down Expand Up @@ -835,8 +833,8 @@ static int __init snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341_t *sa11xx_uda1341,
* isa works but I'm not sure why (or if) it's the right choice
* this may be too large, trying it for now
*/
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_ISA,
snd_pcm_dma_flags(0),
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
snd_dma_isa_data(),
64*1024, 64*1024);

snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_sa11xx_uda1341_playback_ops);
Expand Down Expand Up @@ -900,15 +898,15 @@ void snd_sa11xx_uda1341_free(snd_card_t *card)

audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]);
audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]);
sa11xx_uda1341 = NULL;
card->private_data = NULL;
kfree(chip);
}

static snd_card_t *sa11xx_uda1341_card;

static int __init sa11xx_uda1341_init(void)
{
int err;
snd_card_t *card;
sa11xx_uda1341_t *chip;

if (!machine_is_h3xxx())
return -ENODEV;
Expand All @@ -921,26 +919,25 @@ static int __init sa11xx_uda1341_init(void)
sa11xx_uda1341 = kzalloc(sizeof(*sa11xx_uda1341), GFP_KERNEL);
if (sa11xx_uda1341 == NULL)
return -ENOMEM;
card->private_free = snd_sa11xx_uda1341_free;
chip = card->private_data;
spin_lock_init(&chip->s[0].dma_lock);
spin_lock_init(&chip->s[1].dma_lock);

card->private_data = (void *)sa11xx_uda1341;
card->private_free = snd_sa11xx_uda1341_free;

sa11xx_uda1341->card = card;
sa11xx_uda1341->samplerate = AUDIO_RATE_DEFAULT;
chip->card = card;
chip->samplerate = AUDIO_RATE_DEFAULT;

// mixer
if ((err = snd_chip_uda1341_mixer_new(sa11xx_uda1341->card, &sa11xx_uda1341->uda1341)))
if ((err = snd_chip_uda1341_mixer_new(chip->card, &sa11xx_uda1341->uda1341)))
goto nodev;

// PCM
if ((err = snd_card_sa11xx_uda1341_pcm(sa11xx_uda1341, 0)) < 0)
if ((err = snd_card_sa11xx_uda1341_pcm(chip, 0)) < 0)
goto nodev;

snd_card_set_generic_pm_callback(card,
snd_sa11xx_uda1341_suspend, snd_sa11_uda1341_resume,
sa11xx_uda1341);
snd_sa11xx_uda1341_suspend, snd_sa11_uda1341_resume,
chip);

strcpy(card->driver, "UDA1341");
strcpy(card->shortname, "H3600 UDA1341TS");
Expand All @@ -951,6 +948,7 @@ static int __init sa11xx_uda1341_init(void)

if ((err = snd_card_register(card)) == 0) {
printk( KERN_INFO "iPAQ audio support initialized\n" );
sa11xx_uda1341_card = card;
return 0;
}

Expand All @@ -961,7 +959,7 @@ static int __init sa11xx_uda1341_init(void)

static void __exit sa11xx_uda1341_exit(void)
{
snd_card_free(sa11xx_uda1341->card);
snd_card_free(sa11xx_uda1341_card);
}

module_init(sa11xx_uda1341_init);
Expand Down
Loading

0 comments on commit a7f1865

Please sign in to comment.