From e2681a1bf5ae053426a6c5c1daaed17b2f95efe6 Mon Sep 17 00:00:00 2001 From: Nicolin Chen Date: Thu, 27 Mar 2014 19:06:59 +0800 Subject: ASoC: fsl_sai: Add isr to deal with error flag It's quite cricial to clear error flags because SAI might hang if getting FIFO underrun during playback (I haven't confirmed the same issue on Rx overflow though). So this patch enables those irq and adds isr() to clear the flags so as to keep playback entirely safe. Signed-off-by: Nicolin Chen Signed-off-by: Mark Brown --- sound/soc/fsl/fsl_sai.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++-- sound/soc/fsl/fsl_sai.h | 15 +++++++++ 2 files changed, 97 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index c4a4231..0bc98bb 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -23,6 +23,71 @@ #include "fsl_sai.h" +#define FSL_SAI_FLAGS (FSL_SAI_CSR_SEIE |\ + FSL_SAI_CSR_FEIE) + +static irqreturn_t fsl_sai_isr(int irq, void *devid) +{ + struct fsl_sai *sai = (struct fsl_sai *)devid; + struct device *dev = &sai->pdev->dev; + u32 xcsr, mask; + + /* Only handle those what we enabled */ + mask = (FSL_SAI_FLAGS >> FSL_SAI_CSR_xIE_SHIFT) << FSL_SAI_CSR_xF_SHIFT; + + /* Tx IRQ */ + regmap_read(sai->regmap, FSL_SAI_TCSR, &xcsr); + xcsr &= mask; + + if (xcsr & FSL_SAI_CSR_WSF) + dev_dbg(dev, "isr: Start of Tx word detected\n"); + + if (xcsr & FSL_SAI_CSR_SEF) + dev_warn(dev, "isr: Tx Frame sync error detected\n"); + + if (xcsr & FSL_SAI_CSR_FEF) { + dev_warn(dev, "isr: Transmit underrun detected\n"); + /* FIFO reset for safety */ + xcsr |= FSL_SAI_CSR_FR; + } + + if (xcsr & FSL_SAI_CSR_FWF) + dev_dbg(dev, "isr: Enabled transmit FIFO is empty\n"); + + if (xcsr & FSL_SAI_CSR_FRF) + dev_dbg(dev, "isr: Transmit FIFO watermark has been reached\n"); + + regmap_update_bits(sai->regmap, FSL_SAI_TCSR, + FSL_SAI_CSR_xF_W_MASK | FSL_SAI_CSR_FR, xcsr); + + /* Rx IRQ */ + regmap_read(sai->regmap, FSL_SAI_RCSR, &xcsr); + xcsr &= mask; + + if (xcsr & FSL_SAI_CSR_WSF) + dev_dbg(dev, "isr: Start of Rx word detected\n"); + + if (xcsr & FSL_SAI_CSR_SEF) + dev_warn(dev, "isr: Rx Frame sync error detected\n"); + + if (xcsr & FSL_SAI_CSR_FEF) { + dev_warn(dev, "isr: Receive overflow detected\n"); + /* FIFO reset for safety */ + xcsr |= FSL_SAI_CSR_FR; + } + + if (xcsr & FSL_SAI_CSR_FWF) + dev_dbg(dev, "isr: Enabled receive FIFO is full\n"); + + if (xcsr & FSL_SAI_CSR_FRF) + dev_dbg(dev, "isr: Receive FIFO watermark has been reached\n"); + + regmap_update_bits(sai->regmap, FSL_SAI_RCSR, + FSL_SAI_CSR_xF_W_MASK | FSL_SAI_CSR_FR, xcsr); + + return IRQ_HANDLED; +} + static int fsl_sai_set_dai_sysclk_tr(struct snd_soc_dai *cpu_dai, int clk_id, unsigned int freq, int fsl_dir) { @@ -373,8 +438,8 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai) { struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev); - regmap_update_bits(sai->regmap, FSL_SAI_TCSR, 0xffffffff, 0x0); - regmap_update_bits(sai->regmap, FSL_SAI_RCSR, 0xffffffff, 0x0); + regmap_update_bits(sai->regmap, FSL_SAI_TCSR, 0xffffffff, FSL_SAI_FLAGS); + regmap_update_bits(sai->regmap, FSL_SAI_RCSR, 0xffffffff, FSL_SAI_FLAGS); regmap_update_bits(sai->regmap, FSL_SAI_TCR1, FSL_SAI_CR1_RFW_MASK, FSL_SAI_MAXBURST_TX * 2); regmap_update_bits(sai->regmap, FSL_SAI_RCR1, FSL_SAI_CR1_RFW_MASK, @@ -490,12 +555,14 @@ static int fsl_sai_probe(struct platform_device *pdev) struct fsl_sai *sai; struct resource *res; void __iomem *base; - int ret; + int irq, ret; sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL); if (!sai) return -ENOMEM; + sai->pdev = pdev; + sai->big_endian_regs = of_property_read_bool(np, "big-endian-regs"); if (sai->big_endian_regs) fsl_sai_regmap_config.val_format_endian = REGMAP_ENDIAN_BIG; @@ -514,6 +581,18 @@ static int fsl_sai_probe(struct platform_device *pdev) return PTR_ERR(sai->regmap); } + irq = platform_get_irq(pdev, 0); + if (irq < 0) { + dev_err(&pdev->dev, "no irq for node %s\n", np->full_name); + return irq; + } + + ret = devm_request_irq(&pdev->dev, irq, fsl_sai_isr, 0, np->name, sai); + if (ret) { + dev_err(&pdev->dev, "failed to claim irq %u\n", irq); + return ret; + } + sai->dma_params_rx.addr = res->start + FSL_SAI_RDR; sai->dma_params_tx.addr = res->start + FSL_SAI_TDR; sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX; diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h index e432260..a264185 100644 --- a/sound/soc/fsl/fsl_sai.h +++ b/sound/soc/fsl/fsl_sai.h @@ -37,7 +37,21 @@ /* SAI Transmit/Recieve Control Register */ #define FSL_SAI_CSR_TERE BIT(31) +#define FSL_SAI_CSR_FR BIT(25) +#define FSL_SAI_CSR_xF_SHIFT 16 +#define FSL_SAI_CSR_xF_W_SHIFT 18 +#define FSL_SAI_CSR_xF_MASK (0x1f << FSL_SAI_CSR_xF_SHIFT) +#define FSL_SAI_CSR_xF_W_MASK (0x7 << FSL_SAI_CSR_xF_W_SHIFT) +#define FSL_SAI_CSR_WSF BIT(20) +#define FSL_SAI_CSR_SEF BIT(19) +#define FSL_SAI_CSR_FEF BIT(18) #define FSL_SAI_CSR_FWF BIT(17) +#define FSL_SAI_CSR_FRF BIT(16) +#define FSL_SAI_CSR_xIE_SHIFT 8 +#define FSL_SAI_CSR_WSIE BIT(12) +#define FSL_SAI_CSR_SEIE BIT(11) +#define FSL_SAI_CSR_FEIE BIT(10) +#define FSL_SAI_CSR_FWIE BIT(9) #define FSL_SAI_CSR_FRIE BIT(8) #define FSL_SAI_CSR_FRDE BIT(0) @@ -99,6 +113,7 @@ #define FSL_SAI_MAXBURST_RX 6 struct fsl_sai { + struct platform_device *pdev; struct regmap *regmap; bool big_endian_regs; -- cgit v1.1 From 03a620d8fa5f5423b87aa93e49bfa79b731c5790 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 31 Mar 2014 11:05:17 -0600 Subject: ASoC: rt5640: add an of_match table Add a device tree match table. This serves to make the driver's support of device tree more explicit. Perhaps the fallback for DT matching to using the i2c_device_id table will go away one day, since it fails in face of devices from different vendors with the same name. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/codecs/rt5640.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c index 0061ae6..68b4dd6 100644 --- a/sound/soc/codecs/rt5640.c +++ b/sound/soc/codecs/rt5640.c @@ -2074,6 +2074,14 @@ static const struct i2c_device_id rt5640_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id); +#if defined(CONFIG_OF) +static const struct of_device_id rt5640_of_match[] = { + { .compatible = "realtek,rt5640", }, + {}, +}; +MODULE_DEVICE_TABLE(of, rt5640_of_match); +#endif + #ifdef CONFIG_ACPI static struct acpi_device_id rt5640_acpi_match[] = { { "INT33CA", 0 }, @@ -2203,6 +2211,7 @@ static struct i2c_driver rt5640_i2c_driver = { .name = "rt5640", .owner = THIS_MODULE, .acpi_match_table = ACPI_PTR(rt5640_acpi_match), + .of_match_table = of_match_ptr(rt5640_of_match), }, .probe = rt5640_i2c_probe, .remove = rt5640_i2c_remove, -- cgit v1.1 From e3efe3bedb6592465d9a2bd116d5e611dae362c3 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 31 Mar 2014 12:25:24 -0600 Subject: ASoC: alc5632: fix uninit var in alc5632_probe() alc5632_probe() returns ret, yet it is not initialized or set anywhere. This ends up causing the function to appear to fail, and audio not to work on the Toshiba AC100, with my compiler at least. This function used to set ret in all cases, but recent cleanup removed that. Fixes: 5d6be5aa6bec ("ASoC: codec: Simplify ASoC probe code.") Signed-off-by: Stephen Warren Reviewed-by: Thierry Reding Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index ec071a6..3ee8d4e 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -1061,7 +1061,6 @@ static int alc5632_resume(struct snd_soc_codec *codec) static int alc5632_probe(struct snd_soc_codec *codec) { struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec); - int ret; /* power on device */ alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY); @@ -1075,7 +1074,7 @@ static int alc5632_probe(struct snd_soc_codec *codec) return -EINVAL; } - return ret; + return 0; } /* power down chip */ -- cgit v1.1 From c31b0cb1f1a19bc551875e07e9dd7c531ac3580e Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 31 Mar 2014 12:38:16 -0600 Subject: ASoC: alc5632: add an of_match table Add a device tree match table. This serves to make the driver's support of device tree more explicit. Perhaps the fallback for DT matching to using the i2c_device_id table will go away one day, since it fails in face of devices from different vendors with the same name. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/codecs/alc5632.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index 3ee8d4e..85942ca 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -1190,11 +1190,18 @@ static const struct i2c_device_id alc5632_i2c_table[] = { }; MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table); +static const struct of_device_id alc5632_of_match[] = { + { .compatible = "realtek,alc5632", }, + { } +}; +MODULE_DEVICE_TABLE(of, alc5632_of_match); + /* i2c codec control layer */ static struct i2c_driver alc5632_i2c_driver = { .driver = { .name = "alc5632", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(alc5632_of_match), }, .probe = alc5632_i2c_probe, .remove = alc5632_i2c_remove, -- cgit v1.1 From 2951f93f431a2fc8956a3b13882dc07cb5b8b2b9 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 31 Mar 2014 12:38:18 -0600 Subject: ASoC: max98090: add an of_match table Add a device tree match table. This serves to make the driver's support of device tree more explicit. Perhaps the fallback for DT matching to using the i2c_device_id table will go away one day, since it fails in face of devices from different vendors with the same name. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/codecs/max98090.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c index 361862d..83a773c 100644 --- a/sound/soc/codecs/max98090.c +++ b/sound/soc/codecs/max98090.c @@ -2406,11 +2406,18 @@ static const struct i2c_device_id max98090_i2c_id[] = { }; MODULE_DEVICE_TABLE(i2c, max98090_i2c_id); +static const struct of_device_id max98090_of_match[] = { + { .compatible = "maxim,max98090", }, + { } +}; +MODULE_DEVICE_TABLE(of, max98090_of_match); + static struct i2c_driver max98090_i2c_driver = { .driver = { .name = "max98090", .owner = THIS_MODULE, .pm = &max98090_pm, + .of_match_table = of_match_ptr(max98090_of_match), }, .probe = max98090_i2c_probe, .remove = max98090_i2c_remove, -- cgit v1.1 From 3534b842a83549eb4d06613c616844c8762e9fd0 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 31 Mar 2014 12:38:17 -0600 Subject: ASoC: tlv320aic23: add an of_match table Add a device tree match table. This serves to make the driver's support of device tree more explicit. Perhaps the fallback for DT matching to using the i2c_device_id table will go away one day, since it fails in face of devices from different vendors with the same name. Signed-off-by: Stephen Warren Signed-off-by: Mark Brown --- sound/soc/codecs/tlv320aic23-i2c.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sound') diff --git a/sound/soc/codecs/tlv320aic23-i2c.c b/sound/soc/codecs/tlv320aic23-i2c.c index 20fc460..b73c94e 100644 --- a/sound/soc/codecs/tlv320aic23-i2c.c +++ b/sound/soc/codecs/tlv320aic23-i2c.c @@ -43,9 +43,16 @@ static const struct i2c_device_id tlv320aic23_id[] = { MODULE_DEVICE_TABLE(i2c, tlv320aic23_id); +static const struct of_device_id tlv320aic23_of_match[] = { + { .compatible = "ti,tlv320aic23", }, + { } +}; +MODULE_DEVICE_TABLE(of, tlv320aic23_of_match); + static struct i2c_driver tlv320aic23_i2c_driver = { .driver = { .name = "tlv320aic23-codec", + .of_match_table = of_match_ptr(tlv320aic23_of_match), }, .probe = tlv320aic23_i2c_probe, .remove = __exit_p(tlv320aic23_i2c_remove), -- cgit v1.1 From 8314f22589297bdb100788112f901fe885edacbc Mon Sep 17 00:00:00 2001 From: Kailang Yang Date: Thu, 3 Apr 2014 17:28:39 +0800 Subject: ALSA: hda/realtek - Fixed single output machine get empty hp sense If it only has single output of HP out of machine. The driver parser will copy hp_pins to line_out_pins. hp_pins will empty for alc283_init and alc283_shutup functions. This will cause not have value for hp_pin_sense. Add check line_out_type code will solve it . Signed-off-by: Kailang Yang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ea2351d..dba2972 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3026,6 +3026,11 @@ static void alc283_init(struct hda_codec *codec) bool hp_pin_sense; int val; + if (!spec->gen.autocfg.hp_outs) { + if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) + hp_pin = spec->gen.autocfg.line_out_pins[0]; + } + alc283_restore_default_value(codec); if (!hp_pin) @@ -3062,6 +3067,11 @@ static void alc283_shutup(struct hda_codec *codec) bool hp_pin_sense; int val; + if (!spec->gen.autocfg.hp_outs) { + if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT) + hp_pin = spec->gen.autocfg.line_out_pins[0]; + } + if (!hp_pin) { alc269_shutup(codec); return; -- cgit v1.1 From 415d555e6b398b00fc1733f0113065a54df9106a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 3 Apr 2014 11:51:21 +0200 Subject: ALSA: hda - Fix silent speaker output due to mute LED fixup The recent fixups for HP laptops to support the mute LED made the speaker output silent on some machines. It turned out that they use the NID 0x18 for the speaker while it's also used for controlling the LED via VREF bits although the current driver code blindly assumes that such a node is a mic pin (where 0x18 is usually so). This patch fixes the problem by only changing the VREF bits and keeping the other pin ctl bits. Reported-and-tested-by: Hui Wang Cc: Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index dba2972..0531077 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3371,8 +3371,9 @@ static void alc269_fixup_mic_mute_hook(void *private_data, int enabled) if (spec->mute_led_polarity) enabled = !enabled; - pinval = AC_PINCTL_IN_EN | - (enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80); + pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid); + pinval &= ~AC_PINCTL_VREFEN; + pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80; if (spec->mute_led_nid) snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval); } -- cgit v1.1 From 9229bc1500100226ef4d2dbe51446fd8472a3cea Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Thu, 3 Apr 2014 14:49:46 +0200 Subject: ALSA: cs8427: separate HW initialization Separate HW initialization from device creation. This is needed for suspend/resume support. Signed-off-by: Ondrej Zary Signed-off-by: Takashi Iwai --- sound/i2c/cs8427.c | 57 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 38 insertions(+), 19 deletions(-) (limited to 'sound') diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c index 6c2dc38..7e21621 100644 --- a/sound/i2c/cs8427.c +++ b/sound/i2c/cs8427.c @@ -150,10 +150,8 @@ static void snd_cs8427_free(struct snd_i2c_device *device) kfree(device->private_data); } -int snd_cs8427_create(struct snd_i2c_bus *bus, - unsigned char addr, - unsigned int reset_timeout, - struct snd_i2c_device **r_cs8427) +int snd_cs8427_init(struct snd_i2c_bus *bus, + struct snd_i2c_device *device) { static unsigned char initvals1[] = { CS8427_REG_CONTROL1 | CS8427_REG_AUTOINC, @@ -200,22 +198,10 @@ int snd_cs8427_create(struct snd_i2c_bus *bus, Inhibit E->F transfers. */ CS8427_UD | CS8427_EFTUI | CS8427_DETUI, }; + struct cs8427 *chip = device->private_data; int err; - struct cs8427 *chip; - struct snd_i2c_device *device; unsigned char buf[24]; - if ((err = snd_i2c_device_create(bus, "CS8427", - CS8427_ADDR | (addr & 7), - &device)) < 0) - return err; - chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL); - if (chip == NULL) { - snd_i2c_device_free(device); - return -ENOMEM; - } - device->private_free = snd_cs8427_free; - snd_i2c_lock(bus); err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER); if (err != CS8427_VER8427A) { @@ -264,10 +250,44 @@ int snd_cs8427_create(struct snd_i2c_bus *bus, snd_i2c_unlock(bus); /* turn on run bit and rock'n'roll */ + snd_cs8427_reset(device); + + return 0; + +__fail: + snd_i2c_unlock(bus); + + return err; +} +EXPORT_SYMBOL(snd_cs8427_init); + +int snd_cs8427_create(struct snd_i2c_bus *bus, + unsigned char addr, + unsigned int reset_timeout, + struct snd_i2c_device **r_cs8427) +{ + int err; + struct cs8427 *chip; + struct snd_i2c_device *device; + + err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7), + &device); + if (err < 0) + return err; + chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL); + if (chip == NULL) { + snd_i2c_device_free(device); + return -ENOMEM; + } + device->private_free = snd_cs8427_free; + if (reset_timeout < 1) reset_timeout = 1; chip->reset_timeout = reset_timeout; - snd_cs8427_reset(device); + + err = snd_cs8427_init(bus, device); + if (err) + goto __fail; #if 0 // it's nice for read tests { @@ -286,7 +306,6 @@ int snd_cs8427_create(struct snd_i2c_bus *bus, return 0; __fail: - snd_i2c_unlock(bus); snd_i2c_device_free(device); return err < 0 ? err : -EIO; } -- cgit v1.1 From d272ccd0d084766a3e2adba10bea47091b6d68e7 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Wed, 2 Apr 2014 22:35:33 +0200 Subject: ALSA: ice1712: Add S/PDIF suspend support for ICE1712-based M-Audio cards Add S/PDIF suspend support for M-Audio cards based on ICE1712 chip. Tested (playback only) on Audiophile 24/96. Capture will probably not work. Signed-off-by: Ondrej Zary Signed-off-by: Takashi Iwai --- sound/pci/ice1712/delta.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'sound') diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c index ed2144e..b3eed8d 100644 --- a/sound/pci/ice1712/delta.c +++ b/sound/pci/ice1712/delta.c @@ -580,6 +580,28 @@ static struct snd_ak4xxx_private akm_vx442_priv = { static int snd_ice1712_delta_resume(struct snd_ice1712 *ice) { unsigned char akm_backup[AK4XXX_IMAGE_SIZE]; + + /* init spdif */ + switch (ice->eeprom.subvendor) { + case ICE1712_SUBDEVICE_AUDIOPHILE: + case ICE1712_SUBDEVICE_DELTA410: + case ICE1712_SUBDEVICE_DELTA1010E: + case ICE1712_SUBDEVICE_DELTA1010LT: + case ICE1712_SUBDEVICE_VX442: + case ICE1712_SUBDEVICE_DELTA66E: + snd_cs8427_init(ice->i2c, ice->cs8427); + break; + case ICE1712_SUBDEVICE_DELTA1010: + case ICE1712_SUBDEVICE_MEDIASTATION: + /* nothing */ + break; + case ICE1712_SUBDEVICE_DELTADIO2496: + case ICE1712_SUBDEVICE_DELTA66: + /* Set spdif defaults */ + snd_ice1712_delta_cs8403_spdif_write(ice, ice->spdif.cs8403_bits); + break; + } + /* init codec and restore registers */ if (ice->akm_codecs) { memcpy(akm_backup, ice->akm->images, sizeof(akm_backup)); -- cgit v1.1 From 06b4b813058f6092ded5d7e0d92d4c34d92975bd Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Fri, 4 Apr 2014 11:04:35 +0800 Subject: ASoC: cs42xx8: Check return value of regmap_read and report correct chipid value Fix checking return value of regmap_read(). Also fix reporting the chip_id value. CS42XX8_CHIPID_CHIP_ID_MASK is 0xF0, so the chip_id value is (val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4). Signed-off-by: Axel Lin Acked-by: Paul Handrigan Acked-by: Brian Austin Acked-by: Nicolin Chen Signed-off-by: Mark Brown --- sound/soc/codecs/cs42xx8.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42xx8.c b/sound/soc/codecs/cs42xx8.c index 082299a..8502032 100644 --- a/sound/soc/codecs/cs42xx8.c +++ b/sound/soc/codecs/cs42xx8.c @@ -495,17 +495,16 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap) regcache_cache_bypass(cs42xx8->regmap, true); /* Validate the chip ID */ - regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val); - if (val < 0) { - dev_err(dev, "failed to get device ID: %x", val); - ret = -EINVAL; + ret = regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val); + if (ret < 0) { + dev_err(dev, "failed to get device ID, ret = %d", ret); goto err_enable; } /* The top four bits of the chip ID should be 0000 */ - if ((val & CS42XX8_CHIPID_CHIP_ID_MASK) != 0x00) { + if (((val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4) != 0x00) { dev_err(dev, "unmatched chip ID: %d\n", - val & CS42XX8_CHIPID_CHIP_ID_MASK); + (val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4); ret = -EINVAL; goto err_enable; } -- cgit v1.1 From f78b1e0a8b85ed80b38e9b603b675dd7a0923128 Mon Sep 17 00:00:00 2001 From: Christoph Jaeger Date: Fri, 4 Apr 2014 13:44:19 +0200 Subject: ASoC: alc56(23|32): fix undefined return value of probing code Commit 5d6be5aa ("ASoC: codec: Simplify ASoC probe code.") left variable 'ret', whose value is returned, uninitialized. Since it is not used otherwise, remove it. Signed-off-by: Christoph Jaeger Signed-off-by: Mark Brown --- sound/soc/codecs/alc5623.c | 3 +-- sound/soc/codecs/alc5632.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c index 09f7e77..f500905 100644 --- a/sound/soc/codecs/alc5623.c +++ b/sound/soc/codecs/alc5623.c @@ -902,7 +902,6 @@ static int alc5623_probe(struct snd_soc_codec *codec) { struct alc5623_priv *alc5623 = snd_soc_codec_get_drvdata(codec); struct snd_soc_dapm_context *dapm = &codec->dapm; - int ret; alc5623_reset(codec); @@ -961,7 +960,7 @@ static int alc5623_probe(struct snd_soc_codec *codec) return -EINVAL; } - return ret; + return 0; } /* power down chip */ diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c index ec071a6..3ee8d4e 100644 --- a/sound/soc/codecs/alc5632.c +++ b/sound/soc/codecs/alc5632.c @@ -1061,7 +1061,6 @@ static int alc5632_resume(struct snd_soc_codec *codec) static int alc5632_probe(struct snd_soc_codec *codec) { struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec); - int ret; /* power on device */ alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY); @@ -1075,7 +1074,7 @@ static int alc5632_probe(struct snd_soc_codec *codec) return -EINVAL; } - return ret; + return 0; } /* power down chip */ -- cgit v1.1 From 6e61246f5aeaede80e7a00e8b1de7ae07b1315e7 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Thu, 3 Apr 2014 23:09:37 +0200 Subject: ALSA: ice1712: restore AK4xxx volumes on resume Also restore AK4xxx mixer volumes on resume for M-Audio ICE1712-based cards. This fixes incorrect (sound working) zero mixer volumes after resume. Signed-off-by: Ondrej Zary Signed-off-by: Takashi Iwai --- sound/pci/ice1712/delta.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c index b3eed8d..496dbd0 100644 --- a/sound/pci/ice1712/delta.c +++ b/sound/pci/ice1712/delta.c @@ -579,7 +579,8 @@ static struct snd_ak4xxx_private akm_vx442_priv = { #ifdef CONFIG_PM_SLEEP static int snd_ice1712_delta_resume(struct snd_ice1712 *ice) { - unsigned char akm_backup[AK4XXX_IMAGE_SIZE]; + unsigned char akm_img_bak[AK4XXX_IMAGE_SIZE]; + unsigned char akm_vol_bak[AK4XXX_IMAGE_SIZE]; /* init spdif */ switch (ice->eeprom.subvendor) { @@ -604,9 +605,11 @@ static int snd_ice1712_delta_resume(struct snd_ice1712 *ice) /* init codec and restore registers */ if (ice->akm_codecs) { - memcpy(akm_backup, ice->akm->images, sizeof(akm_backup)); + memcpy(akm_img_bak, ice->akm->images, sizeof(akm_img_bak)); + memcpy(akm_vol_bak, ice->akm->volumes, sizeof(akm_vol_bak)); snd_akm4xxx_init(ice->akm); - memcpy(ice->akm->images, akm_backup, sizeof(akm_backup)); + memcpy(ice->akm->images, akm_img_bak, sizeof(akm_img_bak)); + memcpy(ice->akm->volumes, akm_vol_bak, sizeof(akm_vol_bak)); snd_akm4xxx_reset(ice->akm, 0); } -- cgit v1.1 From 6ea0cae73d3b5ee963bea9348220b61fd8960743 Mon Sep 17 00:00:00 2001 From: Ondrej Zary Date: Thu, 3 Apr 2014 23:09:38 +0200 Subject: ALSA: ice1712: Save/restore routing and rate registers Save/restore routing and rate registers during suspend/resume. This fixes S/PDIF input being disabled after resume. Tested with Audiophile 24/96. Signed-off-by: Ondrej Zary Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1712.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 291672f..da00549 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -1048,6 +1048,8 @@ __out: old = inb(ICEMT(ice, RATE)); if (!force && old == val) goto __out; + + ice->cur_rate = rate; outb(val, ICEMT(ice, RATE)); spin_unlock_irqrestore(&ice->reg_lock, flags); @@ -2832,6 +2834,12 @@ static int snd_ice1712_suspend(struct device *dev) snd_pcm_suspend_all(ice->pcm_ds); snd_ac97_suspend(ice->ac97); + spin_lock_irq(&ice->reg_lock); + ice->pm_saved_is_spdif_master = is_spdif_master(ice); + ice->pm_saved_spdif_ctrl = inw(ICEMT(ice, ROUTE_SPDOUT)); + ice->pm_saved_route = inw(ICEMT(ice, ROUTE_PSDOUT03)); + spin_unlock_irq(&ice->reg_lock); + if (ice->pm_suspend) ice->pm_suspend(ice); @@ -2846,6 +2854,7 @@ static int snd_ice1712_resume(struct device *dev) struct pci_dev *pci = to_pci_dev(dev); struct snd_card *card = dev_get_drvdata(dev); struct snd_ice1712 *ice = card->private_data; + int rate; if (!ice->pm_suspend_enabled) return 0; @@ -2860,14 +2869,37 @@ static int snd_ice1712_resume(struct device *dev) pci_set_master(pci); + if (ice->cur_rate) + rate = ice->cur_rate; + else + rate = PRO_RATE_DEFAULT; + if (snd_ice1712_chip_init(ice) < 0) { snd_card_disconnect(card); return -EIO; } + ice->cur_rate = rate; + if (ice->pm_resume) ice->pm_resume(ice); + if (ice->pm_saved_is_spdif_master) { + /* switching to external clock via SPDIF */ + spin_lock_irq(&ice->reg_lock); + outb(inb(ICEMT(ice, RATE)) | ICE1712_SPDIF_MASTER, + ICEMT(ice, RATE)); + spin_unlock_irq(&ice->reg_lock); + snd_ice1712_set_input_clock_source(ice, 1); + } else { + /* internal on-card clock */ + snd_ice1712_set_pro_rate(ice, rate, 1); + snd_ice1712_set_input_clock_source(ice, 0); + } + + outw(ice->pm_saved_spdif_ctrl, ICEMT(ice, ROUTE_SPDOUT)); + outw(ice->pm_saved_route, ICEMT(ice, ROUTE_PSDOUT03)); + if (ice->ac97) snd_ac97_resume(ice->ac97); -- cgit v1.1 From 3af5d0524aac70a6df638d6558f4b60dbf0216e7 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Fri, 4 Apr 2014 09:09:08 -0700 Subject: sound/oss: Remove uncompilable DBG macro use Most of it duplicates function tracing and one of them has an uncompilable printf %P use. Others have format/argument mismatches. Remove unused DBG1 macro definition Neaten uart401.c use of ok test around this DBG macro removal. Signed-off-by: Joe Perches Signed-off-by: Takashi Iwai --- sound/oss/ad1848.c | 4 ---- sound/oss/opl3.c | 3 --- sound/oss/pas2_mixer.c | 9 --------- sound/oss/pas2_pcm.c | 18 ------------------ sound/oss/sb_common.c | 4 ---- sound/oss/sb_ess.c | 4 ---- sound/oss/sequencer.c | 6 ------ sound/oss/sound_config.h | 4 ---- sound/oss/soundcard.c | 6 ------ sound/oss/uart401.c | 11 ++--------- 10 files changed, 2 insertions(+), 67 deletions(-) (limited to 'sound') diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index 4918b71..ec1ee07 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c @@ -50,8 +50,6 @@ #include #include -#define DEB(x) -#define DEB1(x) #include "sound_config.h" #include "ad1848.h" @@ -1016,8 +1014,6 @@ static void ad1848_close(int dev) ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_port_info *portc = (ad1848_port_info *) audio_devs[dev]->portc; - DEB(printk("ad1848_close(void)\n")); - devc->intr_active = 0; ad1848_halt(dev); diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c index c5c2440..4709e59 100644 --- a/sound/oss/opl3.c +++ b/sound/oss/opl3.c @@ -275,7 +275,6 @@ static int opl3_kill_note (int devno, int voice, int note, int velocity) devc->v_alloc->map[voice] = 0; map = &pv_map[devc->lv_map[voice]]; - DEB(printk("Kill note %d\n", voice)); if (map->voice_mode == 0) return 0; @@ -873,8 +872,6 @@ static void opl3_aftertouch(int dev, int voice, int pressure) map = &pv_map[devc->lv_map[voice]]; - DEB(printk("Aftertouch %d\n", voice)); - if (map->voice_mode == 0) return; diff --git a/sound/oss/pas2_mixer.c b/sound/oss/pas2_mixer.c index a0bcb85..50b5bd5 100644 --- a/sound/oss/pas2_mixer.c +++ b/sound/oss/pas2_mixer.c @@ -21,10 +21,6 @@ #include "pas2.h" -#ifndef DEB -#define DEB(what) /* (what) */ -#endif - extern int pas_translate_code; extern char pas_model; extern int *pas_osp; @@ -120,8 +116,6 @@ pas_mixer_set(int whichDev, unsigned int level) { int left, right, devmask, changed, i, mixer = 0; - DEB(printk("static int pas_mixer_set(int whichDev = %d, unsigned int level = %X)\n", whichDev, level)); - left = level & 0x7f; right = (level & 0x7f00) >> 8; @@ -207,8 +201,6 @@ pas_mixer_reset(void) { int foo; - DEB(printk("pas2_mixer.c: void pas_mixer_reset(void)\n")); - for (foo = 0; foo < SOUND_MIXER_NRDEVICES; foo++) pas_mixer_set(foo, levels[foo]); @@ -220,7 +212,6 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, void __user *arg) int level,v ; int __user *p = (int __user *)arg; - DEB(printk("pas2_mixer.c: int pas_mixer_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg)); if (cmd == SOUND_MIXER_PRIVATE1) { /* Set loudness bit */ if (get_user(level, p)) return -EFAULT; diff --git a/sound/oss/pas2_pcm.c b/sound/oss/pas2_pcm.c index 6f13ab4..474803b 100644 --- a/sound/oss/pas2_pcm.c +++ b/sound/oss/pas2_pcm.c @@ -22,10 +22,6 @@ #include "pas2.h" -#ifndef DEB -#define DEB(WHAT) -#endif - #define PAS_PCM_INTRBITS (0x08) /* * Sample buffer timer interrupt enable @@ -156,8 +152,6 @@ static int pas_audio_ioctl(int dev, unsigned int cmd, void __user *arg) int val, ret; int __user *p = arg; - DEB(printk("pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg)); - switch (cmd) { case SOUND_PCM_WRITE_RATE: @@ -204,8 +198,6 @@ static int pas_audio_ioctl(int dev, unsigned int cmd, void __user *arg) static void pas_audio_reset(int dev) { - DEB(printk("pas2_pcm.c: static void pas_audio_reset(void)\n")); - pas_write(pas_read(0xF8A) & ~0x40, 0xF8A); /* Disable PCM */ } @@ -214,8 +206,6 @@ static int pas_audio_open(int dev, int mode) int err; unsigned long flags; - DEB(printk("pas2_pcm.c: static int pas_audio_open(int mode = %X)\n", mode)); - spin_lock_irqsave(&pas_lock, flags); if (pcm_busy) { @@ -239,8 +229,6 @@ static void pas_audio_close(int dev) { unsigned long flags; - DEB(printk("pas2_pcm.c: static void pas_audio_close(void)\n")); - spin_lock_irqsave(&pas_lock, flags); pas_audio_reset(dev); @@ -256,8 +244,6 @@ static void pas_audio_output_block(int dev, unsigned long buf, int count, { unsigned long flags, cnt; - DEB(printk("pas2_pcm.c: static void pas_audio_output_block(char *buf = %P, int count = %X)\n", buf, count)); - cnt = count; if (audio_devs[dev]->dmap_out->dma > 3) cnt >>= 1; @@ -303,8 +289,6 @@ static void pas_audio_start_input(int dev, unsigned long buf, int count, unsigned long flags; int cnt; - DEB(printk("pas2_pcm.c: static void pas_audio_start_input(char *buf = %P, int count = %X)\n", buf, count)); - cnt = count; if (audio_devs[dev]->dmap_out->dma > 3) cnt >>= 1; @@ -388,8 +372,6 @@ static struct audio_driver pas_audio_driver = void __init pas_pcm_init(struct address_info *hw_config) { - DEB(printk("pas2_pcm.c: long pas_pcm_init()\n")); - pcm_bitsok = 8; if (pas_read(0xEF8B) & 0x08) pcm_bitsok |= 16; diff --git a/sound/oss/sb_common.c b/sound/oss/sb_common.c index 851a1da..3d50fb4 100644 --- a/sound/oss/sb_common.c +++ b/sound/oss/sb_common.c @@ -226,8 +226,6 @@ int sb_dsp_reset(sb_devc * devc) { int loopc; - DEB(printk("Entered sb_dsp_reset()\n")); - if (devc->model == MDL_ESS) return ess_dsp_reset (devc); /* This is only for non-ESS chips */ @@ -246,8 +244,6 @@ int sb_dsp_reset(sb_devc * devc) return 0; /* Sorry */ } - DEB(printk("sb_dsp_reset() OK\n")); - return 1; } diff --git a/sound/oss/sb_ess.c b/sound/oss/sb_ess.c index 0e7254b..b47a690 100644 --- a/sound/oss/sb_ess.c +++ b/sound/oss/sb_ess.c @@ -865,8 +865,6 @@ printk(KERN_INFO "FKS: ess_dsp_reset 1\n"); ess_show_mixerregs (devc); #endif - DEB(printk("Entered ess_dsp_reset()\n")); - outb(3, DSP_RESET); /* Reset FIFO too */ udelay(10); @@ -881,8 +879,6 @@ ess_show_mixerregs (devc); } ess_extended (devc); - DEB(printk("sb_dsp_reset() OK\n")); - #ifdef FKS_LOGGING printk(KERN_INFO "FKS: dsp_reset 2\n"); ess_show_mixerregs (devc); diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index 9b9f7d3..c0eea1d 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c @@ -216,8 +216,6 @@ int sequencer_write(int dev, struct file *file, const char __user *buf, int coun dev = dev >> 4; - DEB(printk("sequencer_write(dev=%d, count=%d)\n", dev, count)); - if (mode == OPEN_READ) return -EIO; @@ -959,8 +957,6 @@ int sequencer_open(int dev, struct file *file) dev = dev >> 4; mode = translate_mode(file); - DEB(printk("sequencer_open(dev=%d)\n", dev)); - if (!sequencer_ok) { /* printk("Sound card: sequencer not initialized\n");*/ @@ -1133,8 +1129,6 @@ void sequencer_release(int dev, struct file *file) dev = dev >> 4; - DEB(printk("sequencer_release(dev=%d)\n", dev)); - /* * Wait until the queue is empty (if we don't have nonblock) */ diff --git a/sound/oss/sound_config.h b/sound/oss/sound_config.h index 9d35c4c..f2554ab 100644 --- a/sound/oss/sound_config.h +++ b/sound/oss/sound_config.h @@ -123,10 +123,6 @@ static inline int translate_mode(struct file *file) #include "sound_calls.h" #include "dev_table.h" -#ifndef DEB -#define DEB(x) -#endif - #ifndef DDB #define DDB(x) do {} while (0) #endif diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c index e778034..b70c7c8 100644 --- a/sound/oss/soundcard.c +++ b/sound/oss/soundcard.c @@ -154,7 +154,6 @@ static ssize_t sound_read(struct file *file, char __user *buf, size_t count, lof mutex_lock(&soundcard_mutex); - DEB(printk("sound_read(dev=%d, count=%d)\n", dev, count)); switch (dev & 0x0f) { case SND_DEV_DSP: case SND_DEV_DSP16: @@ -180,7 +179,6 @@ static ssize_t sound_write(struct file *file, const char __user *buf, size_t cou int ret = -EINVAL; mutex_lock(&soundcard_mutex); - DEB(printk("sound_write(dev=%d, count=%d)\n", dev, count)); switch (dev & 0x0f) { case SND_DEV_SEQ: case SND_DEV_SEQ2: @@ -206,7 +204,6 @@ static int sound_open(struct inode *inode, struct file *file) int dev = iminor(inode); int retval; - DEB(printk("sound_open(dev=%d)\n", dev)); if ((dev >= SND_NDEVS) || (dev < 0)) { printk(KERN_ERR "Invalid minor device %d\n", dev); return -ENXIO; @@ -257,7 +254,6 @@ static int sound_release(struct inode *inode, struct file *file) int dev = iminor(inode); mutex_lock(&soundcard_mutex); - DEB(printk("sound_release(dev=%d)\n", dev)); switch (dev & 0x0f) { case SND_DEV_CTL: module_put(mixer_devs[dev >> 4]->owner); @@ -351,7 +347,6 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (!access_ok(VERIFY_WRITE, p, len)) return -EFAULT; } - DEB(printk("sound_ioctl(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg)); if (cmd == OSS_GETVERSION) return __put_user(SOUND_VERSION, (int __user *)p); @@ -409,7 +404,6 @@ static unsigned int sound_poll(struct file *file, poll_table * wait) struct inode *inode = file_inode(file); int dev = iminor(inode); - DEB(printk("sound_poll(dev=%d)\n", dev)); switch (dev & 0x0f) { case SND_DEV_SEQ: case SND_DEV_SEQ2: diff --git a/sound/oss/uart401.c b/sound/oss/uart401.c index 5433c6f..62b8869 100644 --- a/sound/oss/uart401.c +++ b/sound/oss/uart401.c @@ -274,19 +274,12 @@ static int reset_uart401(uart401_devc * devc) } } - + /* Flush input before enabling interrupts */ if (ok) - { - DEB(printk("Reset UART401 OK\n")); - } + uart401_input_loop(devc); else DDB(printk("Reset UART401 failed - No hardware detected.\n")); - if (ok) - uart401_input_loop(devc); /* - * Flush input before enabling interrupts - */ - return ok; } -- cgit v1.1 From a14bf88749c5b54bb9c636bcd47c26ea79560ce5 Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Sun, 6 Apr 2014 00:04:35 +0800 Subject: ASoC: cs42l52: Fix mask for REVID BIT[0:2] of register 01h is REVID, so the mask for REVID should be 0x7. Also updates the code to use CS42L52_CHIP_REV_MASK. Signed-off-by: Axel Lin Acked-by: Brian Austin Signed-off-by: Mark Brown --- sound/soc/codecs/cs42l52.c | 2 +- sound/soc/codecs/cs42l52.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c index f0ca6be..460d355 100644 --- a/sound/soc/codecs/cs42l52.c +++ b/sound/soc/codecs/cs42l52.c @@ -1259,7 +1259,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client, } dev_info(&i2c_client->dev, "Cirrus Logic CS42L52, Revision: %02X\n", - reg & 0xFF); + reg & CS42L52_CHIP_REV_MASK); /* Set Platform Data */ if (cs42l52->pdata.mica_diff_cfg) diff --git a/sound/soc/codecs/cs42l52.h b/sound/soc/codecs/cs42l52.h index 6fb8f00..ac445993 100644 --- a/sound/soc/codecs/cs42l52.h +++ b/sound/soc/codecs/cs42l52.h @@ -37,7 +37,7 @@ #define CS42L52_CHIP_REV_A0 0x00 #define CS42L52_CHIP_REV_A1 0x01 #define CS42L52_CHIP_REV_B0 0x02 -#define CS42L52_CHIP_REV_MASK 0x03 +#define CS42L52_CHIP_REV_MASK 0x07 #define CS42L52_PWRCTL1 0x02 #define CS42L52_PWRCTL1_PDN_ALL 0x9F -- cgit v1.1 From de9481cb40339d9bfc1104b53649876fc5f3d432 Mon Sep 17 00:00:00 2001 From: Kailang Yang Date: Mon, 7 Apr 2014 16:41:52 +0800 Subject: ALSA: hda/realtek - Improve HP depop when system change power state on Chromebook It is better to change Mic2-Vref to manual mode. Manual control Mic2-Vref will solve pop noise issue. It will improve pop noise for power on, power off, S3 and resume. Signed-off-by: Kailang Yang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0531077..ca1298a 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4005,6 +4005,10 @@ static void alc283_fixup_chromebook(struct hda_codec *codec, spec->gen.mixer_nid = 0; break; case HDA_FIXUP_ACT_INIT: + /* MIC2-VREF control */ + /* Set to manual mode */ + val = alc_read_coef_idx(codec, 0x06); + alc_write_coef_idx(codec, 0x06, val & ~0x000c); /* Enable Line1 input control by verb */ val = alc_read_coef_idx(codec, 0x1a); alc_write_coef_idx(codec, 0x1a, val | (1 << 4)); -- cgit v1.1 From 05b0006734f2aa728331bfe169f105c4b386858a Mon Sep 17 00:00:00 2001 From: Axel Lin Date: Thu, 3 Apr 2014 19:56:32 +0800 Subject: ASoC: da732x: Print correct major id DA732X_ID_MAJOR_MASK is 0xF0, so the major id is (reg & DA732X_ID_MAJOR_MASK) >> 4. Signed-off-by: Axel Lin Acked-by: Adam Thomson Signed-off-by: Mark Brown --- sound/soc/codecs/da732x.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c index 7d168ec..48f3fef 100644 --- a/sound/soc/codecs/da732x.c +++ b/sound/soc/codecs/da732x.c @@ -1571,7 +1571,8 @@ static int da732x_i2c_probe(struct i2c_client *i2c, } dev_info(&i2c->dev, "Revision: %d.%d\n", - (reg & DA732X_ID_MAJOR_MASK), (reg & DA732X_ID_MINOR_MASK)); + (reg & DA732X_ID_MAJOR_MASK) >> 4, + (reg & DA732X_ID_MINOR_MASK)); ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_da732x, da732x_dai, ARRAY_SIZE(da732x_dai)); -- cgit v1.1 From be8ef16a2508d12f4e2faa0933d1ffd02bf49f60 Mon Sep 17 00:00:00 2001 From: Kailang Yang Date: Tue, 8 Apr 2014 15:19:49 +0800 Subject: ALSA: hda/realtek - Change model name alias for ChromeOS Chrome OS was use model name of alc283-dac-wcaps for loading model as default. Change the model name to same as model name of Chrome OS for future support. Signed-off-by: Kailang Yang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index ca1298a..0836a61 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4783,7 +4783,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = { {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"}, {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"}, {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"}, - {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-chrome"}, + {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"}, {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"}, {} }; -- cgit v1.1 From 0435b3ffbaa67cded10c25e4a43404a611a7ebb5 Mon Sep 17 00:00:00 2001 From: Kailang Yang Date: Tue, 8 Apr 2014 17:14:14 +0800 Subject: ALSA: hda/realtek - Add eapd shutup to ALC283 Add eapd shutup function to alc283_shutup. It could avoid pop noise from speaker. Signed-off-by: Kailang Yang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0836a61..0d72dbf 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3095,6 +3095,7 @@ static void alc283_shutup(struct hda_codec *codec) if (hp_pin_sense) msleep(100); + alc_auto_setup_eapd(codec, false); snd_hda_shutup_pins(codec); alc_write_coef_idx(codec, 0x43, 0x9614); } -- cgit v1.1 From dcb32ecd9a533f47ab652c5c5680bc50a7a822cd Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Tue, 8 Apr 2014 12:36:42 +0300 Subject: ALSA: hda - Do not assign streams in reverse order MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently stream numbers are assigned in reverse order. Unfortunately commit 7546abfb8e1f9933b5 ("ALSA: hda - Increment default stream numbers for AMD HDMI controllers") assumed this was not the case (specifically, it had the "old cards had single device only" => "extra unused stream numbers do not matter" assumption), causing non-working audio regressions for AMD Radeon HDMI users. Change the stream numbers to be assigned in forward order. The benefit is that regular audio playback will still work even if the assumed stream count is too high, downside is that a too high stream count may remain hidden. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=77002 Reported-by: Christian Güdel Signed-off-by: Anssi Hannula Tested-by: Christian Güdel # 3.14 Cc: Alex Deucher Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_controller.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 97993e1..3e005e5 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -187,13 +187,14 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream) struct azx_dev *azx_dev = &chip->azx_dev[dev]; dsp_lock(azx_dev); if (!azx_dev->opened && !dsp_is_locked(azx_dev)) { - res = azx_dev; - if (res->assigned_key == key) { - res->opened = 1; - res->assigned_key = key; + if (azx_dev->assigned_key == key) { + azx_dev->opened = 1; + azx_dev->assigned_key = key; dsp_unlock(azx_dev); return azx_dev; } + if (!res) + res = azx_dev; } dsp_unlock(azx_dev); } -- cgit v1.1 From ef33bc3217c7aa9868f497c4f797cc50ad3ce357 Mon Sep 17 00:00:00 2001 From: Nicolin Chen Date: Fri, 4 Apr 2014 15:09:47 +0800 Subject: ASoC: fsl_sai: Fix Bit Clock Polarity configurations The BCP bit in TCR4/RCR4 register rules as followings: 0 Bit clock is active high with drive outputs on rising edge and sample inputs on falling edge. 1 Bit clock is active low with drive outputs on falling edge and sample inputs on rising edge. For all formats currently supported in the fsl_sai driver, they're exactly sending data on the falling edge and sampling on the rising edge. However, the driver clears this BCP bit for all of them which results click noise when working with SGTL5000 and big noise with WM8962. Thus this patch corrects the BCP settings for all the formats here to fix the nosie issue. Signed-off-by: Nicolin Chen Acked-by: Xiubo Li Signed-off-by: Mark Brown --- sound/soc/fsl/fsl_sai.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c index 0bc98bb..56da8c8 100644 --- a/sound/soc/fsl/fsl_sai.c +++ b/sound/soc/fsl/fsl_sai.c @@ -179,7 +179,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai, * that is, together with the last bit of the previous * data word. */ - val_cr2 &= ~FSL_SAI_CR2_BCP; + val_cr2 |= FSL_SAI_CR2_BCP; val_cr4 |= FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP; break; case SND_SOC_DAIFMT_LEFT_J: @@ -187,7 +187,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai, * Frame high, one word length for frame sync, * frame sync asserts with the first bit of the frame. */ - val_cr2 &= ~FSL_SAI_CR2_BCP; + val_cr2 |= FSL_SAI_CR2_BCP; val_cr4 &= ~(FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP); break; case SND_SOC_DAIFMT_DSP_A: @@ -197,7 +197,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai, * that is, together with the last bit of the previous * data word. */ - val_cr2 &= ~FSL_SAI_CR2_BCP; + val_cr2 |= FSL_SAI_CR2_BCP; val_cr4 &= ~FSL_SAI_CR4_FSP; val_cr4 |= FSL_SAI_CR4_FSE; sai->is_dsp_mode = true; @@ -207,7 +207,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai, * Frame high, one bit for frame sync, * frame sync asserts with the first bit of the frame. */ - val_cr2 &= ~FSL_SAI_CR2_BCP; + val_cr2 |= FSL_SAI_CR2_BCP; val_cr4 &= ~(FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP); sai->is_dsp_mode = true; break; -- cgit v1.1 From 71e5222cbea124d737e1fe7de8e255253c12cd29 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Tue, 8 Apr 2014 17:11:04 +0530 Subject: ASoC: samsung: Fix build on multiplatform PCM and S/PDIF drivers referenced mach headers for a trivial data structure. This caused build errors on multiplatform builds as machine headers are not accessible from driver files. Move the data structure definition to the driver header and remove the dependency. While at it rename the structure to avoid multiple definition errors as the same structure is also used by the platform code. Signed-off-by: Sachin Kamat Signed-off-by: Mark Brown --- sound/soc/samsung/ac97.c | 6 +++--- sound/soc/samsung/dma.h | 6 +++++- sound/soc/samsung/i2s.c | 6 +++--- sound/soc/samsung/pcm.c | 5 ++--- sound/soc/samsung/s3c2412-i2s.c | 4 ++-- sound/soc/samsung/s3c24xx-i2s.c | 4 ++-- sound/soc/samsung/spdif.c | 3 +-- 7 files changed, 18 insertions(+), 16 deletions(-) (limited to 'sound') diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c index 4a88e36..76b072b 100644 --- a/sound/soc/samsung/ac97.c +++ b/sound/soc/samsung/ac97.c @@ -39,15 +39,15 @@ struct s3c_ac97_info { }; static struct s3c_ac97_info s3c_ac97; -static struct s3c2410_dma_client s3c_dma_client_out = { +static struct s3c_dma_client s3c_dma_client_out = { .name = "AC97 PCMOut" }; -static struct s3c2410_dma_client s3c_dma_client_in = { +static struct s3c_dma_client s3c_dma_client_in = { .name = "AC97 PCMIn" }; -static struct s3c2410_dma_client s3c_dma_client_micin = { +static struct s3c_dma_client s3c_dma_client_micin = { .name = "AC97 MicIn" }; diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h index 225e537..ad7c0f0 100644 --- a/sound/soc/samsung/dma.h +++ b/sound/soc/samsung/dma.h @@ -14,8 +14,12 @@ #include +struct s3c_dma_client { + char *name; +}; + struct s3c_dma_params { - struct s3c2410_dma_client *client; /* stream identifier */ + struct s3c_dma_client *client; /* stream identifier */ int channel; /* Channel ID */ dma_addr_t dma_addr; int dma_size; /* Size of the DMA transfer */ diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index 0a9b44c..048ead9 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -1211,10 +1211,10 @@ static int samsung_i2s_probe(struct platform_device *pdev) pri_dai->dma_playback.dma_addr = regs_base + I2STXD; pri_dai->dma_capture.dma_addr = regs_base + I2SRXD; pri_dai->dma_playback.client = - (struct s3c2410_dma_client *)&pri_dai->dma_playback; + (struct s3c_dma_client *)&pri_dai->dma_playback; pri_dai->dma_playback.ch_name = "tx"; pri_dai->dma_capture.client = - (struct s3c2410_dma_client *)&pri_dai->dma_capture; + (struct s3c_dma_client *)&pri_dai->dma_capture; pri_dai->dma_capture.ch_name = "rx"; pri_dai->dma_playback.dma_size = 4; pri_dai->dma_capture.dma_size = 4; @@ -1233,7 +1233,7 @@ static int samsung_i2s_probe(struct platform_device *pdev) } sec_dai->dma_playback.dma_addr = regs_base + I2STXDS; sec_dai->dma_playback.client = - (struct s3c2410_dma_client *)&sec_dai->dma_playback; + (struct s3c_dma_client *)&sec_dai->dma_playback; sec_dai->dma_playback.ch_name = "tx-sec"; if (!np) { diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index 6a5e4bf..ab54e29 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c @@ -20,7 +20,6 @@ #include #include -#include #include "dma.h" #include "pcm.h" @@ -132,11 +131,11 @@ struct s3c_pcm_info { struct s3c_dma_params *dma_capture; }; -static struct s3c2410_dma_client s3c_pcm_dma_client_out = { +static struct s3c_dma_client s3c_pcm_dma_client_out = { .name = "PCM Stereo out" }; -static struct s3c2410_dma_client s3c_pcm_dma_client_in = { +static struct s3c_dma_client s3c_pcm_dma_client_in = { .name = "PCM Stereo in" }; diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c index d079445..e9bb5d7 100644 --- a/sound/soc/samsung/s3c2412-i2s.c +++ b/sound/soc/samsung/s3c2412-i2s.c @@ -33,11 +33,11 @@ #include "regs-i2s-v2.h" #include "s3c2412-i2s.h" -static struct s3c2410_dma_client s3c2412_dma_client_out = { +static struct s3c_dma_client s3c2412_dma_client_out = { .name = "I2S PCM Stereo out" }; -static struct s3c2410_dma_client s3c2412_dma_client_in = { +static struct s3c_dma_client s3c2412_dma_client_in = { .name = "I2S PCM Stereo in" }; diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c index f31e916..d7b8457 100644 --- a/sound/soc/samsung/s3c24xx-i2s.c +++ b/sound/soc/samsung/s3c24xx-i2s.c @@ -31,11 +31,11 @@ #include "dma.h" #include "s3c24xx-i2s.h" -static struct s3c2410_dma_client s3c24xx_dma_client_out = { +static struct s3c_dma_client s3c24xx_dma_client_out = { .name = "I2S PCM Stereo out" }; -static struct s3c2410_dma_client s3c24xx_dma_client_in = { +static struct s3c_dma_client s3c24xx_dma_client_in = { .name = "I2S PCM Stereo in" }; diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c index 28487dc..cfe63b7 100644 --- a/sound/soc/samsung/spdif.c +++ b/sound/soc/samsung/spdif.c @@ -18,7 +18,6 @@ #include #include -#include #include "dma.h" #include "spdif.h" @@ -94,7 +93,7 @@ struct samsung_spdif_info { struct s3c_dma_params *dma_playback; }; -static struct s3c2410_dma_client spdif_dma_client_out = { +static struct s3c_dma_client spdif_dma_client_out = { .name = "S/PDIF Stereo out", }; -- cgit v1.1 From 74ddd8c40d8ac747ec780be3da40b37641a9b396 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 4 Apr 2014 14:31:41 +0300 Subject: ASoC: davinci-mcasp: Fix bit clock polarity settings IB_NF, NB_IF and IB_IF configured the bc polarity incorrectly. The receive polarity was set to the same edge as the TX in these cases. Signed-off-by: Peter Ujfalusi Signed-off-by: Mark Brown --- sound/soc/davinci/davinci-mcasp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sound') diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index a01ae97..4f75cac 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -336,7 +336,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL); mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL); - mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL); + mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL); mcasp_clr_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL); break; @@ -344,7 +344,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL); mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL); - mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL); + mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL); mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL); break; @@ -352,7 +352,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai, mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL); mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL); - mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL); + mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL); mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL); break; -- cgit v1.1 From 4f8e940095536bc002a81666a4107a581c84e9b9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 8 Apr 2014 16:58:34 +0200 Subject: ALSA: ice1712: Fix boundary checks in PCM pointer ops PCM pointer callbacks in ice1712 driver check the buffer size boundary wrongly between bytes and frames. This leads to PCM core warnings like: snd_pcm_update_hw_ptr0: 105 callbacks suppressed ALSA pcm_lib.c:352 BUG: pcmC3D0c:0, pos = 5461, buffer size = 5461, period size = 2730 This patch fixes these checks to be placed after the proper unit conversions. Cc: Signed-off-by: Takashi Iwai --- sound/pci/ice1712/ice1712.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'sound') diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index da00549..d9b9e45 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -685,9 +685,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pointer(struct snd_pcm_substream * if (!(snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL) & 1)) return 0; ptr = runtime->buffer_size - inw(ice->ddma_port + 4); + ptr = bytes_to_frames(substream->runtime, ptr); if (ptr == runtime->buffer_size) ptr = 0; - return bytes_to_frames(substream->runtime, ptr); + return ptr; } static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substream *substream) @@ -704,9 +705,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substrea addr = ICE1712_DSC_ADDR0; ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) - ice->playback_con_virt_addr[substream->number]; + ptr = bytes_to_frames(substream->runtime, ptr); if (ptr == substream->runtime->buffer_size) ptr = 0; - return bytes_to_frames(substream->runtime, ptr); + return ptr; } static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *substream) @@ -717,9 +719,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *s if (!(snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL) & 1)) return 0; ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr; + ptr = bytes_to_frames(substream->runtime, ptr); if (ptr == substream->runtime->buffer_size) ptr = 0; - return bytes_to_frames(substream->runtime, ptr); + return ptr; } static const struct snd_pcm_hardware snd_ice1712_playback = { @@ -1116,9 +1119,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(struct snd_pcm_substre if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_PLAYBACK_START)) return 0; ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2); + ptr = bytes_to_frames(substream->runtime, ptr); if (ptr == substream->runtime->buffer_size) ptr = 0; - return bytes_to_frames(substream->runtime, ptr); + return ptr; } static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substream *substream) @@ -1129,9 +1133,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substrea if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_CAPTURE_START_SHADOW)) return 0; ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2); + ptr = bytes_to_frames(substream->runtime, ptr); if (ptr == substream->runtime->buffer_size) ptr = 0; - return bytes_to_frames(substream->runtime, ptr); + return ptr; } static const struct snd_pcm_hardware snd_ice1712_playback_pro = { -- cgit v1.1 From 7b0a48f3402a43bd8bb85bfda4f72e0a34634d74 Mon Sep 17 00:00:00 2001 From: Dylan Reid Date: Tue, 8 Apr 2014 12:06:18 -0700 Subject: ALSA: hda - Use runtime helper to check active state. From azx_interrupt, use the helper to check if the device is active instead of checking the state. This will do the right thing if runtime pm is disabled in addition to if the device is suspended. Signed-off-by: Dylan Reid Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_controller.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 3e005e5..8197afc 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -1759,7 +1759,7 @@ irqreturn_t azx_interrupt(int irq, void *dev_id) #ifdef CONFIG_PM_RUNTIME if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME) - if (chip->card->dev->power.runtime_status != RPM_ACTIVE) + if (!pm_runtime_active(chip->card->dev)) return IRQ_NONE; #endif -- cgit v1.1 From 34f980630f6c135b6735f9fb16079aeb4c21fc18 Mon Sep 17 00:00:00 2001 From: Christoph Jaeger Date: Wed, 9 Apr 2014 09:42:32 +0200 Subject: ALSA: au1x00: use module_platform_driver() Eliminate boilerplate code by using module_platform_driver(). Signed-off-by: Christoph Jaeger Signed-off-by: Takashi Iwai --- sound/mips/au1x00.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'sound') diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c index a7cc49e..d10ef76 100644 --- a/sound/mips/au1x00.c +++ b/sound/mips/au1x00.c @@ -725,15 +725,4 @@ struct platform_driver au1000_ac97c_driver = { .remove = au1000_ac97_remove, }; -static int __init au1000_ac97_load(void) -{ - return platform_driver_register(&au1000_ac97c_driver); -} - -static void __exit au1000_ac97_unload(void) -{ - platform_driver_unregister(&au1000_ac97c_driver); -} - -module_init(au1000_ac97_load); -module_exit(au1000_ac97_unload); +module_platform_driver(au1000_ac97c_driver); -- cgit v1.1 From 292ab81df0e9e1444fd027e1f45336eb0ce4e23d Mon Sep 17 00:00:00 2001 From: Christoph Jaeger Date: Wed, 9 Apr 2014 09:43:53 +0200 Subject: sound: dmasound: use module_platform_driver_probe() Eliminate boilerplate code by using module_platform_driver_probe(). Signed-off-by: Christoph Jaeger Signed-off-by: Takashi Iwai --- sound/oss/dmasound/dmasound_paula.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'sound') diff --git a/sound/oss/dmasound/dmasound_paula.c b/sound/oss/dmasound/dmasound_paula.c index 87910e9..c2d45a5 100644 --- a/sound/oss/dmasound/dmasound_paula.c +++ b/sound/oss/dmasound/dmasound_paula.c @@ -733,19 +733,7 @@ static struct platform_driver amiga_audio_driver = { }, }; -static int __init amiga_audio_init(void) -{ - return platform_driver_probe(&amiga_audio_driver, amiga_audio_probe); -} - -module_init(amiga_audio_init); - -static void __exit amiga_audio_exit(void) -{ - platform_driver_unregister(&amiga_audio_driver); -} - -module_exit(amiga_audio_exit); +module_platform_driver_probe(amiga_audio_driver, amiga_audio_probe); MODULE_LICENSE("GPL"); MODULE_ALIAS("platform:amiga-audio"); -- cgit v1.1 From 137bcc33c6fd775579c7d9d266e1972f56cf5cab Mon Sep 17 00:00:00 2001 From: Hui Wang Date: Wed, 9 Apr 2014 16:01:01 +0800 Subject: ALSA: hda - add headset mic detect quirk for a Dell laptop When we plug a 3-ring headset on the Dell machine (VID: 0x10ec0283, SID: 0x10280667), the headset mic can't be detected, after apply this patch, the headset mic can work well. BugLink: https://bugs.launchpad.net/bugs/1297581 Cc: David Henningsson Cc: stable@vger.kernel.org Signed-off-by: Hui Wang Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+) (limited to 'sound') diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0d72dbf..14ae979 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -4618,6 +4618,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x1028, 0x0658, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x065f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0662, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), + SND_PCI_QUIRK(0x1028, 0x0667, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0668, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0669, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), -- cgit v1.1 From 17c3ad030213da23158082ea90ebbe2a3940a2d2 Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Wed, 9 Apr 2014 12:30:57 +0200 Subject: ALSA: hda - Make full_reset boolean The full_reset argument to azx_init_chip() carries boolean rather than numerical information, so update the type to reflect that. Signed-off-by: Thierry Reding Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_controller.c | 8 ++++---- sound/pci/hda/hda_controller.h | 2 +- sound/pci/hda/hda_intel.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'sound') diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c index 8197afc..248b90a 100644 --- a/sound/pci/hda/hda_controller.c +++ b/sound/pci/hda/hda_controller.c @@ -1605,7 +1605,7 @@ static void azx_exit_link_reset(struct azx *chip) } /* reset codec link */ -static int azx_reset(struct azx *chip, int full_reset) +static int azx_reset(struct azx *chip, bool full_reset) { if (!full_reset) goto __skip; @@ -1702,7 +1702,7 @@ static void azx_int_clear(struct azx *chip) /* * reset and start the controller registers */ -void azx_init_chip(struct azx *chip, int full_reset) +void azx_init_chip(struct azx *chip, bool full_reset) { if (chip->initialized) return; @@ -1842,7 +1842,7 @@ static void azx_bus_reset(struct hda_bus *bus) bus->in_reset = 1; azx_stop_chip(chip); - azx_init_chip(chip, 1); + azx_init_chip(chip, true); #ifdef CONFIG_PM if (chip->initialized) { struct azx_pcm *p; @@ -1949,7 +1949,7 @@ int azx_codec_create(struct azx *chip, const char *model, * get back to the sanity state. */ azx_stop_chip(chip); - azx_init_chip(chip, 1); + azx_init_chip(chip, true); } } } diff --git a/sound/pci/hda/hda_controller.h b/sound/pci/hda/hda_controller.h index 1d2e3be..baf0e77 100644 --- a/sound/pci/hda/hda_controller.h +++ b/sound/pci/hda/hda_controller.h @@ -37,7 +37,7 @@ int azx_alloc_stream_pages(struct azx *chip); void azx_free_stream_pages(struct azx *chip); /* Low level azx interface */ -void azx_init_chip(struct azx *chip, int full_reset); +void azx_init_chip(struct azx *chip, bool full_reset); void azx_stop_chip(struct azx *chip); void azx_enter_link_reset(struct azx *chip); irqreturn_t azx_interrupt(int irq, void *dev_id); diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 77ca894..d6bca62 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -636,7 +636,7 @@ static int azx_resume(struct device *dev) return -EIO; azx_init_pci(chip); - azx_init_chip(chip, 1); + azx_init_chip(chip, true); snd_hda_resume(chip->bus); snd_power_change_state(card, SNDRV_CTL_POWER_D0); @@ -689,7 +689,7 @@ static int azx_runtime_resume(struct device *dev) status = azx_readw(chip, STATESTS); azx_init_pci(chip); - azx_init_chip(chip, 1); + azx_init_chip(chip, true); bus = chip->bus; if (status && bus) { -- cgit v1.1 From a5065eb6da55b226661456e6a7435f605df98111 Mon Sep 17 00:00:00 2001 From: Tim Gardner Date: Wed, 9 Apr 2014 11:30:44 -0600 Subject: ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb() BugLink: http://bugs.launchpad.net/bugs/1305133 Malfunctioning or slow devices can cause a flood of dmesg SPAM. I've ignored checkpatch.pl complaints about the use of printk_ratelimit() in favour of prior art in sound/usb/pcm.c. WARNING: Prefer printk_ratelimited or pr__ratelimited to printk_ratelimit + if (printk_ratelimit() && Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Eldad Zack Cc: Daniel Mack Cc: Clemens Ladisch Signed-off-by: Tim Gardner Signed-off-by: Takashi Iwai --- sound/usb/pcm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'sound') diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index 49de5c1..131336d 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -1501,7 +1501,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs, * The error should be lower than 2ms since the estimate relies * on two reads of a counter updated every ms. */ - if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) + if (printk_ratelimit() && + abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2) dev_dbg(&subs->dev->dev, "delay: estimated %d, actual %d\n", est_delay, subs->last_delay); -- cgit v1.1