Skip to content
This repository has been archived by the owner on Nov 21, 2022. It is now read-only.

Commit

Permalink
ALSA: firewire-lib: Add a new function to check others' connection
Browse files Browse the repository at this point in the history
Plug Control Registers have two fields related to the number of established
connections, one is 'Broadcast connection counter' and another is
'Point-to-point connection counter'. The driver can know there are established
connections or not to check these fields.

This commit is for considering about JACK/FFADO streaming. Currently, when
JACK/FFADO starts its streaming to the device, cmp_connection_establish() is
failed expectedly. This seems to be enough but there are some devices which
needs to change sampling frequency before trying to establish connections.
For such devices, this functionality is needed.

Signed-off-by: Takashi Sakamoto <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
takaswie authored and tiwai committed May 26, 2014
1 parent 44aff69 commit b04479f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sound/firewire/cmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,24 @@ int cmp_connection_init(struct cmp_connection *c,
}
EXPORT_SYMBOL(cmp_connection_init);

/**
* cmp_connection_check_used - check connection is already esablished or not
* @c: the connection manager to be checked
*/
int cmp_connection_check_used(struct cmp_connection *c, bool *used)
{
__be32 pcr;
int err;

err = snd_fw_transaction(
c->resources.unit, TCODE_READ_QUADLET_REQUEST,
pcr_address(c), &pcr, 4, 0);
if (err >= 0)
*used = (pcr & cpu_to_be32(PCR_BCAST_CONN | PCR_P2P_CONN_MASK));
return err;
}
EXPORT_SYMBOL(cmp_connection_check_used);

/**
* cmp_connection_destroy - free connection manager resources
* @c: the connection manager
Expand Down
1 change: 1 addition & 0 deletions sound/firewire/cmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ int cmp_connection_init(struct cmp_connection *connection,
struct fw_unit *unit,
enum cmp_direction direction,
unsigned int pcr_index);
int cmp_connection_check_used(struct cmp_connection *connection, bool *used);
void cmp_connection_destroy(struct cmp_connection *connection);

int cmp_connection_establish(struct cmp_connection *connection,
Expand Down

0 comments on commit b04479f

Please sign in to comment.