Skip to content

Commit

Permalink
ALSA: oxfw: reuse driver entry to detect quirks
Browse files Browse the repository at this point in the history
Currently, assignment to model-dependent quirk is corresponding to
asynchronous transactions on IEEE 1394 bus. This is also achieved with
device entry.

This commit changes the processing of model-dependent quirk with the
entry. As a result, the transactions are sent only for Loud models.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Sakamoto authored and Takashi Iwai committed Dec 15, 2015
1 parent eab8e4e commit 27e6663
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
38 changes: 22 additions & 16 deletions sound/firewire/oxfw/oxfw.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ static bool detect_loud_models(struct fw_unit *unit)
static int name_card(struct snd_oxfw *oxfw)
{
struct fw_device *fw_dev = fw_parent_device(oxfw->unit);
const struct device_info *info;
char vendor[24];
char model[32];
const char *d, *v, *m;
Expand All @@ -84,10 +85,12 @@ static int name_card(struct snd_oxfw *oxfw)
be32_to_cpus(&firmware);

/* to apply card definitions */
if (oxfw->device_info) {
d = oxfw->device_info->driver_name;
v = oxfw->device_info->vendor_name;
m = oxfw->device_info->model_name;
if (oxfw->entry->vendor_id == VENDOR_GRIFFIN ||
oxfw->entry->vendor_id == VENDOR_LACIE) {
info = (const struct device_info *)oxfw->entry->driver_data;
d = info->driver_name;
v = info->vendor_name;
m = info->model_name;
} else {
d = "OXFW";
v = vendor;
Expand Down Expand Up @@ -139,6 +142,16 @@ static void detect_quirks(struct snd_oxfw *oxfw)
int key, val;
int vendor, model;

/*
* TASCAM FireOne has physical control and requires a pair of additional
* MIDI ports.
*/
if (oxfw->entry->vendor_id == VENDOR_TASCAM) {
oxfw->midi_input_ports++;
oxfw->midi_output_ports++;
return;
}

/* Seek from Root Directory of Config ROM. */
vendor = model = 0;
fw_csr_iterator_init(&it, fw_dev->config_rom + 5);
Expand All @@ -155,25 +168,16 @@ static void detect_quirks(struct snd_oxfw *oxfw)
*/
if (vendor == VENDOR_LOUD && model == MODEL_SATELLITE)
oxfw->wrong_dbs = true;

/*
* TASCAM FireOne has physical control and requires a pair of additional
* MIDI ports.
*/
if (vendor == VENDOR_TASCAM) {
oxfw->midi_input_ports++;
oxfw->midi_output_ports++;
}
}

static int oxfw_probe(struct fw_unit *unit,
const struct ieee1394_device_id *id)
const struct ieee1394_device_id *entry)
{
struct snd_card *card;
struct snd_oxfw *oxfw;
int err;

if ((id->vendor_id == VENDOR_LOUD) && !detect_loud_models(unit))
if (entry->vendor_id == VENDOR_LOUD && !detect_loud_models(unit))
return -ENODEV;

err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE,
Expand All @@ -186,7 +190,7 @@ static int oxfw_probe(struct fw_unit *unit,
oxfw->card = card;
mutex_init(&oxfw->mutex);
oxfw->unit = fw_unit_get(unit);
oxfw->device_info = (const struct device_info *)id->driver_data;
oxfw->entry = entry;
spin_lock_init(&oxfw->lock);
init_waitqueue_head(&oxfw->hwdep_wait);

Expand All @@ -205,6 +209,8 @@ static int oxfw_probe(struct fw_unit *unit,
goto error;

if (oxfw->device_info) {
oxfw->device_info =
(const struct device_info *)entry->driver_data;
err = snd_oxfw_add_spkr(oxfw);
if (err < 0)
goto error;
Expand Down
2 changes: 2 additions & 0 deletions sound/firewire/oxfw/oxfw.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ struct snd_oxfw {
int dev_lock_count;
bool dev_lock_changed;
wait_queue_head_t hwdep_wait;

const struct ieee1394_device_id *entry;
};

/*
Expand Down

0 comments on commit 27e6663

Please sign in to comment.