Lines Matching +full:audio +full:- +full:gain +full:- +full:db
1 // SPDX-License-Identifier: GPL-2.0
3 * For the STS-Thompson TDA7432 audio processor chip
5 * Handles audio functions: volume, balance, tone, loudness
18 * debug - set to 1 if you'd like to see debug messages
21 * loudness - set between 0 and 15 for varying degrees of loudness effect
23 * maxvol - set maximum volume to +20db (1), default is 0db(0)
37 #include <media/v4l2-device.h>
38 #include <media/v4l2-ioctl.h>
39 #include <media/v4l2-ctrls.h>
46 MODULE_DESCRIPTION("bttv driver for the tda7432 audio processor chip");
57 MODULE_PARM_DESC(maxvol, "Set maximum volume to +20dB(0) else +0dB(1). Default is +20dB(0).");
84 return &container_of(ctrl->handler, struct tda7432, hdl)->sd; in to_sd()
87 /* The TDA7432 is made by STS-Thompson
91 * TDA7432: I2C-bus controlled basic audio processor
93 * The TDA7432 controls basic audio functions like volume, balance,
114 /* Many of these not used - just for documentation */
116 /* Subaddress 0x00 - Input selection and bass control */
119 * 0x00 - Stereo input
120 * 0x02 - Mono input
121 * 0x03 - Mute (Using Attenuators Plays better with modules)
122 * Mono probably isn't used - I'm guessing only the stereo
125 * Bit 3 controls bass cut: 0/1 is non-symmetric/symmetric bass cut
136 /* Subaddress 0x01 - Volume */
138 /* Lower 7 bits control volume from -79dB to +32dB in 1dB steps
139 * Recommended maximum is +20 dB
141 * +32dB: 0x00
142 * +20dB: 0x0c
143 * 0dB: 0x20
144 * -79dB: 0x6f
153 /* Subaddress 0x02 - Tone control */
155 /* Bits 0,1,2 control absolute treble gain from 0dB to 14dB
156 * 0x0 is 14dB, 0x7 is 0dB
158 * Bit 3 controls treble attenuation/gain (sign)
159 * 1 = gain (+)
160 * 0 = attenuation (-)
162 * Bits 4,5,6 control absolute bass gain from 0dB to 14dB
164 * 0x0 << 4 is 14dB, 0x7 is 0dB
166 * Bit 7 controls bass attenuation/gain (sign)
167 * 1 << 7 = gain (+)
168 * 0 << 7 = attenuation (-)
171 * 1 1 0 1 0 1 0 1 is +4dB bass, -4dB treble
182 /* Subaddress 0x03 - Left Front attenuation */
183 /* Subaddress 0x04 - Left Rear attenuation */
184 /* Subaddress 0x05 - Right Front attenuation */
185 /* Subaddress 0x06 - Right Rear attenuation */
187 /* Bits 0,1,2,3,4 control attenuation from 0dB to -37.5dB
188 * in 1.5dB steps.
190 * 0x00 is 0dB
191 * 0x1f is -37.5dB
202 /* Subaddress 0x07 - Loudness Control */
204 /* Bits 0,1,2,3 control loudness from 0dB to -15dB in 1dB steps
207 * 0x0 is 0dB
208 * 0xf is -15dB
232 return -1; in tda7432_write()
257 return -1; in tda7432_set()
267 v4l2_ctrl_handler_log_status(&state->hdl, sd->name); in tda7432_log_status()
278 switch (ctrl->id) { in tda7432_s_ctrl()
280 if (t->balance->val < 0) { in tda7432_s_ctrl()
282 rr = rf = -t->balance->val; in tda7432_s_ctrl()
284 } else if (t->balance->val > 0) { in tda7432_s_ctrl()
287 lr = lf = t->balance->val; in tda7432_s_ctrl()
293 if (t->mute->val) { in tda7432_s_ctrl()
306 volume = 0x6f - ctrl->val; in tda7432_s_ctrl()
313 bass = t->bass->val; in tda7432_s_ctrl()
314 treble = t->treble->val; in tda7432_s_ctrl()
316 bass = 14 - (bass - 8); in tda7432_s_ctrl()
318 treble = 14 - (treble - 8); in tda7432_s_ctrl()
323 return -EINVAL; in tda7432_s_ctrl()
326 /* ----------------------------------------------------------------------- */
340 /* ----------------------------------------------------------------------- */
352 client->addr << 1, client->adapter->name); in tda7432_probe()
354 t = devm_kzalloc(&client->dev, sizeof(*t), GFP_KERNEL); in tda7432_probe()
356 return -ENOMEM; in tda7432_probe()
357 sd = &t->sd; in tda7432_probe()
359 v4l2_ctrl_handler_init(&t->hdl, 5); in tda7432_probe()
360 v4l2_ctrl_new_std(&t->hdl, &tda7432_ctrl_ops, in tda7432_probe()
362 t->mute = v4l2_ctrl_new_std(&t->hdl, &tda7432_ctrl_ops, in tda7432_probe()
364 t->balance = v4l2_ctrl_new_std(&t->hdl, &tda7432_ctrl_ops, in tda7432_probe()
365 V4L2_CID_AUDIO_BALANCE, -31, 31, 1, 0); in tda7432_probe()
366 t->bass = v4l2_ctrl_new_std(&t->hdl, &tda7432_ctrl_ops, in tda7432_probe()
368 t->treble = v4l2_ctrl_new_std(&t->hdl, &tda7432_ctrl_ops, in tda7432_probe()
370 sd->ctrl_handler = &t->hdl; in tda7432_probe()
371 if (t->hdl.error) { in tda7432_probe()
372 int err = t->hdl.error; in tda7432_probe()
374 v4l2_ctrl_handler_free(&t->hdl); in tda7432_probe()
377 v4l2_ctrl_cluster(2, &t->bass); in tda7432_probe()
378 v4l2_ctrl_cluster(2, &t->mute); in tda7432_probe()
379 v4l2_ctrl_handler_setup(&t->hdl); in tda7432_probe()
399 v4l2_ctrl_handler_free(&t->hdl); in tda7432_remove()