Commit a092f000 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: oxfw: code refactoring for jumbo-payload quirk in OXFW970

This commit adds enumeration to describe quirks of OXFW ASICs.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20210518084557.102681-9-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 95d0c24d
...@@ -153,12 +153,18 @@ static int init_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream) ...@@ -153,12 +153,18 @@ static int init_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream)
struct cmp_connection *conn; struct cmp_connection *conn;
enum cmp_direction c_dir; enum cmp_direction c_dir;
enum amdtp_stream_direction s_dir; enum amdtp_stream_direction s_dir;
unsigned int flags = CIP_NONBLOCKING;
int err; int err;
if (stream == &oxfw->tx_stream) { if (stream == &oxfw->tx_stream) {
conn = &oxfw->out_conn; conn = &oxfw->out_conn;
c_dir = CMP_OUTPUT; c_dir = CMP_OUTPUT;
s_dir = AMDTP_IN_STREAM; 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 { } else {
conn = &oxfw->in_conn; conn = &oxfw->in_conn;
c_dir = CMP_INPUT; c_dir = CMP_INPUT;
...@@ -169,24 +175,12 @@ static int init_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream) ...@@ -169,24 +175,12 @@ static int init_stream(struct snd_oxfw *oxfw, struct amdtp_stream *stream)
if (err < 0) if (err < 0)
return err; 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) { if (err < 0) {
cmp_connection_destroy(conn); cmp_connection_destroy(conn);
return err; 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; return 0;
} }
......
...@@ -86,6 +86,9 @@ static int name_card(struct snd_oxfw *oxfw) ...@@ -86,6 +86,9 @@ static int name_card(struct snd_oxfw *oxfw)
goto end; goto end;
be32_to_cpus(&firmware); be32_to_cpus(&firmware);
if (firmware >> 20 == 0x970)
oxfw->quirks |= SND_OXFW_QUIRK_JUMBO_PAYLOAD;
/* to apply card definitions */ /* to apply card definitions */
if (oxfw->entry->vendor_id == VENDOR_GRIFFIN || if (oxfw->entry->vendor_id == VENDOR_GRIFFIN ||
oxfw->entry->vendor_id == VENDOR_LACIE) { oxfw->entry->vendor_id == VENDOR_LACIE) {
......
...@@ -32,6 +32,12 @@ ...@@ -32,6 +32,12 @@
#include "../amdtp-am824.h" #include "../amdtp-am824.h"
#include "../cmp.h" #include "../cmp.h"
enum snd_oxfw_quirk {
// Postpone transferring packets during handling asynchronous transaction. As a result,
// next isochronous packet includes more events than one packet can include.
SND_OXFW_QUIRK_JUMBO_PAYLOAD = 0x01,
};
/* This is an arbitrary number for convinience. */ /* This is an arbitrary number for convinience. */
#define SND_OXFW_STREAM_FORMAT_ENTRIES 10 #define SND_OXFW_STREAM_FORMAT_ENTRIES 10
struct snd_oxfw { struct snd_oxfw {
...@@ -43,6 +49,8 @@ struct snd_oxfw { ...@@ -43,6 +49,8 @@ struct snd_oxfw {
bool registered; bool registered;
struct delayed_work dwork; struct delayed_work dwork;
// The combination of snd_oxfw_quirk enumeration-constants.
unsigned int quirks;
bool wrong_dbs; bool wrong_dbs;
bool has_output; bool has_output;
bool has_input; bool has_input;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment