Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257711
b: refs/heads/master
c: 00c6850
h: refs/heads/master
i:
  257709: c720b54
  257707: 18ead5d
  257703: 19d9c04
  257695: a6446da
v: v3
  • Loading branch information
Takashi Iwai committed Jun 27, 2011
1 parent a20d412 commit 9d0af39
Show file tree
Hide file tree
Showing 7 changed files with 1,483 additions and 506 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: a86a88eaf6db7bcc3900d0b7d4755474cc73201f
refs/heads/master: 00c6850dde513bac2b901d4e9714d8a580291143
13 changes: 13 additions & 0 deletions trunk/sound/pci/hda/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,19 @@ config SND_HDA_CODEC_CA0110
snd-hda-codec-ca0110.
This module is automatically loaded at probing.

config SND_HDA_CODEC_CA0132
bool "Build Creative CA0132 codec support"
depends on SND_HDA_INTEL
default y
help
Say Y here to include Creative CA0132 codec support in
snd-hda-intel driver.

When the HD-audio driver is built as a module, the codec
support code is also built as another module,
snd-hda-codec-ca0132.
This module is automatically loaded at probing.

config SND_HDA_CODEC_CMEDIA
bool "Build C-Media HD-audio codec support"
default y
Expand Down
4 changes: 4 additions & 0 deletions trunk/sound/pci/hda/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ snd-hda-codec-idt-objs := patch_sigmatel.o
snd-hda-codec-si3054-objs := patch_si3054.o
snd-hda-codec-cirrus-objs := patch_cirrus.o
snd-hda-codec-ca0110-objs := patch_ca0110.o
snd-hda-codec-ca0132-objs := patch_ca0132.o
snd-hda-codec-conexant-objs := patch_conexant.o
snd-hda-codec-via-objs := patch_via.o
snd-hda-codec-hdmi-objs := patch_hdmi.o hda_eld.o
Expand Down Expand Up @@ -42,6 +43,9 @@ endif
ifdef CONFIG_SND_HDA_CODEC_CA0110
obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-ca0110.o
endif
ifdef CONFIG_SND_HDA_CODEC_CA0132
obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-ca0132.o
endif
ifdef CONFIG_SND_HDA_CODEC_CONEXANT
obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-codec-conexant.o
endif
Expand Down
84 changes: 57 additions & 27 deletions trunk/sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,35 +311,35 @@ EXPORT_SYMBOL_HDA(snd_hda_get_sub_nodes);
static int _hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
hda_nid_t *conn_list, int max_conns);
static bool add_conn_list(struct snd_array *array, hda_nid_t nid);
static int copy_conn_list(hda_nid_t nid, hda_nid_t *dst, int max_dst,
hda_nid_t *src, int len);

/**
* snd_hda_get_connections - get connection list
* @codec: the HDA codec
* @nid: NID to parse
* @conn_list: connection list array
* @max_conns: max. number of connections to store
* @listp: the pointer to store NID list
*
* Parses the connection list of the given widget and stores the list
* of NIDs.
*
* Returns the number of connections, or a negative error code.
*/
int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
hda_nid_t *conn_list, int max_conns)
int snd_hda_get_conn_list(struct hda_codec *codec, hda_nid_t nid,
const hda_nid_t **listp)
{
struct snd_array *array = &codec->conn_lists;
int i, len, old_used;
hda_nid_t list[HDA_MAX_CONNECTIONS];
hda_nid_t *p;

/* look up the cached results */
for (i = 0; i < array->used; ) {
hda_nid_t *p = snd_array_elem(array, i);
p = snd_array_elem(array, i);
len = p[1];
if (nid == *p)
return copy_conn_list(nid, conn_list, max_conns,
p + 2, len);
if (nid == *p) {
if (listp)
*listp = p + 2;
return len;
}
i += len + 2;
}

Expand All @@ -355,12 +355,46 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
if (!add_conn_list(array, list[i]))
goto error_add;

return copy_conn_list(nid, conn_list, max_conns, list, len);
p = snd_array_elem(array, old_used);
if (listp)
*listp = p + 2;
return len;

error_add:
array->used = old_used;
return -ENOMEM;
}
EXPORT_SYMBOL_HDA(snd_hda_get_conn_list);

/**
* snd_hda_get_connections - copy connection list
* @codec: the HDA codec
* @nid: NID to parse
* @conn_list: connection list array
* @max_conns: max. number of connections to store
*
* Parses the connection list of the given widget and stores the list
* of NIDs.
*
* Returns the number of connections, or a negative error code.
*/
int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
hda_nid_t *conn_list, int max_conns)
{
const hda_nid_t *list;
int len = snd_hda_get_conn_list(codec, nid, &list);

if (len <= 0)
return len;
if (len > max_conns) {
snd_printk(KERN_ERR "hda_codec: "
"Too many connections %d for NID 0x%x\n",
len, nid);
return -EINVAL;
}
memcpy(conn_list, list, len * sizeof(hda_nid_t));
return len;
}
EXPORT_SYMBOL_HDA(snd_hda_get_connections);

static int _hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
Expand Down Expand Up @@ -471,19 +505,6 @@ static bool add_conn_list(struct snd_array *array, hda_nid_t nid)
return true;
}

static int copy_conn_list(hda_nid_t nid, hda_nid_t *dst, int max_dst,
hda_nid_t *src, int len)
{
if (len > max_dst) {
snd_printk(KERN_ERR "hda_codec: "
"Too many connections %d for NID 0x%x\n",
len, nid);
return -EINVAL;
}
memcpy(dst, src, len * sizeof(hda_nid_t));
return len;
}

/**
* snd_hda_queue_unsol_event - add an unsolicited event to queue
* @bus: the BUS
Expand Down Expand Up @@ -4590,7 +4611,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
unsigned int wid_caps = get_wcaps(codec, nid);
unsigned int wid_type = get_wcaps_type(wid_caps);
unsigned int def_conf;
short assoc, loc;
short assoc, loc, conn, dev;

/* read all default configuration for pin complex */
if (wid_type != AC_WID_PIN)
Expand All @@ -4600,10 +4621,19 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
continue;

def_conf = snd_hda_codec_get_pincfg(codec, nid);
if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
conn = get_defcfg_connect(def_conf);
if (conn == AC_JACK_PORT_NONE)
continue;
loc = get_defcfg_location(def_conf);
switch (get_defcfg_device(def_conf)) {
dev = get_defcfg_device(def_conf);

/* workaround for buggy BIOS setups */
if (dev == AC_JACK_LINE_OUT) {
if (conn == AC_JACK_PORT_FIXED)
dev = AC_JACK_SPEAKER;
}

switch (dev) {
case AC_JACK_LINE_OUT:
seq = get_defcfg_sequence(def_conf);
assoc = get_defcfg_association(def_conf);
Expand Down
2 changes: 2 additions & 0 deletions trunk/sound/pci/hda/hda_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,8 @@ int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid,
hda_nid_t *start_id);
int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid,
hda_nid_t *conn_list, int max_conns);
int snd_hda_get_conn_list(struct hda_codec *codec, hda_nid_t nid,
const hda_nid_t **listp);
int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid,
u32 *ratesp, u64 *formatsp, unsigned int *bpsp);

Expand Down
Loading

0 comments on commit 9d0af39

Please sign in to comment.