ALSA: oxfw: code refactoring for jumbo-payload quirk in OXFW970
[platform/kernel/linux-rpi.git] / sound / firewire / oxfw / oxfw-stream.c
index 80c9dc1..c06173f 100644 (file)
@@ -153,12 +153,18 @@ static int init_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream)
        struct cmp_connection *conn;
        enum cmp_direction c_dir;
        enum amdtp_stream_direction s_dir;
+       unsigned int flags = CIP_NONBLOCKING;
        int err;
 
        if (stream == &oxfw->tx_stream) {
                conn = &oxfw->out_conn;
                c_dir = CMP_OUTPUT;
                s_dir = AMDTP_IN_STREAM;
+
+               if (oxfw->quirks & SND_OXFW_QUIRK_JUMBO_PAYLOAD)
+                       flags |= CIP_JUMBO_PAYLOAD;
+               if (oxfw->wrong_dbs)
+                       flags |= CIP_WRONG_DBS;
        } else {
                conn = &oxfw->in_conn;
                c_dir = CMP_INPUT;
@@ -169,24 +175,12 @@ static int init_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream)
        if (err < 0)
                return err;
 
-       err = amdtp_am824_init(stream, oxfw->unit, s_dir, CIP_NONBLOCKING);
+       err = amdtp_am824_init(stream, oxfw->unit, s_dir, flags);
        if (err < 0) {
                cmp_connection_destroy(conn);
                return err;
        }
 
-       /*
-        * OXFW starts to transmit packets with non-zero dbc.
-        * OXFW postpone transferring packets till handling any asynchronous
-        * packets. As a result, next isochronous packet includes more data
-        * blocks than IEC 61883-6 defines.
-        */
-       if (stream == &oxfw->tx_stream) {
-               oxfw->tx_stream.flags |= CIP_JUMBO_PAYLOAD;
-               if (oxfw->wrong_dbs)
-                       oxfw->tx_stream.flags |= CIP_WRONG_DBS;
-       }
-
        return 0;
 }