| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * oxfw_midi.c - a part of driver for OXFW970/971 based devices |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2014 Takashi Sakamoto |
|---|
| 5 | | - * |
|---|
| 6 | | - * Licensed under the terms of the GNU General Public License, version 2. |
|---|
| 7 | 6 | */ |
|---|
| 8 | 7 | |
|---|
| 9 | 8 | #include "oxfw.h" |
|---|
| .. | .. |
|---|
| 19 | 18 | |
|---|
| 20 | 19 | mutex_lock(&oxfw->mutex); |
|---|
| 21 | 20 | |
|---|
| 22 | | - oxfw->capture_substreams++; |
|---|
| 23 | | - err = snd_oxfw_stream_start_simplex(oxfw, &oxfw->tx_stream, 0, 0); |
|---|
| 21 | + err = snd_oxfw_stream_reserve_duplex(oxfw, &oxfw->tx_stream, 0, 0, 0, 0); |
|---|
| 22 | + if (err >= 0) { |
|---|
| 23 | + ++oxfw->substreams_count; |
|---|
| 24 | + err = snd_oxfw_stream_start_duplex(oxfw); |
|---|
| 25 | + if (err < 0) |
|---|
| 26 | + --oxfw->substreams_count; |
|---|
| 27 | + } |
|---|
| 24 | 28 | |
|---|
| 25 | 29 | mutex_unlock(&oxfw->mutex); |
|---|
| 26 | 30 | |
|---|
| .. | .. |
|---|
| 41 | 45 | |
|---|
| 42 | 46 | mutex_lock(&oxfw->mutex); |
|---|
| 43 | 47 | |
|---|
| 44 | | - oxfw->playback_substreams++; |
|---|
| 45 | | - err = snd_oxfw_stream_start_simplex(oxfw, &oxfw->rx_stream, 0, 0); |
|---|
| 48 | + err = snd_oxfw_stream_reserve_duplex(oxfw, &oxfw->rx_stream, 0, 0, 0, 0); |
|---|
| 49 | + if (err >= 0) { |
|---|
| 50 | + ++oxfw->substreams_count; |
|---|
| 51 | + err = snd_oxfw_stream_start_duplex(oxfw); |
|---|
| 52 | + } |
|---|
| 46 | 53 | |
|---|
| 47 | 54 | mutex_unlock(&oxfw->mutex); |
|---|
| 48 | 55 | |
|---|
| .. | .. |
|---|
| 58 | 65 | |
|---|
| 59 | 66 | mutex_lock(&oxfw->mutex); |
|---|
| 60 | 67 | |
|---|
| 61 | | - oxfw->capture_substreams--; |
|---|
| 62 | | - snd_oxfw_stream_stop_simplex(oxfw, &oxfw->tx_stream); |
|---|
| 68 | + --oxfw->substreams_count; |
|---|
| 69 | + snd_oxfw_stream_stop_duplex(oxfw); |
|---|
| 63 | 70 | |
|---|
| 64 | 71 | mutex_unlock(&oxfw->mutex); |
|---|
| 65 | 72 | |
|---|
| .. | .. |
|---|
| 73 | 80 | |
|---|
| 74 | 81 | mutex_lock(&oxfw->mutex); |
|---|
| 75 | 82 | |
|---|
| 76 | | - oxfw->playback_substreams--; |
|---|
| 77 | | - snd_oxfw_stream_stop_simplex(oxfw, &oxfw->rx_stream); |
|---|
| 83 | + --oxfw->substreams_count; |
|---|
| 84 | + snd_oxfw_stream_stop_duplex(oxfw); |
|---|
| 78 | 85 | |
|---|
| 79 | 86 | mutex_unlock(&oxfw->mutex); |
|---|
| 80 | 87 | |
|---|