Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316151
b: refs/heads/master
c: f68d891
h: refs/heads/master
i:
  316149: 9e1fa0c
  316147: 89d40ac
  316143: 58c94e0
v: v3
  • Loading branch information
Takashi Iwai committed Jul 4, 2012
1 parent 46e5a78 commit c5825ed
Show file tree
Hide file tree
Showing 10 changed files with 508 additions and 202 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: 3fd877d32cac31292628fb8f443543fc1989b49b
refs/heads/master: f68d891d85c8f9ab1af663ed3ceac18ad58dbabe
10 changes: 8 additions & 2 deletions trunk/Documentation/sound/alsa/HD-Audio-Models.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,23 @@ ALC260

ALC262
======
N/A
inv-dmic Inverted internal mic workaround

ALC267/268
==========
N/A
inv-dmic Inverted internal mic workaround

ALC269
======
laptop-amic Laptops with analog-mic input
laptop-dmic Laptops with digital-mic input
alc269-dmic Enable ALC269(VA) digital mic workaround
alc271-dmic Enable ALC271X digital mic workaround
inv-dmic Inverted internal mic workaround

ALC662/663/272
==============
mario Chromebook mario model fixup
asus-mode1 ASUS
asus-mode2 ASUS
asus-mode3 ASUS
Expand All @@ -36,6 +40,7 @@ ALC662/663/272
asus-mode6 ASUS
asus-mode7 ASUS
asus-mode8 ASUS
inv-dmic Inverted internal mic workaround

ALC680
======
Expand All @@ -46,6 +51,7 @@ ALC882/883/885/888/889
acer-aspire-4930g Acer Aspire 4930G/5930G/6530G/6930G/7730G
acer-aspire-8930g Acer Aspire 8330G/6935G
acer-aspire Acer Aspire others
inv-dmic Inverted internal mic workaround

ALC861/660
==========
Expand Down
47 changes: 42 additions & 5 deletions trunk/sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -3489,23 +3489,53 @@ void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg,
}
EXPORT_SYMBOL_HDA(snd_hda_codec_set_power_to_all);

/*
* supported power states check
*/
static bool snd_hda_codec_get_supported_ps(struct hda_codec *codec, hda_nid_t fg,
unsigned int power_state)
{
int sup = snd_hda_param_read(codec, fg, AC_PAR_POWER_STATE);

if (sup < 0)
return false;
if (sup & power_state)
return true;
else
return false;
}

/*
* set power state of the codec
*/
static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg,
unsigned int power_state)
{
int count;
unsigned int state;

if (codec->patch_ops.set_power_state) {
codec->patch_ops.set_power_state(codec, fg, power_state);
return;
}

/* this delay seems necessary to avoid click noise at power-down */
if (power_state == AC_PWRST_D3)
msleep(100);
snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE,
power_state);
snd_hda_codec_set_power_to_all(codec, fg, power_state, true);
if (power_state == AC_PWRST_D3) {
/* transition time less than 10ms for power down */
bool epss = snd_hda_codec_get_supported_ps(codec, fg, AC_PWRST_EPSS);
msleep(epss ? 10 : 100);
}

/* repeat power states setting at most 10 times*/
for (count = 0; count < 10; count++) {
snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE,
power_state);
snd_hda_codec_set_power_to_all(codec, fg, power_state, true);
state = snd_hda_codec_read(codec, fg, 0,
AC_VERB_GET_POWER_STATE, 0);
if (!(state & AC_PWRST_ERROR))
break;
}
}

#ifdef CONFIG_SND_HDA_HWDEP
Expand Down Expand Up @@ -4399,6 +4429,13 @@ static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down)
cancel_delayed_work_sync(&codec->power_work);

