Skip to content

Commit

Permalink
Merge branch 'topic/hda-reconfig' into topic/hda-next
Browse files Browse the repository at this point in the history
  • Loading branch information
Takashi Iwai committed Oct 16, 2008
2 parents 45a6ac1 + 1e1be43 commit dd125b2
Show file tree
Hide file tree
Showing 12 changed files with 731 additions and 355 deletions.
382 changes: 287 additions & 95 deletions sound/pci/hda/hda_codec.c

Large diffs are not rendered by default.

39 changes: 34 additions & 5 deletions sound/pci/hda/hda_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,26 @@ enum {
/* max. codec address */
#define HDA_MAX_CODEC_ADDRESS 0x0f

/*
* generic arrays
*/
struct snd_array {
unsigned int used;
unsigned int alloced;
unsigned int elem_size;
unsigned int alloc_align;
void *list;
};

void *snd_array_new(struct snd_array *array);
void snd_array_free(struct snd_array *array);
static inline void snd_array_init(struct snd_array *array, unsigned int size,
unsigned int align)
{
array->elem_size = size;
array->alloc_align = align;
}

/*
* Structures
*/
Expand All @@ -542,6 +562,8 @@ struct hda_bus_ops {
unsigned int (*get_response)(struct hda_codec *codec);
/* free the private data */
void (*private_free)(struct hda_bus *);
/* attach a PCM stream */
int (*attach_pcm)(struct hda_codec *codec, struct hda_pcm *pcm);
#ifdef CONFIG_SND_HDA_POWER_SAVE
/* notify power-up/down from codec to controller */
void (*pm_notify)(struct hda_codec *codec);
Expand Down Expand Up @@ -635,10 +657,7 @@ struct hda_amp_info {

struct hda_cache_rec {
u16 hash[64]; /* hash table for index */
unsigned int num_entries; /* number of assigned entries */
unsigned int size; /* allocated size */
unsigned int record_size; /* record size (including header) */
void *buffer; /* hash table entries */
struct snd_array buf; /* record entries */
};

/* PCM callbacks */
Expand Down Expand Up @@ -680,7 +699,8 @@ struct hda_pcm {
char *name;
struct hda_pcm_stream stream[2];
unsigned int pcm_type; /* HDA_PCM_TYPE_XXX */
int device; /* assigned device number */
int device; /* device number to assign */
struct snd_pcm *pcm; /* assigned PCM instance */
};

/* codec information */
Expand All @@ -699,6 +719,8 @@ struct hda_codec {

/* detected preset */
const struct hda_codec_preset *preset;
const char *name; /* codec name */
const char *modelname; /* model name for preset */

/* set by patch */
struct hda_codec_ops patch_ops;
Expand All @@ -718,6 +740,8 @@ struct hda_codec {
hda_nid_t start_nid;
u32 *wcaps;

struct snd_array mixers; /* list of assigned mixer elements */

struct hda_cache_rec amp_cache; /* cache for amp access */
struct hda_cache_rec cmd_cache; /* cache for other commands */

Expand All @@ -727,7 +751,11 @@ struct hda_codec {
unsigned int spdif_in_enable; /* SPDIF input enable? */
hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */

#ifdef CONFIG_SND_HDA_HWDEP
struct snd_hwdep *hwdep; /* assigned hwdep device */
struct snd_array init_verbs; /* additional init verbs */
struct snd_array hints; /* additional hints */
#endif

/* misc flags */
unsigned int spdif_status_reset :1; /* needs to toggle SPDIF for each
Expand Down Expand Up @@ -799,6 +827,7 @@ void snd_hda_codec_resume_cache(struct hda_codec *codec);
* Mixer
*/
int snd_hda_build_controls(struct hda_bus *bus);
int snd_hda_codec_build_controls(struct hda_codec *codec);

/*
* PCM
Expand Down
20 changes: 12 additions & 8 deletions sound/pci/hda/hda_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,8 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node,
if (is_loopback)
add_input_loopback(codec, node->nid, HDA_INPUT, index);
snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index);
if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec));
if (err < 0)
return err;
created = 1;
} else if ((node->wid_caps & AC_WCAP_OUT_AMP) &&
Expand All @@ -732,7 +733,8 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node,
if (is_loopback)
add_input_loopback(codec, node->nid, HDA_OUTPUT, 0);
snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid);
if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec));
if (err < 0)
return err;
created = 1;
}
Expand All @@ -745,14 +747,16 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node,
(node->amp_in_caps & AC_AMPCAP_NUM_STEPS)) {
knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, index, HDA_INPUT);
snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index);
if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec));
if (err < 0)
return err;
created = 1;
} else if ((node->wid_caps & AC_WCAP_OUT_AMP) &&
(node->amp_out_caps & AC_AMPCAP_NUM_STEPS)) {
knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, 0, HDA_OUTPUT);
snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid);
if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec));
if (err < 0)
return err;
created = 1;
}
Expand Down Expand Up @@ -849,8 +853,8 @@ static int build_input_controls(struct hda_codec *codec)
}

/* create input MUX if multiple sources are available */
if ((err = snd_ctl_add(codec->bus->card,
snd_ctl_new1(&cap_sel, codec))) < 0)
err = snd_hda_ctl_add(codec, snd_ctl_new1(&cap_sel, codec));
if (err < 0)
return err;

/* no volume control? */
Expand All @@ -867,8 +871,8 @@ static int build_input_controls(struct hda_codec *codec)
HDA_CODEC_VOLUME(name, adc_node->nid,
spec->input_mux.items[i].index,
HDA_INPUT);
if ((err = snd_ctl_add(codec->bus->card,
snd_ctl_new1(&knew, codec))) < 0)
err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec));
if (err < 0)
return err;
}

Expand Down
Loading

0 comments on commit dd125b2

Please sign in to comment.