Skip to content

Commit 14864a5

Browse files
committed
Merge tag 'sound-fix-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "The big chunks here are the updates for oxygen driver for Xonar DG devices, which were slipped from the previous pull request. They are device-specific and thus not too dangerous. Other than that, all patches are small bug fixes, mainly for Samsung build fixes, a few HD-audio enhancements, and other misc ASoC fixes. (And this time ASoC merge is less than Octopus, lucky seven :)" * tag 'sound-fix-3.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (42 commits) ALSA: hda/hdmi - allow PIN_OUT to be dynamically enabled ALSA: hda - add headset mic detect quirks for another Dell laptop ALSA: oxygen: Xonar DG(X): cleanup and minor changes ALSA: oxygen: Xonar DG(X): modify high-pass filter control ALSA: oxygen: Xonar DG(X): modify input select functions ALSA: oxygen: Xonar DG(X): modify capture volume functions ALSA: oxygen: Xonar DG(X): use headphone volume control ALSA: oxygen: Xonar DG(X): modify playback output select ALSA: oxygen: Xonar DG(X): capture from I2S channel 1, not 2 ALSA: oxygen: Xonar DG(X): move the mixer code into another file ALSA: oxygen: modify CS4245 register dumping function ALSA: oxygen: modify adjust_dg_dac_routing function ALSA: oxygen: Xonar DG(X): modify DAC/ADC parameters function ALSA: oxygen: Xonar DG(X): modify initialization functions ALSA: oxygen: Xonar DG(X): add new CS4245 SPI functions ALSA: oxygen: additional definitions for the Xonar DG/DGX card ALSA: oxygen: change description of the xonar_dg.c file ALSA: oxygen: export oxygen_update_dac_routing symbol ALSA: oxygen: add mute mask for the OXYGEN_PLAY_ROUTING register ALSA: oxygen: modify the SPI writing function ...
2 parents 4e13c5d + 75fae11 commit 14864a5

32 files changed

+935
-566
lines changed

Documentation/devicetree/bindings/sound/simple-card.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Example:
4343
sound {
4444
compatible = "simple-audio-card";
4545
simple-audio-card,format = "left_j";
46-
simple-audio-routing =
46+
simple-audio-card,routing =
4747
"MIC_IN", "Mic Jack",
4848
"Headphone Jack", "HP_OUT",
4949
"Ext Spk", "LINE_OUT";

sound/core/init.c

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,31 @@ static inline int init_info_for_card(struct snd_card *card)
131131
#define init_info_for_card(card)
132132
#endif
133133

134+
static int check_empty_slot(struct module *module, int slot)
135+
{
136+
return !slots[slot] || !*slots[slot];
137+
}
138+
139+
/* return an empty slot number (>= 0) found in the given bitmask @mask.
140+
* @mask == -1 == 0xffffffff means: take any free slot up to 32
141+
* when no slot is available, return the original @mask as is.
142+
*/
143+
static int get_slot_from_bitmask(int mask, int (*check)(struct module *, int),
144+
struct module *module)
145+
{
146+
int slot;
147+
148+
for (slot = 0; slot < SNDRV_CARDS; slot++) {
149+
if (slot < 32 && !(mask & (1U << slot)))
150+
continue;
151+
if (!test_bit(slot, snd_cards_lock)) {
152+
if (check(module, slot))
153+
return slot; /* found */
154+
}
155+
}
156+
return mask; /* unchanged */
157+
}
158+
134159
/**
135160
* snd_card_create - create and initialize a soundcard structure
136161
* @idx: card index (address) [0 ... (SNDRV_CARDS-1)]
@@ -152,7 +177,7 @@ int snd_card_create(int idx, const char *xid,
152177
struct snd_card **card_ret)
153178
{
154179
struct snd_card *card;
155-
int err, idx2;
180+
int err;
156181

157182
if (snd_BUG_ON(!card_ret))
158183
return -EINVAL;
@@ -167,32 +192,10 @@ int snd_card_create(int idx, const char *xid,
167192
strlcpy(card->id, xid, sizeof(card->id));
168193
err = 0;
169194
mutex_lock(&snd_card_mutex);
170-
if (idx < 0) {
171-
for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) {
172-
/* idx == -1 == 0xffff means: take any free slot */
173-
if (idx2 < sizeof(int) && !(idx & (1U << idx2)))
174-
continue;
175-
if (!test_bit(idx2, snd_cards_lock)) {
176-
if (module_slot_match(module, idx2)) {
177-
idx = idx2;
178-
break;
179-
}
180-
}
181-
}
182-
}
183-
if (idx < 0) {
184-
for (idx2 = 0; idx2 < SNDRV_CARDS; idx2++) {
185-
/* idx == -1 == 0xffff means: take any free slot */
186-
if (idx2 < sizeof(int) && !(idx & (1U << idx2)))
187-
continue;
188-
if (!test_bit(idx2, snd_cards_lock)) {
189-
if (!slots[idx2] || !*slots[idx2]) {
190-
idx = idx2;
191-
break;
192-
}
193-
}
194-
}
195-
}
195+
if (idx < 0) /* first check the matching module-name slot */
196+
idx = get_slot_from_bitmask(idx, module_slot_match, module);
197+
if (idx < 0) /* if not matched, assign an empty slot */
198+
idx = get_slot_from_bitmask(idx, check_empty_slot, module);
196199
if (idx < 0)
197200
err = -ENODEV;
198201
else if (idx < snd_ecards_limit) {

sound/pci/cs46xx/cs46xx_lib.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ static void free_module_desc(struct dsp_module_desc *module)
369369
kfree(module->segments[i].data);
370370
kfree(module->segments);
371371
}
372+
kfree(module);
372373
}
373374

