aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen/oxygen.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2010-12-02 05:41:10 -0500
committerTakashi Iwai <tiwai@suse.de>2010-12-06 08:48:15 -0500
commit9719fcaa6a82be59a2d7767725e5cd8233c6a387 (patch)
treed9cbeec26ff94c135d15890cb7d9f5b6da5f40c7 /sound/pci/oxygen/oxygen.c
parente96f38f732d24515792296b3738842934c985539 (diff)
ALSA: oxygen: allow to dump codec registers
To help with debugging, add the registers of the model-specific codecs to the controller and AC97 register dump in the proc file. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen/oxygen.c')
-rw-r--r--sound/pci/oxygen/oxygen.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index ea8fffefad9f..a58e448fc1bf 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -41,6 +41,7 @@
41#include <sound/ac97_codec.h> 41#include <sound/ac97_codec.h>
42#include <sound/control.h> 42#include <sound/control.h>
43#include <sound/core.h> 43#include <sound/core.h>
44#include <sound/info.h>
44#include <sound/initval.h> 45#include <sound/initval.h>
45#include <sound/pcm.h> 46#include <sound/pcm.h>
46#include <sound/pcm_params.h> 47#include <sound/pcm_params.h>
@@ -518,6 +519,39 @@ static int generic_wm8785_mixer_init(struct oxygen *chip)
518 return 0; 519 return 0;
519} 520}
520 521
522static void dump_ak4396_registers(struct oxygen *chip,
523 struct snd_info_buffer *buffer)
524{
525 struct generic_data *data = chip->model_data;
526 unsigned int dac, i;
527
528 for (dac = 0; dac < data->dacs; ++dac) {
529 snd_iprintf(buffer, "\nAK4396 %u:", dac + 1);
530 for (i = 0; i < 5; ++i)
531 snd_iprintf(buffer, " %02x", data->ak4396_regs[dac][i]);
532 }
533 snd_iprintf(buffer, "\n");
534}
535
536static void dump_wm8785_registers(struct oxygen *chip,
537 struct snd_info_buffer *buffer)
538{
539 struct generic_data *data = chip->model_data;
540 unsigned int i;
541
542 snd_iprintf(buffer, "\nWM8785:");
543 for (i = 0; i < 3; ++i)
544 snd_iprintf(buffer, " %03x", data->wm8785_regs[i]);
545 snd_iprintf(buffer, "\n");
546}
547
548static void dump_oxygen_registers(struct oxygen *chip,
549 struct snd_info_buffer *buffer)
550{
551 dump_ak4396_registers(chip, buffer);
552 dump_wm8785_registers(chip, buffer);
553}
554
521static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); 555static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
522 556
523static const struct oxygen_model model_generic = { 557static const struct oxygen_model model_generic = {
@@ -533,6 +567,7 @@ static const struct oxygen_model model_generic = {
533 .set_adc_params = set_wm8785_params, 567 .set_adc_params = set_wm8785_params,
534 .update_dac_volume = update_ak4396_volume, 568 .update_dac_volume = update_ak4396_volume,
535 .update_dac_mute = update_ak4396_mute, 569 .update_dac_mute = update_ak4396_mute,
570 .dump_registers = dump_oxygen_registers,
536 .dac_tlv = ak4396_db_scale, 571 .dac_tlv = ak4396_db_scale,
537 .model_data_size = sizeof(struct generic_data), 572 .model_data_size = sizeof(struct generic_data),
538 .device_config = PLAYBACK_0_TO_I2S | 573 .device_config = PLAYBACK_0_TO_I2S |
@@ -561,6 +596,7 @@ static int __devinit get_oxygen_model(struct oxygen *chip,
561 chip->model.mixer_init = generic_mixer_init; 596 chip->model.mixer_init = generic_mixer_init;
562 chip->model.resume = meridian_resume; 597 chip->model.resume = meridian_resume;
563 chip->model.set_adc_params = set_ak5385_params; 598 chip->model.set_adc_params = set_ak5385_params;
599 chip->model.dump_registers = dump_ak4396_registers;
564 chip->model.device_config = PLAYBACK_0_TO_I2S | 600 chip->model.device_config = PLAYBACK_0_TO_I2S |
565 PLAYBACK_1_TO_SPDIF | 601 PLAYBACK_1_TO_SPDIF |
566 CAPTURE_0_FROM_I2S_2 | 602 CAPTURE_0_FROM_I2S_2 |
@@ -579,6 +615,7 @@ static int __devinit get_oxygen_model(struct oxygen *chip,
579 chip->model.suspend = claro_suspend; 615 chip->model.suspend = claro_suspend;
580 chip->model.resume = claro_resume; 616 chip->model.resume = claro_resume;
581 chip->model.set_adc_params = set_ak5385_params; 617 chip->model.set_adc_params = set_ak5385_params;
618 chip->model.dump_registers = dump_ak4396_registers;
582 chip->model.device_config = PLAYBACK_0_TO_I2S | 619 chip->model.device_config = PLAYBACK_0_TO_I2S |
583 PLAYBACK_1_TO_SPDIF | 620 PLAYBACK_1_TO_SPDIF |
584 CAPTURE_0_FROM_I2S_2 | 621 CAPTURE_0_FROM_I2S_2 |
@@ -595,6 +632,7 @@ static int __devinit get_oxygen_model(struct oxygen *chip,
595 chip->model.resume = stereo_resume; 632 chip->model.resume = stereo_resume;
596 chip->model.mixer_init = generic_mixer_init; 633 chip->model.mixer_init = generic_mixer_init;
597 chip->model.set_adc_params = set_no_params; 634 chip->model.set_adc_params = set_no_params;
635 chip->model.dump_registers = dump_ak4396_registers;
598 chip->model.device_config = PLAYBACK_0_TO_I2S | 636 chip->model.device_config = PLAYBACK_0_TO_I2S |
599 PLAYBACK_1_TO_SPDIF; 637 PLAYBACK_1_TO_SPDIF;
600 if (id->driver_data == MODEL_FANTASIA) 638 if (id->driver_data == MODEL_FANTASIA)