spin_lock(&codec->power_lock);
/* If the power down delayed work was cancelled above before starting,
* then there is no need to go through power up here.
*/
if (codec->power_on) {
spin_unlock(&codec->power_lock);
return;
}
trace_hda_power_up(codec);
snd_hda_update_power_acct(codec);
codec->power_on = 1;
Expand Down
3 changes: 3 additions & 0 deletions trunk/sound/pci/hda/hda_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,9 @@ enum {
#define AC_PWRST_D1 0x01
#define AC_PWRST_D2 0x02
#define AC_PWRST_D3 0x03
#define AC_PWRST_ERROR (1<<8)
#define AC_PWRST_CLK_STOP_OK (1<<9)
#define AC_PWRST_SETTING_RESET (1<<10)

/* Processing capabilies */
#define AC_PCAP_BENIGN (1<<0)
Expand Down
15 changes: 12 additions & 3 deletions trunk/sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,7 @@ enum {
#define AZX_DCAPS_BUFSIZE (1 << 21) /* no buffer size alignment */
#define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */
#define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */
#define AZX_DCAPS_POSFIX_COMBO (1 << 24) /* Use COMBO as default */

/* quirks for ATI SB / AMD Hudson */
#define AZX_DCAPS_PRESET_ATI_SB \
Expand Down Expand Up @@ -2731,6 +2732,10 @@ static int __devinit check_position_fix(struct azx *chip, int fix)
snd_printd(SFX "Using LPIB position fix\n");
return POS_FIX_LPIB;
}
if (chip->driver_caps & AZX_DCAPS_POSFIX_COMBO) {
snd_printd(SFX "Using COMBO position fix\n");
return POS_FIX_COMBO;
}
return POS_FIX_AUTO;
}

Expand Down Expand Up @@ -3243,19 +3248,19 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
/* CPT */
{ PCI_DEVICE(0x8086, 0x1c20),
.driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
AZX_DCAPS_BUFSIZE },
AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
/* PBG */
{ PCI_DEVICE(0x8086, 0x1d20),
.driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
AZX_DCAPS_BUFSIZE},
/* Panther Point */
{ PCI_DEVICE(0x8086, 0x1e20),
.driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
AZX_DCAPS_BUFSIZE},
AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
/* Lynx Point */
{ PCI_DEVICE(0x8086, 0x8c20),
.driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
AZX_DCAPS_BUFSIZE},
AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
/* SCH */
{ PCI_DEVICE(0x8086, 0x811b),
.driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
Expand Down Expand Up @@ -3341,6 +3346,10 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
/* VIA VT8251/VT8237A */
{ PCI_DEVICE(0x1106, 0x3288),
.driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA },
/* VIA GFX VT7122/VX900 */
{ PCI_DEVICE(0x1106, 0x9170), .driver_data = AZX_DRIVER_GENERIC },
/* VIA GFX VT6122/VX11 */
{ PCI_DEVICE(0x1106, 0x9140), .driver_data = AZX_DRIVER_GENERIC },
/* SIS966 */
{ PCI_DEVICE(0x1039, 0x7502), .driver_data = AZX_DRIVER_SIS },
/* ULI M5461 */
Expand Down
59 changes: 41 additions & 18 deletions trunk/sound/pci/hda/hda_jack.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,15 @@ void snd_hda_jack_tbl_clear(struct hda_codec *codec)
static void jack_detect_update(struct hda_codec *codec,
struct hda_jack_tbl *jack)
{
if (jack->jack_dirty || !jack->jack_detect) {
if (!jack->jack_dirty)
return;

if (jack->phantom_jack)
jack->pin_sense = AC_PINSENSE_PRESENCE;
else
jack->pin_sense = read_pin_sense(codec, jack->nid);
jack->jack_dirty = 0;
}

jack->jack_dirty = 0;
}

/**
Expand Down Expand Up @@ -264,8 +269,8 @@ static void hda_free_jack_priv(struct snd_jack *jack)
* This assigns a jack-detection kctl to the given pin. The kcontrol
* will have the given name and index.
*/
int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
const char *name, int idx)
static int __snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
const char *name, int idx, bool phantom_jack)
{
struct hda_jack_tbl *jack;
struct snd_kcontrol *kctl;
Expand All @@ -283,19 +288,30 @@ int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
if (err < 0)
return err;
jack->kctl = kctl;
jack->phantom_jack = !!phantom_jack;

state = snd_hda_jack_detect(codec, nid);
snd_kctl_jack_report(codec->bus->card, kctl, state);
#ifdef CONFIG_SND_HDA_INPUT_JACK
jack->type = get_input_jack_type(codec, nid);
err = snd_jack_new(codec->bus->card, name, jack->type, &jack->jack);
if (err < 0)
return err;
jack->jack->private_data = jack;
jack->jack->private_free = hda_free_jack_priv;
snd_jack_report(jack->jack, state ? jack->type : 0);
if (!phantom_jack) {
jack->type = get_input_jack_type(codec, nid);
err = snd_jack_new(codec->bus->card, name, jack->type,
&jack->jack);
if (err < 0)
return err;
jack->jack->private_data = jack;
jack->jack->private_free = hda_free_jack_priv;
snd_jack_report(jack->jack, state ? jack->type : 0);
}
#endif
return 0;
}

