From bb974b8f7b16441d49e188774d74ba987c58be53 Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:54:40 -0400 Subject: ALSA: sb8: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index b8e2391..ad42d23 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c @@ -251,15 +251,4 @@ static struct isa_driver snd_sb8_driver = { }, }; -static int __init alsa_card_sb8_init(void) -{ - return isa_register_driver(&snd_sb8_driver, SNDRV_CARDS); -} - -static void __exit alsa_card_sb8_exit(void) -{ - isa_unregister_driver(&snd_sb8_driver); -} - -module_init(alsa_card_sb8_init) -module_exit(alsa_card_sb8_exit) +module_isa_driver(snd_sb8_driver, SNDRV_CARDS); -- cgit v0.10.2 From fc733cf98c2afa50730928ccdb302e412610e5df Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:54:50 -0400 Subject: ALSA: jazz16: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c index 6b4884d..4d90997 100644 --- a/sound/isa/sb/jazz16.c +++ b/sound/isa/sb/jazz16.c @@ -387,15 +387,4 @@ static struct isa_driver snd_jazz16_driver = { }, }; -static int __init alsa_card_jazz16_init(void) -{ - return isa_register_driver(&snd_jazz16_driver, SNDRV_CARDS); -} - -static void __exit alsa_card_jazz16_exit(void) -{ - isa_unregister_driver(&snd_jazz16_driver); -} - -module_init(alsa_card_jazz16_init) -module_exit(alsa_card_jazz16_exit) +module_isa_driver(snd_jazz16_driver, SNDRV_CARDS); -- cgit v0.10.2 From d2fd147c59d187dcf65e2acf6b7c9c34f2f760e1 Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:55:01 -0400 Subject: ALSA: ad1848: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index f159da4e..a302d1f 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c @@ -170,15 +170,4 @@ static struct isa_driver snd_ad1848_driver = { } }; -static int __init alsa_card_ad1848_init(void) -{ - return isa_register_driver(&snd_ad1848_driver, SNDRV_CARDS); -} - -static void __exit alsa_card_ad1848_exit(void) -{ - isa_unregister_driver(&snd_ad1848_driver); -} - -module_init(alsa_card_ad1848_init); -module_exit(alsa_card_ad1848_exit); +module_isa_driver(snd_ad1848_driver, SNDRV_CARDS); -- cgit v0.10.2 From 042c576ca4932a298e73abd0872f4223d5411679 Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:55:12 -0400 Subject: ALSA: cmi8328: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/cmi8328.c b/sound/isa/cmi8328.c index 2c89d95..7874750 100644 --- a/sound/isa/cmi8328.c +++ b/sound/isa/cmi8328.c @@ -469,15 +469,4 @@ static struct isa_driver snd_cmi8328_driver = { }, }; -static int __init alsa_card_cmi8328_init(void) -{ - return isa_register_driver(&snd_cmi8328_driver, CMI8328_MAX); -} - -static void __exit alsa_card_cmi8328_exit(void) -{ - isa_unregister_driver(&snd_cmi8328_driver); -} - -module_init(alsa_card_cmi8328_init) -module_exit(alsa_card_cmi8328_exit) +module_isa_driver(snd_cmi8328_driver, CMI8328_MAX); -- cgit v0.10.2 From ec5c08969928d3725b8e21a2ebb9e438392d099e Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:55:29 -0400 Subject: ALSA: cs4231: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index 282cd75..ef7448e 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c @@ -186,15 +186,4 @@ static struct isa_driver snd_cs4231_driver = { } }; -static int __init alsa_card_cs4231_init(void) -{ - return isa_register_driver(&snd_cs4231_driver, SNDRV_CARDS); -} - -static void __exit alsa_card_cs4231_exit(void) -{ - isa_unregister_driver(&snd_cs4231_driver); -} - -module_init(alsa_card_cs4231_init); -module_exit(alsa_card_cs4231_exit); +module_isa_driver(snd_cs4231_driver, SNDRV_CARDS); -- cgit v0.10.2 From a99e8c625d38d47a434e954426315aac894deee9 Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:55:48 -0400 Subject: ALSA: gusmax: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index 8216e8d..dd88c9d 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -370,15 +370,4 @@ static struct isa_driver snd_gusmax_driver = { }, }; -static int __init alsa_card_gusmax_init(void) -{ - return isa_register_driver(&snd_gusmax_driver, SNDRV_CARDS); -} - -static void __exit alsa_card_gusmax_exit(void) -{ - isa_unregister_driver(&snd_gusmax_driver); -} - -module_init(alsa_card_gusmax_init) -module_exit(alsa_card_gusmax_exit) +module_isa_driver(snd_gusmax_driver, SNDRV_CARDS); -- cgit v0.10.2 From bfc7e0ffce0a31e1b1552d19c87340f7edeb80f3 Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:55:58 -0400 Subject: ALSA: gusextreme: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index 693d95f..77ac2fd 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -358,15 +358,4 @@ static struct isa_driver snd_gusextreme_driver = { } }; -static int __init alsa_card_gusextreme_init(void) -{ - return isa_register_driver(&snd_gusextreme_driver, SNDRV_CARDS); -} - -static void __exit alsa_card_gusextreme_exit(void) -{ - isa_unregister_driver(&snd_gusextreme_driver); -} - -module_init(alsa_card_gusextreme_init); -module_exit(alsa_card_gusextreme_exit); +module_isa_driver(snd_gusextreme_driver, SNDRV_CARDS); -- cgit v0.10.2 From a04236e213fd42f935447a93ded167cc1e368d9a Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:56:09 -0400 Subject: ALSA: gusclassic: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index f001971..c169be4 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c @@ -229,15 +229,4 @@ static struct isa_driver snd_gusclassic_driver = { } }; -static int __init alsa_card_gusclassic_init(void) -{ - return isa_register_driver(&snd_gusclassic_driver, SNDRV_CARDS); -} - -static void __exit alsa_card_gusclassic_exit(void) -{ - isa_unregister_driver(&snd_gusclassic_driver); -} - -module_init(alsa_card_gusclassic_init); -module_exit(alsa_card_gusclassic_exit); +module_isa_driver(snd_gusclassic_driver, SNDRV_CARDS); -- cgit v0.10.2 From af486dd82b63af441b05d16fcb14cead54dd287c Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:56:28 -0400 Subject: ALSA: sc6000: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c index 51cfa76..b61a663 100644 --- a/sound/isa/sc6000.c +++ b/sound/isa/sc6000.c @@ -711,15 +711,4 @@ static struct isa_driver snd_sc6000_driver = { }; -static int __init alsa_card_sc6000_init(void) -{ - return isa_register_driver(&snd_sc6000_driver, SNDRV_CARDS); -} - -static void __exit alsa_card_sc6000_exit(void) -{ - isa_unregister_driver(&snd_sc6000_driver); -} - -module_init(alsa_card_sc6000_init) -module_exit(alsa_card_sc6000_exit) +module_isa_driver(snd_sc6000_driver, SNDRV_CARDS); -- cgit v0.10.2 From ab55c0500d68c1aff637d2ffa86c53cb7af891ca Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:56:41 -0400 Subject: ALSA: galaxy: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c index 3227884..379abe2 100644 --- a/sound/isa/galaxy/galaxy.c +++ b/sound/isa/galaxy/galaxy.c @@ -634,15 +634,4 @@ static struct isa_driver snd_galaxy_driver = { } }; -static int __init alsa_card_galaxy_init(void) -{ - return isa_register_driver(&snd_galaxy_driver, SNDRV_CARDS); -} - -static void __exit alsa_card_galaxy_exit(void) -{ - isa_unregister_driver(&snd_galaxy_driver); -} - -module_init(alsa_card_galaxy_init); -module_exit(alsa_card_galaxy_exit); +module_isa_driver(snd_galaxy_driver, SNDRV_CARDS); -- cgit v0.10.2 From 1524c7191be24288ac097c7c3c1bc411f36c1fa4 Mon Sep 17 00:00:00 2001 From: William Breathitt Gray Date: Tue, 31 May 2016 11:56:52 -0400 Subject: ALSA: adlib: Utilize the module_isa_driver macro This driver does not do anything special in module init/exit. This patch eliminates the module init/exit boilerplate code by utilizing the module_isa_driver macro. Signed-off-by: William Breathitt Gray Signed-off-by: Takashi Iwai diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c index 120c524..8d3060f 100644 --- a/sound/isa/adlib.c +++ b/sound/isa/adlib.c @@ -112,15 +112,4 @@ static struct isa_driver snd_adlib_driver = { } }; -static int __init alsa_card_adlib_init(void) -{ - return isa_register_driver(&snd_adlib_driver, SNDRV_CARDS); -} - -static void __exit alsa_card_adlib_exit(void) -{ - isa_unregister_driver(&snd_adlib_driver); -} - -module_init(alsa_card_adlib_init); -module_exit(alsa_card_adlib_exit); +module_isa_driver(snd_adlib_driver, SNDRV_CARDS); -- cgit v0.10.2 From fabc16fe9a92709c284325fbd14805fa410dc1d3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 2 Jun 2016 10:42:11 +0200 Subject: ALSA: hda - Turn off loopback mixing as default So far, we enabled the loopback mixing control as default, as this behavior made somewhat compatible with the earlier HD-audio drivers for Realtek & co. However, it's getting annoying as we've got more and more bug reports about the noise coming from the loopback route. Since the loopback mixing is used fairly rarely and often harmful (e.g. using PA), let's get rid of the default turn-on lines. Signed-off-by: Takashi Iwai diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 320445f..7e78548 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c @@ -2492,10 +2492,6 @@ static int create_loopback_mixing_ctl(struct hda_codec *codec) if (!snd_hda_gen_add_kctl(spec, NULL, &loopback_mixing_enum)) return -ENOMEM; spec->have_aamix_ctl = 1; - /* if no explicit aamix path is present (e.g. for Realtek codecs), - * enable aamix as default -- just for compatibility - */ - spec->aamix_mode = !has_aamix_out_paths(spec); return 0; } -- cgit v0.10.2 From 43aa56d95d2c3f141d516c78a654a33d1f287839 Mon Sep 17 00:00:00 2001 From: Bhaktipriya Shridhar Date: Tue, 7 Jun 2016 09:11:48 +0530 Subject: ALSA: sh: aica: Remove deprecated create_workqueue System workqueues have been able to handle high level of concurrency for a long time now and there's no reason to use dedicated workqueues just to gain concurrency. Since aica_queue for AICA sound driver has workitem dreamcastcard->spu_dma_work (maps to run_spu_dma) which is involved in aica dma transfers and is not being used on a memory reclaim path, dedicated aica_queue has been replaced with the use of system_wq. Unlike a dedicated per-cpu workqueue created with create_workqueue(), system_wq allows multiple work items to overlap executions even on the same CPU; however, a per-cpu workqueue doesn't have any CPU locality or global ordering guarantees unless the target CPU is explicitly specified and thus the increase of local concurrency shouldn't make any difference. Since the work items could be pending, flush_work() has been used in snd_aicapcm_pcm_close() to ensure that there is no pending task while disconnecting the driver. Signed-off-by: Bhaktipriya Shridhar Signed-off-by: Takashi Iwai diff --git a/sound/sh/aica.c b/sound/sh/aica.c index ad3d9ae..fbbc252 100644 --- a/sound/sh/aica.c +++ b/sound/sh/aica.c @@ -63,9 +63,6 @@ MODULE_PARM_DESC(id, "ID string for " CARD_NAME " soundcard."); module_param(enable, bool, 0644); MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard."); -/* Use workqueue */ -static struct workqueue_struct *aica_queue; - /* Simple platform device */ static struct platform_device *pd; static struct resource aica_memory_space[2] = { @@ -327,7 +324,7 @@ static void aica_period_elapsed(unsigned long timer_var) dreamcastcard->current_period = play_period; if (unlikely(dreamcastcard->dma_check == 0)) dreamcastcard->dma_check = 1; - queue_work(aica_queue, &(dreamcastcard->spu_dma_work)); + schedule_work(&(dreamcastcard->spu_dma_work)); } static void spu_begin_dma(struct snd_pcm_substream *substream) @@ -337,7 +334,7 @@ static void spu_begin_dma(struct snd_pcm_substream *substream) runtime = substream->runtime; dreamcastcard = substream->pcm->private_data; /*get the queue to do the work */ - queue_work(aica_queue, &(dreamcastcard->spu_dma_work)); + schedule_work(&(dreamcastcard->spu_dma_work)); /* Timer may already be running */ if (unlikely(dreamcastcard->timer.data)) { mod_timer(&dreamcastcard->timer, jiffies + 4); @@ -381,7 +378,7 @@ static int snd_aicapcm_pcm_close(struct snd_pcm_substream *substream) { struct snd_card_aica *dreamcastcard = substream->pcm->private_data; - flush_workqueue(aica_queue); + flush_work(&(dreamcastcard->spu_dma_work)); if (dreamcastcard->timer.data) del_timer(&dreamcastcard->timer); kfree(dreamcastcard->channel); @@ -633,9 +630,6 @@ static int snd_aica_probe(struct platform_device *devptr) if (unlikely(err < 0)) goto freedreamcast; platform_set_drvdata(devptr, dreamcastcard); - aica_queue = create_workqueue(CARD_NAME); - if (unlikely(!aica_queue)) - goto freedreamcast; snd_printk ("ALSA Driver for Yamaha AICA Super Intelligent Sound Processor\n"); return 0; @@ -671,10 +665,6 @@ static int __init aica_init(void) static void __exit aica_exit(void) { - /* Destroy the aica kernel thread * - * being extra cautious to check if it exists*/ - if (likely(aica_queue)) - destroy_workqueue(aica_queue); platform_device_unregister(pd); platform_driver_unregister(&snd_aica_driver); /* Kill any sound still playing and reset ARM7 to safe state */ -- cgit v0.10.2 From 6a99ad7e92c5656b9b734ffae57a32b738475f19 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Wed, 15 Jun 2016 09:23:23 +0530 Subject: sound: aedsp16: Change structure initialisation to C99 style Replace the in order struct initialisation style with explicit field style. The Coccinelle semantic patch used to make this change is as follows: @decl@ identifier i1,fld; type T; field list[n] fs; @@ struct i1 { fs T fld; ...}; @@ identifier decl.i1,i2,decl.fld; expression e; position bad.p, bad.fix; @@ struct i1 i2@p = { ..., + .fld = e - e@fix ,...}; Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Takashi Iwai diff --git a/sound/oss/aedsp16.c b/sound/oss/aedsp16.c index 35b5912..bb477d5 100644 --- a/sound/oss/aedsp16.c +++ b/sound/oss/aedsp16.c @@ -482,13 +482,13 @@ static struct orVals orDMA[] __initdata = { }; static struct aedsp16_info ae_config = { - DEF_AEDSP16_IOB, - DEF_AEDSP16_IRQ, - DEF_AEDSP16_MRQ, - DEF_AEDSP16_DMA, - -1, - -1, - INIT_NONE + .base_io = DEF_AEDSP16_IOB, + .irq = DEF_AEDSP16_IRQ, + .mpu_irq = DEF_AEDSP16_MRQ, + .dma = DEF_AEDSP16_DMA, + .mss_base = -1, + .mpu_base = -1, + .init = INIT_NONE }; /* -- cgit v0.10.2 From 78f4f7c2341f1cf510152ad494108850fec1ae39 Mon Sep 17 00:00:00 2001 From: Kailang Yang Date: Tue, 7 Jun 2016 11:31:34 +0800 Subject: ALSA: hda/realtek - ALC891 headset mode for Dell New headset mode of ALC891 for Dell. This patch is supported Dell headset mode for ALC891. It is only support I-phone type headset. I think this function is only support for DELL. This patch is test passed by Ubuntu team. Signed-off-by: Kailang Yang Signed-off-by: Takashi Iwai diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 0fe18ed..1f652ca1 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3718,6 +3718,9 @@ static void alc_headset_mode_unplugged(struct hda_codec *codec) case 0x10ec0295: alc_process_coef_fw(codec, coef0225); break; + case 0x10ec0867: + alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); + break; } codec_dbg(codec, "Headset jack set to unplugged mode.\n"); } @@ -3805,6 +3808,9 @@ static void alc_headset_mode_mic_in(struct hda_codec *codec, hda_nid_t hp_pin, alc_process_coef_fw(codec, coef0293); snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); break; + case 0x10ec0867: + alc_update_coefex_idx(codec, 0x57, 0x5, 0, 1<<14); + /* fallthru */ case 0x10ec0662: snd_hda_set_pin_ctl_cache(codec, hp_pin, 0); snd_hda_set_pin_ctl_cache(codec, mic_pin, PIN_VREF50); @@ -3899,6 +3905,9 @@ static void alc_headset_mode_default(struct hda_codec *codec) case 0x10ec0668: alc_process_coef_fw(codec, coef0688); break; + case 0x10ec0867: + alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); + break; } codec_dbg(codec, "Headset jack set to headphone (default) mode.\n"); } @@ -3989,6 +3998,9 @@ static void alc_headset_mode_ctia(struct hda_codec *codec) case 0x10ec0295: alc_process_coef_fw(codec, coef0225); break; + case 0x10ec0867: + alc_update_coefex_idx(codec, 0x57, 0x5, 1<<14, 0); + break; } codec_dbg(codec, "Headset jack set to iPhone-style headset mode.\n"); } @@ -4166,6 +4178,9 @@ static void alc_determine_headset_type(struct hda_codec *codec) val = alc_read_coef_idx(codec, 0x46); is_ctia = (val & 0x00f0) == 0x00f0; break; + case 0x10ec0867: + is_ctia = true; + break; } codec_dbg(codec, "Headset jack detected iPhone-style headset: %s\n", @@ -6512,6 +6527,8 @@ enum { ALC668_FIXUP_DELL_XPS13, ALC662_FIXUP_ASUS_Nx50, ALC668_FIXUP_ASUS_Nx51, + ALC891_FIXUP_HEADSET_MODE, + ALC891_FIXUP_DELL_MIC_NO_PRESENCE, }; static const struct hda_fixup alc662_fixups[] = { @@ -6767,6 +6784,20 @@ static const struct hda_fixup alc662_fixups[] = { .chained = true, .chain_id = ALC662_FIXUP_BASS_CHMAP, }, + [ALC891_FIXUP_HEADSET_MODE] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc_fixup_headset_mode, + }, + [ALC891_FIXUP_DELL_MIC_NO_PRESENCE] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl[]) { + { 0x19, 0x03a1913d }, /* use as headphone mic, without its own jack detect */ + { 0x1b, 0x03a1113c }, /* use as headset mic, without its own jack detect */ + { } + }, + .chained = true, + .chain_id = ALC891_FIXUP_HEADSET_MODE + }, }; static const struct snd_pci_quirk alc662_fixup_tbl[] = { @@ -6883,6 +6914,11 @@ static const struct hda_model_fixup alc662_fixup_models[] = { }; static const struct snd_hda_pin_quirk alc662_pin_fixup_tbl[] = { + SND_HDA_PIN_QUIRK(0x10ec0867, 0x1028, "Dell", ALC891_FIXUP_DELL_MIC_NO_PRESENCE, + {0x17, 0x02211010}, + {0x18, 0x01a19030}, + {0x1a, 0x01813040}, + {0x21, 0x01014020}), SND_HDA_PIN_QUIRK(0x10ec0662, 0x1028, "Dell", ALC662_FIXUP_DELL_MIC_NO_PRESENCE, {0x14, 0x01014010}, {0x18, 0x01a19020}, @@ -7071,7 +7107,7 @@ static const struct hda_device_id snd_hda_id_realtek[] = { HDA_CODEC_ENTRY(0x10ec0700, "ALC700", patch_alc269), HDA_CODEC_ENTRY(0x10ec0701, "ALC701", patch_alc269), HDA_CODEC_ENTRY(0x10ec0703, "ALC703", patch_alc269), - HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc882), + HDA_CODEC_ENTRY(0x10ec0867, "ALC891", patch_alc662), HDA_CODEC_ENTRY(0x10ec0880, "ALC880", patch_alc880), HDA_CODEC_ENTRY(0x10ec0882, "ALC882", patch_alc882), HDA_CODEC_ENTRY(0x10ec0883, "ALC883", patch_alc882), -- cgit v0.10.2 From 76f64b24e692978a90d3c2e8f57f3a1f0cd7172a Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Wed, 15 Jun 2016 13:33:31 +0530 Subject: ALSA: seq_oss: Change structure initialisation to C99 style Replace the in order struct initialisation style with explicit field style. The Coccinelle semantic patch used to make this change is as follows: @decl@ identifier i1,fld; type T; field list[n] fs; @@ struct i1 { fs T fld; ...}; @@ identifier decl.i1,i2,decl.fld; expression e; position bad.p, bad.fix; @@ struct i1 i2@p = { ..., + .fld = e - e@fix ,...}; Also, removed some unnecessary comments. Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Takashi Iwai diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c index b16dbef..cd0e0eb 100644 --- a/sound/core/seq/oss/seq_oss_synth.c +++ b/sound/core/seq/oss/seq_oss_synth.c @@ -70,11 +70,11 @@ struct seq_oss_synth { static int max_synth_devs; static struct seq_oss_synth *synth_devs[SNDRV_SEQ_OSS_MAX_SYNTH_DEVS]; static struct seq_oss_synth midi_synth_dev = { - -1, /* seq_device */ - SYNTH_TYPE_MIDI, /* synth_type */ - 0, /* synth_subtype */ - 16, /* nr_voices */ - "MIDI", /* name */ + .seq_device = -1, + .synth_type = SYNTH_TYPE_MIDI, + .synth_subtype = 0, + .nr_voices = 16, + .name = "MIDI", }; static DEFINE_SPINLOCK(register_lock); -- cgit v0.10.2 From 960a581e22d93a784db843110ad1e6249c1542a5 Mon Sep 17 00:00:00 2001 From: Libin Yang Date: Thu, 16 Jun 2016 11:13:25 +0800 Subject: ALSA: hda: fix some klockwork scan warnings This patch fixes some warnings from klockwork. These warnings are not the real issues. The patch adds the sanity check. Signed-off-by: Libin Yang Signed-off-by: Takashi Iwai diff --git a/sound/hda/hdmi_chmap.c b/sound/hda/hdmi_chmap.c index c6c75e7..81acc20 100644 --- a/sound/hda/hdmi_chmap.c +++ b/sound/hda/hdmi_chmap.c @@ -353,7 +353,8 @@ static void hdmi_std_setup_channel_mapping(struct hdac_chmap *chmap, int hdmi_slot = 0; /* fill actual channel mappings in ALSA channel (i) order */ for (i = 0; i < ch_alloc->channels; i++) { - while (!ch_alloc->speakers[7 - hdmi_slot] && !WARN_ON(hdmi_slot >= 8)) + while (!WARN_ON(hdmi_slot >= 8) && + !ch_alloc->speakers[7 - hdmi_slot]) hdmi_slot++; /* skip zero slots */ hdmi_channel_mapping[ca][i] = (i << 4) | hdmi_slot++; @@ -430,6 +431,12 @@ static int to_cea_slot(int ordered_ca, unsigned char pos) int mask = snd_hdac_chmap_to_spk_mask(pos); int i; + /* Add sanity check to pass klockwork check. + * This should never happen. + */ + if (ordered_ca >= ARRAY_SIZE(channel_allocations)) + return -1; + if (mask) { for (i = 0; i < 8; i++) { if (channel_allocations[ordered_ca].speakers[7 - i] == mask) @@ -456,7 +463,15 @@ EXPORT_SYMBOL_GPL(snd_hdac_spk_to_chmap); /* from CEA slot to ALSA API channel position */ static int from_cea_slot(int ordered_ca, unsigned char slot) { - int mask = channel_allocations[ordered_ca].speakers[7 - slot]; + int mask; + + /* Add sanity check to pass klockwork check. + * This should never happen. + */ + if (slot >= 8) + return 0; + + mask = channel_allocations[ordered_ca].speakers[7 - slot]; return snd_hdac_spk_to_chmap(mask); } @@ -523,7 +538,8 @@ static void hdmi_setup_fake_chmap(unsigned char *map, int ca) int ordered_ca = get_channel_allocation_order(ca); for (i = 0; i < 8; i++) { - if (i < channel_allocations[ordered_ca].channels) + if (ordered_ca < ARRAY_SIZE(channel_allocations) && + i < channel_allocations[ordered_ca].channels) map[i] = from_cea_slot(ordered_ca, hdmi_channel_mapping[ca][i] & 0x0f); else map[i] = 0; @@ -551,6 +567,12 @@ int snd_hdac_get_active_channels(int ca) { int ordered_ca = get_channel_allocation_order(ca); + /* Add sanity check to pass klockwork check. + * This should never happen. + */ + if (ordered_ca >= ARRAY_SIZE(channel_allocations)) + ordered_ca = 0; + return channel_allocations[ordered_ca].channels; } EXPORT_SYMBOL_GPL(snd_hdac_get_active_channels); diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 8374188..9913be8 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -3584,6 +3584,12 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, bool reset; spdif = snd_hda_spdif_out_of_nid(codec, nid); + /* Add sanity check to pass klockwork check. + * This should never happen. + */ + if (WARN_ON(spdif == NULL)) + return; + curr_fmt = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_STREAM_FORMAT, 0); reset = codec->spdif_status_reset && @@ -3768,7 +3774,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, spdif = snd_hda_spdif_out_of_nid(codec, mout->dig_out_nid); if (mout->dig_out_nid && mout->share_spdif && mout->dig_out_used != HDA_DIG_EXCLUSIVE) { - if (chs == 2 && + if (chs == 2 && spdif != NULL && snd_hda_is_supported_format(codec, mout->dig_out_nid, format) && !(spdif->status & IEC958_AES0_NONAUDIO)) { diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index d0d5ad8..56e5204 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -1680,6 +1680,11 @@ static bool check_non_pcm_per_cvt(struct hda_codec *codec, hda_nid_t cvt_nid) mutex_lock(&codec->spdif_mutex); spdif = snd_hda_spdif_out_of_nid(codec, cvt_nid); + /* Add sanity check to pass klockwork check. + * This should never happen. + */ + if (WARN_ON(spdif == NULL)) + return true; non_pcm = !!(spdif->status & IEC958_AES0_NONAUDIO); mutex_unlock(&codec->spdif_mutex); return non_pcm; -- cgit v0.10.2 From cfecf1afd3a7412df810c2b98c77744f90c13e24 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Fri, 17 Jun 2016 16:30:03 +0200 Subject: sound: oss: avoid time_t usage We want to remove all time_t users from the kernel because of y2038 compatibility. This particular instance does not even use time_t to store a seconds value, so we can simply use 'unsigned int', which seems more fitting anywhere. The same code is used in two OSS files. Signed-off-by: Arnd Bergmann Signed-off-by: Takashi Iwai diff --git a/sound/oss/sound_timer.c b/sound/oss/sound_timer.c index 8021c85..3a444a6 100644 --- a/sound/oss/sound_timer.c +++ b/sound/oss/sound_timer.c @@ -17,7 +17,7 @@ #include "sound_config.h" static volatile int initialized, opened, tmr_running; -static volatile time_t tmr_offs, tmr_ctr; +static volatile unsigned int tmr_offs, tmr_ctr; static volatile unsigned long ticks_offs; static volatile int curr_tempo, curr_timebase; static volatile unsigned long curr_ticks; diff --git a/sound/oss/sys_timer.c b/sound/oss/sys_timer.c index 2226dda..d17019d 100644 --- a/sound/oss/sys_timer.c +++ b/sound/oss/sys_timer.c @@ -19,7 +19,7 @@ #include "sound_config.h" static volatile int opened, tmr_running; -static volatile time_t tmr_offs, tmr_ctr; +static volatile unsigned int tmr_offs, tmr_ctr; static volatile unsigned long ticks_offs; static volatile int curr_tempo, curr_timebase; static volatile unsigned long curr_ticks; -- cgit v0.10.2 From e5c53278718f7f764a9d3436dc16545cb3844049 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Fri, 17 Jun 2016 20:12:15 +0530 Subject: ALSA: usb-audio: Change structure initialisation to C99 style To allow for structure randomisation, replace the in order struct initialisation style with explicit field style. The Coccinelle semantic patch used to make this change is as follows: @decl@ identifier i1,fld; type T; field list[n] fs; @@ struct i1 { fs T fld; ...}; @@ identifier decl.i1,i2,decl.fld; expression e; position bad.p, bad.fix; @@ struct i1 i2@p = { ..., + .fld = e - e@fix ,...}; Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Takashi Iwai diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c index 1f8fb0d9..9038b2e 100644 --- a/sound/usb/mixer_maps.c +++ b/sound/usb/mixer_maps.c @@ -107,8 +107,10 @@ static struct usbmix_name_map extigy_map[] = { * e.g. no Master and fake PCM volume * Pavel Mihaylov */ -static struct usbmix_dB_map mp3plus_dB_1 = {-4781, 0}; /* just guess */ -static struct usbmix_dB_map mp3plus_dB_2 = {-1781, 618}; /* just guess */ +static struct usbmix_dB_map mp3plus_dB_1 = {.min = -4781, .max = 0}; + /* just guess */ +static struct usbmix_dB_map mp3plus_dB_2 = {.min = -1781, .max = 618}; + /* just guess */ static struct usbmix_name_map mp3plus_map[] = { /* 1: IT pcm */ -- cgit v0.10.2 From d169133889090903d9feb968deb9fa01240a58f5 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Fri, 17 Jun 2016 20:15:54 +0530 Subject: ALSA: ctxfi: Change structure initialisation to C99 style For readability and to allow for structure randomisation, replace the in order struct initialisation style with explicit field style. The Coccinelle semantic patch used to make this change is as follows: @decl@ identifier i1,fld; type T; field list[n] fs; @@ struct i1 { fs T fld; ...}; @@ identifier decl.i1,i2,decl.fld; expression e; position bad.p, bad.fix; @@ struct i1 i2@p = { ..., + .fld = e - e@fix ,...}; Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Takashi Iwai diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c index 9dc2950..6414ecf 100644 --- a/sound/pci/ctxfi/cthw20k2.c +++ b/sound/pci/ctxfi/cthw20k2.c @@ -1615,23 +1615,23 @@ static int hw_dac_init(struct hw *hw, const struct dac_conf *info) int i; struct regs_cs4382 cs_read = {0}; struct regs_cs4382 cs_def = { - 0x00000001, /* Mode Control 1 */ - 0x00000000, /* Mode Control 2 */ - 0x00000084, /* Mode Control 3 */ - 0x00000000, /* Filter Control */ - 0x00000000, /* Invert Control */ - 0x00000024, /* Mixing Control Pair 1 */ - 0x00000000, /* Vol Control A1 */ - 0x00000000, /* Vol Control B1 */ - 0x00000024, /* Mixing Control Pair 2 */ - 0x00000000, /* Vol Control A2 */ - 0x00000000, /* Vol Control B2 */ - 0x00000024, /* Mixing Control Pair 3 */ - 0x00000000, /* Vol Control A3 */ - 0x00000000, /* Vol Control B3 */ - 0x00000024, /* Mixing Control Pair 4 */ - 0x00000000, /* Vol Control A4 */ - 0x00000000 /* Vol Control B4 */ + .mode_control_1 = 0x00000001, /* Mode Control 1 */ + .mode_control_2 = 0x00000000, /* Mode Control 2 */ + .mode_control_3 = 0x00000084, /* Mode Control 3 */ + .filter_control = 0x00000000, /* Filter Control */ + .invert_control = 0x00000000, /* Invert Control */ + .mix_control_P1 = 0x00000024, /* Mixing Control Pair 1 */ + .vol_control_A1 = 0x00000000, /* Vol Control A1 */ + .vol_control_B1 = 0x00000000, /* Vol Control B1 */ + .mix_control_P2 = 0x00000024, /* Mixing Control Pair 2 */ + .vol_control_A2 = 0x00000000, /* Vol Control A2 */ + .vol_control_B2 = 0x00000000, /* Vol Control B2 */ + .mix_control_P3 = 0x00000024, /* Mixing Control Pair 3 */ + .vol_control_A3 = 0x00000000, /* Vol Control A3 */ + .vol_control_B3 = 0x00000000, /* Vol Control B3 */ + .mix_control_P4 = 0x00000024, /* Mixing Control Pair 4 */ + .vol_control_A4 = 0x00000000, /* Vol Control A4 */ + .vol_control_B4 = 0x00000000 /* Vol Control B4 */ }; if (hw->model == CTSB1270) { -- cgit v0.10.2 From 3915bf2946520ace5bcc8104717a3cb0452d7430 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Fri, 17 Jun 2016 17:10:32 +0200 Subject: ALSA: seq_timer: use monotonic times internally The sequencer client manager reports timestamps in units of unsigned 32-bit seconds/nanoseconds, but that does not suffer from the y2038 overflow because it stores only the delta since the 'last_update' time was recorded. However, the use of the do_gettimeofday() function is problematic and we have to replace it to avoid the overflow on on 32-bit architectures. This uses 'struct timespec64' to record 'last_update', and changes the code to use monotonic timestamps that do not suffer from leap seconds and settimeofday updates. As a side-effect, the code can now use the timespec64_sub() helper and become more readable and also avoid a multiplication to convert from microseconds to nanoseconds. Signed-off-by: Arnd Bergmann Signed-off-by: Takashi Iwai diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c index 2931049..dcc1028 100644 --- a/sound/core/seq/seq_timer.c +++ b/sound/core/seq/seq_timer.c @@ -165,7 +165,7 @@ static void snd_seq_timer_interrupt(struct snd_timer_instance *timeri, snd_seq_timer_update_tick(&tmr->tick, resolution); /* register actual time of this timer update */ - do_gettimeofday(&tmr->last_update); + ktime_get_ts64(&tmr->last_update); spin_unlock_irqrestore(&tmr->lock, flags); @@ -392,7 +392,7 @@ static int seq_timer_start(struct snd_seq_timer *tmr) return -EINVAL; snd_timer_start(tmr->timeri, tmr->ticks); tmr->running = 1; - do_gettimeofday(&tmr->last_update); + ktime_get_ts64(&tmr->last_update); return 0; } @@ -420,7 +420,7 @@ static int seq_timer_continue(struct snd_seq_timer *tmr) } snd_timer_start(tmr->timeri, tmr->ticks); tmr->running = 1; - do_gettimeofday(&tmr->last_update); + ktime_get_ts64(&tmr->last_update); return 0; } @@ -444,17 +444,12 @@ snd_seq_real_time_t snd_seq_timer_get_cur_time(struct snd_seq_timer *tmr) spin_lock_irqsave(&tmr->lock, flags); cur_time = tmr->cur_time; if (tmr->running) { - struct timeval tm; - int usec; - do_gettimeofday(&tm); - usec = (int)(tm.tv_usec - tmr->last_update.tv_usec); - if (usec < 0) { - cur_time.tv_nsec += (1000000 + usec) * 1000; - cur_time.tv_sec += tm.tv_sec - tmr->last_update.tv_sec - 1; - } else { - cur_time.tv_nsec += usec * 1000; - cur_time.tv_sec += tm.tv_sec - tmr->last_update.tv_sec; - } + struct timespec64 tm; + + ktime_get_ts64(&tm); + tm = timespec64_sub(tm, tmr->last_update); + cur_time.tv_nsec = tm.tv_nsec; + cur_time.tv_sec = tm.tv_sec; snd_seq_sanity_real_time(&cur_time); } spin_unlock_irqrestore(&tmr->lock, flags); diff --git a/sound/core/seq/seq_timer.h b/sound/core/seq/seq_timer.h index 88dfb71..9506b66 100644 --- a/sound/core/seq/seq_timer.h +++ b/sound/core/seq/seq_timer.h @@ -52,7 +52,7 @@ struct snd_seq_timer { unsigned int skew; unsigned int skew_base; - struct timeval last_update; /* time of last clock update, used for interpolation */ + struct timespec64 last_update; /* time of last clock update, used for interpolation */ spinlock_t lock; }; -- cgit v0.10.2 From cf7d7edc7a120fd5001f6dcc1e9f2c8e9c09e6c9 Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Wed, 29 Jun 2016 20:26:28 +0530 Subject: ALSA: riptide: Use DIV_ROUND_UP The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)) but is perhaps more readable. The Coccinelle script used to make this change is as follows: @haskernel@ @@ #include @depends on haskernel@ expression n,d; @@ ( - (n + d - 1) / d + DIV_ROUND_UP(n,d) | - (n + (d - 1)) / d + DIV_ROUND_UP(n,d) ) Signed-off-by: Amitoj Kaur Chawla Reviewed-by: Takashi Sakamoto Signed-off-by: Takashi Iwai diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 94639d6..067a912 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -1496,7 +1496,7 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream) f = PAGE_SIZE; while ((size + (f >> 1) - 1) <= (f << 7) && (f << 1) > period) f = f >> 1; - pages = (size + f - 1) / f; + pages = DIV_ROUND_UP(size, f); data->size = size; data->pages = pages; snd_printdd -- cgit v0.10.2 From b268c34e5ee92a4cc3099b0caaf26e6bfbdf0f18 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Mon, 4 Jul 2016 17:07:45 +0200 Subject: ALSA: ppc/awacs: shut up maybe-uninitialized warning The awacs sound driver produces a false-positive warning in ppc64_defconfig: sound/ppc/awacs.c: In function 'snd_pmac_awacs_init': include/sound/control.h:219:9: warning: 'master_vol' may be used uninitialized in this function [-Wmaybe-uninitialized] I haven't come up with a good way to rewrite the code to avoid the warning, so here is a bad one: I initialize the variable before the conditionall initialization so gcc no longer has to worry about it. Signed-off-by: Arnd Bergmann Signed-off-by: Takashi Iwai diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c index 09da7b5..1468e4b 100644 --- a/sound/ppc/awacs.c +++ b/sound/ppc/awacs.c @@ -991,6 +991,7 @@ snd_pmac_awacs_init(struct snd_pmac *chip) if (err < 0) return err; } + master_vol = NULL; if (pm7500) err = build_mixers(chip, ARRAY_SIZE(snd_pmac_awacs_mixers_pmac7500), -- cgit v0.10.2 From 860c1994a70a0d2ab6f87fb7e72e722a8fb2c64c Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Thu, 7 Jul 2016 21:57:10 +0900 Subject: ALSA: control: add dimension validator for userspace elements The 'dimen' field in struct snd_ctl_elem_info is used to compose all of members in the element as multi-dimensional matrix. The field has four members. Each member represents the width in each dimension level by element member unit. For example, if the members consist of typical two dimensional matrix, the dimen[0] represents the number of rows and dimen[1] represents the number of columns (or vise-versa). The total members in the matrix should be exactly the same as the number of members in the element, while current implementation has no validator of this information. In a view of userspace applications, the information must be valid so that it cannot cause any bugs such as buffer-over-run. This commit adds a validator of dimension information for userspace applications which add new element sets. When they add the element sets with wrong dimension information, they receive -EINVAL. Signed-off-by: Takashi Sakamoto Signed-off-by: Takashi Iwai diff --git a/sound/core/control.c b/sound/core/control.c index a85d455..9ff081c 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -805,6 +805,36 @@ static int snd_ctl_elem_list(struct snd_card *card, return 0; } +static bool validate_element_member_dimension(struct snd_ctl_elem_info *info) +{ + unsigned int members; + unsigned int i; + + if (info->dimen.d[0] == 0) + return true; + + members = 1; + for (i = 0; i < ARRAY_SIZE(info->dimen.d); ++i) { + if (info->dimen.d[i] == 0) + break; + members *= info->dimen.d[i]; + + /* + * info->count should be validated in advance, to guarantee + * calculation soundness. + */ + if (members > info->count) + return false; + } + + for (++i; i < ARRAY_SIZE(info->dimen.d); ++i) { + if (info->dimen.d[i] > 0) + return false; + } + + return members == info->count; +} + static int snd_ctl_elem_info(struct snd_ctl_file *ctl, struct snd_ctl_elem_info *info) { @@ -1272,6 +1302,8 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file, if (info->count < 1 || info->count > max_value_counts[info->type]) return -EINVAL; + if (!validate_element_member_dimension(info)) + return -EINVAL; private_size = value_sizes[info->type] * info->count; /* -- cgit v0.10.2 From a5d48be457273e4faf34a2033c63f8890f3f9c6c Mon Sep 17 00:00:00 2001 From: Vinod Koul Date: Mon, 11 Jul 2016 15:43:29 +0530 Subject: ALSA - hda: Fix timestamping documentation Some typos in the documentation, so fix them up. Signed-off-by: Vinod Koul Signed-off-by: Takashi Iwai diff --git a/Documentation/sound/alsa/timestamping.txt b/Documentation/sound/alsa/timestamping.txt index 1b6473f..9d579ae 100644 --- a/Documentation/sound/alsa/timestamping.txt +++ b/Documentation/sound/alsa/timestamping.txt @@ -14,7 +14,7 @@ provides a refined estimate with a delay. event or application query. The difference (tstamp - trigger_tstamp) defines the elapsed time. -The ALSA API provides reports two basic pieces of information, avail +The ALSA API provides two basic pieces of information, avail and delay, which combined with the trigger and current system timestamps allow for applications to keep track of the 'fullness' of the ring buffer and the amount of queued samples. @@ -53,21 +53,21 @@ case): The analog time is taken at the last stage of the playback, as close as possible to the actual transducer -The link time is taken at the output of the SOC/chipset as the samples +The link time is taken at the output of the SoC/chipset as the samples are pushed on a link. The link time can be directly measured if supported in hardware by sample counters or wallclocks (e.g. with HDAudio 24MHz or PTP clock for networked solutions) or indirectly estimated (e.g. with the frame counter in USB). The DMA time is measured using counters - typically the least reliable -of all measurements due to the bursty natured of DMA transfers. +of all measurements due to the bursty nature of DMA transfers. The app time corresponds to the time tracked by an application after writing in the ring buffer. -The application can query what the hardware supports, define which +The application can query the hardware capabilities, define which audio time it wants reported by selecting the relevant settings in -audio_tstamp_config fields, get an estimate of the timestamp +audio_tstamp_config fields, thus get an estimate of the timestamp accuracy. It can also request the delay-to-analog be included in the measurement. Direct access to the link time is very interesting on platforms that provide an embedded DSP; measuring directly the link @@ -169,7 +169,7 @@ playback: systime: 938107562 nsec, audio time 938112708 nsec, systime delta -51 Example 1 shows that the timestamp at the DMA level is close to 1ms ahead of the actual playback time (as a side time this sort of measurement can help define rewind safeguards). Compensating for the -DMA-link delay in example 2 helps remove the hardware buffering abut +DMA-link delay in example 2 helps remove the hardware buffering but the information is still very jittery, with up to one sample of error. In example 3 where the timestamps are measured with the link wallclock, the timestamps show a monotonic behavior and a lower -- cgit v0.10.2 From dfa40d3e3686591f7c30990c67f11b5d30f4527f Mon Sep 17 00:00:00 2001 From: Amitoj Kaur Chawla Date: Tue, 12 Jul 2016 08:54:35 +0530 Subject: sound: oss: Remove useless initialisation Remove useless initialisation of variable whose value is reinitialised later. The Coccinelle semantic patch used to make this change is as follows: @@ type T; identifier x; constant C; expression e; @@ T x - = C ; x = e; Signed-off-by: Amitoj Kaur Chawla Signed-off-by: Takashi Iwai diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c index 10c8de1..6368e5c 100644 --- a/sound/oss/ad1848.c +++ b/sound/oss/ad1848.c @@ -254,7 +254,7 @@ static void ad_write(ad1848_info * devc, int reg, int data) static void wait_for_calibration(ad1848_info * devc) { - int timeout = 0; + int timeout; /* * Wait until the auto calibration process has finished. -- cgit v0.10.2 From 3805e6a18d459d520fb921698e3e3e21d8a039db Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 12 Jul 2016 11:22:40 +0100 Subject: ALSA: ak4117: remove redundant check on err being < 0 snd_ak4117_create checks if the error return err is less than zero or not. This is a redundant check, err can only be < 0 to get to the __fail label, in which case just return err and remove the redundant check (since we never return -EIO). Signed-off-by: Colin Ian King Signed-off-by: Takashi Iwai diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c index 48848909..0702f05 100644 --- a/sound/i2c/other/ak4117.c +++ b/sound/i2c/other/ak4117.c @@ -110,7 +110,7 @@ int snd_ak4117_create(struct snd_card *card, ak4117_read_t *read, ak4117_write_t __fail: snd_ak4117_free(chip); - return err < 0 ? err : -EIO; + return err; } void snd_ak4117_reg_write(struct ak4117 *chip, unsigned char reg, unsigned char mask, unsigned char val) -- cgit v0.10.2 From 5137d6da462d26bb2cb0c7a6960888adb789fb3d Mon Sep 17 00:00:00 2001 From: Colin Ian King Date: Tue, 12 Jul 2016 11:26:29 +0100 Subject: ALSA: ak4114: remove redundant check on err being < 0 snd_ak4114_create checks if the error return err is less than zero or not. This is a redundant check, err can only be < 0 to get to the __fail label, in which case just return err and remove the redundant check (since we never return -EIO). Signed-off-by: Colin Ian King Signed-off-by: Takashi Iwai diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index 5a4cf3f..d53c9bb 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c @@ -121,7 +121,7 @@ int snd_ak4114_create(struct snd_card *card, __fail: snd_ak4114_free(chip); - return err < 0 ? err : -EIO; + return err; } EXPORT_SYMBOL(snd_ak4114_create); -- cgit v0.10.2 From 41e8a5788b5a1e187a690877d83b0f485c8c4ccd Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Wed, 13 Jul 2016 12:59:53 +0300 Subject: ALSA: mixart: don't print an unintialized variable on error My static checker complains that "resp" could be unitialized on error when we print its value. Signed-off-by: Dan Carpenter Reviewed-by: Takashi Sakamoto Signed-off-by: Takashi Iwai diff --git a/sound/pci/mixart/mixart_mixer.c b/sound/pci/mixart/mixart_mixer.c index 58fd79e..51e5349 100644 --- a/sound/pci/mixart/mixart_mixer.c +++ b/sound/pci/mixart/mixart_mixer.c @@ -965,7 +965,7 @@ static int mixart_update_monitoring(struct snd_mixart* chip, int channel) int err; struct mixart_msg request; struct mixart_set_out_audio_level audio_level; - u32 resp; + u32 resp = 0; if(chip->pipe_out_ana.status == PIPE_UNDEFINED) return -EINVAL; /* no pipe defined */ -- cgit v0.10.2 From 275353bb684ecfeb42f7a353fead81d43a01c519 Mon Sep 17 00:00:00 2001 From: Takashi Sakamoto Date: Sat, 16 Jul 2016 22:24:32 +0900 Subject: ALSA: echoaudio: purge contradictions between dimension matrix members and total number of members Currently, sound device drivers for PCI cards produced by Echo Audio support dimension parameter of element information. But the information has contradictions to the number of members of each element. I guess that this comes from the assumption that these sound cards are used only by 'echomixer' in userspace. But ideally, they should be used with usual ALSA control applications. This commit removes the contradiction. As a result, 'Monitor Mixer Volume' and 'VMixer Volume' elements are shown in usual ALSA control applications such as 'amixer' and 'alsamixer' in series. Signed-off-by: Takashi Sakamoto Signed-off-by: Takashi Iwai diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 1cb85ae..3a8e8d5 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c @@ -1272,11 +1272,11 @@ static int snd_echo_mixer_info(struct snd_kcontrol *kcontrol, chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = 1; uinfo->value.integer.min = ECHOGAIN_MINOUT; uinfo->value.integer.max = ECHOGAIN_MAXOUT; uinfo->dimen.d[0] = num_busses_out(chip); uinfo->dimen.d[1] = num_busses_in(chip); + uinfo->count = uinfo->dimen.d[0] * uinfo->dimen.d[1]; return 0; } @@ -1344,11 +1344,11 @@ static int snd_echo_vmixer_info(struct snd_kcontrol *kcontrol, chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = 1; uinfo->value.integer.min = ECHOGAIN_MINOUT; uinfo->value.integer.max = ECHOGAIN_MAXOUT; uinfo->dimen.d[0] = num_busses_out(chip); uinfo->dimen.d[1] = num_pipes_out(chip); + uinfo->count = uinfo->dimen.d[0] * uinfo->dimen.d[1]; return 0; } @@ -1728,7 +1728,6 @@ static int snd_echo_vumeters_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; - uinfo->count = 96; uinfo->value.integer.min = ECHOGAIN_MINOUT; uinfo->value.integer.max = 0; #ifdef ECHOCARD_HAS_VMIXER @@ -1738,6 +1737,7 @@ static int snd_echo_vumeters_info(struct snd_kcontrol *kcontrol, #endif uinfo->dimen.d[1] = 16; /* 16 channels */ uinfo->dimen.d[2] = 2; /* 0=level, 1=peak */ + uinfo->count = uinfo->dimen.d[0] * uinfo->dimen.d[1] * uinfo->dimen.d[2]; return 0; } -- cgit v0.10.2