mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-24 13:13:57 +08:00
Merge branch 'topic/component' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-dapm
This commit is contained in:
commit
00a41d9fe2
107
Documentation/devicetree/bindings/sound/st,sta350.txt
Normal file
107
Documentation/devicetree/bindings/sound/st,sta350.txt
Normal file
@ -0,0 +1,107 @@
|
||||
STA350 audio CODEC
|
||||
|
||||
The driver for this device only supports I2C.
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible: "st,sta350"
|
||||
- reg: the I2C address of the device for I2C
|
||||
- reset-gpios: a GPIO spec for the reset pin. If specified, it will be
|
||||
deasserted before communication to the codec starts.
|
||||
|
||||
- power-down-gpios: a GPIO spec for the power down pin. If specified,
|
||||
it will be deasserted before communication to the codec
|
||||
starts.
|
||||
|
||||
- vdd-dig-supply: regulator spec, providing 3.3V
|
||||
- vdd-pll-supply: regulator spec, providing 3.3V
|
||||
- vcc-supply: regulator spec, providing 5V - 26V
|
||||
|
||||
Optional properties:
|
||||
|
||||
- st,output-conf: number, Selects the output configuration:
|
||||
0: 2-channel (full-bridge) power, 2-channel data-out
|
||||
1: 2 (half-bridge). 1 (full-bridge) on-board power
|
||||
2: 2 Channel (Full-Bridge) Power, 1 Channel FFX
|
||||
3: 1 Channel Mono-Parallel
|
||||
If parameter is missing, mode 0 will be enabled.
|
||||
|
||||
- st,ch1-output-mapping: Channel 1 output mapping
|
||||
- st,ch2-output-mapping: Channel 2 output mapping
|
||||
- st,ch3-output-mapping: Channel 3 output mapping
|
||||
0: Channel 1
|
||||
1: Channel 2
|
||||
2: Channel 3
|
||||
If parameter is missing, channel 1 is choosen.
|
||||
|
||||
- st,thermal-warning-recover:
|
||||
If present, thermal warning recovery is enabled.
|
||||
|
||||
- st,thermal-warning-adjustment:
|
||||
If present, thermal warning adjustment is enabled.
|
||||
|
||||
- st,fault-detect-recovery:
|
||||
If present, then fault recovery will be enabled.
|
||||
|
||||
- st,ffx-power-output-mode: string
|
||||
The FFX power output mode selects how the FFX output timing is
|
||||
configured. Must be one of these values:
|
||||
- "drop-compensation"
|
||||
- "tapered-compensation"
|
||||
- "full-power-mode"
|
||||
- "variable-drop-compensation" (default)
|
||||
|
||||
- st,drop-compensation-ns: number
|
||||
Only required for "st,ffx-power-output-mode" ==
|
||||
"variable-drop-compensation".
|
||||
Specifies the drop compensation in nanoseconds.
|
||||
The value must be in the range of 0..300, and only
|
||||
multiples of 20 are allowed. Default is 140ns.
|
||||
|
||||
- st,overcurrent-warning-adjustment:
|
||||
If present, overcurrent warning adjustment is enabled.
|
||||
|
||||
- st,max-power-use-mpcc:
|
||||
If present, then MPCC bits are used for MPC coefficients,
|
||||
otherwise standard MPC coefficients are used.
|
||||
|
||||
- st,max-power-corr:
|
||||
If present, power bridge correction for THD reduction near maximum
|
||||
power output is enabled.
|
||||
|
||||
- st,am-reduction-mode:
|
||||
If present, FFX mode runs in AM reduction mode, otherwise normal
|
||||
FFX mode is used.
|
||||
|
||||
- st,odd-pwm-speed-mode:
|
||||
If present, PWM speed mode run on odd speed mode (341.3 kHz) on all
|
||||
channels. If not present, normal PWM spped mode (384 kHz) will be used.
|
||||
|
||||
- st,distortion-compensation:
|
||||
If present, distortion compensation variable uses DCC coefficient.
|
||||
If not present, preset DC coefficient is used.
|
||||
|
||||
- st,invalid-input-detect-mute:
|
||||
If not present, automatic invalid input detect mute is enabled.
|
||||
|
||||
|
||||
|
||||
Example:
|
||||
|
||||
codec: sta350@38 {
|
||||
compatible = "st,sta350";
|
||||
reg = <0x1c>;
|
||||
reset-gpios = <&gpio1 19 0>;
|
||||
power-down-gpios = <&gpio1 16 0>;
|
||||
st,output-conf = <0x3>; // set output to 2-channel
|
||||
// (full-bridge) power,
|
||||
// 2-channel data-out
|
||||
st,ch1-output-mapping = <0>; // set channel 1 output ch 1
|
||||
st,ch2-output-mapping = <0>; // set channel 2 output ch 1
|
||||
st,ch3-output-mapping = <0>; // set channel 3 output ch 1
|
||||
st,max-power-correction; // enables power bridge
|
||||
// correction for THD reduction
|
||||
// near maximum power output
|
||||
st,invalid-input-detect-mute; // mute if no valid digital
|
||||
// audio signal is provided.
|
||||
};
|
@ -606,6 +606,7 @@ struct snd_soc_dapm_context {
|
||||
enum snd_soc_dapm_type, int);
|
||||
|
||||
struct device *dev; /* from parent - for debug */
|
||||
struct snd_soc_component *component; /* parent component */
|
||||
struct snd_soc_codec *codec; /* parent codec */
|
||||
struct snd_soc_platform *platform; /* parent platform */
|
||||
struct snd_soc_card *card; /* parent card */
|
||||
|
@ -393,14 +393,6 @@ int devm_snd_soc_register_component(struct device *dev,
|
||||
const struct snd_soc_component_driver *cmpnt_drv,
|
||||
struct snd_soc_dai_driver *dai_drv, int num_dai);
|
||||
void snd_soc_unregister_component(struct device *dev);
|
||||
int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
|
||||
unsigned int reg);
|
||||
int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
|
||||
unsigned int reg);
|
||||
int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
|
||||
unsigned int reg);
|
||||
int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
|
||||
struct regmap *regmap);
|
||||
int snd_soc_cache_sync(struct snd_soc_codec *codec);
|
||||
int snd_soc_cache_init(struct snd_soc_codec *codec);
|
||||
int snd_soc_cache_exit(struct snd_soc_codec *codec);
|
||||
@ -469,12 +461,12 @@ static inline void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
|
||||
#endif
|
||||
|
||||
/* codec register bit access */
|
||||
int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned short reg,
|
||||
int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int mask, unsigned int value);
|
||||
int snd_soc_update_bits_locked(struct snd_soc_codec *codec,
|
||||
unsigned short reg, unsigned int mask,
|
||||
unsigned int reg, unsigned int mask,
|
||||
unsigned int value);
|
||||
int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned short reg,
|
||||
int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int mask, unsigned int value);
|
||||
|
||||
int snd_soc_new_ac97_codec(struct snd_soc_codec *codec,
|
||||
@ -668,6 +660,7 @@ struct snd_soc_component {
|
||||
unsigned int active;
|
||||
|
||||
unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
|
||||
unsigned int registered_as_component:1;
|
||||
|
||||
struct list_head list;
|
||||
|
||||
@ -677,6 +670,14 @@ struct snd_soc_component {
|
||||
const struct snd_soc_component_driver *driver;
|
||||
|
||||
struct list_head dai_list;
|
||||
|
||||
int (*read)(struct snd_soc_component *, unsigned int, unsigned int *);
|
||||
int (*write)(struct snd_soc_component *, unsigned int, unsigned int);
|
||||
|
||||
struct regmap *regmap;
|
||||
int val_bytes;
|
||||
|
||||
struct mutex io_mutex;
|
||||
};
|
||||
|
||||
/* SoC Audio Codec device */
|
||||
@ -692,9 +693,6 @@ struct snd_soc_codec {
|
||||
struct list_head list;
|
||||
struct list_head card_list;
|
||||
int num_dai;
|
||||
int (*volatile_register)(struct snd_soc_codec *, unsigned int);
|
||||
int (*readable_register)(struct snd_soc_codec *, unsigned int);
|
||||
int (*writable_register)(struct snd_soc_codec *, unsigned int);
|
||||
|
||||
/* runtime */
|
||||
struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
|
||||
@ -704,18 +702,14 @@ struct snd_soc_codec {
|
||||
unsigned int ac97_registered:1; /* Codec has been AC97 registered */
|
||||
unsigned int ac97_created:1; /* Codec has been created by SoC */
|
||||
unsigned int cache_init:1; /* codec cache has been initialized */
|
||||
unsigned int using_regmap:1; /* using regmap access */
|
||||
u32 cache_only; /* Suppress writes to hardware */
|
||||
u32 cache_sync; /* Cache needs to be synced to hardware */
|
||||
|
||||
/* codec IO */
|
||||
void *control_data; /* codec control (i2c/3wire) data */
|
||||
hw_write_t hw_write;
|
||||
unsigned int (*read)(struct snd_soc_codec *, unsigned int);
|
||||
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
|
||||
void *reg_cache;
|
||||
struct mutex cache_rw_mutex;
|
||||
int val_bytes;
|
||||
|
||||
/* component */
|
||||
struct snd_soc_component component;
|
||||
@ -754,13 +748,9 @@ struct snd_soc_codec_driver {
|
||||
unsigned int freq_in, unsigned int freq_out);
|
||||
|
||||
/* codec IO */
|
||||
struct regmap *(*get_regmap)(struct device *);
|
||||
unsigned int (*read)(struct snd_soc_codec *, unsigned int);
|
||||
int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
|
||||
int (*display_register)(struct snd_soc_codec *, char *,
|
||||
size_t, unsigned int);
|
||||
int (*volatile_register)(struct snd_soc_codec *, unsigned int);
|
||||
int (*readable_register)(struct snd_soc_codec *, unsigned int);
|
||||
int (*writable_register)(struct snd_soc_codec *, unsigned int);
|
||||
unsigned int reg_cache_size;
|
||||
short reg_cache_step;
|
||||
short reg_word_size;
|
||||
@ -791,6 +781,7 @@ struct snd_soc_platform_driver {
|
||||
int (*remove)(struct snd_soc_platform *);
|
||||
int (*suspend)(struct snd_soc_dai *dai);
|
||||
int (*resume)(struct snd_soc_dai *dai);
|
||||
struct snd_soc_component_driver component_driver;
|
||||
|
||||
/* pcm creation and destruction */
|
||||
int (*pcm_new)(struct snd_soc_pcm_runtime *);
|
||||
@ -835,7 +826,6 @@ struct snd_soc_platform {
|
||||
int id;
|
||||
struct device *dev;
|
||||
const struct snd_soc_platform_driver *driver;
|
||||
struct mutex mutex;
|
||||
|
||||
unsigned int suspended:1; /* platform is suspended */
|
||||
unsigned int probed:1;
|
||||
@ -844,6 +834,8 @@ struct snd_soc_platform {
|
||||
struct list_head list;
|
||||
struct list_head card_list;
|
||||
|
||||
struct snd_soc_component component;
|
||||
|
||||
struct snd_soc_dapm_context dapm;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
@ -1120,10 +1112,39 @@ static inline struct snd_soc_codec *snd_soc_component_to_codec(
|
||||
return container_of(component, struct snd_soc_codec, component);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_component_to_platform() - Casts a component to the platform it is embedded in
|
||||
* @component: The component to cast to a platform
|
||||
*
|
||||
* This function must only be used on components that are known to be platforms.
|
||||
* Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_platform *snd_soc_component_to_platform(
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
return container_of(component, struct snd_soc_platform, component);
|
||||
}
|
||||
|
||||
/* codec IO */
|
||||
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
|
||||
unsigned int snd_soc_write(struct snd_soc_codec *codec,
|
||||
unsigned int reg, unsigned int val);
|
||||
int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int val);
|
||||
|
||||
/* component IO */
|
||||
int snd_soc_component_read(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int *val);
|
||||
int snd_soc_component_write(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int val);
|
||||
int snd_soc_component_update_bits(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int mask, unsigned int val);
|
||||
int snd_soc_component_update_bits_async(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int mask, unsigned int val);
|
||||
void snd_soc_component_async_complete(struct snd_soc_component *component);
|
||||
int snd_soc_component_test_bits(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int mask, unsigned int value);
|
||||
|
||||
int snd_soc_component_init_io(struct snd_soc_component *component,
|
||||
struct regmap *regmap);
|
||||
|
||||
/* device driver data */
|
||||
|
||||
@ -1228,6 +1249,50 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
|
||||
return snd_soc_component_is_active(&codec->component);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_kcontrol_component() - Returns the component that registered the
|
||||
* control
|
||||
* @kcontrol: The control for which to get the component
|
||||
*
|
||||
* Note: This function will work correctly if the control has been registered
|
||||
* for a component. Either with snd_soc_add_codec_controls() or
|
||||
* snd_soc_add_platform_controls() or via table based setup for either a
|
||||
* CODEC, a platform or component driver. Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_component *snd_soc_kcontrol_component(
|
||||
struct snd_kcontrol *kcontrol)
|
||||
{
|
||||
return snd_kcontrol_chip(kcontrol);
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_kcontrol_codec() - Returns the CODEC that registered the control
|
||||
* @kcontrol: The control for which to get the CODEC
|
||||
*
|
||||
* Note: This function will only work correctly if the control has been
|
||||
* registered with snd_soc_add_codec_controls() or via table based setup of
|
||||
* snd_soc_codec_driver. Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
|
||||
struct snd_kcontrol *kcontrol)
|
||||
{
|
||||
return snd_soc_component_to_codec(snd_soc_kcontrol_component(kcontrol));
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_kcontrol_platform() - Returns the platform that registerd the control
|
||||
* @kcontrol: The control for which to get the platform
|
||||
*
|
||||
* Note: This function will only work correctly if the control has been
|
||||
* registered with snd_soc_add_platform_controls() or via table based setup of
|
||||
* a snd_soc_platform_driver. Otherwise the behavior is undefined.
|
||||
*/
|
||||
static inline struct snd_soc_platform *snd_soc_kcontrol_platform(
|
||||
struct snd_kcontrol *kcontrol)
|
||||
{
|
||||
return snd_soc_component_to_platform(snd_soc_kcontrol_component(kcontrol));
|
||||
}
|
||||
|
||||
int snd_soc_util_init(void);
|
||||
void snd_soc_util_exit(void);
|
||||
|
||||
|
52
include/sound/sta350.h
Normal file
52
include/sound/sta350.h
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Platform data for ST STA350 ASoC codec driver.
|
||||
*
|
||||
* Copyright: 2014 Raumfeld GmbH
|
||||
* Author: Sven Brandau <info@brandau.biz>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
#ifndef __LINUX_SND__STA350_H
|
||||
#define __LINUX_SND__STA350_H
|
||||
|
||||
#define STA350_OCFG_2CH 0
|
||||
#define STA350_OCFG_2_1CH 1
|
||||
#define STA350_OCFG_1CH 3
|
||||
|
||||
#define STA350_OM_CH1 0
|
||||
#define STA350_OM_CH2 1
|
||||
#define STA350_OM_CH3 2
|
||||
|
||||
#define STA350_THERMAL_ADJUSTMENT_ENABLE 1
|
||||
#define STA350_THERMAL_RECOVERY_ENABLE 2
|
||||
#define STA350_FAULT_DETECT_RECOVERY_BYPASS 1
|
||||
|
||||
#define STA350_FFX_PM_DROP_COMP 0
|
||||
#define STA350_FFX_PM_TAPERED_COMP 1
|
||||
#define STA350_FFX_PM_FULL_POWER 2
|
||||
#define STA350_FFX_PM_VARIABLE_DROP_COMP 3
|
||||
|
||||
|
||||
struct sta350_platform_data {
|
||||
u8 output_conf;
|
||||
u8 ch1_output_mapping;
|
||||
u8 ch2_output_mapping;
|
||||
u8 ch3_output_mapping;
|
||||
u8 ffx_power_output_mode;
|
||||
u8 drop_compensation_ns;
|
||||
unsigned int thermal_warning_recovery:1;
|
||||
unsigned int thermal_warning_adjustment:1;
|
||||
unsigned int fault_detect_recovery:1;
|
||||
unsigned int oc_warning_adjustment:1;
|
||||
unsigned int max_power_use_mpcc:1;
|
||||
unsigned int max_power_correction:1;
|
||||
unsigned int am_reduction_mode:1;
|
||||
unsigned int odd_pwm_speed_mode:1;
|
||||
unsigned int distortion_compensation:1;
|
||||
unsigned int invalid_input_detect_mute:1;
|
||||
};
|
||||
|
||||
#endif /* __LINUX_SND__STA350_H */
|
@ -11,102 +11,10 @@
|
||||
|
||||
struct snd_soc_jack;
|
||||
struct snd_soc_codec;
|
||||
struct snd_soc_platform;
|
||||
struct snd_soc_card;
|
||||
struct snd_soc_dapm_widget;
|
||||
struct snd_soc_dapm_path;
|
||||
|
||||
/*
|
||||
* Log register events
|
||||
*/
|
||||
DECLARE_EVENT_CLASS(snd_soc_reg,
|
||||
|
||||
TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int val),
|
||||
|
||||
TP_ARGS(codec, reg, val),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string( name, codec->name )
|
||||
__field( int, id )
|
||||
__field( unsigned int, reg )
|
||||
__field( unsigned int, val )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, codec->name);
|
||||
__entry->id = codec->id;
|
||||
__entry->reg = reg;
|
||||
__entry->val = val;
|
||||
),
|
||||
|
||||
TP_printk("codec=%s.%d reg=%x val=%x", __get_str(name),
|
||||
(int)__entry->id, (unsigned int)__entry->reg,
|
||||
(unsigned int)__entry->val)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(snd_soc_reg, snd_soc_reg_write,
|
||||
|
||||
TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int val),
|
||||
|
||||
TP_ARGS(codec, reg, val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(snd_soc_reg, snd_soc_reg_read,
|
||||
|
||||
TP_PROTO(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int val),
|
||||
|
||||
TP_ARGS(codec, reg, val)
|
||||
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(snd_soc_preg,
|
||||
|
||||
TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
|
||||
unsigned int val),
|
||||
|
||||
TP_ARGS(platform, reg, val),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__string( name, platform->name )
|
||||
__field( int, id )
|
||||
__field( unsigned int, reg )
|
||||
__field( unsigned int, val )
|
||||
),
|
||||
|
||||
TP_fast_assign(
|
||||
__assign_str(name, platform->name);
|
||||
__entry->id = platform->id;
|
||||
__entry->reg = reg;
|
||||
__entry->val = val;
|
||||
),
|
||||
|
||||
TP_printk("platform=%s.%d reg=%x val=%x", __get_str(name),
|
||||
(int)__entry->id, (unsigned int)__entry->reg,
|
||||
(unsigned int)__entry->val)
|
||||
);
|
||||
|
||||
DEFINE_EVENT(snd_soc_preg, snd_soc_preg_write,
|
||||
|
||||
TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
|
||||
unsigned int val),
|
||||
|
||||
TP_ARGS(platform, reg, val)
|
||||
|
||||
);
|
||||
|
||||
DEFINE_EVENT(snd_soc_preg, snd_soc_preg_read,
|
||||
|
||||
TP_PROTO(struct snd_soc_platform *platform, unsigned int reg,
|
||||
unsigned int val),
|
||||
|
||||
TP_ARGS(platform, reg, val)
|
||||
|
||||
);
|
||||
|
||||
DECLARE_EVENT_CLASS(snd_soc_card,
|
||||
|
||||
TP_PROTO(struct snd_soc_card *card, int val),
|
||||
|
@ -276,7 +276,7 @@ static int snd_soc_get_volsw_2r_st(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
int val[2], val2[2], i;
|
||||
@ -300,7 +300,7 @@ static int snd_soc_put_volsw_2r_st(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
int err;
|
||||
@ -333,7 +333,7 @@ static int snd_soc_get_volsw_2r_out(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
unsigned int shift = mc->shift;
|
||||
@ -353,7 +353,7 @@ static int snd_soc_put_volsw_2r_out(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
unsigned int shift = mc->shift;
|
||||
@ -1327,10 +1327,6 @@ static int pm860x_probe(struct snd_soc_codec *codec)
|
||||
|
||||
pm860x->codec = codec;
|
||||
|
||||
ret = snd_soc_codec_set_cache_io(codec, pm860x->regmap);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < 4; i++) {
|
||||
ret = request_threaded_irq(pm860x->irq[i], NULL,
|
||||
pm860x_codec_handler, IRQF_ONESHOT,
|
||||
@ -1362,10 +1358,18 @@ static int pm860x_remove(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct regmap *pm860x_get_regmap(struct device *dev)
|
||||
{
|
||||
struct pm860x_priv *pm860x = dev_get_drvdata(dev);
|
||||
|
||||
return pm860x->regmap;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_pm860x = {
|
||||
.probe = pm860x_probe,
|
||||
.remove = pm860x_remove,
|
||||
.set_bias_level = pm860x_set_bias_level,
|
||||
.get_regmap = pm860x_get_regmap,
|
||||
|
||||
.controls = pm860x_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(pm860x_snd_controls),
|
||||
|
@ -80,6 +80,7 @@ config SND_SOC_ALL_CODECS
|
||||
select SND_SOC_SSM2602_SPI if SPI_MASTER
|
||||
select SND_SOC_SSM2602_I2C if I2C
|
||||
select SND_SOC_STA32X if I2C
|
||||
select SND_SOC_STA350 if I2C
|
||||
select SND_SOC_STA529 if I2C
|
||||
select SND_SOC_STAC9766 if SND_SOC_AC97_BUS
|
||||
select SND_SOC_TAS5086 if I2C
|
||||
@ -435,6 +436,10 @@ config SND_SOC_SSM2602_I2C
|
||||
config SND_SOC_STA32X
|
||||
tristate
|
||||
|
||||
config SND_SOC_STA350
|
||||
tristate "STA350 speaker amplifier"
|
||||
depends on I2C
|
||||
|
||||
config SND_SOC_STA529
|
||||
tristate
|
||||
|
||||
|
@ -74,6 +74,7 @@ snd-soc-ssm2602-objs := ssm2602.o
|
||||
snd-soc-ssm2602-spi-objs := ssm2602-spi.o
|
||||
snd-soc-ssm2602-i2c-objs := ssm2602-i2c.o
|
||||
snd-soc-sta32x-objs := sta32x.o
|
||||
snd-soc-sta350-objs := sta350.o
|
||||
snd-soc-sta529-objs := sta529.o
|
||||
snd-soc-stac9766-objs := stac9766.o
|
||||
snd-soc-tas5086-objs := tas5086.o
|
||||
@ -221,6 +222,7 @@ obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o
|
||||
obj-$(CONFIG_SND_SOC_SSM2602_SPI) += snd-soc-ssm2602-spi.o
|
||||
obj-$(CONFIG_SND_SOC_SSM2602_I2C) += snd-soc-ssm2602-i2c.o
|
||||
obj-$(CONFIG_SND_SOC_STA32X) += snd-soc-sta32x.o
|
||||
obj-$(CONFIG_SND_SOC_STA350) += snd-soc-sta350.o
|
||||
obj-$(CONFIG_SND_SOC_STA529) += snd-soc-sta529.o
|
||||
obj-$(CONFIG_SND_SOC_STAC9766) += snd-soc-stac9766.o
|
||||
obj-$(CONFIG_SND_SOC_TAS5086) += snd-soc-tas5086.o
|
||||
|
@ -1139,7 +1139,7 @@ static void anc_configure(struct snd_soc_codec *codec,
|
||||
static int sid_status_control_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev);
|
||||
|
||||
mutex_lock(&codec->mutex);
|
||||
@ -1153,7 +1153,7 @@ static int sid_status_control_get(struct snd_kcontrol *kcontrol,
|
||||
static int sid_status_control_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev);
|
||||
unsigned int param, sidconf, val;
|
||||
int status = 1;
|
||||
@ -1208,7 +1208,7 @@ out:
|
||||
static int anc_status_control_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev);
|
||||
|
||||
mutex_lock(&codec->mutex);
|
||||
@ -1221,7 +1221,7 @@ static int anc_status_control_get(struct snd_kcontrol *kcontrol,
|
||||
static int anc_status_control_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ab8500_codec_drvdata *drvdata = dev_get_drvdata(codec->dev);
|
||||
struct device *dev = codec->dev;
|
||||
bool apply_fir, apply_iir;
|
||||
@ -1306,7 +1306,7 @@ static int filter_control_info(struct snd_kcontrol *kcontrol,
|
||||
static int filter_control_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct filter_control *fc =
|
||||
(struct filter_control *)kcontrol->private_value;
|
||||
unsigned int i;
|
||||
@ -1322,7 +1322,7 @@ static int filter_control_get(struct snd_kcontrol *kcontrol,
|
||||
static int filter_control_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct filter_control *fc =
|
||||
(struct filter_control *)kcontrol->private_value;
|
||||
unsigned int i;
|
||||
|
@ -315,7 +315,7 @@ static int adav80x_set_deemph(struct snd_soc_codec *codec)
|
||||
static int adav80x_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int deemph = ucontrol->value.enumerated.item[0];
|
||||
|
||||
@ -330,7 +330,7 @@ static int adav80x_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int adav80x_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = adav80x->deemph;
|
||||
|
@ -74,7 +74,7 @@ static int ak4641_set_deemph(struct snd_soc_codec *codec)
|
||||
static int ak4641_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec);
|
||||
int deemph = ucontrol->value.enumerated.item[0];
|
||||
|
||||
@ -89,7 +89,7 @@ static int ak4641_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int ak4641_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct ak4641_priv *ak4641 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = ak4641->deemph;
|
||||
|
@ -139,8 +139,6 @@ static int cq93vc_probe(struct snd_soc_codec *codec)
|
||||
|
||||
davinci_vc->cq93vc.codec = codec;
|
||||
|
||||
snd_soc_codec_set_cache_io(codec, davinci_vc->regmap);
|
||||
|
||||
/* Off, with power on */
|
||||
cq93vc_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
|
||||
|
||||
@ -154,11 +152,19 @@ static int cq93vc_remove(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct regmap *cq93vc_get_regmap(struct device *dev)
|
||||
{
|
||||
struct davinci_vc *davinci_vc = codec->dev->platform_data;
|
||||
|
||||
return davinci_vc->regmap;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_cq93vc = {
|
||||
.set_bias_level = cq93vc_set_bias_level,
|
||||
.probe = cq93vc_probe,
|
||||
.remove = cq93vc_remove,
|
||||
.resume = cq93vc_resume,
|
||||
.get_regmap = cq93vc_get_regmap,
|
||||
.controls = cq93vc_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cq93vc_snd_controls),
|
||||
};
|
||||
|
@ -438,7 +438,7 @@ static int cs4270_dai_mute(struct snd_soc_dai *dai, int mute)
|
||||
static int cs4270_soc_put_mute(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
|
||||
int left = !ucontrol->value.integer.value[0];
|
||||
int right = !ucontrol->value.integer.value[1];
|
||||
|
@ -284,7 +284,7 @@ static int cs4271_set_deemph(struct snd_soc_codec *codec)
|
||||
static int cs4271_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = cs4271->deemph;
|
||||
@ -294,7 +294,7 @@ static int cs4271_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int cs4271_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct cs4271_private *cs4271 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
cs4271->deemph = ucontrol->value.enumerated.item[0];
|
||||
|
@ -55,7 +55,7 @@ struct cs42l51_private {
|
||||
static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned long value = snd_soc_read(codec, CS42L51_PCM_MIXER)&3;
|
||||
|
||||
switch (value) {
|
||||
@ -83,7 +83,7 @@ static int cs42l51_get_chan_mix(struct snd_kcontrol *kcontrol,
|
||||
static int cs42l51_set_chan_mix(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned char val;
|
||||
|
||||
switch (ucontrol->value.integer.value[0]) {
|
||||
|
@ -335,7 +335,7 @@ static SOC_ENUM_SINGLE_DECL(da7210_hp_mode_sel,
|
||||
static int da7210_put_alc_sw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
|
||||
if (ucontrol->value.integer.value[0]) {
|
||||
/* Check if noise suppression is enabled */
|
||||
@ -358,7 +358,7 @@ static int da7210_put_alc_sw(struct snd_kcontrol *kcontrol,
|
||||
static int da7210_put_noise_sup_sw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
u8 val;
|
||||
|
||||
if (ucontrol->value.integer.value[0]) {
|
||||
|
@ -345,7 +345,7 @@ static void da7213_alc_calib(struct snd_soc_codec *codec)
|
||||
static int da7213_put_mixin_gain(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct da7213_priv *da7213 = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
@ -361,7 +361,7 @@ static int da7213_put_mixin_gain(struct snd_kcontrol *kcontrol,
|
||||
static int da7213_put_alc_sw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct da7213_priv *da7213 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
/* Force ALC offset calibration if enabling ALC */
|
||||
|
@ -332,7 +332,7 @@ static SOC_ENUM_SINGLE_DECL(da732x_adc2_voice_filter_enum,
|
||||
static int da732x_hpf_set(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct soc_enum *enum_ctrl = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int reg = enum_ctrl->reg;
|
||||
unsigned int sel = ucontrol->value.integer.value[0];
|
||||
@ -360,7 +360,7 @@ static int da732x_hpf_set(struct snd_kcontrol *kcontrol,
|
||||
static int da732x_hpf_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct soc_enum *enum_ctrl = (struct soc_enum *)kcontrol->private_value;
|
||||
unsigned int reg = enum_ctrl->reg;
|
||||
int val;
|
||||
|
@ -484,7 +484,7 @@ static int da9055_get_alc_data(struct snd_soc_codec *codec, u8 reg_val)
|
||||
static int da9055_put_alc_sw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
u8 reg_val, adc_left, adc_right, mic_left, mic_right;
|
||||
int avg_left_data, avg_right_data, offset_l, offset_r;
|
||||
|
||||
|
@ -49,7 +49,7 @@ static const struct reg_default lm4857_default_regs[] = {
|
||||
static int lm4857_get_mode(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = lm4857->mode;
|
||||
@ -60,7 +60,7 @@ static int lm4857_get_mode(struct snd_kcontrol *kcontrol,
|
||||
static int lm4857_set_mode(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct lm4857 *lm4857 = snd_soc_codec_get_drvdata(codec);
|
||||
uint8_t value = ucontrol->value.integer.value[0];
|
||||
|
||||
|
@ -43,7 +43,7 @@ static struct reg_default max9768_default_regs[] = {
|
||||
static int max9768_get_gpio(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max9768 *max9768 = snd_soc_codec_get_drvdata(codec);
|
||||
int val = gpio_get_value_cansleep(max9768->mute_gpio);
|
||||
|
||||
@ -55,7 +55,7 @@ static int max9768_get_gpio(struct snd_kcontrol *kcontrol,
|
||||
static int max9768_set_gpio(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max9768 *max9768 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
gpio_set_value_cansleep(max9768->mute_gpio, !ucontrol->value.integer.value[0]);
|
||||
|
@ -635,7 +635,7 @@ static SOC_ENUM_SINGLE_DECL(max98088_dai1_adc_filter_enum,
|
||||
static int max98088_mic1pre_set(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int sel = ucontrol->value.integer.value[0];
|
||||
|
||||
@ -649,7 +649,7 @@ static int max98088_mic1pre_set(struct snd_kcontrol *kcontrol,
|
||||
static int max98088_mic1pre_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = max98088->mic1pre;
|
||||
@ -659,7 +659,7 @@ static int max98088_mic1pre_get(struct snd_kcontrol *kcontrol,
|
||||
static int max98088_mic2pre_set(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int sel = ucontrol->value.integer.value[0];
|
||||
|
||||
@ -673,7 +673,7 @@ static int max98088_mic2pre_set(struct snd_kcontrol *kcontrol,
|
||||
static int max98088_mic2pre_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = max98088->mic2pre;
|
||||
@ -1750,7 +1750,7 @@ static void max98088_setup_eq2(struct snd_soc_codec *codec)
|
||||
static int max98088_put_eq_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec);
|
||||
struct max98088_pdata *pdata = max98088->pdata;
|
||||
int channel = max98088_get_channel(codec, kcontrol->id.name);
|
||||
@ -1782,7 +1782,7 @@ static int max98088_put_eq_enum(struct snd_kcontrol *kcontrol,
|
||||
static int max98088_get_eq_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98088_priv *max98088 = snd_soc_codec_get_drvdata(codec);
|
||||
int channel = max98088_get_channel(codec, kcontrol->id.name);
|
||||
struct max98088_cdata *cdata;
|
||||
|
@ -426,7 +426,7 @@ static const unsigned int max98090_rcv_lout_tlv[] = {
|
||||
static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
@ -466,7 +466,7 @@ static int max98090_get_enab_tlv(struct snd_kcontrol *kcontrol,
|
||||
static int max98090_put_enab_tlv(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98090_priv *max98090 = snd_soc_codec_get_drvdata(codec);
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
|
@ -612,7 +612,7 @@ static SOC_ENUM_SINGLE_DECL(max98095_dai3_dac_filter_enum,
|
||||
static int max98095_mic1pre_set(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int sel = ucontrol->value.integer.value[0];
|
||||
|
||||
@ -626,7 +626,7 @@ static int max98095_mic1pre_set(struct snd_kcontrol *kcontrol,
|
||||
static int max98095_mic1pre_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = max98095->mic1pre;
|
||||
@ -636,7 +636,7 @@ static int max98095_mic1pre_get(struct snd_kcontrol *kcontrol,
|
||||
static int max98095_mic2pre_set(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int sel = ucontrol->value.integer.value[0];
|
||||
|
||||
@ -650,7 +650,7 @@ static int max98095_mic2pre_set(struct snd_kcontrol *kcontrol,
|
||||
static int max98095_mic2pre_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = max98095->mic2pre;
|
||||
@ -1737,7 +1737,7 @@ static int max98095_get_eq_channel(const char *name)
|
||||
static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
|
||||
struct max98095_pdata *pdata = max98095->pdata;
|
||||
int channel = max98095_get_eq_channel(kcontrol->id.name);
|
||||
@ -1801,7 +1801,7 @@ static int max98095_put_eq_enum(struct snd_kcontrol *kcontrol,
|
||||
static int max98095_get_eq_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
|
||||
int channel = max98095_get_eq_channel(kcontrol->id.name);
|
||||
struct max98095_cdata *cdata;
|
||||
@ -1891,7 +1891,7 @@ static int max98095_get_bq_channel(struct snd_soc_codec *codec,
|
||||
static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
|
||||
struct max98095_pdata *pdata = max98095->pdata;
|
||||
int channel = max98095_get_bq_channel(codec, kcontrol->id.name);
|
||||
@ -1952,7 +1952,7 @@ static int max98095_put_bq_enum(struct snd_kcontrol *kcontrol,
|
||||
static int max98095_get_bq_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct max98095_priv *max98095 = snd_soc_codec_get_drvdata(codec);
|
||||
int channel = max98095_get_bq_channel(codec, kcontrol->id.name);
|
||||
struct max98095_cdata *cdata;
|
||||
|
@ -608,14 +608,6 @@ static struct snd_kcontrol_new mc13783_control_list[] = {
|
||||
static int mc13783_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_codec_set_cache_io(codec,
|
||||
dev_get_regmap(codec->dev->parent, NULL));
|
||||
if (ret != 0) {
|
||||
dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* these are the reset values */
|
||||
mc13xxx_reg_write(priv->mc13xxx, MC13783_AUDIO_RX0, 0x25893);
|
||||
@ -735,9 +727,15 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static struct regmap *mc13783_get_regmap(struct device *dev)
|
||||
{
|
||||
return dev_get_regmap(dev->parent, NULL);
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_mc13783 = {
|
||||
.probe = mc13783_probe,
|
||||
.remove = mc13783_remove,
|
||||
.get_regmap = mc13783_get_regmap,
|
||||
.controls = mc13783_control_list,
|
||||
.num_controls = ARRAY_SIZE(mc13783_control_list),
|
||||
.dapm_widgets = mc13783_dapm_widgets,
|
||||
|
@ -115,7 +115,7 @@ static int pcm1681_set_deemph(struct snd_soc_codec *codec)
|
||||
static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = priv->deemph;
|
||||
@ -126,7 +126,7 @@ static int pcm1681_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int pcm1681_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
priv->deemph = ucontrol->value.enumerated.item[0];
|
||||
|
@ -188,7 +188,7 @@ static unsigned int mic_bst_tlv[] = {
|
||||
static int rt5631_dmic_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = rt5631->dmic_used_flag;
|
||||
@ -199,7 +199,7 @@ static int rt5631_dmic_get(struct snd_kcontrol *kcontrol,
|
||||
static int rt5631_dmic_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct rt5631_priv *rt5631 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
rt5631->dmic_used_flag = ucontrol->value.integer.value[0];
|
||||
|
@ -296,7 +296,7 @@ static int dac_info_volsw(struct snd_kcontrol *kcontrol,
|
||||
static int dac_get_volsw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
int reg;
|
||||
int l;
|
||||
int r;
|
||||
@ -349,7 +349,7 @@ static int dac_get_volsw(struct snd_kcontrol *kcontrol,
|
||||
static int dac_put_volsw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
int reg;
|
||||
int l;
|
||||
int r;
|
||||
|
@ -208,13 +208,6 @@ out:
|
||||
return err;
|
||||
}
|
||||
|
||||
static int si476x_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct regmap *regmap = dev_get_regmap(codec->dev->parent, NULL);
|
||||
|
||||
return snd_soc_codec_set_cache_io(codec, regmap);
|
||||
}
|
||||
|
||||
static struct snd_soc_dai_ops si476x_dai_ops = {
|
||||
.hw_params = si476x_codec_hw_params,
|
||||
.set_fmt = si476x_codec_set_dai_fmt,
|
||||
@ -238,8 +231,13 @@ static struct snd_soc_dai_driver si476x_dai = {
|
||||
.ops = &si476x_dai_ops,
|
||||
};
|
||||
|
||||
static struct regmap *si476x_get_regmap(struct device *dev)
|
||||
{
|
||||
return dev_get_regmap(dev->parent, NULL);
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_si476x = {
|
||||
.probe = si476x_codec_probe,
|
||||
.get_regmap = si476x_get_regmap,
|
||||
.dapm_widgets = si476x_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(si476x_dapm_widgets),
|
||||
.dapm_routes = si476x_dapm_routes,
|
||||
|
@ -243,7 +243,7 @@ static int sta32x_coefficient_info(struct snd_kcontrol *kcontrol,
|
||||
static int sta32x_coefficient_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
int numcoef = kcontrol->private_value >> 16;
|
||||
int index = kcontrol->private_value & 0xffff;
|
||||
unsigned int cfud;
|
||||
@ -272,7 +272,7 @@ static int sta32x_coefficient_get(struct snd_kcontrol *kcontrol,
|
||||
static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
|
||||
int numcoef = kcontrol->private_value >> 16;
|
||||
int index = kcontrol->private_value & 0xffff;
|
||||
|
1266
sound/soc/codecs/sta350.c
Normal file
1266
sound/soc/codecs/sta350.c
Normal file
File diff suppressed because it is too large
Load Diff
228
sound/soc/codecs/sta350.h
Normal file
228
sound/soc/codecs/sta350.h
Normal file
@ -0,0 +1,228 @@
|
||||
/*
|
||||
* Codec driver for ST STA350 2.1-channel high-efficiency digital audio system
|
||||
*
|
||||
* Copyright: 2011 Raumfeld GmbH
|
||||
* Author: Sven Brandau <info@brandau.biz>
|
||||
*
|
||||
* based on code from:
|
||||
* Raumfeld GmbH
|
||||
* Johannes Stezenbach <js@sig21.net>
|
||||
* Wolfson Microelectronics PLC.
|
||||
* Mark Brown <broonie@opensource.wolfsonmicro.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*/
|
||||
#ifndef _ASOC_STA_350_H
|
||||
#define _ASOC_STA_350_H
|
||||
|
||||
/* STA50 register addresses */
|
||||
|
||||
#define STA350_REGISTER_COUNT 0x4D
|
||||
#define STA350_COEF_COUNT 62
|
||||
|
||||
#define STA350_CONFA 0x00
|
||||
#define STA350_CONFB 0x01
|
||||
#define STA350_CONFC 0x02
|
||||
#define STA350_CONFD 0x03
|
||||
#define STA350_CONFE 0x04
|
||||
#define STA350_CONFF 0x05
|
||||
#define STA350_MMUTE 0x06
|
||||
#define STA350_MVOL 0x07
|
||||
#define STA350_C1VOL 0x08
|
||||
#define STA350_C2VOL 0x09
|
||||
#define STA350_C3VOL 0x0a
|
||||
#define STA350_AUTO1 0x0b
|
||||
#define STA350_AUTO2 0x0c
|
||||
#define STA350_AUTO3 0x0d
|
||||
#define STA350_C1CFG 0x0e
|
||||
#define STA350_C2CFG 0x0f
|
||||
#define STA350_C3CFG 0x10
|
||||
#define STA350_TONE 0x11
|
||||
#define STA350_L1AR 0x12
|
||||
#define STA350_L1ATRT 0x13
|
||||
#define STA350_L2AR 0x14
|
||||
#define STA350_L2ATRT 0x15
|
||||
#define STA350_CFADDR2 0x16
|
||||
#define STA350_B1CF1 0x17
|
||||
#define STA350_B1CF2 0x18
|
||||
#define STA350_B1CF3 0x19
|
||||
#define STA350_B2CF1 0x1a
|
||||
#define STA350_B2CF2 0x1b
|
||||
#define STA350_B2CF3 0x1c
|
||||
#define STA350_A1CF1 0x1d
|
||||
#define STA350_A1CF2 0x1e
|
||||
#define STA350_A1CF3 0x1f
|
||||
#define STA350_A2CF1 0x20
|
||||
#define STA350_A2CF2 0x21
|
||||
#define STA350_A2CF3 0x22
|
||||
#define STA350_B0CF1 0x23
|
||||
#define STA350_B0CF2 0x24
|
||||
#define STA350_B0CF3 0x25
|
||||
#define STA350_CFUD 0x26
|
||||
#define STA350_MPCC1 0x27
|
||||
#define STA350_MPCC2 0x28
|
||||
#define STA350_DCC1 0x29
|
||||
#define STA350_DCC2 0x2a
|
||||
#define STA350_FDRC1 0x2b
|
||||
#define STA350_FDRC2 0x2c
|
||||
#define STA350_STATUS 0x2d
|
||||
/* reserved: 0x2d - 0x30 */
|
||||
#define STA350_EQCFG 0x31
|
||||
#define STA350_EATH1 0x32
|
||||
#define STA350_ERTH1 0x33
|
||||
#define STA350_EATH2 0x34
|
||||
#define STA350_ERTH2 0x35
|
||||
#define STA350_CONFX 0x36
|
||||
#define STA350_SVCA 0x37
|
||||
#define STA350_SVCB 0x38
|
||||
#define STA350_RMS0A 0x39
|
||||
#define STA350_RMS0B 0x3a
|
||||
#define STA350_RMS0C 0x3b
|
||||
#define STA350_RMS1A 0x3c
|
||||
#define STA350_RMS1B 0x3d
|
||||
#define STA350_RMS1C 0x3e
|
||||
#define STA350_EVOLRES 0x3f
|
||||
/* reserved: 0x40 - 0x47 */
|
||||
#define STA350_NSHAPE 0x48
|
||||
#define STA350_CTXB4B1 0x49
|
||||
#define STA350_CTXB7B5 0x4a
|
||||
#define STA350_MISC1 0x4b
|
||||
#define STA350_MISC2 0x4c
|
||||
|
||||
/* 0x00 CONFA */
|
||||
#define STA350_CONFA_MCS_MASK 0x03
|
||||
#define STA350_CONFA_MCS_SHIFT 0
|
||||
#define STA350_CONFA_IR_MASK 0x18
|
||||
#define STA350_CONFA_IR_SHIFT 3
|
||||
#define STA350_CONFA_TWRB BIT(5)
|
||||
#define STA350_CONFA_TWAB BIT(6)
|
||||
#define STA350_CONFA_FDRB BIT(7)
|
||||
|
||||
/* 0x01 CONFB */
|
||||
#define STA350_CONFB_SAI_MASK 0x0f
|
||||
#define STA350_CONFB_SAI_SHIFT 0
|
||||
#define STA350_CONFB_SAIFB BIT(4)
|
||||
#define STA350_CONFB_DSCKE BIT(5)
|
||||
#define STA350_CONFB_C1IM BIT(6)
|
||||
#define STA350_CONFB_C2IM BIT(7)
|
||||
|
||||
/* 0x02 CONFC */
|
||||
#define STA350_CONFC_OM_MASK 0x03
|
||||
#define STA350_CONFC_OM_SHIFT 0
|
||||
#define STA350_CONFC_CSZ_MASK 0x3c
|
||||
#define STA350_CONFC_CSZ_SHIFT 2
|
||||
#define STA350_CONFC_OCRB BIT(7)
|
||||
|
||||
/* 0x03 CONFD */
|
||||
#define STA350_CONFD_HPB_SHIFT 0
|
||||
#define STA350_CONFD_DEMP_SHIFT 1
|
||||
#define STA350_CONFD_DSPB_SHIFT 2
|
||||
#define STA350_CONFD_PSL_SHIFT 3
|
||||
#define STA350_CONFD_BQL_SHIFT 4
|
||||
#define STA350_CONFD_DRC_SHIFT 5
|
||||
#define STA350_CONFD_ZDE_SHIFT 6
|
||||
#define STA350_CONFD_SME_SHIFT 7
|
||||
|
||||
/* 0x04 CONFE */
|
||||
#define STA350_CONFE_MPCV BIT(0)
|
||||
#define STA350_CONFE_MPCV_SHIFT 0
|
||||
#define STA350_CONFE_MPC BIT(1)
|
||||
#define STA350_CONFE_MPC_SHIFT 1
|
||||
#define STA350_CONFE_NSBW BIT(2)
|
||||
#define STA350_CONFE_NSBW_SHIFT 2
|
||||
#define STA350_CONFE_AME BIT(3)
|
||||
#define STA350_CONFE_AME_SHIFT 3
|
||||
#define STA350_CONFE_PWMS BIT(4)
|
||||
#define STA350_CONFE_PWMS_SHIFT 4
|
||||
#define STA350_CONFE_DCCV BIT(5)
|
||||
#define STA350_CONFE_DCCV_SHIFT 5
|
||||
#define STA350_CONFE_ZCE BIT(6)
|
||||
#define STA350_CONFE_ZCE_SHIFT 6
|
||||
#define STA350_CONFE_SVE BIT(7)
|
||||
#define STA350_CONFE_SVE_SHIFT 7
|
||||
|
||||
/* 0x05 CONFF */
|
||||
#define STA350_CONFF_OCFG_MASK 0x03
|
||||
#define STA350_CONFF_OCFG_SHIFT 0
|
||||
#define STA350_CONFF_IDE BIT(2)
|
||||
#define STA350_CONFF_BCLE BIT(3)
|
||||
#define STA350_CONFF_LDTE BIT(4)
|
||||
#define STA350_CONFF_ECLE BIT(5)
|
||||
#define STA350_CONFF_PWDN BIT(6)
|
||||
#define STA350_CONFF_EAPD BIT(7)
|
||||
|
||||
/* 0x06 MMUTE */
|
||||
#define STA350_MMUTE_MMUTE 0x01
|
||||
#define STA350_MMUTE_MMUTE_SHIFT 0
|
||||
#define STA350_MMUTE_C1M 0x02
|
||||
#define STA350_MMUTE_C1M_SHIFT 1
|
||||
#define STA350_MMUTE_C2M 0x04
|
||||
#define STA350_MMUTE_C2M_SHIFT 2
|
||||
#define STA350_MMUTE_C3M 0x08
|
||||
#define STA350_MMUTE_C3M_SHIFT 3
|
||||
#define STA350_MMUTE_LOC_MASK 0xC0
|
||||
#define STA350_MMUTE_LOC_SHIFT 6
|
||||
|
||||
/* 0x0b AUTO1 */
|
||||
#define STA350_AUTO1_AMGC_MASK 0x30
|
||||
#define STA350_AUTO1_AMGC_SHIFT 4
|
||||
|
||||
/* 0x0c AUTO2 */
|
||||
#define STA350_AUTO2_AMAME 0x01
|
||||
#define STA350_AUTO2_AMAM_MASK 0x0e
|
||||
#define STA350_AUTO2_AMAM_SHIFT 1
|
||||
#define STA350_AUTO2_XO_MASK 0xf0
|
||||
#define STA350_AUTO2_XO_SHIFT 4
|
||||
|
||||
/* 0x0d AUTO3 */
|
||||
#define STA350_AUTO3_PEQ_MASK 0x1f
|
||||
#define STA350_AUTO3_PEQ_SHIFT 0
|
||||
|
||||
/* 0x0e 0x0f 0x10 CxCFG */
|
||||
#define STA350_CxCFG_TCB_SHIFT 0
|
||||
#define STA350_CxCFG_EQBP_SHIFT 1
|
||||
#define STA350_CxCFG_VBP_SHIFT 2
|
||||
#define STA350_CxCFG_BO_SHIFT 3
|
||||
#define STA350_CxCFG_LS_SHIFT 4
|
||||
#define STA350_CxCFG_OM_MASK 0xc0
|
||||
#define STA350_CxCFG_OM_SHIFT 6
|
||||
|
||||
/* 0x11 TONE */
|
||||
#define STA350_TONE_BTC_SHIFT 0
|
||||
#define STA350_TONE_TTC_SHIFT 4
|
||||
|
||||
/* 0x12 0x13 0x14 0x15 limiter attack/release */
|
||||
#define STA350_LxA_SHIFT 0
|
||||
#define STA350_LxR_SHIFT 4
|
||||
|
||||
/* 0x26 CFUD */
|
||||
#define STA350_CFUD_W1 0x01
|
||||
#define STA350_CFUD_WA 0x02
|
||||
#define STA350_CFUD_R1 0x04
|
||||
#define STA350_CFUD_RA 0x08
|
||||
|
||||
|
||||
/* biquad filter coefficient table offsets */
|
||||
#define STA350_C1_BQ_BASE 0
|
||||
#define STA350_C2_BQ_BASE 20
|
||||
#define STA350_CH_BQ_NUM 4
|
||||
#define STA350_BQ_NUM_COEF 5
|
||||
#define STA350_XO_HP_BQ_BASE 40
|
||||
#define STA350_XO_LP_BQ_BASE 45
|
||||
#define STA350_C1_PRESCALE 50
|
||||
#define STA350_C2_PRESCALE 51
|
||||
#define STA350_C1_POSTSCALE 52
|
||||
#define STA350_C2_POSTSCALE 53
|
||||
#define STA350_C3_POSTSCALE 54
|
||||
#define STA350_TW_POSTSCALE 55
|
||||
#define STA350_C1_MIX1 56
|
||||
#define STA350_C1_MIX2 57
|
||||
#define STA350_C2_MIX1 58
|
||||
#define STA350_C2_MIX2 59
|
||||
#define STA350_C3_MIX1 60
|
||||
#define STA350_C3_MIX2 61
|
||||
|
||||
#endif /* _ASOC_STA_350_H */
|
@ -272,7 +272,7 @@ static int tas5086_set_deemph(struct snd_soc_codec *codec)
|
||||
static int tas5086_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = priv->deemph;
|
||||
@ -283,7 +283,7 @@ static int tas5086_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int tas5086_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tas5086_private *priv = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
priv->deemph = ucontrol->value.enumerated.item[0];
|
||||
|
@ -82,7 +82,7 @@ static const DECLARE_TLV_DB_SCALE(sidetone_vol_tlv, -1800, 300, 0);
|
||||
static int snd_soc_tlv320aic23_put_volsw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
u16 val, reg;
|
||||
|
||||
val = (ucontrol->value.integer.value[0] & 0x07);
|
||||
@ -105,7 +105,7 @@ static int snd_soc_tlv320aic23_put_volsw(struct snd_kcontrol *kcontrol,
|
||||
static int snd_soc_tlv320aic23_get_volsw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
u16 val;
|
||||
|
||||
val = snd_soc_read(codec, TLV320AIC23_ANLG) & (0x1C0);
|
||||
|
@ -442,7 +442,7 @@ static int dac33_playback_event(struct snd_soc_dapm_widget *w,
|
||||
static int dac33_get_fifo_mode(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = dac33->fifo_mode;
|
||||
@ -453,7 +453,7 @@ static int dac33_get_fifo_mode(struct snd_kcontrol *kcontrol,
|
||||
static int dac33_set_fifo_mode(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec);
|
||||
int ret = 0;
|
||||
|
||||
|
@ -830,7 +830,7 @@ static int snd_soc_get_volsw_twl4030(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int shift = mc->shift;
|
||||
unsigned int rshift = mc->rshift;
|
||||
@ -859,7 +859,7 @@ static int snd_soc_put_volsw_twl4030(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int shift = mc->shift;
|
||||
unsigned int rshift = mc->rshift;
|
||||
@ -888,7 +888,7 @@ static int snd_soc_get_volsw_r2_twl4030(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
unsigned int shift = mc->shift;
|
||||
@ -915,7 +915,7 @@ static int snd_soc_put_volsw_r2_twl4030(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
unsigned int shift = mc->shift;
|
||||
@ -956,7 +956,7 @@ static SOC_ENUM_SINGLE_DECL(twl4030_op_modes_enum,
|
||||
static int snd_soc_put_twl4030_opmode_enum_double(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct twl4030_priv *twl4030 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
if (twl4030->configured) {
|
||||
|
@ -484,7 +484,7 @@ static SOC_ENUM_SINGLE_EXT_DECL(twl6040_power_mode_enum,
|
||||
static int twl6040_headset_power_get_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = priv->hs_power_mode;
|
||||
@ -495,7 +495,7 @@ static int twl6040_headset_power_get_enum(struct snd_kcontrol *kcontrol,
|
||||
static int twl6040_headset_power_put_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
|
||||
int high_perf = ucontrol->value.enumerated.item[0];
|
||||
int ret = 0;
|
||||
@ -512,7 +512,7 @@ static int twl6040_headset_power_put_enum(struct snd_kcontrol *kcontrol,
|
||||
static int twl6040_pll_get_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = priv->pll_power_mode;
|
||||
@ -523,7 +523,7 @@ static int twl6040_pll_get_enum(struct snd_kcontrol *kcontrol,
|
||||
static int twl6040_pll_put_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
priv->pll_power_mode = ucontrol->value.enumerated.item[0];
|
||||
|
@ -172,7 +172,7 @@ out:
|
||||
static int snd_wl1273_get_audio_route(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = wl1273->mode;
|
||||
@ -190,7 +190,7 @@ static const char * const wl1273_audio_route[] = { "Bt", "FmRx", "FmTx" };
|
||||
static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
if (wl1273->mode == ucontrol->value.integer.value[0])
|
||||
@ -214,7 +214,7 @@ static SOC_ENUM_SINGLE_EXT_DECL(wl1273_enum, wl1273_audio_route);
|
||||
static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
dev_dbg(codec->dev, "%s: enter.\n", __func__);
|
||||
@ -227,7 +227,7 @@ static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol,
|
||||
static int snd_wl1273_fm_audio_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
|
||||
int val, r = 0;
|
||||
|
||||
@ -251,7 +251,7 @@ static SOC_ENUM_SINGLE_EXT_DECL(wl1273_audio_enum, wl1273_audio_strings);
|
||||
static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
dev_dbg(codec->dev, "%s: enter.\n", __func__);
|
||||
@ -264,7 +264,7 @@ static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol,
|
||||
static int snd_wl1273_fm_volume_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec);
|
||||
int r;
|
||||
|
||||
|
@ -607,7 +607,7 @@ static int wm2000_anc_set_mode(struct wm2000_priv *wm2000)
|
||||
static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm2000->anc_active;
|
||||
@ -618,7 +618,7 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,
|
||||
static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
int anc_active = ucontrol->value.enumerated.item[0];
|
||||
int ret;
|
||||
@ -640,7 +640,7 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,
|
||||
static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm2000->spk_ena;
|
||||
@ -651,7 +651,7 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,
|
||||
static int wm2000_speaker_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
|
||||
int val = ucontrol->value.enumerated.item[0];
|
||||
int ret;
|
||||
|
@ -1760,10 +1760,6 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)
|
||||
struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_add_codec_controls(codec, wm_adsp2_fw_controls, 2);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
@ -1802,9 +1798,17 @@ static unsigned int wm5102_digital_vu[] = {
|
||||
ARIZONA_DAC_DIGITAL_VOLUME_5R,
|
||||
};
|
||||
|
||||
static struct regmap *wm5102_get_regmap(struct device *dev)
|
||||
{
|
||||
struct wm5102_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
return priv->core.arizona->regmap;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
|
||||
.probe = wm5102_codec_probe,
|
||||
.remove = wm5102_codec_remove,
|
||||
.get_regmap = wm5102_get_regmap,
|
||||
|
||||
.idle_bias_off = true,
|
||||
|
||||
|
@ -1589,10 +1589,6 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)
|
||||
|
||||
priv->core.arizona->dapm = &codec->dapm;
|
||||
|
||||
ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
arizona_init_spk(codec);
|
||||
arizona_init_gpio(codec);
|
||||
|
||||
@ -1633,9 +1629,17 @@ static unsigned int wm5110_digital_vu[] = {
|
||||
ARIZONA_DAC_DIGITAL_VOLUME_6R,
|
||||
};
|
||||
|
||||
static struct regmap *wm5110_get_regmap(struct device *dev)
|
||||
{
|
||||
struct wm5110_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
return priv->core.arizona->regmap;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
|
||||
.probe = wm5110_codec_probe,
|
||||
.remove = wm5110_codec_remove,
|
||||
.get_regmap = wm5110_get_regmap,
|
||||
|
||||
.idle_bias_off = true,
|
||||
|
||||
|
@ -302,7 +302,7 @@ static int pga_event(struct snd_soc_dapm_widget *w,
|
||||
static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8350_output *out = NULL;
|
||||
struct soc_mixer_control *mc =
|
||||
@ -345,7 +345,7 @@ static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol,
|
||||
static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8350_output *out1 = &wm8350_priv->out1;
|
||||
struct wm8350_output *out2 = &wm8350_priv->out2;
|
||||
@ -1505,8 +1505,6 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
snd_soc_codec_set_cache_io(codec, wm8350->regmap);
|
||||
|
||||
/* Put the codec into reset if it wasn't already */
|
||||
wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
|
||||
|
||||
@ -1608,11 +1606,19 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct regmap *wm8350_get_regmap(struct device *dev)
|
||||
{
|
||||
struct wm8350 *wm8350 = dev_get_platdata(dev);
|
||||
|
||||
return wm8350->regmap;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_wm8350 = {
|
||||
.probe = wm8350_codec_probe,
|
||||
.remove = wm8350_codec_remove,
|
||||
.suspend = wm8350_suspend,
|
||||
.resume = wm8350_resume,
|
||||
.get_regmap = wm8350_get_regmap,
|
||||
.set_bias_level = wm8350_set_bias_level,
|
||||
|
||||
.controls = wm8350_snd_controls,
|
||||
|
@ -93,7 +93,7 @@ static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0);
|
||||
static int wm8400_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
int reg = mc->reg;
|
||||
@ -1318,8 +1318,6 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
|
||||
priv->wm8400 = wm8400;
|
||||
priv->codec = codec;
|
||||
|
||||
snd_soc_codec_set_cache_io(codec, wm8400->regmap);
|
||||
|
||||
ret = devm_regulator_bulk_get(wm8400->dev,
|
||||
ARRAY_SIZE(power), &power[0]);
|
||||
if (ret != 0) {
|
||||
@ -1361,11 +1359,19 @@ static int wm8400_codec_remove(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct regmap *wm8400_get_regmap(struct device *dev)
|
||||
{
|
||||
struct wm8400 *wm8400 = dev_get_platdata(dev);
|
||||
|
||||
return wm8400->regmap;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
|
||||
.probe = wm8400_codec_probe,
|
||||
.remove = wm8400_codec_remove,
|
||||
.suspend = wm8400_suspend,
|
||||
.resume = wm8400_resume,
|
||||
.get_regmap = wm8400_get_regmap,
|
||||
.set_bias_level = wm8400_set_bias_level,
|
||||
|
||||
.controls = wm8400_snd_controls,
|
||||
|
@ -252,7 +252,7 @@ static int wm8580_out_vu(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec);
|
||||
unsigned int reg = mc->reg;
|
||||
unsigned int reg2 = mc->rreg;
|
||||
|
@ -119,7 +119,7 @@ static int wm8731_set_deemph(struct snd_soc_codec *codec)
|
||||
static int wm8731_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8731->deemph;
|
||||
@ -130,7 +130,7 @@ static int wm8731_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int wm8731_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8731_priv *wm8731 = snd_soc_codec_get_drvdata(codec);
|
||||
int deemph = ucontrol->value.enumerated.item[0];
|
||||
int ret = 0;
|
||||
|
@ -234,7 +234,7 @@ SOC_ENUM_SINGLE(WM8753_OUTCTL, 2, 2, wm8753_rout2_phase),
|
||||
static int wm8753_get_dai(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = wm8753->dai_func;
|
||||
@ -244,7 +244,7 @@ static int wm8753_get_dai(struct snd_kcontrol *kcontrol,
|
||||
static int wm8753_set_dai(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8753_priv *wm8753 = snd_soc_codec_get_drvdata(codec);
|
||||
u16 ioctl;
|
||||
|
||||
|
@ -106,7 +106,7 @@ static int txsrc_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_soc_codec *codec;
|
||||
unsigned int src;
|
||||
|
||||
codec = snd_kcontrol_chip(kcontrol);
|
||||
codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
src = snd_soc_read(codec, WM8804_SPDTX4);
|
||||
if (src & 0x40)
|
||||
ucontrol->value.integer.value[0] = 1;
|
||||
@ -122,7 +122,7 @@ static int txsrc_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_soc_codec *codec;
|
||||
unsigned int src, txpwr;
|
||||
|
||||
codec = snd_kcontrol_chip(kcontrol);
|
||||
codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
|
||||
if (ucontrol->value.integer.value[0] != 0
|
||||
&& ucontrol->value.integer.value[0] != 1)
|
||||
|
@ -439,7 +439,7 @@ static int wm8903_set_deemph(struct snd_soc_codec *codec)
|
||||
static int wm8903_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8903->deemph;
|
||||
@ -450,7 +450,7 @@ static int wm8903_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int wm8903_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
|
||||
int deemph = ucontrol->value.enumerated.item[0];
|
||||
int ret = 0;
|
||||
|
@ -391,7 +391,7 @@ static void wm8904_set_drc(struct snd_soc_codec *codec)
|
||||
static int wm8904_put_drc_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8904_pdata *pdata = wm8904->pdata;
|
||||
int value = ucontrol->value.integer.value[0];
|
||||
@ -409,7 +409,7 @@ static int wm8904_put_drc_enum(struct snd_kcontrol *kcontrol,
|
||||
static int wm8904_get_drc_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8904->drc_cfg;
|
||||
@ -462,7 +462,7 @@ static void wm8904_set_retune_mobile(struct snd_soc_codec *codec)
|
||||
static int wm8904_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8904_pdata *pdata = wm8904->pdata;
|
||||
int value = ucontrol->value.integer.value[0];
|
||||
@ -480,7 +480,7 @@ static int wm8904_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
|
||||
static int wm8904_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8904->retune_mobile_cfg;
|
||||
@ -520,7 +520,7 @@ static int wm8904_set_deemph(struct snd_soc_codec *codec)
|
||||
static int wm8904_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8904->deemph;
|
||||
@ -530,7 +530,7 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int wm8904_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec);
|
||||
int deemph = ucontrol->value.enumerated.item[0];
|
||||
|
||||
@ -570,7 +570,7 @@ static SOC_ENUM_SINGLE_DECL(hpf_mode, WM8904_ADC_DIGITAL_0, 5,
|
||||
static int wm8904_adc_osr_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int val;
|
||||
int ret;
|
||||
|
||||
|
@ -390,7 +390,7 @@ static int wm8955_set_deemph(struct snd_soc_codec *codec)
|
||||
static int wm8955_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8955->deemph;
|
||||
@ -400,7 +400,7 @@ static int wm8955_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int wm8955_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8955_priv *wm8955 = snd_soc_codec_get_drvdata(codec);
|
||||
int deemph = ucontrol->value.enumerated.item[0];
|
||||
|
||||
|
@ -456,7 +456,7 @@ static int wm8958_dsp2_busy(struct wm8994_priv *wm8994, int aif)
|
||||
static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8994 *control = wm8994->wm8994;
|
||||
int value = ucontrol->value.integer.value[0];
|
||||
@ -478,7 +478,7 @@ static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol,
|
||||
static int wm8958_get_mbc_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8994->mbc_cfg;
|
||||
@ -500,7 +500,7 @@ static int wm8958_mbc_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int mbc = kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = wm8994->mbc_ena[mbc];
|
||||
@ -512,7 +512,7 @@ static int wm8958_mbc_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int mbc = kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
if (wm8994->mbc_ena[mbc] == ucontrol->value.integer.value[0])
|
||||
@ -546,7 +546,7 @@ static int wm8958_mbc_put(struct snd_kcontrol *kcontrol,
|
||||
static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8994 *control = wm8994->wm8994;
|
||||
int value = ucontrol->value.integer.value[0];
|
||||
@ -568,7 +568,7 @@ static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol,
|
||||
static int wm8958_get_vss_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8994->vss_cfg;
|
||||
@ -579,7 +579,7 @@ static int wm8958_get_vss_enum(struct snd_kcontrol *kcontrol,
|
||||
static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8994 *control = wm8994->wm8994;
|
||||
int value = ucontrol->value.integer.value[0];
|
||||
@ -601,7 +601,7 @@ static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol,
|
||||
static int wm8958_get_vss_hpf_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8994->vss_hpf_cfg;
|
||||
@ -623,7 +623,7 @@ static int wm8958_vss_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int vss = kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = wm8994->vss_ena[vss];
|
||||
@ -635,7 +635,7 @@ static int wm8958_vss_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int vss = kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
if (wm8994->vss_ena[vss] == ucontrol->value.integer.value[0])
|
||||
@ -684,7 +684,7 @@ static int wm8958_hpf_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int hpf = kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
if (hpf < 3)
|
||||
@ -699,7 +699,7 @@ static int wm8958_hpf_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int hpf = kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
if (hpf < 3) {
|
||||
@ -746,7 +746,7 @@ static int wm8958_hpf_put(struct snd_kcontrol *kcontrol,
|
||||
static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8994 *control = wm8994->wm8994;
|
||||
int value = ucontrol->value.integer.value[0];
|
||||
@ -768,7 +768,7 @@ static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol,
|
||||
static int wm8958_get_enh_eq_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8994->enh_eq_cfg;
|
||||
@ -790,7 +790,7 @@ static int wm8958_enh_eq_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int eq = kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = wm8994->enh_eq_ena[eq];
|
||||
@ -802,7 +802,7 @@ static int wm8958_enh_eq_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int eq = kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
if (wm8994->enh_eq_ena[eq] == ucontrol->value.integer.value[0])
|
||||
|
@ -178,7 +178,7 @@ static int wm8960_set_deemph(struct snd_soc_codec *codec)
|
||||
static int wm8960_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.enumerated.item[0] = wm8960->deemph;
|
||||
@ -188,7 +188,7 @@ static int wm8960_get_deemph(struct snd_kcontrol *kcontrol,
|
||||
static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
|
||||
int deemph = ucontrol->value.enumerated.item[0];
|
||||
|
||||
|
@ -1552,7 +1552,7 @@ static int wm8962_dsp2_ena_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int shift = kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
ucontrol->value.integer.value[0] = !!(wm8962->dsp2_ena & 1 << shift);
|
||||
@ -1564,7 +1564,7 @@ static int wm8962_dsp2_ena_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
int shift = kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
|
||||
int old = wm8962->dsp2_ena;
|
||||
int ret = 0;
|
||||
@ -1602,7 +1602,7 @@ out:
|
||||
static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
int ret;
|
||||
|
||||
/* Apply the update (if any) */
|
||||
@ -1632,7 +1632,7 @@ static int wm8962_put_hp_sw(struct snd_kcontrol *kcontrol,
|
||||
static int wm8962_put_spk_sw(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
int ret;
|
||||
|
||||
/* Apply the update (if any) */
|
||||
|
@ -552,7 +552,7 @@ static const struct snd_soc_dapm_route wm8983_audio_map[] = {
|
||||
static int eqmode_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg;
|
||||
|
||||
reg = snd_soc_read(codec, WM8983_EQ1_LOW_SHELF);
|
||||
@ -567,7 +567,7 @@ static int eqmode_get(struct snd_kcontrol *kcontrol,
|
||||
static int eqmode_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int regpwr2, regpwr3;
|
||||
unsigned int reg_eq;
|
||||
|
||||
|
@ -526,7 +526,7 @@ static const struct snd_soc_dapm_route wm8985_dapm_routes[] = {
|
||||
static int eqmode_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg;
|
||||
|
||||
reg = snd_soc_read(codec, WM8985_EQ1_LOW_SHELF);
|
||||
@ -541,7 +541,7 @@ static int eqmode_get(struct snd_kcontrol *kcontrol,
|
||||
static int eqmode_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int regpwr2, regpwr3;
|
||||
unsigned int reg_eq;
|
||||
|
||||
|
@ -132,7 +132,7 @@ static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0);
|
||||
static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
int reg = mc->reg;
|
||||
|
@ -154,7 +154,7 @@ static const unsigned int out_sidetone_tlv[] = {
|
||||
static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
int reg = kcontrol->private_value & 0xff;
|
||||
int ret;
|
||||
u16 val;
|
||||
|
@ -298,7 +298,7 @@ static int wm8994_put_drc_sw(struct snd_kcontrol *kcontrol,
|
||||
{
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
int mask, ret;
|
||||
|
||||
/* Can't enable both ADC and DAC paths simultaneously */
|
||||
@ -355,7 +355,7 @@ static int wm8994_get_drc(const char *name)
|
||||
static int wm8994_put_drc_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8994 *control = wm8994->wm8994;
|
||||
struct wm8994_pdata *pdata = &control->pdata;
|
||||
@ -378,7 +378,7 @@ static int wm8994_put_drc_enum(struct snd_kcontrol *kcontrol,
|
||||
static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
int drc = wm8994_get_drc(kcontrol->id.name);
|
||||
|
||||
@ -462,7 +462,7 @@ static int wm8994_get_retune_mobile_block(const char *name)
|
||||
static int wm8994_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8994 *control = wm8994->wm8994;
|
||||
struct wm8994_pdata *pdata = &control->pdata;
|
||||
@ -485,7 +485,7 @@ static int wm8994_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
|
||||
static int wm8994_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
|
||||
int block = wm8994_get_retune_mobile_block(kcontrol->id.name);
|
||||
|
||||
@ -3999,8 +3999,6 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
|
||||
|
||||
wm8994->hubs.codec = codec;
|
||||
|
||||
snd_soc_codec_set_cache_io(codec, control->regmap);
|
||||
|
||||
mutex_init(&wm8994->accdet_lock);
|
||||
INIT_DELAYED_WORK(&wm8994->jackdet_bootstrap,
|
||||
wm1811_jackdet_bootstrap);
|
||||
@ -4434,11 +4432,19 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct regmap *wm8994_get_regmap(struct device *dev)
|
||||
{
|
||||
struct wm8994 *control = dev_get_drvdata(dev->parent);
|
||||
|
||||
return control->regmap;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_wm8994 = {
|
||||
.probe = wm8994_codec_probe,
|
||||
.remove = wm8994_codec_remove,
|
||||
.suspend = wm8994_codec_suspend,
|
||||
.resume = wm8994_codec_resume,
|
||||
.get_regmap = wm8994_get_regmap,
|
||||
.set_bias_level = wm8994_set_bias_level,
|
||||
};
|
||||
|
||||
|
@ -412,7 +412,7 @@ static int wm8996_get_retune_mobile_block(const char *name)
|
||||
static int wm8996_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
|
||||
struct wm8996_pdata *pdata = &wm8996->pdata;
|
||||
int block = wm8996_get_retune_mobile_block(kcontrol->id.name);
|
||||
@ -434,7 +434,7 @@ static int wm8996_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
|
||||
static int wm8996_get_retune_mobile_enum(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
|
||||
int block = wm8996_get_retune_mobile_block(kcontrol->id.name);
|
||||
|
||||
|
@ -1051,11 +1051,6 @@ static struct snd_soc_dai_driver wm8997_dai[] = {
|
||||
static int wm8997_codec_probe(struct snd_soc_codec *codec)
|
||||
{
|
||||
struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_codec_set_cache_io(codec, priv->core.arizona->regmap);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
arizona_init_spk(codec);
|
||||
|
||||
@ -1086,9 +1081,17 @@ static unsigned int wm8997_digital_vu[] = {
|
||||
ARIZONA_DAC_DIGITAL_VOLUME_5R,
|
||||
};
|
||||
|
||||
static struct regmap *wm8997_get_regmap(struct device *dev)
|
||||
{
|
||||
struct wm8997_priv *priv = dev_get_drvdata(dev);
|
||||
|
||||
return priv->core.arizona->regmap;
|
||||
}
|
||||
|
||||
static struct snd_soc_codec_driver soc_codec_dev_wm8997 = {
|
||||
.probe = wm8997_codec_probe,
|
||||
.remove = wm8997_codec_remove,
|
||||
.get_regmap = wm8997_get_regmap,
|
||||
|
||||
.idle_bias_off = true,
|
||||
|
||||
|
@ -340,7 +340,7 @@ static SOC_ENUM_SINGLE_DECL(speaker_mode, WM9081_ANALOGUE_SPEAKER_2, 6,
|
||||
static int speaker_mode_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg;
|
||||
|
||||
reg = snd_soc_read(codec, WM9081_ANALOGUE_SPEAKER_2);
|
||||
@ -361,7 +361,7 @@ static int speaker_mode_get(struct snd_kcontrol *kcontrol,
|
||||
static int speaker_mode_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
unsigned int reg_pwr = snd_soc_read(codec, WM9081_POWER_MANAGEMENT);
|
||||
unsigned int reg2 = snd_soc_read(codec, WM9081_ANALOGUE_SPEAKER_2);
|
||||
|
||||
|
@ -242,7 +242,7 @@ struct wm_coeff_ctl {
|
||||
static int wm_adsp_fw_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
struct wm_adsp *adsp = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
@ -254,7 +254,7 @@ static int wm_adsp_fw_get(struct snd_kcontrol *kcontrol,
|
||||
static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
|
||||
struct wm_adsp *adsp = snd_soc_codec_get_drvdata(codec);
|
||||
|
||||
|
@ -337,7 +337,7 @@ static void enable_dc_servo(struct snd_soc_codec *codec)
|
||||
static int wm8993_put_dc_servo(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
|
||||
struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
|
||||
int ret;
|
||||
|
||||
|
@ -136,7 +136,7 @@ static inline unsigned int hsw_ipc_to_mixer(u32 value)
|
||||
static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct hsw_priv_data *pdata =
|
||||
@ -174,7 +174,7 @@ static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol,
|
||||
static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct hsw_priv_data *pdata =
|
||||
@ -206,7 +206,7 @@ static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol,
|
||||
static int hsw_volume_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
u32 volume;
|
||||
@ -231,7 +231,7 @@ static int hsw_volume_put(struct snd_kcontrol *kcontrol,
|
||||
static int hsw_volume_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_kcontrol_chip(kcontrol);
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
unsigned int volume = 0;
|
||||
|
@ -162,8 +162,6 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
|
||||
i, codec_drv->reg_word_size) == val)
|
||||
continue;
|
||||
|
||||
WARN_ON(!snd_soc_codec_writable_register(codec, i));
|
||||
|
||||
ret = snd_soc_write(codec, i, val);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -379,86 +379,24 @@ static void dapm_reset(struct snd_soc_card *card)
|
||||
static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg,
|
||||
unsigned int *value)
|
||||
{
|
||||
if (w->codec) {
|
||||
*value = snd_soc_read(w->codec, reg);
|
||||
return 0;
|
||||
} else if (w->platform) {
|
||||
*value = snd_soc_platform_read(w->platform, reg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
dev_err(w->dapm->dev, "ASoC: no valid widget read method\n");
|
||||
return -1;
|
||||
if (!w->dapm->component)
|
||||
return -EIO;
|
||||
return snd_soc_component_read(w->dapm->component, reg, value);
|
||||
}
|
||||
|
||||
static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg,
|
||||
unsigned int val)
|
||||
static int soc_widget_update_bits(struct snd_soc_dapm_widget *w,
|
||||
int reg, unsigned int mask, unsigned int value)
|
||||
{
|
||||
if (w->codec)
|
||||
return snd_soc_write(w->codec, reg, val);
|
||||
else if (w->platform)
|
||||
return snd_soc_platform_write(w->platform, reg, val);
|
||||
|
||||
dev_err(w->dapm->dev, "ASoC: no valid widget write method\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static inline void soc_widget_lock(struct snd_soc_dapm_widget *w)
|
||||
{
|
||||
if (w->codec && !w->codec->using_regmap)
|
||||
mutex_lock(&w->codec->mutex);
|
||||
else if (w->platform)
|
||||
mutex_lock(&w->platform->mutex);
|
||||
}
|
||||
|
||||
static inline void soc_widget_unlock(struct snd_soc_dapm_widget *w)
|
||||
{
|
||||
if (w->codec && !w->codec->using_regmap)
|
||||
mutex_unlock(&w->codec->mutex);
|
||||
else if (w->platform)
|
||||
mutex_unlock(&w->platform->mutex);
|
||||
if (!w->dapm->component)
|
||||
return -EIO;
|
||||
return snd_soc_component_update_bits_async(w->dapm->component, reg,
|
||||
mask, value);
|
||||
}
|
||||
|
||||
static void soc_dapm_async_complete(struct snd_soc_dapm_context *dapm)
|
||||
{
|
||||
if (dapm->codec && dapm->codec->using_regmap)
|
||||
regmap_async_complete(dapm->codec->control_data);
|
||||
}
|
||||
|
||||
static int soc_widget_update_bits_locked(struct snd_soc_dapm_widget *w,
|
||||
int reg, unsigned int mask, unsigned int value)
|
||||
{
|
||||
bool change;
|
||||
unsigned int old, new;
|
||||
int ret;
|
||||
|
||||
if (w->codec && w->codec->using_regmap) {
|
||||
ret = regmap_update_bits_check_async(w->codec->control_data,
|
||||
reg, mask, value,
|
||||
&change);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
} else {
|
||||
soc_widget_lock(w);
|
||||
ret = soc_widget_read(w, reg, &old);
|
||||
if (ret < 0) {
|
||||
soc_widget_unlock(w);
|
||||
return ret;
|
||||
}
|
||||
|
||||
new = (old & ~mask) | (value & mask);
|
||||
change = old != new;
|
||||
if (change) {
|
||||
ret = soc_widget_write(w, reg, new);
|
||||
if (ret < 0) {
|
||||
soc_widget_unlock(w);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
soc_widget_unlock(w);
|
||||
}
|
||||
|
||||
return change;
|
||||
if (dapm->component)
|
||||
snd_soc_component_async_complete(dapm->component);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1133,7 +1071,7 @@ int dapm_reg_event(struct snd_soc_dapm_widget *w,
|
||||
else
|
||||
val = w->off_val;
|
||||
|
||||
soc_widget_update_bits_locked(w, -(w->reg + 1),
|
||||
soc_widget_update_bits(w, -(w->reg + 1),
|
||||
w->mask << w->shift, val << w->shift);
|
||||
|
||||
return 0;
|
||||
@ -1429,7 +1367,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_card *card,
|
||||
"pop test : Applying 0x%x/0x%x to %x in %dms\n",
|
||||
value, mask, reg, card->pop_time);
|
||||
pop_wait(card->pop_time);
|
||||
soc_widget_update_bits_locked(w, reg, mask, value);
|
||||
soc_widget_update_bits(w, reg, mask, value);
|
||||
}
|
||||
|
||||
list_for_each_entry(w, pending, power_list) {
|
||||
@ -1575,8 +1513,7 @@ static void dapm_widget_update(struct snd_soc_card *card)
|
||||
if (!w)
|
||||
return;
|
||||
|
||||
ret = soc_widget_update_bits_locked(w, update->reg, update->mask,
|
||||
update->val);
|
||||
ret = soc_widget_update_bits(w, update->reg, update->mask, update->val);
|
||||
if (ret < 0)
|
||||
dev_err(w->dapm->dev, "ASoC: %s DAPM update failed: %d\n",
|
||||
w->name, ret);
|
||||
|
@ -17,77 +17,285 @@
|
||||
#include <linux/export.h>
|
||||
#include <sound/soc.h>
|
||||
|
||||
#include <trace/events/asoc.h>
|
||||
|
||||
#ifdef CONFIG_REGMAP
|
||||
static int hw_write(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int value)
|
||||
{
|
||||
return regmap_write(codec->control_data, reg, value);
|
||||
}
|
||||
|
||||
static unsigned int hw_read(struct snd_soc_codec *codec, unsigned int reg)
|
||||
/**
|
||||
* snd_soc_component_read() - Read register value
|
||||
* @component: Component to read from
|
||||
* @reg: Register to read
|
||||
* @val: Pointer to where the read value is stored
|
||||
*
|
||||
* Return: 0 on success, a negative error code otherwise.
|
||||
*/
|
||||
int snd_soc_component_read(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int *val)
|
||||
{
|
||||
int ret;
|
||||
unsigned int val;
|
||||
|
||||
ret = regmap_read(codec->control_data, reg, &val);
|
||||
if (ret == 0)
|
||||
return val;
|
||||
if (component->regmap)
|
||||
ret = regmap_read(component->regmap, reg, val);
|
||||
else if (component->read)
|
||||
ret = component->read(component, reg, val);
|
||||
else
|
||||
return -1;
|
||||
ret = -EIO;
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_read);
|
||||
|
||||
/**
|
||||
* snd_soc_component_write() - Write register value
|
||||
* @component: Component to write to
|
||||
* @reg: Register to write
|
||||
* @val: Value to write to the register
|
||||
*
|
||||
* Return: 0 on success, a negative error code otherwise.
|
||||
*/
|
||||
int snd_soc_component_write(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int val)
|
||||
{
|
||||
if (component->regmap)
|
||||
return regmap_write(component->regmap, reg, val);
|
||||
else if (component->write)
|
||||
return component->write(component, reg, val);
|
||||
else
|
||||
return -EIO;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_write);
|
||||
|
||||
static int snd_soc_component_update_bits_legacy(
|
||||
struct snd_soc_component *component, unsigned int reg,
|
||||
unsigned int mask, unsigned int val, bool *change)
|
||||
{
|
||||
unsigned int old, new;
|
||||
int ret;
|
||||
|
||||
if (!component->read || !component->write)
|
||||
return -EIO;
|
||||
|
||||
mutex_lock(&component->io_mutex);
|
||||
|
||||
ret = component->read(component, reg, &old);
|
||||
if (ret < 0)
|
||||
goto out_unlock;
|
||||
|
||||
new = (old & ~mask) | (val & mask);
|
||||
*change = old != new;
|
||||
if (*change)
|
||||
ret = component->write(component, reg, new);
|
||||
out_unlock:
|
||||
mutex_unlock(&component->io_mutex);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* snd_soc_codec_set_cache_io: Set up standard I/O functions.
|
||||
* snd_soc_component_update_bits() - Perform read/modify/write cycle
|
||||
* @component: Component to update
|
||||
* @reg: Register to update
|
||||
* @mask: Mask that specifies which bits to update
|
||||
* @val: New value for the bits specified by mask
|
||||
*
|
||||
* @codec: CODEC to configure.
|
||||
* @map: Register map to write to
|
||||
*
|
||||
* Register formats are frequently shared between many I2C and SPI
|
||||
* devices. In order to promote code reuse the ASoC core provides
|
||||
* some standard implementations of CODEC read and write operations
|
||||
* which can be set up using this function.
|
||||
*
|
||||
* The caller is responsible for allocating and initialising the
|
||||
* actual cache.
|
||||
*
|
||||
* Note that at present this code cannot be used by CODECs with
|
||||
* volatile registers.
|
||||
* Return: 1 if the operation was successful and the value of the register
|
||||
* changed, 0 if the operation was successful, but the value did not change.
|
||||
* Returns a negative error code otherwise.
|
||||
*/
|
||||
int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
|
||||
struct regmap *regmap)
|
||||
int snd_soc_component_update_bits(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int mask, unsigned int val)
|
||||
{
|
||||
bool change;
|
||||
int ret;
|
||||
|
||||
if (component->regmap)
|
||||
ret = regmap_update_bits_check(component->regmap, reg, mask,
|
||||
val, &change);
|
||||
else
|
||||
ret = snd_soc_component_update_bits_legacy(component, reg,
|
||||
mask, val, &change);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return change;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_update_bits);
|
||||
|
||||
/**
|
||||
* snd_soc_component_update_bits_async() - Perform asynchronous
|
||||
* read/modify/write cycle
|
||||
* @component: Component to update
|
||||
* @reg: Register to update
|
||||
* @mask: Mask that specifies which bits to update
|
||||
* @val: New value for the bits specified by mask
|
||||
*
|
||||
* This function is similar to snd_soc_component_update_bits(), but the update
|
||||
* operation is scheduled asynchronously. This means it may not be completed
|
||||
* when the function returns. To make sure that all scheduled updates have been
|
||||
* completed snd_soc_component_async_complete() must be called.
|
||||
*
|
||||
* Return: 1 if the operation was successful and the value of the register
|
||||
* changed, 0 if the operation was successful, but the value did not change.
|
||||
* Returns a negative error code otherwise.
|
||||
*/
|
||||
int snd_soc_component_update_bits_async(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int mask, unsigned int val)
|
||||
{
|
||||
bool change;
|
||||
int ret;
|
||||
|
||||
if (component->regmap)
|
||||
ret = regmap_update_bits_check_async(component->regmap, reg,
|
||||
mask, val, &change);
|
||||
else
|
||||
ret = snd_soc_component_update_bits_legacy(component, reg,
|
||||
mask, val, &change);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return change;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_update_bits_async);
|
||||
|
||||
/**
|
||||
* snd_soc_component_async_complete() - Ensure asynchronous I/O has completed
|
||||
* @component: Component for which to wait
|
||||
*
|
||||
* This function blocks until all asynchronous I/O which has previously been
|
||||
* scheduled using snd_soc_component_update_bits_async() has completed.
|
||||
*/
|
||||
void snd_soc_component_async_complete(struct snd_soc_component *component)
|
||||
{
|
||||
if (component->regmap)
|
||||
regmap_async_complete(component->regmap);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_async_complete);
|
||||
|
||||
/**
|
||||
* snd_soc_component_test_bits - Test register for change
|
||||
* @component: component
|
||||
* @reg: Register to test
|
||||
* @mask: Mask that specifies which bits to test
|
||||
* @value: Value to test against
|
||||
*
|
||||
* Tests a register with a new value and checks if the new value is
|
||||
* different from the old value.
|
||||
*
|
||||
* Return: 1 for change, otherwise 0.
|
||||
*/
|
||||
int snd_soc_component_test_bits(struct snd_soc_component *component,
|
||||
unsigned int reg, unsigned int mask, unsigned int value)
|
||||
{
|
||||
unsigned int old, new;
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_component_read(component, reg, &old);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
new = (old & ~mask) | value;
|
||||
return old != new;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_test_bits);
|
||||
|
||||
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg)
|
||||
{
|
||||
unsigned int val;
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_component_read(&codec->component, reg, &val);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
return val;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_read);
|
||||
|
||||
int snd_soc_write(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int val)
|
||||
{
|
||||
return snd_soc_component_write(&codec->component, reg, val);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_write);
|
||||
|
||||
/**
|
||||
* snd_soc_update_bits - update codec register bits
|
||||
* @codec: audio codec
|
||||
* @reg: codec register
|
||||
* @mask: register mask
|
||||
* @value: new value
|
||||
*
|
||||
* Writes new register value.
|
||||
*
|
||||
* Returns 1 for change, 0 for no change, or negative error code.
|
||||
*/
|
||||
int snd_soc_update_bits(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int mask, unsigned int value)
|
||||
{
|
||||
return snd_soc_component_update_bits(&codec->component, reg, mask,
|
||||
value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_update_bits);
|
||||
|
||||
/**
|
||||
* snd_soc_test_bits - test register for change
|
||||
* @codec: audio codec
|
||||
* @reg: codec register
|
||||
* @mask: register mask
|
||||
* @value: new value
|
||||
*
|
||||
* Tests a register with a new value and checks if the new value is
|
||||
* different from the old value.
|
||||
*
|
||||
* Returns 1 for change else 0.
|
||||
*/
|
||||
int snd_soc_test_bits(struct snd_soc_codec *codec, unsigned int reg,
|
||||
unsigned int mask, unsigned int value)
|
||||
{
|
||||
return snd_soc_component_test_bits(&codec->component, reg, mask, value);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_test_bits);
|
||||
|
||||
int snd_soc_platform_read(struct snd_soc_platform *platform,
|
||||
unsigned int reg)
|
||||
{
|
||||
unsigned int val;
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_component_read(&platform->component, reg, &val);
|
||||
if (ret < 0)
|
||||
return -1;
|
||||
|
||||
return val;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_platform_read);
|
||||
|
||||
int snd_soc_platform_write(struct snd_soc_platform *platform,
|
||||
unsigned int reg, unsigned int val)
|
||||
{
|
||||
return snd_soc_component_write(&platform->component, reg, val);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_platform_write);
|
||||
|
||||
/**
|
||||
* snd_soc_component_init_io() - Initialize regmap IO
|
||||
*
|
||||
* @component: component to initialize
|
||||
* @regmap: regmap instance to use for IO operations
|
||||
*
|
||||
* Return: 0 on success, a negative error code otherwise
|
||||
*/
|
||||
int snd_soc_component_init_io(struct snd_soc_component *component,
|
||||
struct regmap *regmap)
|
||||
{
|
||||
int ret;
|
||||
|
||||
/* Device has made its own regmap arrangements */
|
||||
if (!regmap)
|
||||
codec->control_data = dev_get_regmap(codec->dev, NULL);
|
||||
else
|
||||
codec->control_data = regmap;
|
||||
return -EINVAL;
|
||||
|
||||
if (IS_ERR(codec->control_data))
|
||||
return PTR_ERR(codec->control_data);
|
||||
|
||||
codec->write = hw_write;
|
||||
codec->read = hw_read;
|
||||
|
||||
ret = regmap_get_val_bytes(codec->control_data);
|
||||
ret = regmap_get_val_bytes(regmap);
|
||||
/* Errors are legitimate for non-integer byte
|
||||
* multiples */
|
||||
if (ret > 0)
|
||||
codec->val_bytes = ret;
|
||||
component->val_bytes = ret;
|
||||
|
||||
codec->using_regmap = true;
|
||||
component->regmap = regmap;
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);
|
||||
#else
|
||||
int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
|
||||
struct regmap *regmap)
|
||||
{
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(snd_soc_codec_set_cache_io);
|
||||
#endif
|
||||
EXPORT_SYMBOL_GPL(snd_soc_component_init_io);
|
||||
|
Loading…
Reference in New Issue
Block a user