int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
const char *name, int idx)
{
return __snd_hda_jack_add_kctl(codec, nid, name, idx, false);
}
EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctl);

static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,
Expand All @@ -305,25 +321,32 @@ static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,
unsigned int def_conf, conn;
char name[44];
int idx, err;
bool phantom_jack;

if (!nid)
return 0;
if (!is_jack_detectable(codec, nid))
return 0;
def_conf = snd_hda_codec_get_pincfg(codec, nid);
conn = get_defcfg_connect(def_conf);
if (conn != AC_JACK_PORT_COMPLEX)
if (conn == AC_JACK_PORT_NONE)
return 0;
phantom_jack = (conn != AC_JACK_PORT_COMPLEX) ||
!is_jack_detectable(codec, nid);

snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), &idx);
if (phantom_jack)
/* Example final name: "Internal Mic Phantom Jack" */
strncat(name, " Phantom", sizeof(name) - strlen(name) - 1);
if (!strcmp(name, lastname) && idx == *lastidx)
idx++;
strncpy(lastname, name, 44);
strncpy(lastname, name, sizeof(name));
*lastidx = idx;
err = snd_hda_jack_add_kctl(codec, nid, name, idx);
err = __snd_hda_jack_add_kctl(codec, nid, name, idx, phantom_jack);
if (err < 0)
return err;
return snd_hda_jack_detect_enable(codec, nid, 0);

if (!phantom_jack)
return snd_hda_jack_detect_enable(codec, nid, 0);
return 0;
}

/**
Expand Down
1 change: 1 addition & 0 deletions trunk/sound/pci/hda/hda_jack.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct hda_jack_tbl {
unsigned int pin_sense; /* cached pin-sense value */
unsigned int jack_detect:1; /* capable of jack-detection? */
unsigned int jack_dirty:1; /* needs to update? */
unsigned int phantom_jack:1; /* a fixed, always present port? */
struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */
#ifdef CONFIG_SND_HDA_INPUT_JACK
int type;
Expand Down
17 changes: 12 additions & 5 deletions trunk/sound/pci/hda/hda_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,10 @@ static void print_digital_conv(struct snd_info_buffer *buffer,

static const char *get_pwr_state(u32 state)
{
static const char * const buf[4] = {
"D0", "D1", "D2", "D3"
static const char * const buf[] = {
"D0", "D1", "D2", "D3", "D3cold"
};
if (state < 4)
if (state < ARRAY_SIZE(buf))
return buf[state];
return "UNKNOWN";
}
Expand All @@ -451,14 +451,21 @@ static void print_power_state(struct snd_info_buffer *buffer,
int sup = snd_hda_param_read(codec, nid, AC_PAR_POWER_STATE);
int pwr = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_POWER_STATE, 0);
if (sup)
if (sup != -1)
snd_iprintf(buffer, " Power states: %s\n",
bits_names(sup, names, ARRAY_SIZE(names)));

snd_iprintf(buffer, " Power: setting=%s, actual=%s\n",
snd_iprintf(buffer, " Power: setting=%s, actual=%s",
get_pwr_state(pwr & AC_PWRST_SETTING),
get_pwr_state((pwr & AC_PWRST_ACTUAL) >>
AC_PWRST_ACTUAL_SHIFT));
if (pwr & AC_PWRST_ERROR)
snd_iprintf(buffer, ", Error");
if (pwr & AC_PWRST_CLK_STOP_OK)
snd_iprintf(buffer, ", Clock-stop-OK");
if (pwr & AC_PWRST_SETTING_RESET)
snd_iprintf(buffer, ", Setting-reset");
snd_iprintf(buffer, "\n");
}

static void print_unsol_cap(struct snd_info_buffer *buffer,
Expand Down
Loading

0 comments on commit c5825ed

Please sign in to comment.