aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/oxygen/oxygen.c')
-rw-r--r--sound/pci/oxygen/oxygen.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index d12fd9efe94e..3ad9eb00aebd 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -352,6 +352,70 @@ static void set_ak5385_params(struct oxygen *chip,
352 value, GPIO_AK5385_DFS_MASK); 352 value, GPIO_AK5385_DFS_MASK);
353} 353}
354 354
355static int rolloff_info(struct snd_kcontrol *ctl,
356 struct snd_ctl_elem_info *info)
357{
358 static const char *const names[2] = {
359 "Sharp Roll-off", "Slow Roll-off"
360 };
361
362 info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
363 info->count = 1;
364 info->value.enumerated.items = 2;
365 if (info->value.enumerated.item >= 2)
366 info->value.enumerated.item = 1;
367 strcpy(info->value.enumerated.name, names[info->value.enumerated.item]);
368 return 0;
369}
370
371static int rolloff_get(struct snd_kcontrol *ctl,
372 struct snd_ctl_elem_value *value)
373{
374 struct oxygen *chip = ctl->private_data;
375 struct generic_data *data = chip->model_data;
376
377 value->value.enumerated.item[0] =
378 (data->ak4396_regs[0][AK4396_CONTROL_2] & AK4396_SLOW) != 0;
379 return 0;
380}
381
382static int rolloff_put(struct snd_kcontrol *ctl,
383 struct snd_ctl_elem_value *value)
384{
385 struct oxygen *chip = ctl->private_data;
386 struct generic_data *data = chip->model_data;
387 unsigned int i;
388 int changed;
389 u8 reg;
390
391 mutex_lock(&chip->mutex);
392 reg = data->ak4396_regs[0][AK4396_CONTROL_2];
393 if (value->value.enumerated.item[0])
394 reg |= AK4396_SLOW;
395 else
396 reg &= ~AK4396_SLOW;
397 changed = reg != data->ak4396_regs[0][AK4396_CONTROL_2];
398 if (changed) {
399 for (i = 0; i < 4; ++i)
400 ak4396_write(chip, i, AK4396_CONTROL_2, reg);
401 }
402 mutex_unlock(&chip->mutex);
403 return changed;
404}
405
406static const struct snd_kcontrol_new rolloff_control = {
407 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
408 .name = "DAC Filter Playback Enum",
409 .info = rolloff_info,
410 .get = rolloff_get,
411 .put = rolloff_put,
412};
413
414static int generic_mixer_init(struct oxygen *chip)
415{
416 return snd_ctl_add(chip->card, snd_ctl_new1(&rolloff_control, chip));
417}
418
355static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); 419static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
356 420
357static const struct oxygen_model model_generic = { 421static const struct oxygen_model model_generic = {
@@ -359,6 +423,7 @@ static const struct oxygen_model model_generic = {
359 .longname = "C-Media Oxygen HD Audio", 423 .longname = "C-Media Oxygen HD Audio",
360 .chip = "CMI8788", 424 .chip = "CMI8788",
361 .init = generic_init, 425 .init = generic_init,
426 .mixer_init = generic_mixer_init,
362 .cleanup = generic_cleanup, 427 .cleanup = generic_cleanup,
363 .resume = generic_resume, 428 .resume = generic_resume,
364 .get_i2s_mclk = oxygen_default_i2s_mclk, 429 .get_i2s_mclk = oxygen_default_i2s_mclk,