ret = gb_i2s_mgmt_set_samples_per_message(connection,
CONFIG_SAMPLES_PER_MSG);
- if (ret) {
+ if (ret)
pr_err("set_samples_per_msg failed: %d\n", ret);
- goto free_get_cfg;
- }
-
- ret = gb_i2s_mgmt_activate_cport(connection,
- CONFIG_I2S_REMOTE_DATA_CPORT);
- if (ret) {
- pr_err("activate_cport failed: %d\n", ret);
- goto free_get_cfg;
- }
free_get_cfg:
kfree(get_cfg);
struct snd_pcm_substream *substream = snd_dev->substream;
struct snd_pcm_runtime *runtime = substream->runtime;
unsigned int stride, frames, oldptr;
- int period_elapsed;
+ int period_elapsed, ret;
char *address;
long len;
if (!snd_dev)
return;
- if (!atomic_read(&snd_dev->running))
+ if (!atomic_read(&snd_dev->running)) {
+ if (snd_dev->cport_active) {
+ ret = gb_i2s_mgmt_deactivate_cport(
+ snd_dev->mgmt_connection,
+ CONFIG_I2S_REMOTE_DATA_CPORT);
+ if (ret) /* XXX Do what else with failure? */
+ pr_err("deactivate_cport failed: %d\n", ret);
+
+ snd_dev->cport_active = false;
+ }
+
return;
+ } else if (!snd_dev->cport_active) {
+ ret = gb_i2s_mgmt_activate_cport(snd_dev->mgmt_connection,
+ CONFIG_I2S_REMOTE_DATA_CPORT);
+ if (ret)
+ pr_err("activate_cport failed: %d\n", ret);
+
+ snd_dev->cport_active = true;
+ }
address = runtime->dma_area + snd_dev->hwptr_done;
void gb_pcm_hrtimer_start(struct gb_snd *snd_dev)
{
atomic_set(&snd_dev->running, 1);
+ queue_work(snd_dev->workqueue, &snd_dev->work); /* Activates CPort */
hrtimer_start(&snd_dev->timer, ns_to_ktime(CONFIG_PERIOD_NS),
HRTIMER_MODE_REL);
}
{
atomic_set(&snd_dev->running, 0);
hrtimer_cancel(&snd_dev->timer);
+ queue_work(snd_dev->workqueue, &snd_dev->work); /* Deactivates CPort */
}
static int gb_pcm_hrtimer_init(struct gb_snd *snd_dev)
if (!snd_dev->send_data_req_buf) {
ret = -ENOMEM;
- goto err_deactivate_cport;
+ goto err_free_snd_dev;
}
return 0;
-err_deactivate_cport:
- gb_i2s_mgmt_deactivate_cport(connection, CONFIG_I2S_REMOTE_DATA_CPORT);
err_free_snd_dev:
gb_free_snd(snd_dev);
return ret;
static void gb_i2s_mgmt_connection_exit(struct gb_connection *connection)
{
struct gb_snd *snd_dev = (struct gb_snd *)connection->private;
- int ret;
-
- ret = gb_i2s_mgmt_deactivate_cport(connection,
- CONFIG_I2S_REMOTE_DATA_CPORT);
- if (ret)
- pr_err("deactivate_cport failed: %d\n", ret);
kfree(snd_dev->send_data_req_buf);
snd_dev->send_data_req_buf = NULL;