Skip to content

Commit

Permalink
Merge branch 'xonar-dg' of git://git.alsa-project.org/alsa-kprivate i…
Browse files Browse the repository at this point in the history
…nto for-next

This completes the hardware support for the Asus Xonar DG/DGX cards,
and makes them actually usable.

This is v4 of Roman's patch set with some small formatting changes.
  • Loading branch information
Takashi Iwai committed Jan 30, 2014
2 parents cd26251 + 3f49a66 commit 77d531b
Show file tree
Hide file tree
Showing 9 changed files with 713 additions and 501 deletions.
2 changes: 1 addition & 1 deletion sound/pci/oxygen/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
snd-oxygen-lib-objs := oxygen_io.o oxygen_lib.o oxygen_mixer.o oxygen_pcm.o
snd-oxygen-objs := oxygen.o xonar_dg.o
snd-oxygen-objs := oxygen.o xonar_dg_mixer.o xonar_dg.o
snd-virtuoso-objs := virtuoso.o xonar_lib.o \
xonar_pcm179x.o xonar_cs43xx.o xonar_wm87x6.o xonar_hdmi.o

Expand Down
7 changes: 5 additions & 2 deletions sound/pci/oxygen/cs4245.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@
#define CS4245_ADC_OVFL 0x02
#define CS4245_ADC_UNDRFL 0x01

#define CS4245_SPI_ADDRESS_S (0x9e << 16)
#define CS4245_SPI_WRITE_S (0 << 16)

#define CS4245_SPI_ADDRESS (0x9e << 16)
#define CS4245_SPI_WRITE (0 << 16)
#define CS4245_SPI_ADDRESS 0x9e
#define CS4245_SPI_WRITE 0
#define CS4245_SPI_READ 1
2 changes: 1 addition & 1 deletion sound/pci/oxygen/oxygen.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void oxygen_write_ac97(struct oxygen *chip, unsigned int codec,
void oxygen_write_ac97_masked(struct oxygen *chip, unsigned int codec,
unsigned int index, u16 data, u16 mask);

void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data);
int oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data);
void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data);

void oxygen_reset_uart(struct oxygen *chip);
Expand Down
25 changes: 19 additions & 6 deletions sound/pci/oxygen/oxygen_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,23 +194,36 @@ void oxygen_write_ac97_masked(struct oxygen *chip, unsigned int codec,
}
EXPORT_SYMBOL(oxygen_write_ac97_masked);

void oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data)
static int oxygen_wait_spi(struct oxygen *chip)
{
unsigned int count;

/* should not need more than 30.72 us (24 * 1.28 us) */
count = 10;
while ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) & OXYGEN_SPI_BUSY)
&& count > 0) {
/*
* Higher timeout to be sure: 200 us;
* actual transaction should not need more than 40 us.
*/
for (count = 50; count > 0; count--) {
udelay(4);
--count;
if ((oxygen_read8(chip, OXYGEN_SPI_CONTROL) &
OXYGEN_SPI_BUSY) == 0)
return 0;
}
snd_printk(KERN_ERR "oxygen: SPI wait timeout\n");
return -EIO;
}

int oxygen_write_spi(struct oxygen *chip, u8 control, unsigned int data)
{
/*
* We need to wait AFTER initiating the SPI transaction,
* otherwise read operations will not work.
*/
oxygen_write8(chip, OXYGEN_SPI_DATA1, data);
oxygen_write8(chip, OXYGEN_SPI_DATA2, data >> 8);
if (control & OXYGEN_SPI_DATA_LENGTH_3)
oxygen_write8(chip, OXYGEN_SPI_DATA3, data >> 16);
oxygen_write8(chip, OXYGEN_SPI_CONTROL, control);
return oxygen_wait_spi(chip);
}
EXPORT_SYMBOL(oxygen_write_spi);

Expand Down
1 change: 1 addition & 0 deletions sound/pci/oxygen/oxygen_mixer.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ void oxygen_update_dac_routing(struct oxygen *chip)
if (chip->model.update_center_lfe_mix)
chip->model.update_center_lfe_mix(chip, chip->dac_routing > 2);
}
EXPORT_SYMBOL(oxygen_update_dac_routing);

static int upmix_put(struct snd_kcontrol *ctl, struct snd_ctl_elem_value *value)
{
Expand Down
1 change: 1 addition & 0 deletions sound/pci/oxygen/oxygen_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@
#define OXYGEN_PLAY_MUTE23 0x0002
#define OXYGEN_PLAY_MUTE45 0x0004
#define OXYGEN_PLAY_MUTE67 0x0008
#define OXYGEN_PLAY_MUTE_MASK 0x000f
#define OXYGEN_PLAY_MULTICH_MASK 0x0010
#define OXYGEN_PLAY_MULTICH_I2S_DAC 0x0000
#define OXYGEN_PLAY_MULTICH_AC97 0x0010
Expand Down
Loading

0 comments on commit 77d531b

Please sign in to comment.