Lines Matching refs:mix
198 static int tumbler_set_master_volume(struct pmac_tumbler *mix) in tumbler_set_master_volume() argument
203 if (! mix->i2c.client) in tumbler_set_master_volume()
206 if (! mix->master_switch[0]) in tumbler_set_master_volume()
209 left_vol = mix->master_vol[0]; in tumbler_set_master_volume()
214 if (! mix->master_switch[1]) in tumbler_set_master_volume()
217 right_vol = mix->master_vol[1]; in tumbler_set_master_volume()
231 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_VOL, 6, in tumbler_set_master_volume()
256 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_get_master_volume() local
258 ucontrol->value.integer.value[0] = mix->master_vol[0]; in tumbler_get_master_volume()
259 ucontrol->value.integer.value[1] = mix->master_vol[1]; in tumbler_get_master_volume()
267 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_put_master_volume() local
276 change = mix->master_vol[0] != vol[0] || in tumbler_put_master_volume()
277 mix->master_vol[1] != vol[1]; in tumbler_put_master_volume()
279 mix->master_vol[0] = vol[0]; in tumbler_put_master_volume()
280 mix->master_vol[1] = vol[1]; in tumbler_put_master_volume()
281 tumbler_set_master_volume(mix); in tumbler_put_master_volume()
291 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_get_master_switch() local
293 ucontrol->value.integer.value[0] = mix->master_switch[0]; in tumbler_get_master_switch()
294 ucontrol->value.integer.value[1] = mix->master_switch[1]; in tumbler_get_master_switch()
302 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_put_master_switch() local
305 change = mix->master_switch[0] != ucontrol->value.integer.value[0] || in tumbler_put_master_switch()
306 mix->master_switch[1] != ucontrol->value.integer.value[1]; in tumbler_put_master_switch()
308 mix->master_switch[0] = !!ucontrol->value.integer.value[0]; in tumbler_put_master_switch()
309 mix->master_switch[1] = !!ucontrol->value.integer.value[1]; in tumbler_put_master_switch()
310 tumbler_set_master_volume(mix); in tumbler_put_master_switch()
322 static int tumbler_set_drc(struct pmac_tumbler *mix) in tumbler_set_drc() argument
326 if (! mix->i2c.client) in tumbler_set_drc()
329 if (mix->drc_enable) { in tumbler_set_drc()
331 if (mix->drc_range > TAS3001_DRC_MAX) in tumbler_set_drc()
333 else if (mix->drc_range < 0) in tumbler_set_drc()
336 val[1] = mix->drc_range + 0x91; in tumbler_set_drc()
342 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC, in tumbler_set_drc()
357 static int snapper_set_drc(struct pmac_tumbler *mix) in snapper_set_drc() argument
361 if (! mix->i2c.client) in snapper_set_drc()
364 if (mix->drc_enable) in snapper_set_drc()
369 if (mix->drc_range > 0xef) in snapper_set_drc()
371 else if (mix->drc_range < 0) in snapper_set_drc()
374 val[2] = mix->drc_range; in snapper_set_drc()
379 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC, in snapper_set_drc()
404 struct pmac_tumbler *mix; in tumbler_get_drc_value() local
405 mix = chip->mixer_data; in tumbler_get_drc_value()
406 if (!mix) in tumbler_get_drc_value()
408 ucontrol->value.integer.value[0] = mix->drc_range; in tumbler_get_drc_value()
416 struct pmac_tumbler *mix; in tumbler_put_drc_value() local
420 mix = chip->mixer_data; in tumbler_put_drc_value()
421 if (!mix) in tumbler_put_drc_value()
431 change = mix->drc_range != val; in tumbler_put_drc_value()
433 mix->drc_range = val; in tumbler_put_drc_value()
435 tumbler_set_drc(mix); in tumbler_put_drc_value()
437 snapper_set_drc(mix); in tumbler_put_drc_value()
446 struct pmac_tumbler *mix; in tumbler_get_drc_switch() local
447 mix = chip->mixer_data; in tumbler_get_drc_switch()
448 if (!mix) in tumbler_get_drc_switch()
450 ucontrol->value.integer.value[0] = mix->drc_enable; in tumbler_get_drc_switch()
458 struct pmac_tumbler *mix; in tumbler_put_drc_switch() local
461 mix = chip->mixer_data; in tumbler_put_drc_switch()
462 if (!mix) in tumbler_put_drc_switch()
464 change = mix->drc_enable != ucontrol->value.integer.value[0]; in tumbler_put_drc_switch()
466 mix->drc_enable = !!ucontrol->value.integer.value[0]; in tumbler_put_drc_switch()
468 tumbler_set_drc(mix); in tumbler_put_drc_switch()
470 snapper_set_drc(mix); in tumbler_put_drc_switch()
488 static int tumbler_set_mono_volume(struct pmac_tumbler *mix, in tumbler_set_mono_volume() argument
495 if (! mix->i2c.client) in tumbler_set_mono_volume()
498 vol = mix->mono_vol[info->index]; in tumbler_set_mono_volume()
504 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, info->reg, in tumbler_set_mono_volume()
530 struct pmac_tumbler *mix; in tumbler_get_mono() local
531 mix = chip->mixer_data; in tumbler_get_mono()
532 if (!mix) in tumbler_get_mono()
534 ucontrol->value.integer.value[0] = mix->mono_vol[info->index]; in tumbler_get_mono()
543 struct pmac_tumbler *mix; in tumbler_put_mono() local
547 mix = chip->mixer_data; in tumbler_put_mono()
548 if (!mix) in tumbler_put_mono()
553 change = mix->mono_vol[info->index] != vol; in tumbler_put_mono()
555 mix->mono_vol[info->index] = vol; in tumbler_put_mono()
556 tumbler_set_mono_volume(mix, info); in tumbler_put_mono()
627 static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int reg) in snapper_set_mix_vol1() argument
632 vol = mix->mix_vol[idx][ch]; in snapper_set_mix_vol1()
635 mix->mix_vol[idx][ch] = vol; in snapper_set_mix_vol1()
639 vol = mix->mix_vol[i][ch]; in snapper_set_mix_vol1()
644 if (i2c_smbus_write_i2c_block_data(mix->i2c.client, reg, in snapper_set_mix_vol1()
652 static int snapper_set_mix_vol(struct pmac_tumbler *mix, int idx) in snapper_set_mix_vol() argument
654 if (! mix->i2c.client) in snapper_set_mix_vol()
656 if (snapper_set_mix_vol1(mix, idx, 0, TAS_REG_LMIX) < 0 || in snapper_set_mix_vol()
657 snapper_set_mix_vol1(mix, idx, 1, TAS_REG_RMIX) < 0) in snapper_set_mix_vol()
677 struct pmac_tumbler *mix; in snapper_get_mix() local
678 mix = chip->mixer_data; in snapper_get_mix()
679 if (!mix) in snapper_get_mix()
681 ucontrol->value.integer.value[0] = mix->mix_vol[idx][0]; in snapper_get_mix()
682 ucontrol->value.integer.value[1] = mix->mix_vol[idx][1]; in snapper_get_mix()
691 struct pmac_tumbler *mix; in snapper_put_mix() local
695 mix = chip->mixer_data; in snapper_put_mix()
696 if (!mix) in snapper_put_mix()
703 change = mix->mix_vol[idx][0] != vol[0] || in snapper_put_mix()
704 mix->mix_vol[idx][1] != vol[1]; in snapper_put_mix()
706 mix->mix_vol[idx][0] = vol[0]; in snapper_put_mix()
707 mix->mix_vol[idx][1] = vol[1]; in snapper_put_mix()
708 snapper_set_mix_vol(mix, idx); in snapper_put_mix()
725 struct pmac_tumbler *mix; in tumbler_get_mute_switch() local
727 mix = chip->mixer_data; in tumbler_get_mute_switch()
728 if (!mix) in tumbler_get_mute_switch()
732 gp = &mix->hp_mute; break; in tumbler_get_mute_switch()
734 gp = &mix->amp_mute; break; in tumbler_get_mute_switch()
736 gp = &mix->line_mute; break; in tumbler_get_mute_switch()
750 struct pmac_tumbler *mix; in tumbler_put_mute_switch() local
757 mix = chip->mixer_data; in tumbler_put_mute_switch()
758 if (!mix) in tumbler_put_mute_switch()
762 gp = &mix->hp_mute; break; in tumbler_put_mute_switch()
764 gp = &mix->amp_mute; break; in tumbler_put_mute_switch()
766 gp = &mix->line_mute; break; in tumbler_put_mute_switch()
780 static int snapper_set_capture_source(struct pmac_tumbler *mix) in snapper_set_capture_source() argument
782 if (! mix->i2c.client) in snapper_set_capture_source()
784 if (mix->capture_source) in snapper_set_capture_source()
785 mix->acs |= 2; in snapper_set_capture_source()
787 mix->acs &= ~2; in snapper_set_capture_source()
788 return i2c_smbus_write_byte_data(mix->i2c.client, TAS_REG_ACS, mix->acs); in snapper_set_capture_source()
805 struct pmac_tumbler *mix = chip->mixer_data; in snapper_get_capture_source() local
807 ucontrol->value.enumerated.item[0] = mix->capture_source; in snapper_get_capture_source()
815 struct pmac_tumbler *mix = chip->mixer_data; in snapper_put_capture_source() local
818 change = ucontrol->value.enumerated.item[0] != mix->capture_source; in snapper_put_capture_source()
820 mix->capture_source = !!ucontrol->value.enumerated.item[0]; in snapper_put_capture_source()
821 snapper_set_capture_source(mix); in snapper_put_capture_source()
935 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_detect_headphone() local
938 if (mix->hp_detect.addr) in tumbler_detect_headphone()
939 detect |= read_audio_gpio(&mix->hp_detect); in tumbler_detect_headphone()
945 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_detect_lineout() local
948 if (mix->line_detect.addr) in tumbler_detect_lineout()
949 detect |= read_audio_gpio(&mix->line_detect); in tumbler_detect_lineout()
970 struct pmac_tumbler *mix; in device_change_handler() local
976 mix = chip->mixer_data; in device_change_handler()
977 if (snd_BUG_ON(!mix)) in device_change_handler()
988 check_mute(chip, &mix->hp_mute, 0, mix->auto_mute_notify, in device_change_handler()
990 if (lineout && mix->line_mute.addr != 0) in device_change_handler()
991 check_mute(chip, &mix->line_mute, 0, mix->auto_mute_notify, in device_change_handler()
993 if (mix->anded_reset) in device_change_handler()
995 check_mute(chip, &mix->amp_mute, !IS_G4DA, mix->auto_mute_notify, in device_change_handler()
999 check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify, in device_change_handler()
1001 if (mix->anded_reset) in device_change_handler()
1003 check_mute(chip, &mix->hp_mute, 1, mix->auto_mute_notify, in device_change_handler()
1005 if (mix->line_mute.addr != 0) in device_change_handler()
1006 check_mute(chip, &mix->line_mute, 1, mix->auto_mute_notify, in device_change_handler()
1009 if (mix->auto_mute_notify) in device_change_handler()
1014 mix->drc_enable = ! (headphone || lineout); in device_change_handler()
1015 if (mix->auto_mute_notify) in device_change_handler()
1019 tumbler_set_drc(mix); in device_change_handler()
1021 snapper_set_drc(mix); in device_change_handler()
1025 tumbler_set_master_volume(mix); in device_change_handler()
1031 struct pmac_tumbler *mix; in tumbler_update_automute() local
1032 mix = chip->mixer_data; in tumbler_update_automute()
1033 if (snd_BUG_ON(!mix)) in tumbler_update_automute()
1035 mix->auto_mute_notify = do_notify; in tumbler_update_automute()
1166 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_reset_audio() local
1168 if (mix->anded_reset) { in tumbler_reset_audio()
1170 write_audio_gpio(&mix->hp_mute, 0); in tumbler_reset_audio()
1171 write_audio_gpio(&mix->amp_mute, 0); in tumbler_reset_audio()
1173 write_audio_gpio(&mix->hp_mute, 1); in tumbler_reset_audio()
1174 write_audio_gpio(&mix->amp_mute, 1); in tumbler_reset_audio()
1176 write_audio_gpio(&mix->hp_mute, 0); in tumbler_reset_audio()
1177 write_audio_gpio(&mix->amp_mute, 0); in tumbler_reset_audio()
1182 write_audio_gpio(&mix->audio_reset, 0); in tumbler_reset_audio()
1184 write_audio_gpio(&mix->audio_reset, 1); in tumbler_reset_audio()
1186 write_audio_gpio(&mix->audio_reset, 0); in tumbler_reset_audio()
1195 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_suspend() local
1197 if (mix->headphone_irq >= 0) in tumbler_suspend()
1198 disable_irq(mix->headphone_irq); in tumbler_suspend()
1199 if (mix->lineout_irq >= 0) in tumbler_suspend()
1200 disable_irq(mix->lineout_irq); in tumbler_suspend()
1201 mix->save_master_switch[0] = mix->master_switch[0]; in tumbler_suspend()
1202 mix->save_master_switch[1] = mix->master_switch[1]; in tumbler_suspend()
1203 mix->save_master_vol[0] = mix->master_vol[0]; in tumbler_suspend()
1204 mix->save_master_vol[1] = mix->master_vol[1]; in tumbler_suspend()
1205 mix->master_switch[0] = mix->master_switch[1] = 0; in tumbler_suspend()
1206 tumbler_set_master_volume(mix); in tumbler_suspend()
1207 if (!mix->anded_reset) { in tumbler_suspend()
1208 write_audio_gpio(&mix->amp_mute, 1); in tumbler_suspend()
1209 write_audio_gpio(&mix->hp_mute, 1); in tumbler_suspend()
1212 mix->acs |= 1; in tumbler_suspend()
1213 i2c_smbus_write_byte_data(mix->i2c.client, TAS_REG_ACS, mix->acs); in tumbler_suspend()
1215 if (mix->anded_reset) { in tumbler_suspend()
1216 write_audio_gpio(&mix->amp_mute, 1); in tumbler_suspend()
1217 write_audio_gpio(&mix->hp_mute, 1); in tumbler_suspend()
1219 write_audio_gpio(&mix->audio_reset, 1); in tumbler_suspend()
1225 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_resume() local
1227 mix->acs &= ~1; in tumbler_resume()
1228 mix->master_switch[0] = mix->save_master_switch[0]; in tumbler_resume()
1229 mix->master_switch[1] = mix->save_master_switch[1]; in tumbler_resume()
1230 mix->master_vol[0] = mix->save_master_vol[0]; in tumbler_resume()
1231 mix->master_vol[1] = mix->save_master_vol[1]; in tumbler_resume()
1233 if (mix->i2c.client && mix->i2c.init_client) { in tumbler_resume()
1234 if (mix->i2c.init_client(&mix->i2c) < 0) in tumbler_resume()
1239 tumbler_set_mono_volume(mix, &tumbler_pcm_vol_info); in tumbler_resume()
1240 tumbler_set_mono_volume(mix, &tumbler_bass_vol_info); in tumbler_resume()
1241 tumbler_set_mono_volume(mix, &tumbler_treble_vol_info); in tumbler_resume()
1242 tumbler_set_drc(mix); in tumbler_resume()
1244 snapper_set_mix_vol(mix, VOL_IDX_PCM); in tumbler_resume()
1245 snapper_set_mix_vol(mix, VOL_IDX_PCM2); in tumbler_resume()
1246 snapper_set_mix_vol(mix, VOL_IDX_ADC); in tumbler_resume()
1247 tumbler_set_mono_volume(mix, &snapper_bass_vol_info); in tumbler_resume()
1248 tumbler_set_mono_volume(mix, &snapper_treble_vol_info); in tumbler_resume()
1249 snapper_set_drc(mix); in tumbler_resume()
1250 snapper_set_capture_source(mix); in tumbler_resume()
1252 tumbler_set_master_volume(mix); in tumbler_resume()
1255 if (mix->headphone_irq >= 0) { in tumbler_resume()
1258 enable_irq(mix->headphone_irq); in tumbler_resume()
1260 val = do_gpio_read(&mix->hp_detect); in tumbler_resume()
1261 do_gpio_write(&mix->hp_detect, val | 0x80); in tumbler_resume()
1263 if (mix->lineout_irq >= 0) in tumbler_resume()
1264 enable_irq(mix->lineout_irq); in tumbler_resume()
1272 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_init() local
1276 &mix->audio_reset, 0) < 0) in tumbler_init()
1279 &mix->audio_reset, 1); in tumbler_init()
1282 &mix->amp_mute, 0) < 0) in tumbler_init()
1285 &mix->amp_mute, 1); in tumbler_init()
1288 &mix->hp_mute, 0) < 0) in tumbler_init()
1291 &mix->hp_mute, 1); in tumbler_init()
1294 &mix->line_mute, 0) < 0) in tumbler_init()
1297 &mix->line_mute, 1); in tumbler_init()
1299 NULL, &mix->hp_detect, 0); in tumbler_init()
1302 NULL, &mix->hp_detect, 1); in tumbler_init()
1305 NULL, &mix->hp_detect, 1); in tumbler_init()
1306 mix->headphone_irq = irq; in tumbler_init()
1308 NULL, &mix->line_detect, 0); in tumbler_init()
1311 NULL, &mix->line_detect, 1); in tumbler_init()
1314 NULL, &mix->line_detect, 1); in tumbler_init()
1315 mix->lineout_irq = irq; in tumbler_init()
1324 struct pmac_tumbler *mix = chip->mixer_data; in tumbler_cleanup() local
1325 if (! mix) in tumbler_cleanup()
1328 if (mix->headphone_irq >= 0) in tumbler_cleanup()
1329 free_irq(mix->headphone_irq, chip); in tumbler_cleanup()
1330 if (mix->lineout_irq >= 0) in tumbler_cleanup()
1331 free_irq(mix->lineout_irq, chip); in tumbler_cleanup()
1332 tumbler_gpio_free(&mix->audio_reset); in tumbler_cleanup()
1333 tumbler_gpio_free(&mix->amp_mute); in tumbler_cleanup()
1334 tumbler_gpio_free(&mix->hp_mute); in tumbler_cleanup()
1335 tumbler_gpio_free(&mix->hp_detect); in tumbler_cleanup()
1336 snd_pmac_keywest_cleanup(&mix->i2c); in tumbler_cleanup()
1337 kfree(mix); in tumbler_cleanup()
1345 struct pmac_tumbler *mix; in snd_pmac_tumbler_init() local
1352 mix = kzalloc(sizeof(*mix), GFP_KERNEL); in snd_pmac_tumbler_init()
1353 if (! mix) in snd_pmac_tumbler_init()
1355 mix->headphone_irq = -1; in snd_pmac_tumbler_init()
1357 chip->mixer_data = mix; in snd_pmac_tumbler_init()
1359 mix->anded_reset = 0; in snd_pmac_tumbler_init()
1360 mix->reset_on_sleep = 1; in snd_pmac_tumbler_init()
1365 mix->anded_reset = 1; in snd_pmac_tumbler_init()
1367 mix->reset_on_sleep = 0; in snd_pmac_tumbler_init()
1387 mix->i2c.addr = (*paddr) >> 1; in snd_pmac_tumbler_init()
1389 mix->i2c.addr = TAS_I2C_ADDR; in snd_pmac_tumbler_init()
1392 DBG("(I) TAS i2c address is: %x\n", mix->i2c.addr); in snd_pmac_tumbler_init()
1395 mix->i2c.init_client = tumbler_init_client; in snd_pmac_tumbler_init()
1396 mix->i2c.name = "TAS3001c"; in snd_pmac_tumbler_init()
1399 mix->i2c.init_client = snapper_init_client; in snd_pmac_tumbler_init()
1400 mix->i2c.name = "TAS3004"; in snd_pmac_tumbler_init()
1404 err = snd_pmac_keywest_init(&mix->i2c); in snd_pmac_tumbler_init()
1434 if (mix->line_mute.addr != 0) { in snd_pmac_tumbler_init()
1447 mix->drc_range = (TAS3001_DRC_MAX * 6) / 10; in snd_pmac_tumbler_init()
1449 mix->drc_range = (TAS3004_DRC_MAX * 6) / 10; in snd_pmac_tumbler_init()
1450 mix->drc_enable = 1; /* will be changed later if AUTO_DRC is set */ in snd_pmac_tumbler_init()
1452 tumbler_set_drc(mix); in snd_pmac_tumbler_init()
1454 snapper_set_drc(mix); in snd_pmac_tumbler_init()
1465 if (mix->headphone_irq >= 0 || mix->lineout_irq >= 0) { in snd_pmac_tumbler_init()
1475 if (mix->headphone_irq >= 0) { in snd_pmac_tumbler_init()
1477 err = request_irq(mix->headphone_irq, headphone_intr, 0, in snd_pmac_tumbler_init()
1482 val = do_gpio_read(&mix->hp_detect); in snd_pmac_tumbler_init()
1483 do_gpio_write(&mix->hp_detect, val | 0x80); in snd_pmac_tumbler_init()
1485 if (mix->lineout_irq >= 0) { in snd_pmac_tumbler_init()
1487 err = request_irq(mix->lineout_irq, headphone_intr, 0, in snd_pmac_tumbler_init()
1492 val = do_gpio_read(&mix->line_detect); in snd_pmac_tumbler_init()
1493 do_gpio_write(&mix->line_detect, val | 0x80); in snd_pmac_tumbler_init()