// SPDX-License-Identifier: GPL-2.0+ // // soc-ops.c -- Generic ASoC operations // // Copyright 2005 Wolfson Microelectronics PLC. // Copyright 2005 Openedhand Ltd. // Copyright (C) 2010 Slimlogic Ltd. // Copyright (C) 2010 Texas Instruments Inc. // // Author: Liam Girdwood <[email protected]> // with code, comments and ideas from :- // Richard Purdie <[email protected]> #include <linux/cleanup.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h> #include <linux/pm.h> #include <linux/bitops.h> #include <linux/ctype.h> #include <linux/slab.h> #include <sound/core.h> #include <sound/jack.h> #include <sound/pcm.h> #include <sound/pcm_params.h> #include <sound/soc.h> #include <sound/soc-dpcm.h> #include <sound/initval.h> /** * snd_soc_info_enum_double - enumerated double mixer info callback * @kcontrol: mixer control * @uinfo: control element information * * Callback to provide information about a double enumerated * mixer control. * * Returns 0 for success. */ int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_get_enum_double - enumerated double mixer get callback * @kcontrol: mixer control * @ucontrol: control element information * * Callback to get the value of a double enumerated mixer. * * Returns 0 for success. */ int snd_soc_get_enum_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_put_enum_double - enumerated double mixer put callback * @kcontrol: mixer control * @ucontrol: control element information * * Callback to set the value of a double enumerated mixer. * * Returns 0 for success. */ int snd_soc_put_enum_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_read_signed - Read a codec register and interpret as signed value * @component: component * @reg: Register to read * @mask: Mask to use after shifting the register value * @shift: Right shift of register value * @sign_bit: Bit that describes if a number is negative or not. * @signed_val: Pointer to where the read value should be stored * * This functions reads a codec register. The register value is shifted right * by 'shift' bits and masked with the given 'mask'. Afterwards it translates * the given registervalue into a signed integer if sign_bit is non-zero. * * Returns 0 on sucess, otherwise an error value */ static int snd_soc_read_signed(struct snd_soc_component *component, unsigned int reg, unsigned int mask, unsigned int shift, unsigned int sign_bit, int *signed_val) { … } /** * snd_soc_info_volsw - single mixer info callback * @kcontrol: mixer control * @uinfo: control element information * * Callback to provide information about a single mixer control, or a double * mixer control that spans 2 registers. * * Returns 0 for success. */ int snd_soc_info_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_info_volsw_sx - Mixer info callback for SX TLV controls * @kcontrol: mixer control * @uinfo: control element information * * Callback to provide information about a single mixer control, or a double * mixer control that spans 2 registers of the SX TLV type. SX TLV controls * have a range that represents both positive and negative values either side * of zero but without a sign bit. min is the minimum register value, max is * the number of steps. * * Returns 0 for success. */ int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_get_volsw - single mixer get callback * @kcontrol: mixer control * @ucontrol: control element information * * Callback to get the value of a single mixer control, or a double mixer * control that spans 2 registers. * * Returns 0 for success. */ int snd_soc_get_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_put_volsw - single mixer put callback * @kcontrol: mixer control * @ucontrol: control element information * * Callback to set the value of a single mixer control, or a double mixer * control that spans 2 registers. * * Returns 0 for success. */ int snd_soc_put_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_get_volsw_sx - single mixer get callback * @kcontrol: mixer control * @ucontrol: control element information * * Callback to get the value of a single mixer control, or a double mixer * control that spans 2 registers. * * Returns 0 for success. */ int snd_soc_get_volsw_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_put_volsw_sx - double mixer set callback * @kcontrol: mixer control * @ucontrol: control element information * * Callback to set the value of a double mixer control that spans 2 registers. * * Returns 0 for success. */ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_info_volsw_range - single mixer info callback with range. * @kcontrol: mixer control * @uinfo: control element information * * Callback to provide information, within a range, about a single * mixer control. * * returns 0 for success. */ int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_put_volsw_range - single mixer put value callback with range. * @kcontrol: mixer control * @ucontrol: control element information * * Callback to set the value, within a range, for a single mixer control. * * Returns 0 for success. */ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_get_volsw_range - single mixer get callback with range * @kcontrol: mixer control * @ucontrol: control element information * * Callback to get the value, within a range, of a single mixer control. * * Returns 0 for success. */ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_limit_volume - Set new limit to an existing volume control. * * @card: where to look for the control * @name: Name of the control * @max: new maximum limit * * Return 0 for success, else error. */ int snd_soc_limit_volume(struct snd_soc_card *card, const char *name, int max) { … } EXPORT_SYMBOL_GPL(…); int snd_soc_bytes_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { … } EXPORT_SYMBOL_GPL(…); int snd_soc_bytes_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); int snd_soc_bytes_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *ucontrol) { … } EXPORT_SYMBOL_GPL(…); int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag, unsigned int size, unsigned int __user *tlv) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_info_xr_sx - signed multi register info callback * @kcontrol: mreg control * @uinfo: control element information * * Callback to provide information of a control that can * span multiple codec registers which together * forms a single signed value in a MSB/LSB manner. * * Returns 0 for success. */ int snd_soc_info_xr_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_get_xr_sx - signed multi register get callback * @kcontrol: mreg control * @ucontrol: control element information * * Callback to get the value of a control that can span * multiple codec registers which together forms a single * signed value in a MSB/LSB manner. The control supports * specifying total no of bits used to allow for bitfields * across the multiple codec registers. * * Returns 0 for success. */ int snd_soc_get_xr_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_put_xr_sx - signed multi register get callback * @kcontrol: mreg control * @ucontrol: control element information * * Callback to set the value of a control that can span * multiple codec registers which together forms a single * signed value in a MSB/LSB manner. The control supports * specifying total no of bits used to allow for bitfields * across the multiple codec registers. * * Returns 0 for success. */ int snd_soc_put_xr_sx(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_get_strobe - strobe get callback * @kcontrol: mixer control * @ucontrol: control element information * * Callback get the value of a strobe mixer control. * * Returns 0 for success. */ int snd_soc_get_strobe(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…); /** * snd_soc_put_strobe - strobe put callback * @kcontrol: mixer control * @ucontrol: control element information * * Callback strobe a register bit to high then low (or the inverse) * in one pass of a single mixer enum control. * * Returns 1 for success. */ int snd_soc_put_strobe(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { … } EXPORT_SYMBOL_GPL(…);