Lines Matching refs:cs42l42

488 	struct sub_codec *cs42l42 = spec->scodecs[get_amp_index(kctrl)];  in cs42l42_volume_get()  local
496 *valp++ = cs42l42->vol[ofs]; in cs42l42_volume_get()
498 *valp = cs42l42->vol[ofs+1]; in cs42l42_volume_get()
502 *valp = cs42l42->vol[ofs]; in cs42l42_volume_get()
511 static void cs42l42_mute(struct sub_codec *cs42l42, int vol_type, in cs42l42_mute() argument
517 cs8409_i2c_write(cs42l42, CS42L42_MIXER_CHA_VOL, 0x3f); in cs42l42_mute()
519 cs8409_i2c_write(cs42l42, CS42L42_MIXER_CHB_VOL, 0x3f); in cs42l42_mute()
522 cs8409_i2c_write(cs42l42, CS42L42_ADC_VOLUME, 0x9f); in cs42l42_mute()
527 cs8409_i2c_write(cs42l42, CS42L42_MIXER_CHA_VOL, in cs42l42_mute()
528 -(cs42l42->vol[CS42L42_DAC_CH0_VOL_OFFSET]) in cs42l42_mute()
531 cs8409_i2c_write(cs42l42, CS42L42_MIXER_CHB_VOL, in cs42l42_mute()
532 -(cs42l42->vol[CS42L42_DAC_CH1_VOL_OFFSET]) in cs42l42_mute()
536 cs8409_i2c_write(cs42l42, CS42L42_ADC_VOLUME, in cs42l42_mute()
537 cs42l42->vol[CS42L42_ADC_VOL_OFFSET] in cs42l42_mute()
547 struct sub_codec *cs42l42 = spec->scodecs[get_amp_index(kctrl)]; in cs42l42_volume_put() local
555 cs42l42->vol[ofs] = *valp; in cs42l42_volume_put()
558 cs42l42->vol[ofs + 1] = *valp; in cs42l42_volume_put()
561 cs42l42_mute(cs42l42, CS42L42_VOL_DAC, chs, false); in cs42l42_volume_put()
565 cs42l42->vol[ofs] = *valp; in cs42l42_volume_put()
567 cs42l42_mute(cs42l42, CS42L42_VOL_ADC, chs, false); in cs42l42_volume_put()
582 struct sub_codec *cs42l42; in cs42l42_playback_pcm_hook() local
600 cs42l42 = spec->scodecs[i]; in cs42l42_playback_pcm_hook()
601 cs42l42_mute(cs42l42, CS42L42_VOL_DAC, 0x3, mute); in cs42l42_playback_pcm_hook()
611 struct sub_codec *cs42l42; in cs42l42_capture_pcm_hook() local
629 cs42l42 = spec->scodecs[i]; in cs42l42_capture_pcm_hook()
630 cs42l42_mute(cs42l42, CS42L42_VOL_ADC, 0x3, mute); in cs42l42_capture_pcm_hook()
635 static void cs42l42_enable_jack_detect(struct sub_codec *cs42l42) in cs42l42_enable_jack_detect() argument
637 cs8409_i2c_write(cs42l42, CS42L42_HSBIAS_SC_AUTOCTL, cs42l42->hsbias_hiz); in cs42l42_enable_jack_detect()
639 cs8409_i2c_write(cs42l42, CS42L42_WAKE_CTL, 0x00C1); in cs42l42_enable_jack_detect()
643 cs8409_i2c_write(cs42l42, CS42L42_WAKE_CTL, 0x00C0); in cs42l42_enable_jack_detect()
645 cs8409_i2c_read(cs42l42, CS42L42_TSRS_PLUG_STATUS); in cs42l42_enable_jack_detect()
647 cs8409_i2c_write(cs42l42, CS42L42_TSRS_PLUG_INT_MASK, 0xF3); in cs42l42_enable_jack_detect()
651 static void cs42l42_run_jack_detect(struct sub_codec *cs42l42) in cs42l42_run_jack_detect() argument
654 cs8409_i2c_read(cs42l42, CS42L42_CODEC_STATUS); in cs42l42_run_jack_detect()
655 cs8409_i2c_read(cs42l42, CS42L42_DET_STATUS1); in cs42l42_run_jack_detect()
656 cs8409_i2c_write(cs42l42, CS42L42_TSRS_PLUG_INT_MASK, 0xFF); in cs42l42_run_jack_detect()
657 cs8409_i2c_read(cs42l42, CS42L42_TSRS_PLUG_STATUS); in cs42l42_run_jack_detect()
659 cs8409_i2c_write(cs42l42, CS42L42_PWR_CTL2, 0x87); in cs42l42_run_jack_detect()
660 cs8409_i2c_write(cs42l42, CS42L42_DAC_CTL2, 0x86); in cs42l42_run_jack_detect()
661 cs8409_i2c_write(cs42l42, CS42L42_MISC_DET_CTL, 0x07); in cs42l42_run_jack_detect()
662 cs8409_i2c_write(cs42l42, CS42L42_CODEC_INT_MASK, 0xFD); in cs42l42_run_jack_detect()
663 cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL2, 0x80); in cs42l42_run_jack_detect()
666 cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL1, 0x77); in cs42l42_run_jack_detect()
667 cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL2, 0xc0); in cs42l42_run_jack_detect()
670 static int cs42l42_manual_hs_det(struct sub_codec *cs42l42) in cs42l42_manual_hs_det() argument
679 cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL2, in cs42l42_manual_hs_det()
686 cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL1, in cs42l42_manual_hs_det()
691 cs8409_i2c_write(cs42l42, CS42L42_HS_SWITCH_CTL, CS42L42_HSDET_SW_COMP1); in cs42l42_manual_hs_det()
695 hs_det_status = cs8409_i2c_read(cs42l42, CS42L42_HS_DET_STATUS); in cs42l42_manual_hs_det()
703 cs8409_i2c_write(cs42l42, CS42L42_HS_SWITCH_CTL, CS42L42_HSDET_SW_COMP2); in cs42l42_manual_hs_det()
707 hs_det_status = cs8409_i2c_read(cs42l42, CS42L42_HS_DET_STATUS); in cs42l42_manual_hs_det()
747 cs8409_i2c_write(cs42l42, CS42L42_HS_SWITCH_CTL, hs_det_sw); in cs42l42_manual_hs_det()
750 cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL2, in cs42l42_manual_hs_det()
757 cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL1, in cs42l42_manual_hs_det()
764 static int cs42l42_handle_tip_sense(struct sub_codec *cs42l42, unsigned int reg_ts_status) in cs42l42_handle_tip_sense() argument
771 if (cs42l42->no_type_dect) { in cs42l42_handle_tip_sense()
773 cs42l42->hp_jack_in = 1; in cs42l42_handle_tip_sense()
774 cs42l42->mic_jack_in = 0; in cs42l42_handle_tip_sense()
776 cs42l42_run_jack_detect(cs42l42); in cs42l42_handle_tip_sense()
782 cs42l42->hp_jack_in = 0; in cs42l42_handle_tip_sense()
783 cs42l42->mic_jack_in = 0; in cs42l42_handle_tip_sense()
790 codec_dbg(cs42l42->codec, "Tip Sense Detection: (%d)\n", reg_ts_status); in cs42l42_handle_tip_sense()
795 static int cs42l42_jack_unsol_event(struct sub_codec *cs42l42) in cs42l42_jack_unsol_event() argument
805 reg_cdc_status = cs8409_i2c_read(cs42l42, CS42L42_CODEC_STATUS); in cs42l42_jack_unsol_event()
806 reg_hs_status = cs8409_i2c_read(cs42l42, CS42L42_HS_DET_STATUS); in cs42l42_jack_unsol_event()
807 reg_ts_status = cs8409_i2c_read(cs42l42, CS42L42_TSRS_PLUG_STATUS); in cs42l42_jack_unsol_event()
820 cs8409_i2c_write(cs42l42, CS42L42_CODEC_INT_MASK, 0xFF); in cs42l42_jack_unsol_event()
825 cs8409_i2c_write(cs42l42, CS42L42_HSDET_CTL2, 0x80); in cs42l42_jack_unsol_event()
827 if (cs42l42->no_type_dect) { in cs42l42_jack_unsol_event()
828 status_changed = cs42l42_handle_tip_sense(cs42l42, current_plug_status); in cs42l42_jack_unsol_event()
831 codec_dbg(cs42l42->codec, in cs42l42_jack_unsol_event()
834 type = cs42l42_manual_hs_det(cs42l42); in cs42l42_jack_unsol_event()
841 cs42l42->hp_jack_in = 1; in cs42l42_jack_unsol_event()
842 cs42l42->mic_jack_in = 1; in cs42l42_jack_unsol_event()
846 cs42l42->hp_jack_in = 1; in cs42l42_jack_unsol_event()
847 cs42l42->mic_jack_in = 0; in cs42l42_jack_unsol_event()
851 cs42l42->hp_jack_in = 0; in cs42l42_jack_unsol_event()
852 cs42l42->mic_jack_in = 0; in cs42l42_jack_unsol_event()
855 codec_dbg(cs42l42->codec, "Detection done (%d)\n", type); in cs42l42_jack_unsol_event()
859 cs8409_i2c_write(cs42l42, CS42L42_DAC_CTL2, 0x02); in cs42l42_jack_unsol_event()
861 cs8409_i2c_write(cs42l42, CS42L42_TSRS_PLUG_INT_MASK, 0xF3); in cs42l42_jack_unsol_event()
863 status_changed = cs42l42_handle_tip_sense(cs42l42, current_plug_status); in cs42l42_jack_unsol_event()
869 static void cs42l42_resume(struct sub_codec *cs42l42) in cs42l42_resume() argument
871 struct hda_codec *codec = cs42l42->codec; in cs42l42_resume()
883 spec->gpio_data |= cs42l42->reset_gpio; in cs42l42_resume()
887 cs42l42->suspended = 0; in cs42l42_resume()
890 cs8409_i2c_bulk_write(cs42l42, cs42l42->init_seq, cs42l42->init_seq_num); in cs42l42_resume()
894 cs8409_i2c_bulk_read(cs42l42, irq_regs, ARRAY_SIZE(irq_regs)); in cs42l42_resume()
896 fsv_old = cs8409_i2c_read(cs42l42, CS42L42_HP_CTL); in cs42l42_resume()
897 if (cs42l42->full_scale_vol == CS42L42_FULL_SCALE_VOL_0DB) in cs42l42_resume()
902 cs8409_i2c_write(cs42l42, CS42L42_HP_CTL, fsv_new); in cs42l42_resume()
907 snd_hda_codec_allow_unsol_events(cs42l42->codec); in cs42l42_resume()
909 cs42l42_enable_jack_detect(cs42l42); in cs42l42_resume()
912 static void cs42l42_suspend(struct sub_codec *cs42l42) in cs42l42_suspend() argument
914 struct hda_codec *codec = cs42l42->codec; in cs42l42_suspend()
931 cs8409_i2c_bulk_write(cs42l42, cs42l42_pwr_down_seq, ARRAY_SIZE(cs42l42_pwr_down_seq)); in cs42l42_suspend()
935 true, cs42l42, CS42L42_CODEC_STATUS) < 0) in cs42l42_suspend()
939 cs8409_i2c_write(cs42l42, CS42L42_PWR_CTL2, 0x9C); in cs42l42_suspend()
940 cs42l42->suspended = 1; in cs42l42_suspend()
941 cs42l42->last_page = 0; in cs42l42_suspend()
942 cs42l42->hp_jack_in = 0; in cs42l42_suspend()
943 cs42l42->mic_jack_in = 0; in cs42l42_suspend()
947 spec->gpio_data &= ~cs42l42->reset_gpio; in cs42l42_suspend()
977 struct sub_codec *cs42l42 = spec->scodecs[CS8409_CODEC0]; in cs8409_cs42l42_jack_unsol_event() local
985 if (res & cs42l42->irq_mask) in cs8409_cs42l42_jack_unsol_event()
988 if (cs42l42_jack_unsol_event(cs42l42)) { in cs8409_cs42l42_jack_unsol_event()
990 cs42l42->hp_jack_in ? 0 : PIN_OUT); in cs8409_cs42l42_jack_unsol_event()
1034 struct sub_codec *cs42l42 = spec->scodecs[CS8409_CODEC0]; in cs8409_cs42l42_hw_init() local
1067 cs42l42_resume(cs42l42); in cs8409_cs42l42_hw_init()
1087 struct sub_codec *cs42l42 = spec->scodecs[CS8409_CODEC0]; in cs8409_cs42l42_exec_verb() local
1100 *res = (cs42l42->hp_jack_in) ? AC_PINSENSE_PRESENCE : 0; in cs8409_cs42l42_exec_verb()
1106 *res = (cs42l42->mic_jack_in) ? AC_PINSENSE_PRESENCE : 0; in cs8409_cs42l42_exec_verb()
1240 struct sub_codec *cs42l42; in dolphin_jack_unsol_event() local
1243 cs42l42 = spec->scodecs[CS8409_CODEC0]; in dolphin_jack_unsol_event()
1244 if (!cs42l42->suspended && (~res & cs42l42->irq_mask) && in dolphin_jack_unsol_event()
1245 cs42l42_jack_unsol_event(cs42l42)) { in dolphin_jack_unsol_event()
1259 cs42l42 = spec->scodecs[CS8409_CODEC1]; in dolphin_jack_unsol_event()
1260 if (!cs42l42->suspended && (~res & cs42l42->irq_mask) && in dolphin_jack_unsol_event()
1261 cs42l42_jack_unsol_event(cs42l42)) { in dolphin_jack_unsol_event()
1277 struct sub_codec *cs42l42; in dolphin_hw_init() local
1293 cs42l42 = spec->scodecs[i]; in dolphin_hw_init()
1294 cs42l42_resume(cs42l42); in dolphin_hw_init()
1315 struct sub_codec *cs42l42 = spec->scodecs[CS8409_CODEC0]; in dolphin_exec_verb() local
1329 cs42l42 = spec->scodecs[CS8409_CODEC1]; in dolphin_exec_verb()
1331 *res = (cs42l42->hp_jack_in) ? AC_PINSENSE_PRESENCE : 0; in dolphin_exec_verb()
1337 *res = (cs42l42->mic_jack_in) ? AC_PINSENSE_PRESENCE : 0; in dolphin_exec_verb()