Lines Matching +full:master +full:- +full:side

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2004 James Courtier-Dutton <James@superbug.demon.co.uk>
67 if (emu->spdif_enable) { in ca0106_spdif_enable()
73 val = inl(emu->port + CA0106_GPIO) & ~0x101; in ca0106_spdif_enable()
74 outl(val, emu->port + CA0106_GPIO); in ca0106_spdif_enable()
82 val = inl(emu->port + CA0106_GPIO) | 0x101; in ca0106_spdif_enable()
83 outl(val, emu->port + CA0106_GPIO); in ca0106_spdif_enable()
89 unsigned int val = emu->capture_source; in ca0106_set_capture_source()
103 ngain = emu->i2c_capture_volume[val][0]; /* Left */ in ca0106_set_i2c_capture_source()
104 ogain = emu->i2c_capture_volume[emu->i2c_capture_source][0]; /* Left */ in ca0106_set_i2c_capture_source()
107 ngain = emu->i2c_capture_volume[val][1]; /* Right */ in ca0106_set_i2c_capture_source()
108 ogain = emu->i2c_capture_volume[emu->i2c_capture_source][1]; /* Right */ in ca0106_set_i2c_capture_source()
113 emu->i2c_capture_source = val; in ca0106_set_i2c_capture_source()
120 if (emu->capture_mic_line_in) { in ca0106_set_capture_mic_line_in()
122 tmp = inl(emu->port + CA0106_GPIO) & ~0x400; in ca0106_set_capture_mic_line_in()
124 outl(tmp, emu->port + CA0106_GPIO); in ca0106_set_capture_mic_line_in()
128 tmp = inl(emu->port + CA0106_GPIO) & ~0x400; in ca0106_set_capture_mic_line_in()
129 outl(tmp, emu->port + CA0106_GPIO); in ca0106_set_capture_mic_line_in()
136 snd_ca0106_ptr_write(emu, SPCS0 + idx, 0, emu->spdif_str_bits[idx]); in ca0106_set_spdif_bits()
141 static const DECLARE_TLV_DB_SCALE(snd_ca0106_db_scale1, -5175, 25, 1);
142 static const DECLARE_TLV_DB_SCALE(snd_ca0106_db_scale2, -10350, 50, 1);
151 ucontrol->value.integer.value[0] = emu->spdif_enable; in snd_ca0106_shared_spdif_get()
162 val = !!ucontrol->value.integer.value[0]; in snd_ca0106_shared_spdif_put()
163 change = (emu->spdif_enable != val); in snd_ca0106_shared_spdif_put()
165 emu->spdif_enable = val; in snd_ca0106_shared_spdif_put()
186 ucontrol->value.enumerated.item[0] = emu->capture_source; in snd_ca0106_capture_source_get()
197 val = ucontrol->value.enumerated.item[0] ; in snd_ca0106_capture_source_put()
199 return -EINVAL; in snd_ca0106_capture_source_put()
200 change = (emu->capture_source != val); in snd_ca0106_capture_source_put()
202 emu->capture_source = val; in snd_ca0106_capture_source_put()
223 ucontrol->value.enumerated.item[0] = emu->i2c_capture_source; in snd_ca0106_i2c_capture_source_get()
237 source_id = ucontrol->value.enumerated.item[0] ; in snd_ca0106_i2c_capture_source_put()
239 return -EINVAL; in snd_ca0106_i2c_capture_source_put()
240 change = (emu->i2c_capture_source != source_id); in snd_ca0106_i2c_capture_source_put()
250 static const char * const texts[2] = { "Side out", "Line in" }; in snd_ca0106_capture_line_in_side_out_info()
268 ucontrol->value.enumerated.item[0] = emu->capture_mic_line_in; in snd_ca0106_capture_mic_line_in_get()
279 val = ucontrol->value.enumerated.item[0] ; in snd_ca0106_capture_mic_line_in_put()
281 return -EINVAL; in snd_ca0106_capture_mic_line_in_put()
282 change = (emu->capture_mic_line_in != val); in snd_ca0106_capture_mic_line_in_put()
284 emu->capture_mic_line_in = val; in snd_ca0106_capture_mic_line_in_put()
302 .name = "Shared Line in/Side out Capture Switch",
312 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; in snd_ca0106_spdif_info()
313 uinfo->count = 1; in snd_ca0106_spdif_info()
329 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_ca0106_spdif_get_default()
331 decode_spdif_bits(ucontrol->value.iec958.status, in snd_ca0106_spdif_get_default()
332 emu->spdif_bits[idx]); in snd_ca0106_spdif_get_default()
340 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_ca0106_spdif_get_stream()
342 decode_spdif_bits(ucontrol->value.iec958.status, in snd_ca0106_spdif_get_stream()
343 emu->spdif_str_bits[idx]); in snd_ca0106_spdif_get_stream()
350 ucontrol->value.iec958.status[0] = 0xff; in snd_ca0106_spdif_get_mask()
351 ucontrol->value.iec958.status[1] = 0xff; in snd_ca0106_spdif_get_mask()
352 ucontrol->value.iec958.status[2] = 0xff; in snd_ca0106_spdif_get_mask()
353 ucontrol->value.iec958.status[3] = 0xff; in snd_ca0106_spdif_get_mask()
369 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_ca0106_spdif_put_default()
372 val = encode_spdif_bits(ucontrol->value.iec958.status); in snd_ca0106_spdif_put_default()
373 if (val != emu->spdif_bits[idx]) { in snd_ca0106_spdif_put_default()
374 emu->spdif_bits[idx] = val; in snd_ca0106_spdif_put_default()
376 * with older alsa-lib config in snd_ca0106_spdif_put_default()
378 emu->spdif_str_bits[idx] = val; in snd_ca0106_spdif_put_default()
389 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_ca0106_spdif_put_stream()
392 val = encode_spdif_bits(ucontrol->value.iec958.status); in snd_ca0106_spdif_put_stream()
393 if (val != emu->spdif_str_bits[idx]) { in snd_ca0106_spdif_put_stream()
394 emu->spdif_str_bits[idx] = val; in snd_ca0106_spdif_put_stream()
404 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_ca0106_volume_info()
405 uinfo->count = 2; in snd_ca0106_volume_info()
406 uinfo->value.integer.min = 0; in snd_ca0106_volume_info()
407 uinfo->value.integer.max = 255; in snd_ca0106_volume_info()
418 channel_id = (kcontrol->private_value >> 8) & 0xff; in snd_ca0106_volume_get()
419 reg = kcontrol->private_value & 0xff; in snd_ca0106_volume_get()
422 ucontrol->value.integer.value[0] = 0xff - ((value >> 24) & 0xff); /* Left */ in snd_ca0106_volume_get()
423 ucontrol->value.integer.value[1] = 0xff - ((value >> 16) & 0xff); /* Right */ in snd_ca0106_volume_get()
434 channel_id = (kcontrol->private_value >> 8) & 0xff; in snd_ca0106_volume_put()
435 reg = kcontrol->private_value & 0xff; in snd_ca0106_volume_put()
438 nval = ((0xff - ucontrol->value.integer.value[0]) << 24) | in snd_ca0106_volume_put()
439 ((0xff - ucontrol->value.integer.value[1]) << 16); in snd_ca0106_volume_put()
440 nval |= ((0xff - ucontrol->value.integer.value[0]) << 8) | in snd_ca0106_volume_put()
441 ((0xff - ucontrol->value.integer.value[1]) ); in snd_ca0106_volume_put()
451 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_ca0106_i2c_volume_info()
452 uinfo->count = 2; in snd_ca0106_i2c_volume_info()
453 uinfo->value.integer.min = 0; in snd_ca0106_i2c_volume_info()
454 uinfo->value.integer.max = 255; in snd_ca0106_i2c_volume_info()
464 source_id = kcontrol->private_value; in snd_ca0106_i2c_volume_get()
466 ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0]; in snd_ca0106_i2c_volume_get()
467 ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1]; in snd_ca0106_i2c_volume_get()
480 source_id = kcontrol->private_value; in snd_ca0106_i2c_volume_put()
481 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */ in snd_ca0106_i2c_volume_put()
482 ngain = ucontrol->value.integer.value[0]; in snd_ca0106_i2c_volume_put()
484 return -EINVAL; in snd_ca0106_i2c_volume_put()
486 if (emu->i2c_capture_source == source_id) in snd_ca0106_i2c_volume_put()
488 emu->i2c_capture_volume[source_id][0] = ucontrol->value.integer.value[0]; in snd_ca0106_i2c_volume_put()
491 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */ in snd_ca0106_i2c_volume_put()
492 ngain = ucontrol->value.integer.value[1]; in snd_ca0106_i2c_volume_put()
494 return -EINVAL; in snd_ca0106_i2c_volume_put()
496 if (emu->i2c_capture_source == source_id) in snd_ca0106_i2c_volume_put()
498 emu->i2c_capture_volume[source_id][1] = ucontrol->value.integer.value[1]; in snd_ca0106_i2c_volume_put()
511 unsigned int reg = kcontrol->private_value >> SPI_REG_SHIFT; in spi_mute_get()
512 unsigned int bit = kcontrol->private_value & SPI_REG_MASK; in spi_mute_get()
514 ucontrol->value.integer.value[0] = !(emu->spi_dac_reg[reg] & bit); in spi_mute_get()
522 unsigned int reg = kcontrol->private_value >> SPI_REG_SHIFT; in spi_mute_put()
523 unsigned int bit = kcontrol->private_value & SPI_REG_MASK; in spi_mute_put()
526 ret = emu->spi_dac_reg[reg] & bit; in spi_mute_put()
527 if (ucontrol->value.integer.value[0]) { in spi_mute_put()
530 emu->spi_dac_reg[reg] &= ~bit; in spi_mute_put()
534 emu->spi_dac_reg[reg] |= bit; in spi_mute_put()
537 ret = snd_ca0106_spi_write(emu, emu->spi_dac_reg[reg]); in spi_mute_put()
538 return ret ? -EINVAL : 1; in spi_mute_put()
560 CA_VOLUME("Analog Side Playback Volume",
673 dac_id = (details->spi_dac & 0xf000) >> (4 * 3); in snd_ca0106_volume_spi_dac_ctl()
677 dac_id = (details->spi_dac & 0x0f00) >> (4 * 2); in snd_ca0106_volume_spi_dac_ctl()
681 dac_id = (details->spi_dac & 0x00f0) >> (4 * 1); in snd_ca0106_volume_spi_dac_ctl()
684 spi_switch.name = "Analog Side Playback Switch"; in snd_ca0106_volume_spi_dac_ctl()
685 dac_id = (details->spi_dac & 0x000f) >> (4 * 0); in snd_ca0106_volume_spi_dac_ctl()
716 return -ENOENT; in rename_ctl()
730 DECLARE_TLV_DB_SCALE(snd_ca0106_master_db_scale, -6375, 25, 1);
736 "Analog Side Playback Volume",
749 "Analog Side Playback Switch",
757 struct snd_card *card = emu->card; in snd_ca0106_mixer()
761 "Master Mono Playback Switch", in snd_ca0106_mixer()
762 "Master Mono Playback Volume", in snd_ca0106_mixer()
763 "3D Control - Switch", in snd_ca0106_mixer()
764 "3D Control Sigmatel - Depth", in snd_ca0106_mixer()
780 "Sigmatel 4-Speaker Stereo Playback Switch", in snd_ca0106_mixer()
785 "Master Playback Switch", "Capture Switch", in snd_ca0106_mixer()
786 "Master Playback Volume", "Capture Volume", in snd_ca0106_mixer()
805 if (emu->details->i2c_adc == 1) { in snd_ca0106_mixer()
807 if (emu->details->gpio_type == 1) in snd_ca0106_mixer()
814 if (emu->details->spi_dac) { in snd_ca0106_mixer()
818 ctl = snd_ca0106_volume_spi_dac_ctl(emu->details, i); in snd_ca0106_mixer()
827 /* Create virtual master controls */ in snd_ca0106_mixer()
828 vmaster = snd_ctl_make_virtual_master("Master Playback Volume", in snd_ca0106_mixer()
831 return -ENOMEM; in snd_ca0106_mixer()
839 if (emu->details->spi_dac) { in snd_ca0106_mixer()
840 vmaster = snd_ctl_make_virtual_master("Master Playback Switch", in snd_ca0106_mixer()
843 return -ENOMEM; in snd_ca0106_mixer()
852 strcpy(card->mixername, "CA0106"); in snd_ca0106_mixer()
880 chip->saved_vol[i] = in snd_ca0106_mixer_suspend()
892 chip->saved_vol[i]); in snd_ca0106_mixer_resume()
896 ca0106_set_i2c_capture_source(chip, chip->i2c_capture_source, 1); in snd_ca0106_mixer_resume()
899 if (chip->details->i2c_adc) in snd_ca0106_mixer_resume()