@@ -114,64 +114,6 @@ static int tpa6130a2_power(u8 power)
114
114
return ret ;
115
115
}
116
116
117
- static int tpa6130a2_get_volsw (struct snd_kcontrol * kcontrol ,
118
- struct snd_ctl_elem_value * ucontrol )
119
- {
120
- struct soc_mixer_control * mc =
121
- (struct soc_mixer_control * )kcontrol -> private_value ;
122
- struct tpa6130a2_data * data ;
123
- unsigned int reg = mc -> reg ;
124
- unsigned int shift = mc -> shift ;
125
- int max = mc -> max , val ;
126
- unsigned int mask = (1 << fls (max )) - 1 ;
127
- unsigned int invert = mc -> invert ;
128
-
129
- if (WARN_ON (!tpa6130a2_client ))
130
- return - EINVAL ;
131
- data = i2c_get_clientdata (tpa6130a2_client );
132
-
133
- mutex_lock (& data -> mutex );
134
-
135
- regmap_read (data -> regmap , reg , & val );
136
- ucontrol -> value .integer .value [0 ] = (val >> shift ) & mask ;
137
-
138
- if (invert )
139
- ucontrol -> value .integer .value [0 ] =
140
- max - ucontrol -> value .integer .value [0 ];
141
-
142
- mutex_unlock (& data -> mutex );
143
- return 0 ;
144
- }
145
-
146
- static int tpa6130a2_put_volsw (struct snd_kcontrol * kcontrol ,
147
- struct snd_ctl_elem_value * ucontrol )
148
- {
149
- struct soc_mixer_control * mc =
150
- (struct soc_mixer_control * )kcontrol -> private_value ;
151
- struct tpa6130a2_data * data ;
152
- unsigned int reg = mc -> reg ;
153
- unsigned int shift = mc -> shift ;
154
- int max = mc -> max ;
155
- unsigned int mask = (1 << fls (max )) - 1 ;
156
- unsigned int invert = mc -> invert ;
157
- unsigned int val = (ucontrol -> value .integer .value [0 ] & mask );
158
- bool change ;
159
-
160
- if (WARN_ON (!tpa6130a2_client ))
161
- return - EINVAL ;
162
- data = i2c_get_clientdata (tpa6130a2_client );
163
-
164
- if (invert )
165
- val = max - val ;
166
-
167
- mutex_lock (& data -> mutex );
168
- regmap_update_bits_check (data -> regmap , reg , mask << shift , val << shift ,
169
- & change );
170
- mutex_unlock (& data -> mutex );
171
-
172
- return change ;
173
- }
174
-
175
117
/*
176
118
* TPA6130 volume. From -59.5 to 4 dB with increasing step size when going
177
119
* down in gain.
@@ -190,9 +132,8 @@ static const DECLARE_TLV_DB_RANGE(tpa6130_tlv,
190
132
);
191
133
192
134
static const struct snd_kcontrol_new tpa6130a2_controls [] = {
193
- SOC_SINGLE_EXT_TLV ("Headphone Playback Volume ",
135
+ SOC_SINGLE_TLV ("Headphone Playback Volume ",
194
136
TPA6130A2_REG_VOL_MUTE , 0 , 0x3f , 0 ,
195
- tpa6130a2_get_volsw , tpa6130a2_put_volsw ,
196
137
tpa6130_tlv ),
197
138
};
198
139
@@ -203,9 +144,8 @@ static const DECLARE_TLV_DB_RANGE(tpa6140_tlv,
203
144
);
204
145
205
146
static const struct snd_kcontrol_new tpa6140a2_controls [] = {
206
- SOC_SINGLE_EXT_TLV ("Headphone Playback Volume ",
147
+ SOC_SINGLE_TLV ("Headphone Playback Volume ",
207
148
TPA6130A2_REG_VOL_MUTE , 1 , 0x1f , 0 ,
208
- tpa6130a2_get_volsw , tpa6130a2_put_volsw ,
209
149
tpa6140_tlv ),
210
150
};
211
151
0 commit comments