Skip to content

Commit b04479f

Browse files
takaswietiwai
authored andcommitted
ALSA: firewire-lib: Add a new function to check others' connection
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 <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 44aff69 commit b04479f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

sound/firewire/cmp.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,24 @@ int cmp_connection_init(struct cmp_connection *c,
151151
}
152152
EXPORT_SYMBOL(cmp_connection_init);
153153

154+
/**
155+
* cmp_connection_check_used - check connection is already esablished or not
156+
* @c: the connection manager to be checked
157+
*/
158+
int cmp_connection_check_used(struct cmp_connection *c, bool *used)
159+
{
160+
__be32 pcr;
161+
int err;
162+
163+
err = snd_fw_transaction(
164+
c->resources.unit, TCODE_READ_QUADLET_REQUEST,
165+
pcr_address(c), &pcr, 4, 0);
166+
if (err >= 0)
167+
*used = (pcr & cpu_to_be32(PCR_BCAST_CONN | PCR_P2P_CONN_MASK));
168+
return err;
169+
}
170+
EXPORT_SYMBOL(cmp_connection_check_used);
171+
154172
/**
155173
* cmp_connection_destroy - free connection manager resources
156174
* @c: the connection manager

sound/firewire/cmp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ int cmp_connection_init(struct cmp_connection *connection,
3838
struct fw_unit *unit,
3939
enum cmp_direction direction,
4040
unsigned int pcr_index);
41+
int cmp_connection_check_used(struct cmp_connection *connection, bool *used);
4142
void cmp_connection_destroy(struct cmp_connection *connection);
4243

4344
int cmp_connection_establish(struct cmp_connection *connection,

0 commit comments

Comments
 (0)