ALSA: firewire-lib: Add a new function to check others' connection
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Fri, 25 Apr 2014 13:44:57 +0000 (22:44 +0900)
committerTakashi Iwai <tiwai@suse.de>
Mon, 26 May 2014 12:22:46 +0000 (14:22 +0200)
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>
sound/firewire/cmp.c
sound/firewire/cmp.h

index 9da40d9e79daa8526e0e73c858eb486a4e2864c3..d31a403ac53922dd94141d6ccfe17a9bcff9158d 100644 (file)
@@ -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
index 9b58448d5791ab2ca705b090023eae50693409c5..ebcb48484fca30ec8f906720032a1146590ada1d 100644 (file)
@@ -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,
This page took 0.037694 seconds and 5 git commands to generate.