All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: tiwai@suse.de, alsa-devel@alsa-project.org,
	linux1394-devel@lists.sourceforge.net, ffado-devel@lists.sf.net
Subject: Re: [PATCH 0/8] [RFC] new driver for Echo Audio's Fireworks based devices
Date: Sat, 08 Jun 2013 11:29:40 +0200	[thread overview]
Message-ID: <51B2F984.60706@ladisch.de> (raw)
In-Reply-To: <51B1CF0A.6020402@sakamocchi.jp>

Takashi Sakamoto wrote:
> Actually Fireworks supports severarl clock source, "Internal", "SYT
> Match", "Word", "S/PDIF", "ADAT1", "ADAT2". Then there is two options,
> one is for SYT match and another is for the others.
>
> SYT match:
> PC is a clock master to transmit SYT in CIP. So receive stream require
> transmit stream in advance.
>
> The others:
> Device is a clock master and PC should generate SYT for transmit
> stream from SYT in receive stream.
>
>> (and, of course, the capture packets must be used to determine
>> when to send packets).
>
> To achieve this, we need to change calculate_syt() or add new function
> to amdtp.c. I think it's enough to generate outgoing SYT from incoming
> SYT with TRANSFER_DELAY (479.17 micro seconds).

We want the playback stream to behave like the capture stream, and the
SYT is interpreted relative to the frame in which the packet is actually
transferred, so what the driver has to do is this:
1) compute the offset between the frame where the capture packet was
   received and its SYT;
2) compute the frame where the playback packet will be sent (i.e., add
   the queue length to the current frame);
3) add the offset to that frame.

The SYT field wraps around after 2 ms, so the corresponding capture/
playback SYT values will be identical only if the queue length is
a multiple of 2 ms.


But there is another thing: the driver has to choose whether a packet to
send contains SYT_INTERVAL samples or is a NO-DATA packet.

In SYT Match mode, the driver just checks whether enough samples are
available for that frame.

In the other modes, the driver must copy the packet type from the
capture stream, i.e., when it receives a NO-DATA packet, it submits
a NO-DATA packet, and when it receives a data packet, it submits a data
packet.  This implies that the queueing of playback packets happens not
in the playback packet completion callback, but in the *capture* packet
completion callback.

> But I have no idea when playback starts. Do you have any idea?

Playback packets can be submitted only when we already have a running
capture stream with its packet completion callbacks.  (This is similar
to starting playback in the SYT Match case, where the driver submits
a bunch of skip packets so that the playback packet completion
callbacks arrive with the correct timing.)


Regards,
Clemens

      reply	other threads:[~2013-06-08  9:29 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-01 15:55 [PATCH 0/8] [RFC] new driver for Echo Audio's Fireworks based devices o-takashi
2013-06-01 15:55 ` [PATCH 1/8] add main file of driver module o-takashi
2013-06-03 11:18   ` Clemens Ladisch
2013-06-01 15:55 ` [PATCH 2/8] add device specific command o-takashi
2013-06-03 11:18   ` Clemens Ladisch
2013-06-06 17:33     ` Takashi Sakamoto
2013-06-06 22:49       ` Takashi Sakamoto
2013-06-01 15:55 ` [PATCH 3/8] add control interfaces o-takashi
2013-06-01 15:55 ` [PATCH 4/8] add handling AMDTP stream o-takashi
2013-06-01 15:55 ` [PATCH 5/8] add MIDI interface o-takashi
2013-06-03 11:18   ` Clemens Ladisch
2013-06-01 15:55 ` [PATCH 6/8] add PCM interface o-takashi
2013-06-03 11:18   ` Clemens Ladisch
2013-06-01 15:55 ` [PATCH 7/8] add proc interface o-takashi
2013-06-01 15:55 ` [PATCH 8/8] modify Makefile and Kconfig to build this module o-takashi
2013-06-03 11:19   ` Clemens Ladisch
2013-06-03 11:18 ` [PATCH 0/8] [RFC] new driver for Echo Audio's Fireworks based devices Clemens Ladisch
2013-06-07 12:16   ` Takashi Sakamoto
2013-06-08  9:29     ` Clemens Ladisch [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51B2F984.60706@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=ffado-devel@lists.sf.net \
    --cc=linux1394-devel@lists.sourceforge.net \
    --cc=o-takashi@sakamocchi.jp \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.