Lines Matching refs:component

59 static void wait_for_dc_servo(struct snd_soc_component *component, unsigned int op)  in wait_for_dc_servo()  argument
61 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in wait_for_dc_servo()
70 snd_soc_component_write(component, WM8993_DC_SERVO_0, val); in wait_for_dc_servo()
72 dev_dbg(component->dev, "Waiting for DC servo...\n"); in wait_for_dc_servo()
88 reg = snd_soc_component_read(component, WM8993_DC_SERVO_0); in wait_for_dc_servo()
89 dev_dbg(component->dev, "DC servo: %x\n", reg); in wait_for_dc_servo()
93 dev_err(component->dev, "Timed out waiting for DC Servo %x\n", in wait_for_dc_servo()
107 static bool wm_hubs_dac_hp_direct(struct snd_soc_component *component) in wm_hubs_dac_hp_direct() argument
112 reg = snd_soc_component_read(component, WM8993_OUTPUT_MIXER1); in wm_hubs_dac_hp_direct()
115 dev_vdbg(component->dev, "Analogue paths connected: %x\n", in wm_hubs_dac_hp_direct()
119 dev_vdbg(component->dev, "HPL connected to mixer\n"); in wm_hubs_dac_hp_direct()
122 dev_vdbg(component->dev, "HPL connected to DAC\n"); in wm_hubs_dac_hp_direct()
125 reg = snd_soc_component_read(component, WM8993_OUTPUT_MIXER2); in wm_hubs_dac_hp_direct()
128 dev_vdbg(component->dev, "Analogue paths connected: %x\n", in wm_hubs_dac_hp_direct()
132 dev_vdbg(component->dev, "HPR connected to mixer\n"); in wm_hubs_dac_hp_direct()
135 dev_vdbg(component->dev, "HPR connected to DAC\n"); in wm_hubs_dac_hp_direct()
148 static bool wm_hubs_dcs_cache_get(struct snd_soc_component *component, in wm_hubs_dcs_cache_get() argument
151 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in wm_hubs_dcs_cache_get()
155 left = snd_soc_component_read(component, WM8993_LEFT_OUTPUT_VOLUME); in wm_hubs_dcs_cache_get()
158 right = snd_soc_component_read(component, WM8993_RIGHT_OUTPUT_VOLUME); in wm_hubs_dcs_cache_get()
172 static void wm_hubs_dcs_cache_set(struct snd_soc_component *component, u16 dcs_cfg) in wm_hubs_dcs_cache_set() argument
174 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in wm_hubs_dcs_cache_set()
180 cache = devm_kzalloc(component->dev, sizeof(*cache), GFP_KERNEL); in wm_hubs_dcs_cache_set()
184 cache->left = snd_soc_component_read(component, WM8993_LEFT_OUTPUT_VOLUME); in wm_hubs_dcs_cache_set()
187 cache->right = snd_soc_component_read(component, WM8993_RIGHT_OUTPUT_VOLUME); in wm_hubs_dcs_cache_set()
195 static int wm_hubs_read_dc_servo(struct snd_soc_component *component, in wm_hubs_read_dc_servo() argument
198 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in wm_hubs_read_dc_servo()
219 *reg_l = snd_soc_component_read(component, WM8993_DC_SERVO_READBACK_1) in wm_hubs_read_dc_servo()
221 *reg_r = snd_soc_component_read(component, WM8993_DC_SERVO_READBACK_2) in wm_hubs_read_dc_servo()
226 reg = snd_soc_component_read(component, dcs_reg); in wm_hubs_read_dc_servo()
241 static void enable_dc_servo(struct snd_soc_component *component) in enable_dc_servo() argument
243 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in enable_dc_servo()
259 if (wm_hubs_dac_hp_direct(component) && in enable_dc_servo()
260 wm_hubs_dcs_cache_get(component, &cache)) { in enable_dc_servo()
261 dev_dbg(component->dev, "Using cached DCS offset %x for %d,%d\n", in enable_dc_servo()
263 snd_soc_component_write(component, dcs_reg, cache->dcs_cfg); in enable_dc_servo()
264 wait_for_dc_servo(component, in enable_dc_servo()
272 snd_soc_component_update_bits(component, WM8993_DC_SERVO_1, in enable_dc_servo()
275 wait_for_dc_servo(component, in enable_dc_servo()
279 wait_for_dc_servo(component, in enable_dc_servo()
284 if (wm_hubs_read_dc_servo(component, &reg_l, &reg_r) < 0) in enable_dc_servo()
287 dev_dbg(component->dev, "DCS input: %x %x\n", reg_l, reg_r); in enable_dc_servo()
291 dev_dbg(component->dev, in enable_dc_servo()
297 dev_dbg(component->dev, "DCS right %d->%d\n", offset, in enable_dc_servo()
304 dev_dbg(component->dev, "DCS left %d->%d\n", offset, in enable_dc_servo()
309 dev_dbg(component->dev, "DCS result: %x\n", dcs_cfg); in enable_dc_servo()
312 snd_soc_component_write(component, dcs_reg, dcs_cfg); in enable_dc_servo()
313 wait_for_dc_servo(component, in enable_dc_servo()
323 if (wm_hubs_dac_hp_direct(component)) in enable_dc_servo()
324 wm_hubs_dcs_cache_set(component, dcs_cfg); in enable_dc_servo()
333 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); in wm8993_put_dc_servo() local
334 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in wm8993_put_dc_servo()
345 if (snd_soc_component_read(component, WM8993_POWER_MANAGEMENT_1) in wm8993_put_dc_servo()
347 snd_soc_component_update_bits(component, in wm8993_put_dc_servo()
498 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in hp_supply_event() local
499 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in hp_supply_event()
508 snd_soc_component_update_bits(component, WM8993_POWER_MANAGEMENT_1, in hp_supply_event()
515 snd_soc_component_update_bits(component, WM8993_ANALOGUE_HP_0, in hp_supply_event()
522 dev_err(component->dev, "Unknown HP startup mode %d\n", in hp_supply_event()
529 snd_soc_component_update_bits(component, WM8993_CHARGE_PUMP_1, in hp_supply_event()
540 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in hp_event() local
541 unsigned int reg = snd_soc_component_read(component, WM8993_ANALOGUE_HP_0); in hp_event()
545 snd_soc_component_update_bits(component, WM8993_CHARGE_PUMP_1, in hp_event()
550 snd_soc_component_update_bits(component, WM8993_POWER_MANAGEMENT_1, in hp_event()
555 snd_soc_component_write(component, WM8993_ANALOGUE_HP_0, reg); in hp_event()
557 snd_soc_component_update_bits(component, WM8993_DC_SERVO_1, in hp_event()
560 enable_dc_servo(component); in hp_event()
564 snd_soc_component_write(component, WM8993_ANALOGUE_HP_0, reg); in hp_event()
568 snd_soc_component_update_bits(component, WM8993_ANALOGUE_HP_0, in hp_event()
574 snd_soc_component_update_bits(component, WM8993_ANALOGUE_HP_0, in hp_event()
578 snd_soc_component_write(component, WM8993_DC_SERVO_0, 0); in hp_event()
580 snd_soc_component_update_bits(component, WM8993_POWER_MANAGEMENT_1, in hp_event()
592 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in earpiece_event() local
593 u16 reg = snd_soc_component_read(component, WM8993_ANTIPOP1) & ~WM8993_HPOUT2_IN_ENA; in earpiece_event()
598 snd_soc_component_write(component, WM8993_ANTIPOP1, reg); in earpiece_event()
603 snd_soc_component_write(component, WM8993_ANTIPOP1, reg); in earpiece_event()
617 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in lineout_event() local
618 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in lineout_event()
647 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in micbias_event() local
648 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in micbias_event()
666 void wm_hubs_update_class_w(struct snd_soc_component *component) in wm_hubs_update_class_w() argument
668 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in wm_hubs_update_class_w()
671 if (!wm_hubs_dac_hp_direct(component)) in wm_hubs_update_class_w()
674 if (hubs->check_class_w_digital && !hubs->check_class_w_digital(component)) in wm_hubs_update_class_w()
677 dev_vdbg(component->dev, "Class W %s\n", enable ? "enabled" : "disabled"); in wm_hubs_update_class_w()
679 snd_soc_component_update_bits(component, WM8993_CLASS_W_0, in wm_hubs_update_class_w()
682 snd_soc_component_write(component, WM8993_LEFT_OUTPUT_VOLUME, in wm_hubs_update_class_w()
683 snd_soc_component_read(component, WM8993_LEFT_OUTPUT_VOLUME)); in wm_hubs_update_class_w()
684 snd_soc_component_write(component, WM8993_RIGHT_OUTPUT_VOLUME, in wm_hubs_update_class_w()
685 snd_soc_component_read(component, WM8993_RIGHT_OUTPUT_VOLUME)); in wm_hubs_update_class_w()
696 struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); in class_w_put_volsw() local
701 wm_hubs_update_class_w(component); in class_w_put_volsw()
716 struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol); in class_w_put_double() local
721 wm_hubs_update_class_w(component); in class_w_put_double()
1112 int wm_hubs_add_analogue_controls(struct snd_soc_component *component) in wm_hubs_add_analogue_controls() argument
1114 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); in wm_hubs_add_analogue_controls()
1117 snd_soc_component_update_bits(component, WM8993_LEFT_LINE_INPUT_1_2_VOLUME, in wm_hubs_add_analogue_controls()
1119 snd_soc_component_update_bits(component, WM8993_RIGHT_LINE_INPUT_1_2_VOLUME, in wm_hubs_add_analogue_controls()
1121 snd_soc_component_update_bits(component, WM8993_LEFT_LINE_INPUT_3_4_VOLUME, in wm_hubs_add_analogue_controls()
1123 snd_soc_component_update_bits(component, WM8993_RIGHT_LINE_INPUT_3_4_VOLUME, in wm_hubs_add_analogue_controls()
1126 snd_soc_component_update_bits(component, WM8993_SPEAKER_VOLUME_LEFT, in wm_hubs_add_analogue_controls()
1128 snd_soc_component_update_bits(component, WM8993_SPEAKER_VOLUME_RIGHT, in wm_hubs_add_analogue_controls()
1131 snd_soc_component_update_bits(component, WM8993_LEFT_OUTPUT_VOLUME, in wm_hubs_add_analogue_controls()
1134 snd_soc_component_update_bits(component, WM8993_RIGHT_OUTPUT_VOLUME, in wm_hubs_add_analogue_controls()
1138 snd_soc_component_update_bits(component, WM8993_LEFT_OPGA_VOLUME, in wm_hubs_add_analogue_controls()
1141 snd_soc_component_update_bits(component, WM8993_RIGHT_OPGA_VOLUME, in wm_hubs_add_analogue_controls()
1145 snd_soc_add_component_controls(component, analogue_snd_controls, in wm_hubs_add_analogue_controls()
1154 int wm_hubs_add_analogue_routes(struct snd_soc_component *component, in wm_hubs_add_analogue_routes() argument
1157 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in wm_hubs_add_analogue_routes()
1158 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); in wm_hubs_add_analogue_routes()
1160 hubs->component = component; in wm_hubs_add_analogue_routes()
1190 int wm_hubs_handle_analogue_pdata(struct snd_soc_component *component, in wm_hubs_handle_analogue_pdata() argument
1197 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in wm_hubs_handle_analogue_pdata()
1205 snd_soc_component_update_bits(component, WM8993_LINE_MIXER1, in wm_hubs_handle_analogue_pdata()
1209 snd_soc_component_update_bits(component, WM8993_LINE_MIXER2, in wm_hubs_handle_analogue_pdata()
1214 snd_soc_component_update_bits(component, WM8993_ANTIPOP1, in wm_hubs_handle_analogue_pdata()
1219 snd_soc_component_update_bits(component, WM8993_ADDITIONAL_CONTROL, in wm_hubs_handle_analogue_pdata()
1223 snd_soc_component_update_bits(component, WM8993_ADDITIONAL_CONTROL, in wm_hubs_handle_analogue_pdata()
1229 snd_soc_component_update_bits(component, WM8993_MICBIAS, in wm_hubs_handle_analogue_pdata()
1241 void wm_hubs_vmid_ena(struct snd_soc_component *component) in wm_hubs_vmid_ena() argument
1243 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in wm_hubs_vmid_ena()
1253 snd_soc_component_update_bits(component, WM8993_POWER_MANAGEMENT_3, val, val); in wm_hubs_vmid_ena()
1257 void wm_hubs_set_bias_level(struct snd_soc_component *component, in wm_hubs_set_bias_level() argument
1260 struct wm_hubs_data *hubs = snd_soc_component_get_drvdata(component); in wm_hubs_set_bias_level()
1266 snd_soc_component_update_bits(component, WM8993_INPUTS_CLAMP_REG, in wm_hubs_set_bias_level()
1293 snd_soc_component_update_bits(component, WM8993_POWER_MANAGEMENT_3, in wm_hubs_set_bias_level()
1297 snd_soc_component_update_bits(component, WM8993_INPUTS_CLAMP_REG, in wm_hubs_set_bias_level()