374375
/* firmware binary format:

sound/pci/hda/hda_codec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,7 @@ struct hda_codec {
361361
unsigned int epss:1; /* supporting EPSS? */
362362
unsigned int cached_write:1; /* write only to caches */
363363
unsigned int dp_mst:1; /* support DP1.2 Multi-stream transport */
364+
unsigned int dump_coef:1; /* dump processing coefs in codec proc file */
364365
#ifdef CONFIG_PM
365366
unsigned int power_on :1; /* current (global) power-state */
366367
unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */

sound/pci/hda/hda_proc.c

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,14 @@
2424
#include <linux/init.h>
2525
#include <linux/slab.h>
2626
#include <sound/core.h>
27+
#include <linux/module.h>
2728
#include "hda_codec.h"
2829
#include "hda_local.h"
2930

31+
static int dump_coef = -1;
32+
module_param(dump_coef, int, 0644);
33+
MODULE_PARM_DESC(dump_coef, "Dump processing coefficients in codec proc file (-1=auto, 0=disable, 1=enable)");
34+
3035
static char *bits_names(unsigned int bits, char *names[], int size)
3136
{
3237
int i, n;
@@ -488,14 +493,39 @@ static void print_unsol_cap(struct snd_info_buffer *buffer,
488493
(unsol & AC_UNSOL_ENABLED) ? 1 : 0);
489494
}
490495

496+
static inline bool can_dump_coef(struct hda_codec *codec)
497+
{
498+
switch (dump_coef) {
499+
case 0: return false;
500+
case 1: return true;
501+
default: return codec->dump_coef;
502+
}
503+
}
504+
491505
static void print_proc_caps(struct snd_info_buffer *buffer,
492506
struct hda_codec *codec, hda_nid_t nid)
493507
{
508+
unsigned int i, ncoeff, oldindex;
494509
unsigned int proc_caps = snd_hda_param_read(codec, nid,
495510
AC_PAR_PROC_CAP);
511+
ncoeff = (proc_caps & AC_PCAP_NUM_COEF) >> AC_PCAP_NUM_COEF_SHIFT;
496512
snd_iprintf(buffer, " Processing caps: benign=%d, ncoeff=%d\n",
497-
proc_caps & AC_PCAP_BENIGN,
498-
(proc_caps & AC_PCAP_NUM_COEF) >> AC_PCAP_NUM_COEF_SHIFT);
513+
proc_caps & AC_PCAP_BENIGN, ncoeff);
514+
515+
if (!can_dump_coef(codec))
516+
return;
517+
518+
/* Note: This is racy - another process could run in parallel and change
519+
the coef index too. */
520+
oldindex = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_COEF_INDEX, 0);
521+
for (i = 0; i < ncoeff; i++) {
522+
unsigned int val;
523+
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, i);
524+
val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF,
525+
0);
526+
snd_iprintf(buffer, " Coeff 0x%02x: 0x%04x\n", i, val);
527+
}
528+
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, oldindex);
499529
}
500530

