| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Scarlett Driver for ALSA |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 12 | 13 | * |
|---|
| 13 | 14 | * Code cleanup: |
|---|
| 14 | 15 | * David Henningsson <david.henningsson at canonical.com> |
|---|
| 15 | | - * |
|---|
| 16 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 17 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 18 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 19 | | - * (at your option) any later version. |
|---|
| 20 | | - * |
|---|
| 21 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 22 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 23 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 24 | | - * GNU General Public License for more details. |
|---|
| 25 | | - * |
|---|
| 26 | 16 | */ |
|---|
| 27 | 17 | |
|---|
| 28 | 18 | /* |
|---|
| .. | .. |
|---|
| 152 | 142 | SCARLETT_OUTPUTS, |
|---|
| 153 | 143 | SCARLETT_SWITCH_IMPEDANCE, |
|---|
| 154 | 144 | SCARLETT_SWITCH_PAD, |
|---|
| 145 | + SCARLETT_SWITCH_GAIN, |
|---|
| 155 | 146 | }; |
|---|
| 156 | 147 | |
|---|
| 157 | 148 | enum { |
|---|
| .. | .. |
|---|
| 199 | 190 | .offsets = {}, |
|---|
| 200 | 191 | .names = (char const * const []){ |
|---|
| 201 | 192 | "0dB", "-10dB" |
|---|
| 193 | + } |
|---|
| 194 | +}; |
|---|
| 195 | + |
|---|
| 196 | +static const struct scarlett_mixer_elem_enum_info opt_gain = { |
|---|
| 197 | + .start = 0, |
|---|
| 198 | + .len = 2, |
|---|
| 199 | + .offsets = {}, |
|---|
| 200 | + .names = (char const * const []){ |
|---|
| 201 | + "Lo", "Hi" |
|---|
| 202 | 202 | } |
|---|
| 203 | 203 | }; |
|---|
| 204 | 204 | |
|---|
| .. | .. |
|---|
| 662 | 662 | { .num = 1, .type = SCARLETT_SWITCH_PAD, .name = NULL}, |
|---|
| 663 | 663 | { .num = 2, .type = SCARLETT_SWITCH_IMPEDANCE, .name = NULL}, |
|---|
| 664 | 664 | { .num = 2, .type = SCARLETT_SWITCH_PAD, .name = NULL}, |
|---|
| 665 | | - { .num = 3, .type = SCARLETT_SWITCH_PAD, .name = NULL}, |
|---|
| 666 | | - { .num = 4, .type = SCARLETT_SWITCH_PAD, .name = NULL}, |
|---|
| 665 | + { .num = 3, .type = SCARLETT_SWITCH_GAIN, .name = NULL}, |
|---|
| 666 | + { .num = 4, .type = SCARLETT_SWITCH_GAIN, .name = NULL}, |
|---|
| 667 | 667 | }, |
|---|
| 668 | 668 | |
|---|
| 669 | 669 | .matrix_mux_init = { |
|---|
| .. | .. |
|---|
| 893 | 893 | if (err < 0) |
|---|
| 894 | 894 | return err; |
|---|
| 895 | 895 | break; |
|---|
| 896 | + case SCARLETT_SWITCH_GAIN: |
|---|
| 897 | + sprintf(mx, "Input %d Gain Switch", ctl->num); |
|---|
| 898 | + err = add_new_ctl(mixer, &usb_scarlett_ctl_enum, |
|---|
| 899 | + scarlett_ctl_enum_resume, 0x01, |
|---|
| 900 | + 0x08, ctl->num, USB_MIXER_S16, 1, mx, |
|---|
| 901 | + &opt_gain, &elem); |
|---|
| 902 | + if (err < 0) |
|---|
| 903 | + return err; |
|---|
| 904 | + break; |
|---|
| 896 | 905 | } |
|---|
| 897 | 906 | } |
|---|
| 898 | 907 | |
|---|