Re: [PATCH v2 0/1] *** SUBJECT HERE ***

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Thu, 22 Jul 2010 14:07:18 +0300,
Peter Ujfalusi wrote:
> 
> Hi,
> 
> to give Takashi the context ;)
> 
> On Thursday 22 July 2010 13:57:16 Ujfalusi Peter (Nokia-MS/Tampere) wrote:
> > So let's ask Takashi:
> > Is it possible to use the constraint API for placing HALF_DUPLEX on a
> > stream (modifying bits in the info_flags)?
> 
> Is there a clean way to do:
> 
> +       switch (wl1273->mode) {
> +       case WL1273_MODE_BT:
> +               pcm->info_flags &= ~SNDRV_PCM_INFO_HALF_DUPLEX;
> +               break;
> +       case WL1273_MODE_FM_RX:
> +               if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
> +                       pr_err("Cannot play in RX mode.\n");
> +                       return -EINVAL;
> +               }
> +               pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX;
>                  ^
>                  This
> 
> +               break;
> +       case WL1273_MODE_FM_TX:
> +               if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
> +                       pr_err("Cannot capture in TX mode.\n");
> +                       return -EINVAL;
> +               }
> +               pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX;
>                  ^
>                  and this
> 
> +               break;
> +       default:
> 
> with for example the ALSA constraint API?

I don't think so.  Because...

> The info_flags are modified at stream open time.

The HALF_DUPLEX flag is referred in the PCM open itself, but before
the driver's open callback is called (snd_pcm_attach_substream()).
So, changing it in the open callback is too late -- at least for
filtering the duplex access in the common open call.  Of course, the
modified info can be propagated via ioctl to user-space, but the
driver doesn't block the full-duplex.

The hw constrains are basically for hw_params setup.  So, the question
is whether do we want to make open successful but further setup fails,
or do we give the error at open time?  IMO, the latter looks
straightforward.  That is, changing the flag before open call is
needed, or we need to check explicitly in the open callback itself.


Or, let me know if I misunderstand the discussion here...


thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel


[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux