Lines Matching refs:spec

24 	struct cs8409_spec *spec = codec->spec;  in cs8409_parse_auto_config()  local
28 err = snd_hda_parse_pin_defcfg(codec, &spec->gen.autocfg, NULL, 0); in cs8409_parse_auto_config()
32 err = snd_hda_gen_parse_auto_config(codec, &spec->gen.autocfg); in cs8409_parse_auto_config()
37 if (spec->gen.dyn_adc_switch) { in cs8409_parse_auto_config()
40 for (i = 0; i < spec->gen.input_mux.num_items; i++) { in cs8409_parse_auto_config()
41 int idx = spec->gen.dyn_adc_idx[i]; in cs8409_parse_auto_config()
45 snd_hda_gen_fix_pin_power(codec, spec->gen.adc_nids[idx]); in cs8409_parse_auto_config()
57 struct cs8409_spec *spec; in cs8409_alloc_spec() local
59 spec = kzalloc(sizeof(*spec), GFP_KERNEL); in cs8409_alloc_spec()
60 if (!spec) in cs8409_alloc_spec()
62 codec->spec = spec; in cs8409_alloc_spec()
63 spec->codec = codec; in cs8409_alloc_spec()
65 mutex_init(&spec->i2c_mux); in cs8409_alloc_spec()
66 INIT_DELAYED_WORK(&spec->i2c_clk_work, cs8409_disable_i2c_clock_worker); in cs8409_alloc_spec()
67 snd_hda_gen_spec_init(&spec->gen); in cs8409_alloc_spec()
69 return spec; in cs8409_alloc_spec()
93 struct cs8409_spec *spec = codec->spec; in cs8409_disable_i2c_clock() local
95 mutex_lock(&spec->i2c_mux); in cs8409_disable_i2c_clock()
96 if (spec->i2c_clck_enabled) { in cs8409_disable_i2c_clock()
97 cs8409_vendor_coef_set(spec->codec, 0x0, in cs8409_disable_i2c_clock()
98 cs8409_vendor_coef_get(spec->codec, 0x0) & 0xfffffff7); in cs8409_disable_i2c_clock()
99 spec->i2c_clck_enabled = 0; in cs8409_disable_i2c_clock()
101 mutex_unlock(&spec->i2c_mux); in cs8409_disable_i2c_clock()
109 struct cs8409_spec *spec = container_of(work, struct cs8409_spec, i2c_clk_work.work); in cs8409_disable_i2c_clock_worker() local
111 cs8409_disable_i2c_clock(spec->codec); in cs8409_disable_i2c_clock_worker()
122 struct cs8409_spec *spec = codec->spec; in cs8409_enable_i2c_clock() local
130 cancel_delayed_work(&spec->i2c_clk_work); in cs8409_enable_i2c_clock()
132 if (!spec->i2c_clck_enabled) { in cs8409_enable_i2c_clock()
134 spec->i2c_clck_enabled = 1; in cs8409_enable_i2c_clock()
136 queue_delayed_work(system_power_efficient_wq, &spec->i2c_clk_work, msecs_to_jiffies(25)); in cs8409_enable_i2c_clock()
161 struct cs8409_spec *spec = codec->spec; in cs8409_set_i2c_dev_addr() local
163 if (spec->dev_addr != addr) { in cs8409_set_i2c_dev_addr()
165 spec->dev_addr = addr; in cs8409_set_i2c_dev_addr()
200 struct cs8409_spec *spec = codec->spec; in cs8409_i2c_read() local
207 mutex_lock(&spec->i2c_mux); in cs8409_i2c_read()
222 mutex_unlock(&spec->i2c_mux); in cs8409_i2c_read()
227 mutex_unlock(&spec->i2c_mux); in cs8409_i2c_read()
243 struct cs8409_spec *spec = codec->spec; in cs8409_i2c_bulk_read() local
250 mutex_lock(&spec->i2c_mux); in cs8409_i2c_bulk_read()
267 mutex_unlock(&spec->i2c_mux); in cs8409_i2c_bulk_read()
272 mutex_unlock(&spec->i2c_mux); in cs8409_i2c_bulk_read()
288 struct cs8409_spec *spec = codec->spec; in cs8409_i2c_write() local
294 mutex_lock(&spec->i2c_mux); in cs8409_i2c_write()
308 mutex_unlock(&spec->i2c_mux); in cs8409_i2c_write()
312 mutex_unlock(&spec->i2c_mux); in cs8409_i2c_write()
329 struct cs8409_spec *spec = codec->spec; in cs8409_i2c_bulk_write() local
336 mutex_lock(&spec->i2c_mux); in cs8409_i2c_bulk_write()
351 mutex_unlock(&spec->i2c_mux); in cs8409_i2c_bulk_write()
356 mutex_unlock(&spec->i2c_mux); in cs8409_i2c_bulk_write()
386 struct cs8409_spec *spec = codec->spec; in cs8409_enable_ur() local
390 for (i = 0; i < spec->num_scodecs; i++) in cs8409_enable_ur()
391 ur_gpios |= spec->scodecs[i]->irq_mask; in cs8409_enable_ur()
426 struct cs8409_spec *spec = codec->spec; in cs8409_spk_sw_gpio_get() local
428 ucontrol->value.integer.value[0] = !!(spec->gpio_data & spec->speaker_pdn_gpio); in cs8409_spk_sw_gpio_get()
436 struct cs8409_spec *spec = codec->spec; in cs8409_spk_sw_gpio_put() local
439 gpio_data = (spec->gpio_data & ~spec->speaker_pdn_gpio) | in cs8409_spk_sw_gpio_put()
440 (ucontrol->value.integer.value[0] ? spec->speaker_pdn_gpio : 0); in cs8409_spk_sw_gpio_put()
441 if (gpio_data == spec->gpio_data) in cs8409_spk_sw_gpio_put()
443 spec->gpio_data = gpio_data; in cs8409_spk_sw_gpio_put()
444 snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA, spec->gpio_data); in cs8409_spk_sw_gpio_put()
487 struct cs8409_spec *spec = codec->spec; in cs42l42_volume_get() local
488 struct sub_codec *cs42l42 = spec->scodecs[get_amp_index(kctrl)]; in cs42l42_volume_get()
546 struct cs8409_spec *spec = codec->spec; in cs42l42_volume_put() local
547 struct sub_codec *cs42l42 = spec->scodecs[get_amp_index(kctrl)]; in cs42l42_volume_put()
560 if (spec->playback_started) in cs42l42_volume_put()
566 if (spec->capture_started) in cs42l42_volume_put()
581 struct cs8409_spec *spec = codec->spec; in cs42l42_playback_pcm_hook() local
589 spec->playback_started = 1; in cs42l42_playback_pcm_hook()
593 spec->playback_started = 0; in cs42l42_playback_pcm_hook()
599 for (i = 0; i < spec->num_scodecs; i++) { in cs42l42_playback_pcm_hook()
600 cs42l42 = spec->scodecs[i]; in cs42l42_playback_pcm_hook()
610 struct cs8409_spec *spec = codec->spec; in cs42l42_capture_pcm_hook() local
618 spec->capture_started = 1; in cs42l42_capture_pcm_hook()
622 spec->capture_started = 0; in cs42l42_capture_pcm_hook()
628 for (i = 0; i < spec->num_scodecs; i++) { in cs42l42_capture_pcm_hook()
629 cs42l42 = spec->scodecs[i]; in cs42l42_capture_pcm_hook()
872 struct cs8409_spec *spec = codec->spec; in cs42l42_resume() local
882 spec->gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0); in cs42l42_resume()
883 spec->gpio_data |= cs42l42->reset_gpio; in cs42l42_resume()
884 snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA, spec->gpio_data); in cs42l42_resume()
916 struct cs8409_spec *spec = codec->spec; in cs42l42_suspend() local
947 spec->gpio_data = snd_hda_codec_read(codec, CS8409_PIN_AFG, 0, AC_VERB_GET_GPIO_DATA, 0); in cs42l42_suspend()
948 spec->gpio_data &= ~cs42l42->reset_gpio; in cs42l42_suspend()
949 snd_hda_codec_write(codec, CS8409_PIN_AFG, 0, AC_VERB_SET_GPIO_DATA, spec->gpio_data); in cs42l42_suspend()
955 struct cs8409_spec *spec = codec->spec; in cs8409_free() local
958 cancel_delayed_work_sync(&spec->i2c_clk_work); in cs8409_free()
978 struct cs8409_spec *spec = codec->spec; in cs8409_cs42l42_jack_unsol_event() local
979 struct sub_codec *cs42l42 = spec->scodecs[CS8409_CODEC0]; in cs8409_cs42l42_jack_unsol_event()
1010 struct cs8409_spec *spec = codec->spec; in cs8409_cs42l42_suspend() local
1013 spec->init_done = 0; in cs8409_cs42l42_suspend()
1017 for (i = 0; i < spec->num_scodecs; i++) in cs8409_cs42l42_suspend()
1018 cs42l42_suspend(spec->scodecs[i]); in cs8409_cs42l42_suspend()
1021 cancel_delayed_work_sync(&spec->i2c_clk_work); in cs8409_cs42l42_suspend()
1037 struct cs8409_spec *spec = codec->spec; in cs8409_cs42l42_hw_init() local
1038 struct sub_codec *cs42l42 = spec->scodecs[CS8409_CODEC0]; in cs8409_cs42l42_hw_init()
1040 if (spec->gpio_mask) { in cs8409_cs42l42_hw_init()
1042 spec->gpio_mask); in cs8409_cs42l42_hw_init()
1044 spec->gpio_dir); in cs8409_cs42l42_hw_init()
1046 spec->gpio_data); in cs8409_cs42l42_hw_init()
1092 struct cs8409_spec *spec = codec->spec; in cs8409_cs42l42_exec_verb() local
1093 struct sub_codec *cs42l42 = spec->scodecs[CS8409_CODEC0]; in cs8409_cs42l42_exec_verb()
1120 return spec->exec_verb(dev, cmd, flags, res); in cs8409_cs42l42_exec_verb()
1125 struct cs8409_spec *spec = codec->spec; in cs8409_cs42l42_fixups() local
1131 spec->exec_verb = codec->core.exec_verb; in cs8409_cs42l42_fixups()
1134 spec->scodecs[CS8409_CODEC0] = &cs8409_cs42l42_codec; in cs8409_cs42l42_fixups()
1135 spec->num_scodecs = 1; in cs8409_cs42l42_fixups()
1136 spec->scodecs[CS8409_CODEC0]->codec = codec; in cs8409_cs42l42_fixups()
1139 spec->gen.suppress_auto_mute = 1; in cs8409_cs42l42_fixups()
1140 spec->gen.no_primary_hp = 1; in cs8409_cs42l42_fixups()
1141 spec->gen.suppress_vmaster = 1; in cs8409_cs42l42_fixups()
1143 spec->speaker_pdn_gpio = 0; in cs8409_cs42l42_fixups()
1146 spec->gpio_dir = spec->scodecs[CS8409_CODEC0]->reset_gpio; in cs8409_cs42l42_fixups()
1147 spec->gpio_data = 0; in cs8409_cs42l42_fixups()
1148 spec->gpio_mask = 0x03f; in cs8409_cs42l42_fixups()
1156 spec->scodecs[CS8409_CODEC0]->hsbias_hiz = 0x0020; in cs8409_cs42l42_fixups()
1160 spec->scodecs[CS8409_CODEC0]->full_scale_vol = in cs8409_cs42l42_fixups()
1162 spec->speaker_pdn_gpio = CS8409_CYBORG_SPEAKER_PDN; in cs8409_cs42l42_fixups()
1165 spec->scodecs[CS8409_CODEC0]->full_scale_vol = CS42L42_FULL_SCALE_VOL_0DB; in cs8409_cs42l42_fixups()
1166 spec->speaker_pdn_gpio = CS8409_CYBORG_SPEAKER_PDN; in cs8409_cs42l42_fixups()
1170 spec->scodecs[CS8409_CODEC0]->full_scale_vol = CS42L42_FULL_SCALE_VOL_0DB; in cs8409_cs42l42_fixups()
1171 spec->speaker_pdn_gpio = CS8409_WARLOCK_SPEAKER_PDN; in cs8409_cs42l42_fixups()
1174 spec->scodecs[CS8409_CODEC0]->full_scale_vol = in cs8409_cs42l42_fixups()
1176 spec->speaker_pdn_gpio = CS8409_WARLOCK_SPEAKER_PDN; in cs8409_cs42l42_fixups()
1180 if (spec->speaker_pdn_gpio > 0) { in cs8409_cs42l42_fixups()
1181 spec->gpio_dir |= spec->speaker_pdn_gpio; in cs8409_cs42l42_fixups()
1182 spec->gpio_data |= spec->speaker_pdn_gpio; in cs8409_cs42l42_fixups()
1188 spec->gen.stream_analog_playback = &cs42l42_48k_pcm_analog_playback; in cs8409_cs42l42_fixups()
1189 spec->gen.stream_analog_capture = &cs42l42_48k_pcm_analog_capture; in cs8409_cs42l42_fixups()
1191 spec->gen.pcm_playback_hook = cs42l42_playback_pcm_hook; in cs8409_cs42l42_fixups()
1192 spec->gen.pcm_capture_hook = cs42l42_capture_pcm_hook; in cs8409_cs42l42_fixups()
1197 snd_hda_gen_add_kctl(&spec->gen, "Headphone Playback Volume", in cs8409_cs42l42_fixups()
1199 snd_hda_gen_add_kctl(&spec->gen, "Mic Capture Volume", in cs8409_cs42l42_fixups()
1201 if (spec->speaker_pdn_gpio > 0) in cs8409_cs42l42_fixups()
1202 snd_hda_gen_add_kctl(&spec->gen, "Speaker Playback Switch", in cs8409_cs42l42_fixups()
1210 spec->init_done = 1; in cs8409_cs42l42_fixups()
1211 if (spec->init_done && spec->build_ctrl_done in cs8409_cs42l42_fixups()
1212 && !spec->scodecs[CS8409_CODEC0]->hp_jack_in) in cs8409_cs42l42_fixups()
1213 cs42l42_run_jack_detect(spec->scodecs[CS8409_CODEC0]); in cs8409_cs42l42_fixups()
1216 spec->build_ctrl_done = 1; in cs8409_cs42l42_fixups()
1222 if (spec->init_done && spec->build_ctrl_done in cs8409_cs42l42_fixups()
1223 && !spec->scodecs[CS8409_CODEC0]->hp_jack_in) in cs8409_cs42l42_fixups()
1224 cs42l42_run_jack_detect(spec->scodecs[CS8409_CODEC0]); in cs8409_cs42l42_fixups()
1245 struct cs8409_spec *spec = codec->spec; in dolphin_jack_unsol_event() local
1249 cs42l42 = spec->scodecs[CS8409_CODEC0]; in dolphin_jack_unsol_event()
1265 cs42l42 = spec->scodecs[CS8409_CODEC1]; in dolphin_jack_unsol_event()
1282 struct cs8409_spec *spec = codec->spec; in dolphin_hw_init() local
1286 if (spec->gpio_mask) { in dolphin_hw_init()
1288 spec->gpio_mask); in dolphin_hw_init()
1290 spec->gpio_dir); in dolphin_hw_init()
1292 spec->gpio_data); in dolphin_hw_init()
1298 for (i = 0; i < spec->num_scodecs; i++) { in dolphin_hw_init()
1299 cs42l42 = spec->scodecs[i]; in dolphin_hw_init()
1322 struct cs8409_spec *spec = codec->spec; in dolphin_exec_verb() local
1323 struct sub_codec *cs42l42 = spec->scodecs[CS8409_CODEC0]; in dolphin_exec_verb()
1337 cs42l42 = spec->scodecs[CS8409_CODEC1]; in dolphin_exec_verb()
1353 return spec->exec_verb(dev, cmd, flags, res); in dolphin_exec_verb()
1358 struct cs8409_spec *spec = codec->spec; in dolphin_fixups() local
1366 spec->exec_verb = codec->core.exec_verb; in dolphin_fixups()
1369 spec->scodecs[CS8409_CODEC0] = &dolphin_cs42l42_0; in dolphin_fixups()
1370 spec->scodecs[CS8409_CODEC0]->codec = codec; in dolphin_fixups()
1371 spec->scodecs[CS8409_CODEC1] = &dolphin_cs42l42_1; in dolphin_fixups()
1372 spec->scodecs[CS8409_CODEC1]->codec = codec; in dolphin_fixups()
1373 spec->num_scodecs = 2; in dolphin_fixups()
1374 spec->gen.suppress_vmaster = 1; in dolphin_fixups()
1379 spec->gpio_dir = spec->scodecs[CS8409_CODEC0]->reset_gpio | in dolphin_fixups()
1380 spec->scodecs[CS8409_CODEC1]->reset_gpio; in dolphin_fixups()
1381 spec->gpio_data = 0; in dolphin_fixups()
1382 spec->gpio_mask = 0x03f; in dolphin_fixups()
1397 spec->scodecs[CS8409_CODEC0]->full_scale_vol = CS42L42_FULL_SCALE_VOL_MINUS6DB; in dolphin_fixups()
1398 spec->scodecs[CS8409_CODEC1]->full_scale_vol = CS42L42_FULL_SCALE_VOL_MINUS6DB; in dolphin_fixups()
1403 spec->gen.stream_analog_playback = &cs42l42_48k_pcm_analog_playback; in dolphin_fixups()
1404 spec->gen.stream_analog_capture = &cs42l42_48k_pcm_analog_capture; in dolphin_fixups()
1406 spec->gen.pcm_playback_hook = cs42l42_playback_pcm_hook; in dolphin_fixups()
1407 spec->gen.pcm_capture_hook = cs42l42_capture_pcm_hook; in dolphin_fixups()
1408 snd_hda_gen_add_kctl(&spec->gen, "Headphone Playback Volume", in dolphin_fixups()
1410 snd_hda_gen_add_kctl(&spec->gen, "Mic Capture Volume", &cs42l42_adc_volume_mixer); in dolphin_fixups()
1411 kctrl = snd_hda_gen_add_kctl(&spec->gen, "Line Out Playback Volume", in dolphin_fixups()
1421 spec->init_done = 1; in dolphin_fixups()
1422 if (spec->init_done && spec->build_ctrl_done) { in dolphin_fixups()
1423 for (i = 0; i < spec->num_scodecs; i++) { in dolphin_fixups()
1424 if (!spec->scodecs[i]->hp_jack_in) in dolphin_fixups()
1425 cs42l42_run_jack_detect(spec->scodecs[i]); in dolphin_fixups()
1430 spec->build_ctrl_done = 1; in dolphin_fixups()
1436 if (spec->init_done && spec->build_ctrl_done) { in dolphin_fixups()
1437 for (i = 0; i < spec->num_scodecs; i++) { in dolphin_fixups()
1438 if (!spec->scodecs[i]->hp_jack_in) in dolphin_fixups()
1439 cs42l42_run_jack_detect(spec->scodecs[i]); in dolphin_fixups()