diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-03-30 05:26:40 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:43:49 -0400 |
commit | df1d5ed8a81565b78d45fbdffb6561c75c75ec0d (patch) | |
tree | d153ca216a5a7633e741a2240ad2391ff61202ed /drivers/media/video/cx25840/cx25840-audio.c | |
parent | 2c26976d726838878eb8dd1bc91f84df38a05143 (diff) |
V4L/DVB (11309): cx25840: cleanup: remove intermediate 'ioctl' step
The audio and vbi functions where still called through an ioctl-like
interface, even though this is no longer needed with v4l2-subdev. Just
change each 'case' into a proper function and call that directly.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx25840/cx25840-audio.c')
-rw-r--r-- | drivers/media/video/cx25840/cx25840-audio.c | 121 |
1 files changed, 60 insertions, 61 deletions
diff --git a/drivers/media/video/cx25840/cx25840-audio.c b/drivers/media/video/cx25840/cx25840-audio.c index d199d80ea0a3..93d74bee292a 100644 --- a/drivers/media/video/cx25840/cx25840-audio.c +++ b/drivers/media/video/cx25840/cx25840-audio.c | |||
@@ -363,75 +363,74 @@ static void set_mute(struct i2c_client *client, int mute) | |||
363 | } | 363 | } |
364 | } | 364 | } |
365 | 365 | ||
366 | int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg) | 366 | int cx25840_s_clock_freq(struct v4l2_subdev *sd, u32 freq) |
367 | { | 367 | { |
368 | struct cx25840_state *state = to_state(i2c_get_clientdata(client)); | 368 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
369 | struct v4l2_control *ctrl = arg; | 369 | struct cx25840_state *state = to_state(sd); |
370 | int retval; | 370 | int retval; |
371 | 371 | ||
372 | switch (cmd) { | 372 | if (!state->is_cx25836) |
373 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: | 373 | cx25840_and_or(client, 0x810, ~0x1, 1); |
374 | if (!state->is_cx25836) | 374 | if (state->aud_input != CX25840_AUDIO_SERIAL) { |
375 | cx25840_and_or(client, 0x810, ~0x1, 1); | 375 | cx25840_and_or(client, 0x803, ~0x10, 0); |
376 | if (state->aud_input != CX25840_AUDIO_SERIAL) { | 376 | cx25840_write(client, 0x8d3, 0x1f); |
377 | cx25840_and_or(client, 0x803, ~0x10, 0); | 377 | } |
378 | cx25840_write(client, 0x8d3, 0x1f); | 378 | retval = set_audclk_freq(client, freq); |
379 | } | 379 | if (state->aud_input != CX25840_AUDIO_SERIAL) |
380 | retval = set_audclk_freq(client, *(u32 *)arg); | 380 | cx25840_and_or(client, 0x803, ~0x10, 0x10); |
381 | if (state->aud_input != CX25840_AUDIO_SERIAL) { | 381 | if (!state->is_cx25836) |
382 | cx25840_and_or(client, 0x803, ~0x10, 0x10); | 382 | cx25840_and_or(client, 0x810, ~0x1, 0); |
383 | } | 383 | return retval; |
384 | if (!state->is_cx25836) | 384 | } |
385 | cx25840_and_or(client, 0x810, ~0x1, 0); | ||
386 | return retval; | ||
387 | |||
388 | case VIDIOC_G_CTRL: | ||
389 | switch (ctrl->id) { | ||
390 | case V4L2_CID_AUDIO_VOLUME: | ||
391 | ctrl->value = get_volume(client); | ||
392 | break; | ||
393 | case V4L2_CID_AUDIO_BASS: | ||
394 | ctrl->value = get_bass(client); | ||
395 | break; | ||
396 | case V4L2_CID_AUDIO_TREBLE: | ||
397 | ctrl->value = get_treble(client); | ||
398 | break; | ||
399 | case V4L2_CID_AUDIO_BALANCE: | ||
400 | ctrl->value = get_balance(client); | ||
401 | break; | ||
402 | case V4L2_CID_AUDIO_MUTE: | ||
403 | ctrl->value = get_mute(client); | ||
404 | break; | ||
405 | default: | ||
406 | return -EINVAL; | ||
407 | } | ||
408 | break; | ||
409 | 385 | ||
410 | case VIDIOC_S_CTRL: | 386 | int cx25840_audio_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) |
411 | switch (ctrl->id) { | 387 | { |
412 | case V4L2_CID_AUDIO_VOLUME: | 388 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
413 | set_volume(client, ctrl->value); | ||
414 | break; | ||
415 | case V4L2_CID_AUDIO_BASS: | ||
416 | set_bass(client, ctrl->value); | ||
417 | break; | ||
418 | case V4L2_CID_AUDIO_TREBLE: | ||
419 | set_treble(client, ctrl->value); | ||
420 | break; | ||
421 | case V4L2_CID_AUDIO_BALANCE: | ||
422 | set_balance(client, ctrl->value); | ||
423 | break; | ||
424 | case V4L2_CID_AUDIO_MUTE: | ||
425 | set_mute(client, ctrl->value); | ||
426 | break; | ||
427 | default: | ||
428 | return -EINVAL; | ||
429 | } | ||
430 | break; | ||
431 | 389 | ||
390 | switch (ctrl->id) { | ||
391 | case V4L2_CID_AUDIO_VOLUME: | ||
392 | ctrl->value = get_volume(client); | ||
393 | break; | ||
394 | case V4L2_CID_AUDIO_BASS: | ||
395 | ctrl->value = get_bass(client); | ||
396 | break; | ||
397 | case V4L2_CID_AUDIO_TREBLE: | ||
398 | ctrl->value = get_treble(client); | ||
399 | break; | ||
400 | case V4L2_CID_AUDIO_BALANCE: | ||
401 | ctrl->value = get_balance(client); | ||
402 | break; | ||
403 | case V4L2_CID_AUDIO_MUTE: | ||
404 | ctrl->value = get_mute(client); | ||
405 | break; | ||
432 | default: | 406 | default: |
433 | return -EINVAL; | 407 | return -EINVAL; |
434 | } | 408 | } |
409 | return 0; | ||
410 | } | ||
435 | 411 | ||
412 | int cx25840_audio_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | ||
413 | { | ||
414 | struct i2c_client *client = v4l2_get_subdevdata(sd); | ||
415 | |||
416 | switch (ctrl->id) { | ||
417 | case V4L2_CID_AUDIO_VOLUME: | ||
418 | set_volume(client, ctrl->value); | ||
419 | break; | ||
420 | case V4L2_CID_AUDIO_BASS: | ||
421 | set_bass(client, ctrl->value); | ||
422 | break; | ||
423 | case V4L2_CID_AUDIO_TREBLE: | ||
424 | set_treble(client, ctrl->value); | ||
425 | break; | ||
426 | case V4L2_CID_AUDIO_BALANCE: | ||
427 | set_balance(client, ctrl->value); | ||
428 | break; | ||
429 | case V4L2_CID_AUDIO_MUTE: | ||
430 | set_mute(client, ctrl->value); | ||
431 | break; | ||
432 | default: | ||
433 | return -EINVAL; | ||
434 | } | ||
436 | return 0; | 435 | return 0; |
437 | } | 436 | } |