• Home
  • Raw
  • Download

Lines Matching +full:comp +full:- +full:disable

1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
3 // Copyright (c) 2017-2018, Linaro Limited
10 #include "wcd-clsh-v2.h"
19 struct snd_soc_component *comp; member
22 /* Class-H registers for codecs from and above WCD9335 */
109 struct snd_soc_component *comp = ctrl->comp; in wcd_enable_clsh_block() local
111 if ((enable && ++ctrl->clsh_users == 1) || in wcd_enable_clsh_block()
112 (!enable && --ctrl->clsh_users == 0)) in wcd_enable_clsh_block()
113 snd_soc_component_update_bits(comp, WCD9XXX_A_CDC_CLSH_CRC, in wcd_enable_clsh_block()
116 if (ctrl->clsh_users < 0) in wcd_enable_clsh_block()
117 ctrl->clsh_users = 0; in wcd_enable_clsh_block()
120 static inline bool wcd_clsh_enable_status(struct snd_soc_component *comp) in wcd_clsh_enable_status() argument
122 return snd_soc_component_read(comp, WCD9XXX_A_CDC_CLSH_CRC) & in wcd_clsh_enable_status()
126 static inline void wcd_clsh_set_buck_mode(struct snd_soc_component *comp, in wcd_clsh_set_buck_mode() argument
131 snd_soc_component_update_bits(comp, WCD9XXX_A_ANA_RX_SUPPLIES, in wcd_clsh_set_buck_mode()
135 snd_soc_component_update_bits(comp, WCD9XXX_A_ANA_RX_SUPPLIES, in wcd_clsh_set_buck_mode()
140 static inline void wcd_clsh_set_flyback_mode(struct snd_soc_component *comp, in wcd_clsh_set_flyback_mode() argument
145 snd_soc_component_update_bits(comp, WCD9XXX_A_ANA_RX_SUPPLIES, in wcd_clsh_set_flyback_mode()
149 snd_soc_component_update_bits(comp, WCD9XXX_A_ANA_RX_SUPPLIES, in wcd_clsh_set_flyback_mode()
158 struct snd_soc_component *comp = ctrl->comp; in wcd_clsh_buck_ctrl() local
160 /* enable/disable buck */ in wcd_clsh_buck_ctrl()
161 if ((enable && (++ctrl->buck_users == 1)) || in wcd_clsh_buck_ctrl()
162 (!enable && (--ctrl->buck_users == 0))) in wcd_clsh_buck_ctrl()
163 snd_soc_component_update_bits(comp, WCD9XXX_A_ANA_RX_SUPPLIES, in wcd_clsh_buck_ctrl()
167 * 500us sleep is required after buck enable/disable in wcd_clsh_buck_ctrl()
177 struct snd_soc_component *comp = ctrl->comp; in wcd_clsh_flyback_ctrl() local
179 /* enable/disable flyback */ in wcd_clsh_flyback_ctrl()
180 if ((enable && (++ctrl->flyback_users == 1)) || in wcd_clsh_flyback_ctrl()
181 (!enable && (--ctrl->flyback_users == 0))) { in wcd_clsh_flyback_ctrl()
182 snd_soc_component_update_bits(comp, WCD9XXX_A_ANA_RX_SUPPLIES, in wcd_clsh_flyback_ctrl()
189 * 500us sleep is required after flyback enable/disable in wcd_clsh_flyback_ctrl()
197 struct snd_soc_component *comp = ctrl->comp; in wcd_clsh_set_gain_path() local
213 snd_soc_component_update_bits(comp, WCD9XXX_HPH_L_EN, in wcd_clsh_set_gain_path()
217 snd_soc_component_update_bits(comp, WCD9XXX_HPH_R_EN, in wcd_clsh_set_gain_path()
222 static void wcd_clsh_set_hph_mode(struct snd_soc_component *comp, in wcd_clsh_set_hph_mode() argument
252 snd_soc_component_update_bits(comp, WCD9XXX_A_ANA_HPH, in wcd_clsh_set_hph_mode()
254 snd_soc_component_update_bits(comp, WCD9XXX_CLASSH_CTRL_VCL_2, in wcd_clsh_set_hph_mode()
258 snd_soc_component_update_bits(comp, in wcd_clsh_set_hph_mode()
262 snd_soc_component_update_bits(comp, WCD9XXX_CLASSH_CTRL_CCL_1, in wcd_clsh_set_hph_mode()
267 static void wcd_clsh_set_flyback_current(struct snd_soc_component *comp, in wcd_clsh_set_flyback_current() argument
271 snd_soc_component_update_bits(comp, WCD9XXX_RX_BIAS_FLYB_BUFF, in wcd_clsh_set_flyback_current()
273 snd_soc_component_update_bits(comp, WCD9XXX_RX_BIAS_FLYB_BUFF, in wcd_clsh_set_flyback_current()
279 static void wcd_clsh_set_buck_regulator_mode(struct snd_soc_component *comp, in wcd_clsh_set_buck_regulator_mode() argument
283 snd_soc_component_update_bits(comp, WCD9XXX_A_ANA_RX_SUPPLIES, in wcd_clsh_set_buck_regulator_mode()
287 snd_soc_component_update_bits(comp, WCD9XXX_A_ANA_RX_SUPPLIES, in wcd_clsh_set_buck_regulator_mode()
295 struct snd_soc_component *comp = ctrl->comp; in wcd_clsh_state_lo() local
298 dev_err(comp->dev, "%s: LO cannot be in this mode: %d\n", in wcd_clsh_state_lo()
304 wcd_clsh_set_buck_regulator_mode(comp, mode); in wcd_clsh_state_lo()
305 wcd_clsh_set_buck_mode(comp, mode); in wcd_clsh_state_lo()
306 wcd_clsh_set_flyback_mode(comp, mode); in wcd_clsh_state_lo()
308 wcd_clsh_set_flyback_current(comp, mode); in wcd_clsh_state_lo()
313 wcd_clsh_set_flyback_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_lo()
314 wcd_clsh_set_buck_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_lo()
315 wcd_clsh_set_buck_regulator_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_lo()
322 struct snd_soc_component *comp = ctrl->comp; in wcd_clsh_state_hph_r() local
325 dev_err(comp->dev, "%s: Normal mode not applicable for hph_r\n", in wcd_clsh_state_hph_r()
337 snd_soc_component_update_bits(comp, in wcd_clsh_state_hph_r()
341 snd_soc_component_update_bits(comp, in wcd_clsh_state_hph_r()
345 snd_soc_component_update_bits(comp, in wcd_clsh_state_hph_r()
350 wcd_clsh_set_buck_regulator_mode(comp, mode); in wcd_clsh_state_hph_r()
351 wcd_clsh_set_flyback_mode(comp, mode); in wcd_clsh_state_hph_r()
353 wcd_clsh_set_flyback_current(comp, mode); in wcd_clsh_state_hph_r()
354 wcd_clsh_set_buck_mode(comp, mode); in wcd_clsh_state_hph_r()
356 wcd_clsh_set_hph_mode(comp, mode); in wcd_clsh_state_hph_r()
359 wcd_clsh_set_hph_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_hph_r()
362 snd_soc_component_update_bits(comp, in wcd_clsh_state_hph_r()
368 /* buck and flyback set to default mode and disable */ in wcd_clsh_state_hph_r()
371 wcd_clsh_set_flyback_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_hph_r()
372 wcd_clsh_set_buck_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_hph_r()
373 wcd_clsh_set_buck_regulator_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_hph_r()
380 struct snd_soc_component *comp = ctrl->comp; in wcd_clsh_state_hph_l() local
383 dev_err(comp->dev, "%s: Normal mode not applicable for hph_l\n", in wcd_clsh_state_hph_l()
395 snd_soc_component_update_bits(comp, in wcd_clsh_state_hph_l()
399 snd_soc_component_update_bits(comp, in wcd_clsh_state_hph_l()
403 snd_soc_component_update_bits(comp, in wcd_clsh_state_hph_l()
408 wcd_clsh_set_buck_regulator_mode(comp, mode); in wcd_clsh_state_hph_l()
409 wcd_clsh_set_flyback_mode(comp, mode); in wcd_clsh_state_hph_l()
411 wcd_clsh_set_flyback_current(comp, mode); in wcd_clsh_state_hph_l()
412 wcd_clsh_set_buck_mode(comp, mode); in wcd_clsh_state_hph_l()
414 wcd_clsh_set_hph_mode(comp, mode); in wcd_clsh_state_hph_l()
417 wcd_clsh_set_hph_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_hph_l()
420 snd_soc_component_update_bits(comp, in wcd_clsh_state_hph_l()
429 wcd_clsh_set_flyback_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_hph_l()
430 wcd_clsh_set_buck_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_hph_l()
431 wcd_clsh_set_buck_regulator_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_hph_l()
438 struct snd_soc_component *comp = ctrl->comp; in wcd_clsh_state_ear() local
441 dev_err(comp->dev, "%s: mode: %d cannot be used for EAR\n", in wcd_clsh_state_ear()
448 snd_soc_component_update_bits(comp, in wcd_clsh_state_ear()
452 wcd_clsh_set_buck_mode(comp, mode); in wcd_clsh_state_ear()
453 wcd_clsh_set_flyback_mode(comp, mode); in wcd_clsh_state_ear()
455 wcd_clsh_set_flyback_current(comp, mode); in wcd_clsh_state_ear()
458 snd_soc_component_update_bits(comp, in wcd_clsh_state_ear()
465 wcd_clsh_set_flyback_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_ear()
466 wcd_clsh_set_buck_mode(comp, CLS_H_NORMAL); in wcd_clsh_state_ear()
528 struct snd_soc_component *comp = ctrl->comp; in wcd_clsh_ctrl_set_state() local
530 if (nstate == ctrl->state) in wcd_clsh_ctrl_set_state()
534 dev_err(comp->dev, "Class-H not a valid new state:\n"); in wcd_clsh_ctrl_set_state()
535 return -EINVAL; in wcd_clsh_ctrl_set_state()
547 ctrl->state = nstate; in wcd_clsh_ctrl_set_state()
548 ctrl->mode = mode; in wcd_clsh_ctrl_set_state()
555 return ctrl->state; in wcd_clsh_ctrl_get_state()
558 struct wcd_clsh_ctrl *wcd_clsh_ctrl_alloc(struct snd_soc_component *comp, in wcd_clsh_ctrl_alloc() argument
565 return ERR_PTR(-ENOMEM); in wcd_clsh_ctrl_alloc()
567 ctrl->state = WCD_CLSH_STATE_IDLE; in wcd_clsh_ctrl_alloc()
568 ctrl->comp = comp; in wcd_clsh_ctrl_alloc()