// SPDX-License-Identifier: GPL-2.0-only /***************************************************************************** * * Copyright (C) 2008 Cedric Bregardis <cedric.bregardis@free.fr> and * Jean-Christian Hassler <jhassler@free.fr> * * This file is part of the Audiowerk2 ALSA driver *
*****************************************************************************/
Threshold definition VALUE WRITE MODE READ MODE 00 1 Dword of valid data 1 empty Dword 01 4 Dwords of valid data 4 empty Dwords 10 8 Dwords of valid data 8 empty Dwords
11 16 Dwords of valid data 16 empty Dwords */
unsignedint acon2; unsignedint acon1 = 0; int i;
/* Set base addr */
chip->base_addr = pci_base_addr;
/* A1 and A2 are active and asynchronous */
acon1 |= 3 * AUDIO_MODE;
WRITEREG(acon1, ACON1);
/* The following comes from original windows driver. It is needed to have a correct behavior of input and output
simultenously, but I don't know why ! */
WRITEREG(3 * (BurstA1_in) + 3 * (ThreshA1_in) +
3 * (BurstA1_out) + 3 * (ThreshA1_out) +
3 * (BurstA2_out) + 3 * (ThreshA2_out), PCI_BT_A);
/* Configure DMA for substream Configuration informations: ALSA has allocated continuous memory pages. So we don't need to use MMU of saa7146.
*/
/* No MMU -> nothing to do with PageA1, we only configure the limit of
PageAx_out register */ /* Disable MMU */
dw_page = (0L << 11);
/* Configure Limit for DMA access. The limit register defines an address limit, which generates an interrupt if passed by the actual PCI address pointer. '0001' means an interrupt will be generated if the lower 6 bits (64 bytes) of the PCI address are zero. '0010' defines a limit of 128 bytes, '0011' one of 256 bytes, and so on up to 1 Mbyte defined by '1111'. This interrupt range can be calculated as follows: Range = 2^(5 + Limit) bytes.
*/
dw_limit = snd_aw2_saa7146_get_limit(period_size);
dw_page |= (dw_limit << 4);
if (stream_number == 0) {
WRITEREG(dw_page, PageA2_out);
/* Base address for DMA transfert. */ /* This address has been reserved by ALSA. */ /* This is a physical address */
WRITEREG(dma_addr, BaseA2_out);
/* Base address for DMA transfert. */ /* This address has been reserved by ALSA. */ /* This is a physical address */
WRITEREG(dma_addr, BaseA1_out);
/* Define upper limit for DMA access */
WRITEREG(dma_addr + buffer_size, ProtA1_out);
} else {
pr_err("aw2: snd_aw2_saa7146_pcm_init_playback: " "Substream number is not 0 or 1 -> not managed\n");
}
}
/* Configure DMA for substream Configuration informations: ALSA has allocated continuous memory pages. So we don't need to use MMU of saa7146.
*/
/* No MMU -> nothing to do with PageA1, we only configure the limit of
PageAx_out register */ /* Disable MMU */
dw_page = (0L << 11);
/* Configure Limit for DMA access. The limit register defines an address limit, which generates an interrupt if passed by the actual PCI address pointer. '0001' means an interrupt will be generated if the lower 6 bits (64 bytes) of the PCI address are zero. '0010' defines a limit of 128 bytes, '0011' one of 256 bytes, and so on up to 1 Mbyte defined by '1111'. This interrupt range can be calculated as follows: Range = 2^(5 + Limit) bytes.
*/
dw_limit = snd_aw2_saa7146_get_limit(period_size);
dw_page |= (dw_limit << 4);
if (stream_number == 0) {
WRITEREG(dw_page, PageA1_in);
/* Base address for DMA transfert. */ /* This address has been reserved by ALSA. */ /* This is a physical address */
WRITEREG(dma_addr, BaseA1_in);
/* Define upper limit for DMA access */
WRITEREG(dma_addr + buffer_size, ProtA1_in);
} else {
pr_err("aw2: snd_aw2_saa7146_pcm_init_capture: " "Substream number is not 0 -> not managed\n");
}
}
void snd_aw2_saa7146_pcm_trigger_start_playback(struct snd_aw2_saa7146 *chip, int stream_number)
{ unsignedint acon1 = 0; /* In aw8 driver, dma transfert is always active. It is
started and stopped in a larger "space" */
acon1 = READREG(ACON1); if (stream_number == 0) {
WRITEREG((TR_E_A2_OUT << 16) | TR_E_A2_OUT, MC1);
void snd_aw2_saa7146_pcm_trigger_start_capture(struct snd_aw2_saa7146 *chip, int stream_number)
{ /* In aw8 driver, dma transfert is always active. It is
started and stopped in a larger "space" */ if (stream_number == 0)
WRITEREG((TR_E_A1_IN << 16) | TR_E_A1_IN, MC1);
}
void snd_aw2_saa7146_pcm_trigger_stop_capture(struct snd_aw2_saa7146 *chip, int stream_number)
{ if (stream_number == 0)
WRITEREG((TR_E_A1_IN << 16), MC1);
}
void snd_aw2_saa7146_use_digital_input(struct snd_aw2_saa7146 *chip, int use_digital)
{ /* FIXME: switch between analog and digital input does not always work. It can produce a kind of white noise. It seams that received data are inverted sometime (endian inversion). Why ? I don't know, maybe a problem of synchronization... However for the time being I have not found the problem. Workaround: switch again (and again) between
digital and analog input until it works. */ if (use_digital)
WRITEREG(0x40, GPIO_CTRL); else
WRITEREG(0x50, GPIO_CTRL);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.