[alsa-devel] commit bd5389278c96f585afcac4058420e4f3ac201d2a introduce big problem

Scott Jiang scott.jiang.linux at gmail.com
Tue Nov 15 07:08:36 CET 2011


2011/11/14 Takashi Iwai <tiwai at suse.de>:
> At Mon, 14 Nov 2011 17:53:10 +0800,
> Does your driver support mmap?

No, our tdm driver doesn't support mmap.

struct snd_pcm_ops bf5xx_pcm_tdm_ops = {
        .open           = bf5xx_pcm_open,
        .ioctl          = snd_pcm_lib_ioctl,
        .hw_params      = bf5xx_pcm_hw_params,
        .hw_free        = bf5xx_pcm_hw_free,
        .prepare        = bf5xx_pcm_prepare,
        .trigger        = bf5xx_pcm_trigger,
        .pointer        = bf5xx_pcm_pointer,
        .copy           = bf5xx_pcm_copy,
        .silence        = bf5xx_pcm_silence,
};
And only support s32_le and 48000
static const struct snd_pcm_hardware bf5xx_pcm_hardware = {
        .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_BLOCK_TRANSFER |
                SNDRV_PCM_INFO_RESUME),
        .formats =          SNDRV_PCM_FMTBIT_S32_LE,
        .rates =            SNDRV_PCM_RATE_48000,
        .channels_min =     2,
        .channels_max =     8,
        .buffer_bytes_max = PCM_BUFFER_MAX,
        .period_bytes_min = FRAGMENT_SIZE_MIN,
        .period_bytes_max = PCM_BUFFER_MAX/2,
        .periods_min =      FRAGMENTS_MIN,
        .periods_max =      FRAGMENTS_MAX,
};
> What shows aplay -v with the arguments above?
>
root:/> arecord -t wav -c 2 -r 48000 -f S16_LE -d 3 -v 1.wav
Recording WAVE '1.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Linear conversion PCM (S32_LE)
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S16_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 16
  buffer_size  : 4096
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 4096
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Slave: Mmap emulation PCM
Its setup is:
  stream       : CAPTURE
  access       : MMAP_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 4096
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 4096
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Slave: Hardware PCM card 0 'bfin-ad1836' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 4096
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1073741824
  stop_threshold   : 4096
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
  appl_ptr     : 0
  hw_ptr       : 0
root:/> arecord -t wav -c 2 -r 48000 -f S32_LE -d 3 -v 1.wav
Recording WAVE '1.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
Plug PCM: Mmap emulation PCM
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 4096
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1
  stop_threshold   : 4096
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
Slave: Hardware PCM card 0 'bfin-ad1836' device 0 subdevice 0
Its setup is:
  stream       : CAPTURE
  access       : RW_INTERLEAVED
  format       : S32_LE
  subformat    : STD
  channels     : 2
  rate         : 48000
  exact rate   : 48000 (48000/1)
  msbits       : 32
  buffer_size  : 4096
  period_size  : 1024
  period_time  : 21333
  tstamp_mode  : NONE
  period_step  : 1
  avail_min    : 1024
  period_event : 0
  start_threshold  : 1073741824
  stop_threshold   : 4096
  silence_threshold: 0
  silence_size : 0
  boundary     : 1073741824
  appl_ptr     : 0
  hw_ptr       : 0
arecord: pcm_read:1773: read error: Input/output error

> I know of a problem of mmap-emul plugin when it runs over a slave
> that supports the mmap by itself.  But it should work when it runs
> over a slave that doesn't support mmap.
>
I found this bug was introduced by this commit I mentioned.


More information about the Alsa-devel mailing list