aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/msp3400-driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/msp3400-driver.c')
-rw-r--r--drivers/media/video/msp3400-driver.c40
1 files changed, 15 insertions, 25 deletions
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 9e8e06cfe5c6..e9df3cb02cc1 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -56,7 +56,7 @@
56#include <linux/videodev2.h> 56#include <linux/videodev2.h>
57#include <media/v4l2-device.h> 57#include <media/v4l2-device.h>
58#include <media/v4l2-ioctl.h> 58#include <media/v4l2-ioctl.h>
59#include <media/v4l2-i2c-drv-legacy.h> 59#include <media/v4l2-i2c-drv.h>
60#include <media/msp3400.h> 60#include <media/msp3400.h>
61#include <media/tvaudio.h> 61#include <media/tvaudio.h>
62#include "msp3400-driver.h" 62#include "msp3400-driver.h"
@@ -108,10 +108,6 @@ MODULE_PARM_DESC(dolby, "Activates Dolby processsing");
108/* DSP unit subaddress */ 108/* DSP unit subaddress */
109#define I2C_MSP_DSP 0x12 109#define I2C_MSP_DSP 0x12
110 110
111/* Addresses to scan */
112static unsigned short normal_i2c[] = { 0x80 >> 1, 0x88 >> 1, I2C_CLIENT_END };
113
114I2C_CLIENT_INSMOD;
115 111
116/* ----------------------------------------------------------------------- */ 112/* ----------------------------------------------------------------------- */
117/* functions for talking to the MSP3400C Sound processor */ 113/* functions for talking to the MSP3400C Sound processor */
@@ -509,25 +505,26 @@ static int msp_s_std(struct v4l2_subdev *sd, v4l2_std_id id)
509 return 0; 505 return 0;
510} 506}
511 507
512static int msp_s_routing(struct v4l2_subdev *sd, const struct v4l2_routing *rt) 508static int msp_s_routing(struct v4l2_subdev *sd,
509 u32 input, u32 output, u32 config)
513{ 510{
514 struct msp_state *state = to_state(sd); 511 struct msp_state *state = to_state(sd);
515 struct i2c_client *client = v4l2_get_subdevdata(sd); 512 struct i2c_client *client = v4l2_get_subdevdata(sd);
516 int tuner = (rt->input >> 3) & 1; 513 int tuner = (input >> 3) & 1;
517 int sc_in = rt->input & 0x7; 514 int sc_in = input & 0x7;
518 int sc1_out = rt->output & 0xf; 515 int sc1_out = output & 0xf;
519 int sc2_out = (rt->output >> 4) & 0xf; 516 int sc2_out = (output >> 4) & 0xf;
520 u16 val, reg; 517 u16 val, reg;
521 int i; 518 int i;
522 int extern_input = 1; 519 int extern_input = 1;
523 520
524 if (state->routing.input == rt->input && 521 if (state->route_in == input && state->route_out == output)
525 state->routing.output == rt->output)
526 return 0; 522 return 0;
527 state->routing = *rt; 523 state->route_in = input;
524 state->route_out = output;
528 /* check if the tuner input is used */ 525 /* check if the tuner input is used */
529 for (i = 0; i < 5; i++) { 526 for (i = 0; i < 5; i++) {
530 if (((rt->input >> (4 + i * 4)) & 0xf) == 0) 527 if (((input >> (4 + i * 4)) & 0xf) == 0)
531 extern_input = 0; 528 extern_input = 0;
532 } 529 }
533 state->mode = extern_input ? MSP_MODE_EXTERN : MSP_MODE_AM_DETECT; 530 state->mode = extern_input ? MSP_MODE_EXTERN : MSP_MODE_AM_DETECT;
@@ -677,7 +674,7 @@ static int msp_log_status(struct v4l2_subdev *sd)
677 } 674 }
678 v4l_info(client, "Audmode: 0x%04x\n", state->audmode); 675 v4l_info(client, "Audmode: 0x%04x\n", state->audmode);
679 v4l_info(client, "Routing: 0x%08x (input) 0x%08x (output)\n", 676 v4l_info(client, "Routing: 0x%08x (input) 0x%08x (output)\n",
680 state->routing.input, state->routing.output); 677 state->route_in, state->route_out);
681 v4l_info(client, "ACB: 0x%04x\n", state->acb); 678 v4l_info(client, "ACB: 0x%04x\n", state->acb);
682 return 0; 679 return 0;
683} 680}
@@ -696,11 +693,6 @@ static int msp_resume(struct i2c_client *client)
696 return 0; 693 return 0;
697} 694}
698 695
699static int msp_command(struct i2c_client *client, unsigned cmd, void *arg)
700{
701 return v4l2_subdev_command(i2c_get_clientdata(client), cmd, arg);
702}
703
704/* ----------------------------------------------------------------------- */ 696/* ----------------------------------------------------------------------- */
705 697
706static const struct v4l2_subdev_core_ops msp_core_ops = { 698static const struct v4l2_subdev_core_ops msp_core_ops = {
@@ -709,6 +701,7 @@ static const struct v4l2_subdev_core_ops msp_core_ops = {
709 .g_ctrl = msp_g_ctrl, 701 .g_ctrl = msp_g_ctrl,
710 .s_ctrl = msp_s_ctrl, 702 .s_ctrl = msp_s_ctrl,
711 .queryctrl = msp_queryctrl, 703 .queryctrl = msp_queryctrl,
704 .s_std = msp_s_std,
712}; 705};
713 706
714static const struct v4l2_subdev_tuner_ops msp_tuner_ops = { 707static const struct v4l2_subdev_tuner_ops msp_tuner_ops = {
@@ -716,7 +709,6 @@ static const struct v4l2_subdev_tuner_ops msp_tuner_ops = {
716 .g_tuner = msp_g_tuner, 709 .g_tuner = msp_g_tuner,
717 .s_tuner = msp_s_tuner, 710 .s_tuner = msp_s_tuner,
718 .s_radio = msp_s_radio, 711 .s_radio = msp_s_radio,
719 .s_std = msp_s_std,
720}; 712};
721 713
722static const struct v4l2_subdev_audio_ops msp_audio_ops = { 714static const struct v4l2_subdev_audio_ops msp_audio_ops = {
@@ -770,8 +762,8 @@ static int msp_probe(struct i2c_client *client, const struct i2c_device_id *id)
770 state->i2s_mode = 0; 762 state->i2s_mode = 0;
771 init_waitqueue_head(&state->wq); 763 init_waitqueue_head(&state->wq);
772 /* These are the reset input/output positions */ 764 /* These are the reset input/output positions */
773 state->routing.input = MSP_INPUT_DEFAULT; 765 state->route_in = MSP_INPUT_DEFAULT;
774 state->routing.output = MSP_OUTPUT_DEFAULT; 766 state->route_out = MSP_OUTPUT_DEFAULT;
775 767
776 state->rev1 = msp_read_dsp(client, 0x1e); 768 state->rev1 = msp_read_dsp(client, 0x1e);
777 if (state->rev1 != -1) 769 if (state->rev1 != -1)
@@ -925,8 +917,6 @@ MODULE_DEVICE_TABLE(i2c, msp_id);
925 917
926static struct v4l2_i2c_driver_data v4l2_i2c_data = { 918static struct v4l2_i2c_driver_data v4l2_i2c_data = {
927 .name = "msp3400", 919 .name = "msp3400",
928 .driverid = I2C_DRIVERID_MSP3400,
929 .command = msp_command,
930 .probe = msp_probe, 920 .probe = msp_probe,
931 .remove = msp_remove, 921 .remove = msp_remove,
932 .suspend = msp_suspend, 922 .suspend = msp_suspend,