aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorDylan Reid <dgreid@chromium.org>2014-02-28 18:41:19 -0500
committerTakashi Iwai <tiwai@suse.de>2014-03-01 05:21:43 -0500
commite62a42aebd7c97977d8ae0bca8de40d26254a1cd (patch)
treeda59fdcc89184db987b434e4e018c7c7829ef89d /sound/pci/hda
parent749ee287fc937d8026fb459b7574d39745c0cbb9 (diff)
ALSA: hda - Pass max_slots and power_save to codec_create
Passing the max slots and power save arguments to codec_create will allow for its reuse by an hda_platform driver. It makes the function independent of the module params in hda_intel and ready to move to hda_shared in a following commit. Signed-off-by: Dylan Reid <dgreid@chromium.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_intel.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 1e7d3f3e6c5c..ebbeefe203fd 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -128,6 +128,7 @@ static struct kernel_param_ops param_ops_xint = {
128#define param_check_xint param_check_int 128#define param_check_xint param_check_int
129 129
130static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; 130static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;
131static int *power_save_addr = &power_save;
131module_param(power_save, xint, 0644); 132module_param(power_save, xint, 0644);
132MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " 133MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
133 "(in second, 0 = disable)."); 134 "(in second, 0 = disable).");
@@ -139,6 +140,8 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
139static bool power_save_controller = 1; 140static bool power_save_controller = 1;
140module_param(power_save_controller, bool, 0644); 141module_param(power_save_controller, bool, 0644);
141MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); 142MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode.");
143#else
144static int *power_save_addr;
142#endif /* CONFIG_PM */ 145#endif /* CONFIG_PM */
143 146
144static int align_buffer_size = -1; 147static int align_buffer_size = -1;
@@ -1347,17 +1350,12 @@ static int get_jackpoll_interval(struct azx *chip)
1347 * Codec initialization 1350 * Codec initialization
1348 */ 1351 */
1349 1352
1350/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ 1353static int azx_codec_create(struct azx *chip, const char *model,
1351static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = { 1354 unsigned int max_slots,
1352 [AZX_DRIVER_NVIDIA] = 8, 1355 int *power_save_to)
1353 [AZX_DRIVER_TERA] = 1,
1354};
1355
1356static int azx_codec_create(struct azx *chip, const char *model)
1357{ 1356{
1358 struct hda_bus_template bus_temp; 1357 struct hda_bus_template bus_temp;
1359 int c, codecs, err; 1358 int c, codecs, err;
1360 int max_slots;
1361 1359
1362 memset(&bus_temp, 0, sizeof(bus_temp)); 1360 memset(&bus_temp, 0, sizeof(bus_temp));
1363 bus_temp.private_data = chip; 1361 bus_temp.private_data = chip;
@@ -1368,7 +1366,7 @@ static int azx_codec_create(struct azx *chip, const char *model)
1368 bus_temp.ops.attach_pcm = azx_attach_pcm_stream; 1366 bus_temp.ops.attach_pcm = azx_attach_pcm_stream;
1369 bus_temp.ops.bus_reset = azx_bus_reset; 1367 bus_temp.ops.bus_reset = azx_bus_reset;
1370#ifdef CONFIG_PM 1368#ifdef CONFIG_PM
1371 bus_temp.power_save = &power_save; 1369 bus_temp.power_save = power_save_to;
1372 bus_temp.ops.pm_notify = azx_power_notify; 1370 bus_temp.ops.pm_notify = azx_power_notify;
1373#endif 1371#endif
1374#ifdef CONFIG_SND_HDA_DSP_LOADER 1372#ifdef CONFIG_SND_HDA_DSP_LOADER
@@ -1387,7 +1385,6 @@ static int azx_codec_create(struct azx *chip, const char *model)
1387 } 1385 }
1388 1386
1389 codecs = 0; 1387 codecs = 0;
1390 max_slots = azx_max_codecs[chip->driver_type];
1391 if (!max_slots) 1388 if (!max_slots)
1392 max_slots = AZX_DEFAULT_CODECS; 1389 max_slots = AZX_DEFAULT_CODECS;
1393 1390
@@ -3568,6 +3565,12 @@ out_free:
3568 return err; 3565 return err;
3569} 3566}
3570 3567
3568/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */
3569static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = {
3570 [AZX_DRIVER_NVIDIA] = 8,
3571 [AZX_DRIVER_TERA] = 1,
3572};
3573
3571static int azx_probe_continue(struct azx *chip) 3574static int azx_probe_continue(struct azx *chip)
3572{ 3575{
3573 struct pci_dev *pci = chip->pci; 3576 struct pci_dev *pci = chip->pci;
@@ -3596,7 +3599,10 @@ static int azx_probe_continue(struct azx *chip)
3596#endif 3599#endif
3597 3600
3598 /* create codec instances */ 3601 /* create codec instances */
3599 err = azx_codec_create(chip, model[dev]); 3602 err = azx_codec_create(chip, model[dev],
3603 azx_max_codecs[chip->driver_type],
3604 power_save_addr);
3605
3600 if (err < 0) 3606 if (err < 0)
3601 goto out_free; 3607 goto out_free;
3602#ifdef CONFIG_SND_HDA_PATCH_LOADER 3608#ifdef CONFIG_SND_HDA_PATCH_LOADER