aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/pcxhr/pcxhr_mix22.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/pcxhr/pcxhr_mix22.c')
-rw-r--r--sound/pci/pcxhr/pcxhr_mix22.c40
1 files changed, 36 insertions, 4 deletions
diff --git a/sound/pci/pcxhr/pcxhr_mix22.c b/sound/pci/pcxhr/pcxhr_mix22.c
index ff019126b672..1cb82c0a9cb3 100644
--- a/sound/pci/pcxhr/pcxhr_mix22.c
+++ b/sound/pci/pcxhr/pcxhr_mix22.c
@@ -53,6 +53,8 @@
53#define PCXHR_DSP_RESET_DSP 0x01 53#define PCXHR_DSP_RESET_DSP 0x01
54#define PCXHR_DSP_RESET_MUTE 0x02 54#define PCXHR_DSP_RESET_MUTE 0x02
55#define PCXHR_DSP_RESET_CODEC 0x08 55#define PCXHR_DSP_RESET_CODEC 0x08
56#define PCXHR_DSP_RESET_GPO_OFFSET 5
57#define PCXHR_DSP_RESET_GPO_MASK 0x60
56 58
57/* values for PCHR_XLX_CFG register */ 59/* values for PCHR_XLX_CFG register */
58#define PCXHR_CFG_SYNCDSP_MASK 0x80 60#define PCXHR_CFG_SYNCDSP_MASK 0x80
@@ -81,6 +83,8 @@
81/* values for PCHR_XLX_STATUS register - READ */ 83/* values for PCHR_XLX_STATUS register - READ */
82#define PCXHR_STAT_SRC_LOCK 0x01 84#define PCXHR_STAT_SRC_LOCK 0x01
83#define PCXHR_STAT_LEVEL_IN 0x02 85#define PCXHR_STAT_LEVEL_IN 0x02
86#define PCXHR_STAT_GPI_OFFSET 2
87#define PCXHR_STAT_GPI_MASK 0x0C
84#define PCXHR_STAT_MIC_CAPS 0x10 88#define PCXHR_STAT_MIC_CAPS 0x10
85/* values for PCHR_XLX_STATUS register - WRITE */ 89/* values for PCHR_XLX_STATUS register - WRITE */
86#define PCXHR_STAT_FREQ_SYNC_MASK 0x01 90#define PCXHR_STAT_FREQ_SYNC_MASK 0x01
@@ -291,10 +295,11 @@ int hr222_sub_init(struct pcxhr_mgr *mgr)
291 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, 295 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET,
292 PCXHR_DSP_RESET_DSP); 296 PCXHR_DSP_RESET_DSP);
293 msleep(5); 297 msleep(5);
294 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, 298 mgr->dsp_reset = PCXHR_DSP_RESET_DSP |
295 PCXHR_DSP_RESET_DSP | 299 PCXHR_DSP_RESET_MUTE |
296 PCXHR_DSP_RESET_MUTE | 300 PCXHR_DSP_RESET_CODEC;
297 PCXHR_DSP_RESET_CODEC); 301 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, mgr->dsp_reset);
302 /* hr222_write_gpo(mgr, 0); does the same */
298 msleep(5); 303 msleep(5);
299 304
300 /* config AKM */ 305 /* config AKM */
@@ -496,6 +501,33 @@ int hr222_get_external_clock(struct pcxhr_mgr *mgr,
496} 501}
497 502
498 503
504int hr222_read_gpio(struct pcxhr_mgr *mgr, int is_gpi, int *value)
505{
506 if (is_gpi) {
507 unsigned char reg = PCXHR_INPB(mgr, PCXHR_XLX_STATUS);
508 *value = (int)(reg & PCXHR_STAT_GPI_MASK) >>
509 PCXHR_STAT_GPI_OFFSET;
510 } else {
511 *value = (int)(mgr->dsp_reset & PCXHR_DSP_RESET_GPO_MASK) >>
512 PCXHR_DSP_RESET_GPO_OFFSET;
513 }
514 return 0;
515}
516
517
518int hr222_write_gpo(struct pcxhr_mgr *mgr, int value)
519{
520 unsigned char reg = mgr->dsp_reset & ~PCXHR_DSP_RESET_GPO_MASK;
521
522 reg |= (unsigned char)(value << PCXHR_DSP_RESET_GPO_OFFSET) &
523 PCXHR_DSP_RESET_GPO_MASK;
524
525 PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, reg);
526 mgr->dsp_reset = reg;
527 return 0;
528}
529
530
499int hr222_update_analog_audio_level(struct snd_pcxhr *chip, 531int hr222_update_analog_audio_level(struct snd_pcxhr *chip,
500 int is_capture, int channel) 532 int is_capture, int channel)
501{ 533{