Skip to content

Commit

Permalink
ALSA: firewire-lib: add a kernel API to add AMDTP stream into AMDTP d…
Browse files Browse the repository at this point in the history
…omain

This commit adds a kernel API to insert AMDTP stream to list in AMDTP
domain.

Signed-off-by: Takashi Sakamoto <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
takaswie authored and tiwai committed Aug 5, 2019
1 parent 6261f90 commit 157a53e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
26 changes: 26 additions & 0 deletions sound/firewire/amdtp-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -1159,6 +1159,32 @@ void amdtp_domain_destroy(struct amdtp_domain *d)
}
EXPORT_SYMBOL_GPL(amdtp_domain_destroy);

/**
* amdtp_domain_add_stream - register isoc context into the domain.
* @d: the AMDTP domain.
* @s: the AMDTP stream.
* @channel: the isochronous channel on the bus.
* @speed: firewire speed code.
*/
int amdtp_domain_add_stream(struct amdtp_domain *d, struct amdtp_stream *s,
int channel, int speed)
{
struct amdtp_stream *tmp;

list_for_each_entry(tmp, &d->streams, list) {
if (s == tmp)
return -EBUSY;
}

list_add(&s->list, &d->streams);

s->channel = channel;
s->speed = speed;

return 0;
}
EXPORT_SYMBOL_GPL(amdtp_domain_add_stream);

/**
* amdtp_domain_stop - stop sending packets for isoc context in the same domain.
* @d: the AMDTP domain to which the isoc contexts belong.
Expand Down
5 changes: 5 additions & 0 deletions sound/firewire/amdtp-stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ struct amdtp_stream {
amdtp_stream_process_ctx_payloads_t process_ctx_payloads;

// For domain.
int channel;
int speed;
struct list_head list;
};

Expand Down Expand Up @@ -277,6 +279,9 @@ struct amdtp_domain {
int amdtp_domain_init(struct amdtp_domain *d);
void amdtp_domain_destroy(struct amdtp_domain *d);

int amdtp_domain_add_stream(struct amdtp_domain *d, struct amdtp_stream *s,
int channel, int speed);

void amdtp_domain_stop(struct amdtp_domain *d);

#endif

0 comments on commit 157a53e

Please sign in to comment.