Lines Matching +full:left +full:- +full:most

1 // SPDX-License-Identifier: GPL-2.0
3 * For the STS-Thompson TDA7432 audio processor chip
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>
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
95 * output (for front and rear). Since most vidcap cards probably
105 #define TDA7432_LF 0x03 /* Attenuation LF (Left Front) */
106 #define TDA7432_LR 0x04 /* Attenuation LR (Left Rear) */
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
123 * input is connected on most cards, so we'll set it to 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
144 * -79dB: 0x6f
153 /* Subaddress 0x02 - Tone control */
160 * 0 = attenuation (-)
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
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
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()
281 /* shifted to left, attenuate right */ 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()
285 /* shifted to right, attenuate left */ 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()