Lines Matching +full:modem +full:- +full:init
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * cx20442.c -- CX20442 ALSA Soc Audio driver
94 return -EINVAL; in cx20442_read_reg_cache()
96 return cx20442->reg_cache; in cx20442_read_reg_cache()
139 return -EINVAL; in cx20442_pm_to_v253_vls()
149 return (value & (1 << CX20442_AGC)) ? -EINVAL : 0; in cx20442_pm_to_v253_vsp()
160 return -EINVAL; in cx20442_write()
162 /* tty and write pointers required for talking to the modem in cx20442_write()
164 if (!cx20442->tty || !cx20442->tty->ops->write) in cx20442_write()
165 return -EIO; in cx20442_write()
167 old = cx20442->reg_cache; in cx20442_write()
168 cx20442->reg_cache = value; in cx20442_write()
189 if (unlikely(len > (ARRAY_SIZE(buf) - 1))) in cx20442_write()
190 return -ENOMEM; in cx20442_write()
192 dev_dbg(component->dev, "%s: %s\n", __func__, buf); in cx20442_write()
193 if (cx20442->tty->ops->write(cx20442->tty, buf, len) != len) in cx20442_write()
194 return -EIO; in cx20442_write()
208 /* Modem init: echo off, digital speaker off, quiet off, voice mode */
217 if (!tty->ops->write) in v253_open()
218 return -EINVAL; in v253_open()
221 if (!tty->disc_data) in v253_open()
222 return -ENODEV; in v253_open()
224 tty->receive_room = 16; in v253_open()
225 if (tty->ops->write(tty, v253_init, len) != len) { in v253_open()
226 ret = -EIO; in v253_open()
229 /* Actual setup will be performed after the modem responds. */ in v253_open()
232 tty->disc_data = NULL; in v253_open()
239 struct snd_soc_component *component = tty->disc_data; in v253_close()
242 tty->disc_data = NULL; in v253_close()
249 /* Prevent the codec driver from further accessing the modem */ in v253_close()
250 cx20442->tty = NULL; in v253_close()
251 component->card->pop_time = 0; in v253_close()
265 struct snd_soc_component *component = tty->disc_data; in v253_receive()
273 if (!cx20442->tty) { in v253_receive()
274 /* First modem response, complete setup procedure */ in v253_receive()
276 /* Set up codec driver access to modem controls */ in v253_receive()
277 cx20442->tty = tty; in v253_receive()
278 component->card->pop_time = 1; in v253_receive()
305 .name = "cx20442-voice",
332 if (IS_ERR(cx20442->por)) in cx20442_set_bias_level()
333 err = PTR_ERR(cx20442->por); in cx20442_set_bias_level()
335 err = regulator_enable(cx20442->por); in cx20442_set_bias_level()
340 if (IS_ERR(cx20442->por)) in cx20442_set_bias_level()
341 err = PTR_ERR(cx20442->por); in cx20442_set_bias_level()
343 err = regulator_disable(cx20442->por); in cx20442_set_bias_level()
358 return -ENOMEM; in cx20442_component_probe()
360 cx20442->por = regulator_get(component->dev, "POR"); in cx20442_component_probe()
361 if (IS_ERR(cx20442->por)) { in cx20442_component_probe()
362 int err = PTR_ERR(cx20442->por); in cx20442_component_probe()
364 dev_warn(component->dev, "failed to get POR supply (%d)", err); in cx20442_component_probe()
366 * When running on a non-dt platform and requested regulator in cx20442_component_probe()
368 * -EPROBE_DEFER as it is not able to justify if the regulator in cx20442_component_probe()
372 * sufficient. Hence, if we get -ENODEV here, let's convert in cx20442_component_probe()
373 * it to -EPROBE_DEFER and wait for the board to decide or in cx20442_component_probe()
376 if (err == -ENODEV) in cx20442_component_probe()
377 err = -EPROBE_DEFER; in cx20442_component_probe()
382 cx20442->tty = NULL; in cx20442_component_probe()
385 component->card->pop_time = 0; in cx20442_component_probe()
395 if (cx20442->tty) { in cx20442_component_remove()
396 struct tty_struct *tty = cx20442->tty; in cx20442_component_remove()
400 if (!IS_ERR(cx20442->por)) { in cx20442_component_remove()
402 regulator_put(cx20442->por); in cx20442_component_remove()
427 return devm_snd_soc_register_component(&pdev->dev, in cx20442_platform_probe()
433 .name = "cx20442-codec",
440 MODULE_DESCRIPTION("ASoC CX20442-11 voice modem codec driver");
443 MODULE_ALIAS("platform:cx20442-codec");