static int oxfw_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { struct snd_oxfw *oxfw; if (entry->vendor_id == VENDOR_LOUD && !detect_loud_models(unit)) return -ENODEV; /* Allocate this independent of sound card instance. */ oxfw = kzalloc(sizeof(struct snd_oxfw), GFP_KERNEL); if (oxfw == NULL) return -ENOMEM; oxfw->entry = entry; oxfw->unit = fw_unit_get(unit); dev_set_drvdata(&unit->device, oxfw); mutex_init(&oxfw->mutex); spin_lock_init(&oxfw->lock); init_waitqueue_head(&oxfw->hwdep_wait); /* Allocate and register this sound card later. */ INIT_DEFERRABLE_WORK(&oxfw->dwork, do_registration); snd_fw_schedule_registration(unit, &oxfw->dwork); return 0; }
static void motu_bus_update(struct fw_unit *unit) { struct snd_motu *motu = dev_get_drvdata(&unit->device); /* Postpone a workqueue for deferred registration. */ if (!motu->registered) snd_fw_schedule_registration(unit, &motu->dwork); /* The handler address register becomes initialized. */ snd_motu_transaction_reregister(motu); }
static void snd_ff_update(struct fw_unit *unit) { struct snd_ff *ff = dev_get_drvdata(&unit->device); /* Postpone a workqueue for deferred registration. */ if (!ff->registered) snd_fw_schedule_registration(unit, &ff->dwork); snd_ff_transaction_reregister(ff); if (ff->registered) snd_ff_stream_update_duplex(ff); }
/* * This driver doesn't update streams in bus reset handler. * * DM1000/ DM1100/DM1500 chipsets with BeBoB firmware transfer packets with * discontinued counter at bus reset. This discontinuity is immediately * detected in packet streaming layer, then it sets XRUN to PCM substream. * * ALSA PCM applications can know the XRUN by getting -EPIPE from PCM operation. * Then, they can recover the PCM substream by executing ioctl(2) with * SNDRV_PCM_IOCTL_PREPARE. 'struct snd_pcm_ops.prepare' is called and drivers * restart packet streaming. * * The above processing may be executed before this bus-reset handler is * executed. When this handler updates streams with current isochronous * channels, the streams already have the current ones. */ static void bebob_update(struct fw_unit *unit) { struct snd_bebob *bebob = dev_get_drvdata(&unit->device); if (bebob == NULL) return; /* Postpone a workqueue for deferred registration. */ if (!bebob->registered) snd_fw_schedule_registration(unit, &bebob->dwork); else fcp_bus_reset(bebob->unit); }
static void snd_tscm_update(struct fw_unit *unit) { struct snd_tscm *tscm = dev_get_drvdata(&unit->device); /* Postpone a workqueue for deferred registration. */ if (!tscm->registered) snd_fw_schedule_registration(unit, &tscm->dwork); snd_tscm_transaction_reregister(tscm); /* * After registration, userspace can start packet streaming, then this * code block works fine. */ if (tscm->registered) { mutex_lock(&tscm->mutex); snd_tscm_stream_update_duplex(tscm); mutex_unlock(&tscm->mutex); } }
static void oxfw_bus_reset(struct fw_unit *unit) { struct snd_oxfw *oxfw = dev_get_drvdata(&unit->device); if (!oxfw->registered) snd_fw_schedule_registration(unit, &oxfw->dwork); fcp_bus_reset(oxfw->unit); if (oxfw->registered) { mutex_lock(&oxfw->mutex); snd_oxfw_stream_update_simplex(oxfw, &oxfw->rx_stream); if (oxfw->has_output) snd_oxfw_stream_update_simplex(oxfw, &oxfw->tx_stream); mutex_unlock(&oxfw->mutex); if (oxfw->entry->vendor_id == OUI_STANTON) snd_oxfw_scs1x_update(oxfw); } }
static int snd_ff_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { struct snd_ff *ff; ff = devm_kzalloc(&unit->device, sizeof(struct snd_ff), GFP_KERNEL); if (!ff) return -ENOMEM; ff->unit = fw_unit_get(unit); dev_set_drvdata(&unit->device, ff); mutex_init(&ff->mutex); spin_lock_init(&ff->lock); init_waitqueue_head(&ff->hwdep_wait); ff->spec = (const struct snd_ff_spec *)entry->driver_data; /* Register this sound card later. */ INIT_DEFERRABLE_WORK(&ff->dwork, do_registration); snd_fw_schedule_registration(unit, &ff->dwork); return 0; }
static int motu_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { struct snd_motu *motu; /* Allocate this independently of sound card instance. */ motu = devm_kzalloc(&unit->device, sizeof(struct snd_motu), GFP_KERNEL); if (!motu) return -ENOMEM; motu->unit = fw_unit_get(unit); dev_set_drvdata(&unit->device, motu); motu->spec = (const struct snd_motu_spec *)entry->driver_data; mutex_init(&motu->mutex); spin_lock_init(&motu->lock); init_waitqueue_head(&motu->hwdep_wait); /* Allocate and register this sound card later. */ INIT_DEFERRABLE_WORK(&motu->dwork, do_registration); snd_fw_schedule_registration(unit, &motu->dwork); return 0; }
static int snd_dg00x_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { struct snd_dg00x *dg00x; /* Allocate this independent of sound card instance. */ dg00x = kzalloc(sizeof(struct snd_dg00x), GFP_KERNEL); if (dg00x == NULL) return -ENOMEM; dg00x->unit = fw_unit_get(unit); dev_set_drvdata(&unit->device, dg00x); mutex_init(&dg00x->mutex); spin_lock_init(&dg00x->lock); init_waitqueue_head(&dg00x->hwdep_wait); /* Allocate and register this sound card later. */ INIT_DEFERRABLE_WORK(&dg00x->dwork, do_registration); snd_fw_schedule_registration(unit, &dg00x->dwork); return 0; }
static int bebob_probe(struct fw_unit *unit, const struct ieee1394_device_id *entry) { struct snd_bebob *bebob; const struct snd_bebob_spec *spec; if (entry->vendor_id == VEN_FOCUSRITE && entry->model_id == MODEL_FOCUSRITE_SAFFIRE_BOTH) spec = get_saffire_spec(unit); else if (entry->vendor_id == VEN_MAUDIO1 && entry->model_id == MODEL_MAUDIO_AUDIOPHILE_BOTH && !check_audiophile_booted(unit)) spec = NULL; else spec = (const struct snd_bebob_spec *)entry->driver_data; if (spec == NULL) { if (entry->vendor_id == VEN_MAUDIO1 || entry->vendor_id == VEN_MAUDIO2) return snd_bebob_maudio_load_firmware(unit); else return -ENODEV; } /* Allocate this independent of sound card instance. */ bebob = kzalloc(sizeof(struct snd_bebob), GFP_KERNEL); if (bebob == NULL) return -ENOMEM; bebob->unit = fw_unit_get(unit); bebob->entry = entry; bebob->spec = spec; dev_set_drvdata(&unit->device, bebob); mutex_init(&bebob->mutex); spin_lock_init(&bebob->lock); init_waitqueue_head(&bebob->hwdep_wait); /* Allocate and register this sound card later. */ INIT_DEFERRABLE_WORK(&bebob->dwork, do_registration); if (entry->vendor_id != VEN_MAUDIO1 || (entry->model_id != MODEL_MAUDIO_FW1814 && entry->model_id != MODEL_MAUDIO_PROJECTMIX)) { snd_fw_schedule_registration(unit, &bebob->dwork); } else { /* * This is a workaround. This bus reset seems to have an effect * to make devices correctly handling transactions. Without * this, the devices have gap_count mismatch. This causes much * failure of transaction. * * Just after registration, user-land application receive * signals from dbus and starts I/Os. To avoid I/Os till the * future bus reset, registration is done in next update(). */ fw_schedule_bus_reset(fw_parent_device(bebob->unit)->card, false, true); } return 0; }