501531
static void print_conn_list(struct snd_info_buffer *buffer,

sound/pci/hda/patch_hdmi.c

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ struct hdmi_spec {
132132

133133
struct hdmi_eld temp_eld;
134134
struct hdmi_ops ops;
135+
136+
bool dyn_pin_out;
137+
135138
/*
136139
* Non-generic VIA/NVIDIA specific
137140
*/
@@ -500,15 +503,25 @@ static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t pin_nid,
500503

501504
static void hdmi_init_pin(struct hda_codec *codec, hda_nid_t pin_nid)
502505
{
506+
struct hdmi_spec *spec = codec->spec;
507+
int pin_out;
508+
503509
/* Unmute */
504510
if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP)
505511
snd_hda_codec_write(codec, pin_nid, 0,
506512
AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
507-
/* Enable pin out: some machines with GM965 gets broken output when
508-
* the pin is disabled or changed while using with HDMI
509-
*/
513+
514+
if (spec->dyn_pin_out)
515+
/* Disable pin out until stream is active */
516+
pin_out = 0;
517+
else
518+
/* Enable pin out: some machines with GM965 gets broken output
519+
* when the pin is disabled or changed while using with HDMI
520+
*/
521+
pin_out = PIN_OUT;
522+
510523
snd_hda_codec_write(codec, pin_nid, 0,
511-
AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
524+
AC_VERB_SET_PIN_WIDGET_CONTROL, pin_out);
512525
}
513526

514527
static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t cvt_nid)
@@ -1735,6 +1748,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
17351748
struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
17361749
hda_nid_t pin_nid = per_pin->pin_nid;
17371750
bool non_pcm;
1751+
int pinctl;
17381752

17391753
non_pcm = check_non_pcm_per_cvt(codec, cvt_nid);
17401754
mutex_lock(&per_pin->lock);
@@ -1744,6 +1758,14 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
17441758
hdmi_setup_audio_infoframe(codec, per_pin, non_pcm);
17451759
mutex_unlock(&per_pin->lock);
17461760

1761+
if (spec->dyn_pin_out) {
1762+
pinctl = snd_hda_codec_read(codec, pin_nid, 0,
1763+
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
1764+
snd_hda_codec_write(codec, pin_nid, 0,
1765+
AC_VERB_SET_PIN_WIDGET_CONTROL,
1766+
pinctl | PIN_OUT);
1767+
}
1768+
17471769
return spec->ops.setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
17481770
}
17491771

@@ -1763,6 +1785,7 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
17631785
int cvt_idx, pin_idx;
17641786
struct hdmi_spec_per_cvt *per_cvt;
17651787
struct hdmi_spec_per_pin *per_pin;
1788+
int pinctl;
17661789

17671790
if (hinfo->nid) {
17681791
cvt_idx = cvt_nid_to_cvt_index(spec, hinfo->nid);
@@ -1779,6 +1802,14 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
17791802
return -EINVAL;
17801803
per_pin = get_pin(spec, pin_idx);
17811804

1805+
if (spec->dyn_pin_out) {
1806+
pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
1807+
AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
1808+
snd_hda_codec_write(codec, per_pin->pin_nid, 0,
1809+
AC_VERB_SET_PIN_WIDGET_CONTROL,
1810+
pinctl & ~PIN_OUT);
1811+
}
1812+
17821813
snd_hda_spdif_ctls_unassign(codec, pin_idx);
17831814

17841815
mutex_lock(&per_pin->lock);
@@ -2840,6 +2871,7 @@ static int patch_nvhdmi(struct hda_codec *codec)
28402871
return err;
28412872

28422873
spec = codec->spec;
2874+
spec->dyn_pin_out = true;
28432875

28442876
spec->ops.chmap_cea_alloc_validate_get_type =
28452877
nvhdmi_chmap_cea_alloc_validate_get_type;

sound/pci/hda/patch_realtek.c

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,6 +1819,7 @@ enum {
18191819
ALC889_FIXUP_DAC_ROUTE,
18201820
ALC889_FIXUP_MBP_VREF,
18211821
ALC889_FIXUP_IMAC91_VREF,
1822+
ALC889_FIXUP_MBA11_VREF,
18221823
ALC889_FIXUP_MBA21_VREF,
18231824
ALC882_FIXUP_INV_DMIC,
18241825
ALC882_FIXUP_NO_PRIMARY_HP,
@@ -1949,6 +1950,16 @@ static void alc889_fixup_imac91_vref(struct hda_codec *codec,
19491950
alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
19501951
}
19511952

1953+
/* Set VREF on speaker pins on mba11 */
1954+
static void alc889_fixup_mba11_vref(struct hda_codec *codec,
1955+
const struct hda_fixup *fix, int action)
1956+
{
1957+
static hda_nid_t nids[1] = { 0x18 };
1958+
1959+
if (action == HDA_FIXUP_ACT_INIT)
1960+
alc889_fixup_mac_pins(codec, nids, ARRAY_SIZE(nids));
1961+
}
1962+
19521963
/* Set VREF on speaker pins on mba21 */
19531964
static void alc889_fixup_mba21_vref(struct hda_codec *codec,
19541965
const struct hda_fixup *fix, int action)
@@ -2167,6 +2178,12 @@ static const struct hda_fixup alc882_fixups[] = {
21672178
.chained = true,
21682179
.chain_id = ALC882_FIXUP_GPIO1,
21692180
},
2181+
[ALC889_FIXUP_MBA11_VREF] = {
2182+
.type = HDA_FIXUP_FUNC,
2183+
.v.func = alc889_fixup_mba11_vref,
2184+
.chained = true,
2185+
.chain_id = ALC889_FIXUP_MBP_VREF,
2186+
},
21702187
[ALC889_FIXUP_MBA21_VREF] = {
21712188
.type = HDA_FIXUP_FUNC,
21722189
.v.func = alc889_fixup_mba21_vref,
@@ -2242,7 +2259,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
22422259
SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
22432260
SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889_FIXUP_MBP_VREF),
22442261
SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
2245-
SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBP_VREF),
2262+
SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC889_FIXUP_MBA11_VREF),
22462263
SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC889_FIXUP_MBA21_VREF),
22472264
SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889_FIXUP_MBP_VREF),
22482265
SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
@@ -3833,6 +3850,7 @@ enum {
38333850
ALC269_FIXUP_ACER_AC700,
38343851
ALC269_FIXUP_LIMIT_INT_MIC_BOOST,
38353852
ALC269VB_FIXUP_ASUS_ZENBOOK,
3853+
ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A,
38363854
ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED,
38373855
ALC269VB_FIXUP_ORDISSIMO_EVE2,
38383856
ALC283_FIXUP_CHROME_BOOK,
@@ -4126,6 +4144,17 @@ static const struct hda_fixup alc269_fixups[] = {
41264144
.chained = true,
41274145
.chain_id = ALC269VB_FIXUP_DMIC,
41284146
},
4147+
[ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A] = {
4148+
.type = HDA_FIXUP_VERBS,
4149+
.v.verbs = (const struct hda_verb[]) {
4150+
/* class-D output amp +5dB */
4151+
{ 0x20, AC_VERB_SET_COEF_INDEX, 0x12 },
4152+
{ 0x20, AC_VERB_SET_PROC_COEF, 0x2800 },
4153+
{}
4154+
},
4155+
.chained = true,
4156+
.chain_id = ALC269VB_FIXUP_ASUS_ZENBOOK,
4157+
},
41294158
[ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
41304159
.type = HDA_FIXUP_FUNC,
41314160
.v.func = alc269_fixup_limit_int_mic_boost,
@@ -4265,6 +4294,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
42654294
SND_PCI_QUIRK(0x1028, 0x063e, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
42664295
SND_PCI_QUIRK(0x1028, 0x063f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
42674296
SND_PCI_QUIRK(0x1028, 0x0640, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4297+
SND_PCI_QUIRK(0x1028, 0x064d, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
42684298
SND_PCI_QUIRK(0x1028, 0x0651, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
42694299
SND_PCI_QUIRK(0x1028, 0x0652, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
42704300
SND_PCI_QUIRK(0x1028, 0x0653, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
@@ -4282,7 +4312,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
42824312
SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
42834313
SND_PCI_QUIRK(0x1043, 0x115d, "Asus 1015E", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
42844314
SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
4285-
SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK),
4315+
SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
42864316
SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
42874317
SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
42884318
SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),

sound/pci/oxygen/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
snd-oxygen-lib-objs := oxygen_io.o oxygen_lib.o oxygen_mixer.o oxygen_pcm.o
2-
snd-oxygen-objs := oxygen.o xonar_dg.o
2+
snd-oxygen-objs := oxygen.o xonar_dg_mixer.o xonar_dg.o
33
snd-virtuoso-objs := virtuoso.o xonar_lib.o \
44
xonar_pcm179x.o xonar_cs43xx.o xonar_wm87x6.o xonar_hdmi.o
55

sound/pci/oxygen/cs4245.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,9 @@
102102
#define CS4245_ADC_OVFL 0x02
103103
#define CS4245_ADC_UNDRFL 0x01
104104

105+
#define CS4245_SPI_ADDRESS_S (0x9e << 16)
106+
#define CS4245_SPI_WRITE_S (0 << 16)
105107

106-
#define CS4245_SPI_ADDRESS (0x9e << 16)
107-
#define CS4245_SPI_WRITE (0 << 16)
108+
#define CS4245_SPI_ADDRESS 0x9e
109+
#define CS4245_SPI_WRITE 0
110+
#define CS4245_SPI_READ 1

sound/pci/oxygen/oxygen.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ void oxygen_write_ac97(struct oxygen *chip, unsigned int codec,
198198
void oxygen_write_ac97_masked(struct oxygen *chip, unsigned int codec,
199199
unsigned int index, u16 data, u16 mask);
200200

201-
void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data);
201+
int oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data);
202202
void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data);
203203

204204
void oxygen_reset_uart(struct oxygen *chip);

0 commit comments

Comments
 (0)