|
@@ -144,9 +144,11 @@ static int oxygen_open(struct snd_pcm_substream *substream,
|
|
|
runtime->hw = *oxygen_hardware[channel];
|
|
|
switch (channel) {
|
|
|
case PCM_C:
|
|
|
- runtime->hw.rates &= ~(SNDRV_PCM_RATE_32000 |
|
|
|
- SNDRV_PCM_RATE_64000);
|
|
|
- runtime->hw.rate_min = 44100;
|
|
|
+ if (chip->model.device_config & CAPTURE_1_FROM_SPDIF) {
|
|
|
+ runtime->hw.rates &= ~(SNDRV_PCM_RATE_32000 |
|
|
|
+ SNDRV_PCM_RATE_64000);
|
|
|
+ runtime->hw.rate_min = 44100;
|
|
|
+ }
|
|
|
/* fall through */
|
|
|
case PCM_A:
|
|
|
case PCM_B:
|
|
@@ -430,17 +432,36 @@ static int oxygen_rec_c_hw_params(struct snd_pcm_substream *substream,
|
|
|
struct snd_pcm_hw_params *hw_params)
|
|
|
{
|
|
|
struct oxygen *chip = snd_pcm_substream_chip(substream);
|
|
|
+ bool is_spdif;
|
|
|
int err;
|
|
|
|
|
|
err = oxygen_hw_params(substream, hw_params);
|
|
|
if (err < 0)
|
|
|
return err;
|
|
|
|
|
|
+ is_spdif = chip->model.device_config & CAPTURE_1_FROM_SPDIF;
|
|
|
+
|
|
|
spin_lock_irq(&chip->reg_lock);
|
|
|
oxygen_write8_masked(chip, OXYGEN_REC_FORMAT,
|
|
|
oxygen_format(hw_params) << OXYGEN_REC_FORMAT_C_SHIFT,
|
|
|
OXYGEN_REC_FORMAT_C_MASK);
|
|
|
+ if (!is_spdif)
|
|
|
+ oxygen_write16_masked(chip, OXYGEN_I2S_C_FORMAT,
|
|
|
+ oxygen_rate(hw_params) |
|
|
|
+ chip->model.adc_i2s_format |
|
|
|
+ get_mclk(chip, PCM_B, hw_params) |
|
|
|
+ oxygen_i2s_bits(hw_params),
|
|
|
+ OXYGEN_I2S_RATE_MASK |
|
|
|
+ OXYGEN_I2S_FORMAT_MASK |
|
|
|
+ OXYGEN_I2S_MCLK_MASK |
|
|
|
+ OXYGEN_I2S_BITS_MASK);
|
|
|
spin_unlock_irq(&chip->reg_lock);
|
|
|
+
|
|
|
+ if (!is_spdif) {
|
|
|
+ mutex_lock(&chip->mutex);
|
|
|
+ chip->model.set_adc_params(chip, hw_params);
|
|
|
+ mutex_unlock(&chip->mutex);
|
|
|
+ }
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -764,5 +785,23 @@ int oxygen_pcm_init(struct oxygen *chip)
|
|
|
DEFAULT_BUFFER_BYTES,
|
|
|
BUFFER_BYTES_MAX);
|
|
|
}
|
|
|
+
|
|
|
+ ins = !!(chip->model.device_config & CAPTURE_3_FROM_I2S_3);
|
|
|
+ if (ins) {
|
|
|
+ err = snd_pcm_new(chip->card, "Analog3", 3, 0, ins, &pcm);
|
|
|
+ if (err < 0)
|
|
|
+ return err;
|
|
|
+ snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
|
|
|
+ &oxygen_rec_c_ops);
|
|
|
+ oxygen_write8_masked(chip, OXYGEN_REC_ROUTING,
|
|
|
+ OXYGEN_REC_C_ROUTE_I2S_ADC_3,
|
|
|
+ OXYGEN_REC_C_ROUTE_MASK);
|
|
|
+ pcm->private_data = chip;
|
|
|
+ strcpy(pcm->name, "Analog 3");
|
|
|
+ snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
|
|
|
+ snd_dma_pci_data(chip->pci),
|
|
|
+ DEFAULT_BUFFER_BYTES,
|
|
|
+ BUFFER_BYTES_MAX);
|
|
|
+ }
|
|
|
return 0;
|
|
|
}
|