diff options
| -rw-r--r-- | drivers/media/video/cx25840/cx25840-audio.c | 44 | ||||
| -rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 55 | ||||
| -rw-r--r-- | drivers/media/video/cx25840/cx25840-core.h | 22 | ||||
| -rw-r--r-- | drivers/media/video/cx25840/cx25840-firmware.c | 10 |
4 files changed, 71 insertions, 60 deletions
diff --git a/drivers/media/video/cx25840/cx25840-audio.c b/drivers/media/video/cx25840/cx25840-audio.c index 2f846f5e0f9f..fbccbdce26e0 100644 --- a/drivers/media/video/cx25840/cx25840-audio.c +++ b/drivers/media/video/cx25840/cx25840-audio.c | |||
| @@ -32,19 +32,19 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 32 | 32 | ||
| 33 | /* common for all inputs and rates */ | 33 | /* common for all inputs and rates */ |
| 34 | /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x10 */ | 34 | /* SA_MCLK_SEL=1, SA_MCLK_DIV=0x10 */ |
| 35 | if (!state->is_cx23885 && !state->is_cx231xx) | 35 | if (!is_cx2388x(state) && !is_cx231xx(state)) |
| 36 | cx25840_write(client, 0x127, 0x50); | 36 | cx25840_write(client, 0x127, 0x50); |
| 37 | 37 | ||
| 38 | if (state->aud_input != CX25840_AUDIO_SERIAL) { | 38 | if (state->aud_input != CX25840_AUDIO_SERIAL) { |
| 39 | switch (freq) { | 39 | switch (freq) { |
| 40 | case 32000: | 40 | case 32000: |
| 41 | if (state->is_cx23885) { | 41 | if (is_cx2388x(state)) { |
| 42 | /* We don't have register values | 42 | /* We don't have register values |
| 43 | * so avoid destroying registers. */ | 43 | * so avoid destroying registers. */ |
| 44 | break; | 44 | break; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | if (!state->is_cx231xx) { | 47 | if (!is_cx231xx(state)) { |
| 48 | /* VID_PLL and AUX_PLL */ | 48 | /* VID_PLL and AUX_PLL */ |
| 49 | cx25840_write4(client, 0x108, 0x1006040f); | 49 | cx25840_write4(client, 0x108, 0x1006040f); |
| 50 | 50 | ||
| @@ -52,7 +52,7 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 52 | cx25840_write4(client, 0x110, 0x01bb39ee); | 52 | cx25840_write4(client, 0x110, 0x01bb39ee); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | if (state->is_cx25836) | 55 | if (is_cx2583x(state)) |
| 56 | break; | 56 | break; |
| 57 | 57 | ||
| 58 | /* src3/4/6_ctl = 0x0801f77f */ | 58 | /* src3/4/6_ctl = 0x0801f77f */ |
| @@ -62,13 +62,13 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 62 | break; | 62 | break; |
| 63 | 63 | ||
| 64 | case 44100: | 64 | case 44100: |
| 65 | if (state->is_cx23885) { | 65 | if (is_cx2388x(state)) { |
| 66 | /* We don't have register values | 66 | /* We don't have register values |
| 67 | * so avoid destroying registers. */ | 67 | * so avoid destroying registers. */ |
| 68 | break; | 68 | break; |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | if (!state->is_cx231xx) { | 71 | if (!is_cx231xx(state)) { |
| 72 | /* VID_PLL and AUX_PLL */ | 72 | /* VID_PLL and AUX_PLL */ |
| 73 | cx25840_write4(client, 0x108, 0x1009040f); | 73 | cx25840_write4(client, 0x108, 0x1009040f); |
| 74 | 74 | ||
| @@ -76,7 +76,7 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 76 | cx25840_write4(client, 0x110, 0x00ec6bd6); | 76 | cx25840_write4(client, 0x110, 0x00ec6bd6); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | if (state->is_cx25836) | 79 | if (is_cx2583x(state)) |
| 80 | break; | 80 | break; |
| 81 | 81 | ||
| 82 | /* src3/4/6_ctl = 0x08016d59 */ | 82 | /* src3/4/6_ctl = 0x08016d59 */ |
| @@ -86,13 +86,13 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 86 | break; | 86 | break; |
| 87 | 87 | ||
| 88 | case 48000: | 88 | case 48000: |
| 89 | if (state->is_cx23885) { | 89 | if (is_cx2388x(state)) { |
| 90 | /* We don't have register values | 90 | /* We don't have register values |
| 91 | * so avoid destroying registers. */ | 91 | * so avoid destroying registers. */ |
| 92 | break; | 92 | break; |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | if (!state->is_cx231xx) { | 95 | if (!is_cx231xx(state)) { |
| 96 | /* VID_PLL and AUX_PLL */ | 96 | /* VID_PLL and AUX_PLL */ |
| 97 | cx25840_write4(client, 0x108, 0x100a040f); | 97 | cx25840_write4(client, 0x108, 0x100a040f); |
| 98 | 98 | ||
| @@ -100,7 +100,7 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 100 | cx25840_write4(client, 0x110, 0x0098d6e5); | 100 | cx25840_write4(client, 0x110, 0x0098d6e5); |
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | if (state->is_cx25836) | 103 | if (is_cx2583x(state)) |
| 104 | break; | 104 | break; |
| 105 | 105 | ||
| 106 | /* src3/4/6_ctl = 0x08014faa */ | 106 | /* src3/4/6_ctl = 0x08014faa */ |
| @@ -112,13 +112,13 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 112 | } else { | 112 | } else { |
| 113 | switch (freq) { | 113 | switch (freq) { |
| 114 | case 32000: | 114 | case 32000: |
| 115 | if (state->is_cx23885) { | 115 | if (is_cx2388x(state)) { |
| 116 | /* We don't have register values | 116 | /* We don't have register values |
| 117 | * so avoid destroying registers. */ | 117 | * so avoid destroying registers. */ |
| 118 | break; | 118 | break; |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | if (!state->is_cx231xx) { | 121 | if (!is_cx231xx(state)) { |
| 122 | /* VID_PLL and AUX_PLL */ | 122 | /* VID_PLL and AUX_PLL */ |
| 123 | cx25840_write4(client, 0x108, 0x1e08040f); | 123 | cx25840_write4(client, 0x108, 0x1e08040f); |
| 124 | 124 | ||
| @@ -126,7 +126,7 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 126 | cx25840_write4(client, 0x110, 0x012a0869); | 126 | cx25840_write4(client, 0x110, 0x012a0869); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | if (state->is_cx25836) | 129 | if (is_cx2583x(state)) |
| 130 | break; | 130 | break; |
| 131 | 131 | ||
| 132 | /* src1_ctl = 0x08010000 */ | 132 | /* src1_ctl = 0x08010000 */ |
| @@ -142,14 +142,14 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 142 | break; | 142 | break; |
| 143 | 143 | ||
| 144 | case 44100: | 144 | case 44100: |
| 145 | if (state->is_cx23885) { | 145 | if (is_cx2388x(state)) { |
| 146 | /* We don't have register values | 146 | /* We don't have register values |
| 147 | * so avoid destroying registers. */ | 147 | * so avoid destroying registers. */ |
| 148 | break; | 148 | break; |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | 151 | ||
| 152 | if (!state->is_cx231xx) { | 152 | if (!is_cx231xx(state)) { |
| 153 | /* VID_PLL and AUX_PLL */ | 153 | /* VID_PLL and AUX_PLL */ |
| 154 | cx25840_write4(client, 0x108, 0x1809040f); | 154 | cx25840_write4(client, 0x108, 0x1809040f); |
| 155 | 155 | ||
| @@ -157,7 +157,7 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 157 | cx25840_write4(client, 0x110, 0x00ec6bd6); | 157 | cx25840_write4(client, 0x110, 0x00ec6bd6); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | if (state->is_cx25836) | 160 | if (is_cx2583x(state)) |
| 161 | break; | 161 | break; |
| 162 | 162 | ||
| 163 | /* src1_ctl = 0x08010000 */ | 163 | /* src1_ctl = 0x08010000 */ |
| @@ -170,7 +170,7 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 170 | break; | 170 | break; |
| 171 | 171 | ||
| 172 | case 48000: | 172 | case 48000: |
| 173 | if (!state->is_cx23885 && !state->is_cx231xx) { | 173 | if (!is_cx2388x(state) && !is_cx231xx(state)) { |
| 174 | /* VID_PLL and AUX_PLL */ | 174 | /* VID_PLL and AUX_PLL */ |
| 175 | cx25840_write4(client, 0x108, 0x180a040f); | 175 | cx25840_write4(client, 0x108, 0x180a040f); |
| 176 | 176 | ||
| @@ -178,10 +178,10 @@ static int set_audclk_freq(struct i2c_client *client, u32 freq) | |||
| 178 | cx25840_write4(client, 0x110, 0x0098d6e5); | 178 | cx25840_write4(client, 0x110, 0x0098d6e5); |
| 179 | } | 179 | } |
| 180 | 180 | ||
| 181 | if (state->is_cx25836) | 181 | if (is_cx2583x(state)) |
| 182 | break; | 182 | break; |
| 183 | 183 | ||
| 184 | if (!state->is_cx23885 && !state->is_cx231xx) { | 184 | if (!is_cx2388x(state) && !is_cx231xx(state)) { |
| 185 | /* src1_ctl */ | 185 | /* src1_ctl */ |
| 186 | cx25840_write4(client, 0x8f8, 0x08018000); | 186 | cx25840_write4(client, 0x8f8, 0x08018000); |
| 187 | 187 | ||
| @@ -243,7 +243,7 @@ void cx25840_audio_set_path(struct i2c_client *client) | |||
| 243 | cx25840_and_or(client, 0x810, ~0x1, 0x00); | 243 | cx25840_and_or(client, 0x810, ~0x1, 0x00); |
| 244 | 244 | ||
| 245 | /* Ensure the controller is running when we exit */ | 245 | /* Ensure the controller is running when we exit */ |
| 246 | if (state->is_cx23885 || state->is_cx231xx) | 246 | if (is_cx2388x(state) || is_cx231xx(state)) |
| 247 | cx25840_and_or(client, 0x803, ~0x10, 0x10); | 247 | cx25840_and_or(client, 0x803, ~0x10, 0x10); |
| 248 | } | 248 | } |
| 249 | 249 | ||
| @@ -383,7 +383,7 @@ int cx25840_s_clock_freq(struct v4l2_subdev *sd, u32 freq) | |||
| 383 | struct cx25840_state *state = to_state(sd); | 383 | struct cx25840_state *state = to_state(sd); |
| 384 | int retval; | 384 | int retval; |
| 385 | 385 | ||
| 386 | if (!state->is_cx25836) | 386 | if (!is_cx2583x(state)) |
| 387 | cx25840_and_or(client, 0x810, ~0x1, 1); | 387 | cx25840_and_or(client, 0x810, ~0x1, 1); |
| 388 | if (state->aud_input != CX25840_AUDIO_SERIAL) { | 388 | if (state->aud_input != CX25840_AUDIO_SERIAL) { |
| 389 | cx25840_and_or(client, 0x803, ~0x10, 0); | 389 | cx25840_and_or(client, 0x803, ~0x10, 0); |
| @@ -392,7 +392,7 @@ int cx25840_s_clock_freq(struct v4l2_subdev *sd, u32 freq) | |||
| 392 | retval = set_audclk_freq(client, freq); | 392 | retval = set_audclk_freq(client, freq); |
| 393 | if (state->aud_input != CX25840_AUDIO_SERIAL) | 393 | if (state->aud_input != CX25840_AUDIO_SERIAL) |
| 394 | cx25840_and_or(client, 0x803, ~0x10, 0x10); | 394 | cx25840_and_or(client, 0x803, ~0x10, 0x10); |
| 395 | if (!state->is_cx25836) | 395 | if (!is_cx2583x(state)) |
| 396 | cx25840_and_or(client, 0x810, ~0x1, 0); | 396 | cx25840_and_or(client, 0x810, ~0x1, 0); |
| 397 | return retval; | 397 | return retval; |
| 398 | } | 398 | } |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index e83656729991..a6446e637f17 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
| @@ -494,7 +494,7 @@ void cx25840_std_setup(struct i2c_client *client) | |||
| 494 | } | 494 | } |
| 495 | 495 | ||
| 496 | /* DEBUG: Displays configured PLL frequency */ | 496 | /* DEBUG: Displays configured PLL frequency */ |
| 497 | if (!state->is_cx231xx) { | 497 | if (!is_cx231xx(state)) { |
| 498 | pll_int = cx25840_read(client, 0x108); | 498 | pll_int = cx25840_read(client, 0x108); |
| 499 | pll_frac = cx25840_read4(client, 0x10c) & 0x1ffffff; | 499 | pll_frac = cx25840_read4(client, 0x10c) & 0x1ffffff; |
| 500 | pll_post = cx25840_read(client, 0x109); | 500 | pll_post = cx25840_read(client, 0x109); |
| @@ -678,7 +678,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
| 678 | * configuration in reg (for the cx23885) so we have no | 678 | * configuration in reg (for the cx23885) so we have no |
| 679 | * need to attempt to flip bits for earlier av decoders. | 679 | * need to attempt to flip bits for earlier av decoders. |
| 680 | */ | 680 | */ |
| 681 | if (!state->is_cx23885 && !state->is_cx231xx) { | 681 | if (!is_cx2388x(state) && !is_cx231xx(state)) { |
| 682 | switch (aud_input) { | 682 | switch (aud_input) { |
| 683 | case CX25840_AUDIO_SERIAL: | 683 | case CX25840_AUDIO_SERIAL: |
| 684 | /* do nothing, use serial audio input */ | 684 | /* do nothing, use serial audio input */ |
| @@ -701,7 +701,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
| 701 | /* Set INPUT_MODE to Composite (0) or S-Video (1) */ | 701 | /* Set INPUT_MODE to Composite (0) or S-Video (1) */ |
| 702 | cx25840_and_or(client, 0x401, ~0x6, is_composite ? 0 : 0x02); | 702 | cx25840_and_or(client, 0x401, ~0x6, is_composite ? 0 : 0x02); |
| 703 | 703 | ||
| 704 | if (!state->is_cx23885 && !state->is_cx231xx) { | 704 | if (!is_cx2388x(state) && !is_cx231xx(state)) { |
| 705 | /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */ | 705 | /* Set CH_SEL_ADC2 to 1 if input comes from CH3 */ |
| 706 | cx25840_and_or(client, 0x102, ~0x2, (reg & 0x80) == 0 ? 2 : 0); | 706 | cx25840_and_or(client, 0x102, ~0x2, (reg & 0x80) == 0 ? 2 : 0); |
| 707 | /* Set DUAL_MODE_ADC2 to 1 if input comes from both CH2&CH3 */ | 707 | /* Set DUAL_MODE_ADC2 to 1 if input comes from both CH2&CH3 */ |
| @@ -720,12 +720,12 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
| 720 | 720 | ||
| 721 | state->vid_input = vid_input; | 721 | state->vid_input = vid_input; |
| 722 | state->aud_input = aud_input; | 722 | state->aud_input = aud_input; |
| 723 | if (!state->is_cx25836) { | 723 | if (!is_cx2583x(state)) { |
| 724 | cx25840_audio_set_path(client); | 724 | cx25840_audio_set_path(client); |
| 725 | input_change(client); | 725 | input_change(client); |
| 726 | } | 726 | } |
| 727 | 727 | ||
| 728 | if (state->is_cx23885) { | 728 | if (is_cx2388x(state)) { |
| 729 | /* Audio channel 1 src : Parallel 1 */ | 729 | /* Audio channel 1 src : Parallel 1 */ |
| 730 | cx25840_write(client, 0x124, 0x03); | 730 | cx25840_write(client, 0x124, 0x03); |
| 731 | 731 | ||
| @@ -741,7 +741,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp | |||
| 741 | */ | 741 | */ |
| 742 | cx25840_write(client, 0x918, 0xa0); | 742 | cx25840_write(client, 0x918, 0xa0); |
| 743 | cx25840_write(client, 0x919, 0x01); | 743 | cx25840_write(client, 0x919, 0x01); |
| 744 | } else if (state->is_cx231xx) { | 744 | } else if (is_cx231xx(state)) { |
| 745 | /* Audio channel 1 src : Parallel 1 */ | 745 | /* Audio channel 1 src : Parallel 1 */ |
| 746 | cx25840_write(client, 0x124, 0x03); | 746 | cx25840_write(client, 0x124, 0x03); |
| 747 | 747 | ||
| @@ -805,7 +805,7 @@ static int set_v4lstd(struct i2c_client *client) | |||
| 805 | cx25840_and_or(client, 0x400, ~0xf, fmt); | 805 | cx25840_and_or(client, 0x400, ~0xf, fmt); |
| 806 | cx25840_and_or(client, 0x403, ~0x3, pal_m); | 806 | cx25840_and_or(client, 0x403, ~0x3, pal_m); |
| 807 | cx25840_std_setup(client); | 807 | cx25840_std_setup(client); |
| 808 | if (!state->is_cx25836) | 808 | if (!is_cx2583x(state)) |
| 809 | input_change(client); | 809 | input_change(client); |
| 810 | return 0; | 810 | return 0; |
| 811 | } | 811 | } |
| @@ -868,7 +868,7 @@ static int cx25840_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
| 868 | case V4L2_CID_AUDIO_TREBLE: | 868 | case V4L2_CID_AUDIO_TREBLE: |
| 869 | case V4L2_CID_AUDIO_BALANCE: | 869 | case V4L2_CID_AUDIO_BALANCE: |
| 870 | case V4L2_CID_AUDIO_MUTE: | 870 | case V4L2_CID_AUDIO_MUTE: |
| 871 | if (state->is_cx25836) | 871 | if (is_cx2583x(state)) |
| 872 | return -EINVAL; | 872 | return -EINVAL; |
| 873 | return cx25840_audio_s_ctrl(sd, ctrl); | 873 | return cx25840_audio_s_ctrl(sd, ctrl); |
| 874 | 874 | ||
| @@ -905,7 +905,7 @@ static int cx25840_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) | |||
| 905 | case V4L2_CID_AUDIO_TREBLE: | 905 | case V4L2_CID_AUDIO_TREBLE: |
| 906 | case V4L2_CID_AUDIO_BALANCE: | 906 | case V4L2_CID_AUDIO_BALANCE: |
| 907 | case V4L2_CID_AUDIO_MUTE: | 907 | case V4L2_CID_AUDIO_MUTE: |
| 908 | if (state->is_cx25836) | 908 | if (is_cx2583x(state)) |
| 909 | return -EINVAL; | 909 | return -EINVAL; |
| 910 | return cx25840_audio_g_ctrl(sd, ctrl); | 910 | return cx25840_audio_g_ctrl(sd, ctrl); |
| 911 | default: | 911 | default: |
| @@ -1209,11 +1209,11 @@ static int cx25840_load_fw(struct v4l2_subdev *sd) | |||
| 1209 | if (!state->is_initialized) { | 1209 | if (!state->is_initialized) { |
| 1210 | /* initialize and load firmware */ | 1210 | /* initialize and load firmware */ |
| 1211 | state->is_initialized = 1; | 1211 | state->is_initialized = 1; |
| 1212 | if (state->is_cx25836) | 1212 | if (is_cx2583x(state)) |
| 1213 | cx25836_initialize(client); | 1213 | cx25836_initialize(client); |
| 1214 | else if (state->is_cx23885) | 1214 | else if (is_cx2388x(state)) |
| 1215 | cx23885_initialize(client); | 1215 | cx23885_initialize(client); |
| 1216 | else if (state->is_cx231xx) | 1216 | else if (is_cx231xx(state)) |
| 1217 | cx231xx_initialize(client); | 1217 | cx231xx_initialize(client); |
| 1218 | else | 1218 | else |
| 1219 | cx25840_initialize(client); | 1219 | cx25840_initialize(client); |
| @@ -1256,17 +1256,17 @@ static int cx25840_s_stream(struct v4l2_subdev *sd, int enable) | |||
| 1256 | v4l_dbg(1, cx25840_debug, client, "%s output\n", | 1256 | v4l_dbg(1, cx25840_debug, client, "%s output\n", |
| 1257 | enable ? "enable" : "disable"); | 1257 | enable ? "enable" : "disable"); |
| 1258 | if (enable) { | 1258 | if (enable) { |
| 1259 | if (state->is_cx23885 || state->is_cx231xx) { | 1259 | if (is_cx2388x(state) || is_cx231xx(state)) { |
| 1260 | u8 v = (cx25840_read(client, 0x421) | 0x0b); | 1260 | u8 v = (cx25840_read(client, 0x421) | 0x0b); |
| 1261 | cx25840_write(client, 0x421, v); | 1261 | cx25840_write(client, 0x421, v); |
| 1262 | } else { | 1262 | } else { |
| 1263 | cx25840_write(client, 0x115, | 1263 | cx25840_write(client, 0x115, |
| 1264 | state->is_cx25836 ? 0x0c : 0x8c); | 1264 | is_cx2583x(state) ? 0x0c : 0x8c); |
| 1265 | cx25840_write(client, 0x116, | 1265 | cx25840_write(client, 0x116, |
| 1266 | state->is_cx25836 ? 0x04 : 0x07); | 1266 | is_cx2583x(state) ? 0x04 : 0x07); |
| 1267 | } | 1267 | } |
| 1268 | } else { | 1268 | } else { |
| 1269 | if (state->is_cx23885 || state->is_cx231xx) { | 1269 | if (is_cx2388x(state) || is_cx231xx(state)) { |
| 1270 | u8 v = cx25840_read(client, 0x421) & ~(0x0b); | 1270 | u8 v = cx25840_read(client, 0x421) & ~(0x0b); |
| 1271 | cx25840_write(client, 0x421, v); | 1271 | cx25840_write(client, 0x421, v); |
| 1272 | } else { | 1272 | } else { |
| @@ -1292,7 +1292,7 @@ static int cx25840_queryctrl(struct v4l2_subdev *sd, struct v4l2_queryctrl *qc) | |||
| 1292 | default: | 1292 | default: |
| 1293 | break; | 1293 | break; |
| 1294 | } | 1294 | } |
| 1295 | if (state->is_cx25836) | 1295 | if (is_cx2583x(state)) |
| 1296 | return -EINVAL; | 1296 | return -EINVAL; |
| 1297 | 1297 | ||
| 1298 | switch (qc->id) { | 1298 | switch (qc->id) { |
| @@ -1346,7 +1346,7 @@ static int cx25840_s_audio_routing(struct v4l2_subdev *sd, | |||
| 1346 | struct cx25840_state *state = to_state(sd); | 1346 | struct cx25840_state *state = to_state(sd); |
| 1347 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1347 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1348 | 1348 | ||
| 1349 | if (state->is_cx25836) | 1349 | if (is_cx2583x(state)) |
| 1350 | return -EINVAL; | 1350 | return -EINVAL; |
| 1351 | return set_input(client, state->vid_input, input); | 1351 | return set_input(client, state->vid_input, input); |
| 1352 | } | 1352 | } |
| @@ -1356,7 +1356,7 @@ static int cx25840_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *fr | |||
| 1356 | struct cx25840_state *state = to_state(sd); | 1356 | struct cx25840_state *state = to_state(sd); |
| 1357 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1357 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1358 | 1358 | ||
| 1359 | if (!state->is_cx25836) | 1359 | if (!is_cx2583x(state)) |
| 1360 | input_change(client); | 1360 | input_change(client); |
| 1361 | return 0; | 1361 | return 0; |
| 1362 | } | 1362 | } |
| @@ -1373,7 +1373,7 @@ static int cx25840_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) | |||
| 1373 | return 0; | 1373 | return 0; |
| 1374 | 1374 | ||
| 1375 | vt->signal = vpres ? 0xffff : 0x0; | 1375 | vt->signal = vpres ? 0xffff : 0x0; |
| 1376 | if (state->is_cx25836) | 1376 | if (is_cx2583x(state)) |
| 1377 | return 0; | 1377 | return 0; |
| 1378 | 1378 | ||
| 1379 | vt->capability |= | 1379 | vt->capability |= |
| @@ -1404,7 +1404,7 @@ static int cx25840_s_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt) | |||
| 1404 | struct cx25840_state *state = to_state(sd); | 1404 | struct cx25840_state *state = to_state(sd); |
| 1405 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1405 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1406 | 1406 | ||
| 1407 | if (state->radio || state->is_cx25836) | 1407 | if (state->radio || is_cx2583x(state)) |
| 1408 | return 0; | 1408 | return 0; |
| 1409 | 1409 | ||
| 1410 | switch (vt->audmode) { | 1410 | switch (vt->audmode) { |
| @@ -1445,11 +1445,11 @@ static int cx25840_reset(struct v4l2_subdev *sd, u32 val) | |||
| 1445 | struct cx25840_state *state = to_state(sd); | 1445 | struct cx25840_state *state = to_state(sd); |
| 1446 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1446 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1447 | 1447 | ||
| 1448 | if (state->is_cx25836) | 1448 | if (is_cx2583x(state)) |
| 1449 | cx25836_initialize(client); | 1449 | cx25836_initialize(client); |
| 1450 | else if (state->is_cx23885) | 1450 | else if (is_cx2388x(state)) |
| 1451 | cx23885_initialize(client); | 1451 | cx23885_initialize(client); |
| 1452 | else if (state->is_cx231xx) | 1452 | else if (is_cx231xx(state)) |
| 1453 | cx231xx_initialize(client); | 1453 | cx231xx_initialize(client); |
| 1454 | else | 1454 | else |
| 1455 | cx25840_initialize(client); | 1455 | cx25840_initialize(client); |
| @@ -1470,7 +1470,7 @@ static int cx25840_log_status(struct v4l2_subdev *sd) | |||
| 1470 | struct i2c_client *client = v4l2_get_subdevdata(sd); | 1470 | struct i2c_client *client = v4l2_get_subdevdata(sd); |
| 1471 | 1471 | ||
| 1472 | log_video_status(client); | 1472 | log_video_status(client); |
| 1473 | if (!state->is_cx25836) | 1473 | if (!is_cx2583x(state)) |
| 1474 | log_audio_status(client); | 1474 | log_audio_status(client); |
| 1475 | return 0; | 1475 | return 0; |
| 1476 | } | 1476 | } |
| @@ -1594,22 +1594,18 @@ static int cx25840_probe(struct i2c_client *client, | |||
| 1594 | v4l2_i2c_subdev_init(sd, client, &cx25840_ops); | 1594 | v4l2_i2c_subdev_init(sd, client, &cx25840_ops); |
| 1595 | switch (id) { | 1595 | switch (id) { |
| 1596 | case V4L2_IDENT_CX23885_AV: | 1596 | case V4L2_IDENT_CX23885_AV: |
| 1597 | state->is_cx23885 = 1; | ||
| 1598 | v4l_info(client, "cx23885 A/V decoder found @ 0x%x (%s)\n", | 1597 | v4l_info(client, "cx23885 A/V decoder found @ 0x%x (%s)\n", |
| 1599 | client->addr << 1, client->adapter->name); | 1598 | client->addr << 1, client->adapter->name); |
| 1600 | break; | 1599 | break; |
| 1601 | case V4L2_IDENT_CX23887_AV: | 1600 | case V4L2_IDENT_CX23887_AV: |
| 1602 | state->is_cx23885 = 1; | ||
| 1603 | v4l_info(client, "cx23887 A/V decoder found @ 0x%x (%s)\n", | 1601 | v4l_info(client, "cx23887 A/V decoder found @ 0x%x (%s)\n", |
| 1604 | client->addr << 1, client->adapter->name); | 1602 | client->addr << 1, client->adapter->name); |
| 1605 | break; | 1603 | break; |
| 1606 | case V4L2_IDENT_CX23888_AV: | 1604 | case V4L2_IDENT_CX23888_AV: |
| 1607 | state->is_cx23885 = 1; | ||
| 1608 | v4l_info(client, "cx23888 A/V decoder found @ 0x%x (%s)\n", | 1605 | v4l_info(client, "cx23888 A/V decoder found @ 0x%x (%s)\n", |
| 1609 | client->addr << 1, client->adapter->name); | 1606 | client->addr << 1, client->adapter->name); |
| 1610 | break; | 1607 | break; |
| 1611 | case V4L2_IDENT_CX2310X_AV: | 1608 | case V4L2_IDENT_CX2310X_AV: |
| 1612 | state->is_cx231xx = 1; | ||
| 1613 | v4l_info(client, "cx%d A/V decoder found @ 0x%x (%s)\n", | 1609 | v4l_info(client, "cx%d A/V decoder found @ 0x%x (%s)\n", |
| 1614 | device_id, client->addr << 1, client->adapter->name); | 1610 | device_id, client->addr << 1, client->adapter->name); |
| 1615 | break; | 1611 | break; |
| @@ -1627,7 +1623,6 @@ static int cx25840_probe(struct i2c_client *client, | |||
| 1627 | break; | 1623 | break; |
| 1628 | case V4L2_IDENT_CX25836: | 1624 | case V4L2_IDENT_CX25836: |
| 1629 | case V4L2_IDENT_CX25837: | 1625 | case V4L2_IDENT_CX25837: |
| 1630 | state->is_cx25836 = 1; | ||
| 1631 | default: | 1626 | default: |
| 1632 | v4l_info(client, "cx25%3x-%x found @ 0x%x (%s)\n", | 1627 | v4l_info(client, "cx25%3x-%x found @ 0x%x (%s)\n", |
| 1633 | (device_id & 0xfff0) >> 4, device_id & 0x0f, | 1628 | (device_id & 0xfff0) >> 4, device_id & 0x0f, |
diff --git a/drivers/media/video/cx25840/cx25840-core.h b/drivers/media/video/cx25840/cx25840-core.h index 814b56536994..55345444417f 100644 --- a/drivers/media/video/cx25840/cx25840-core.h +++ b/drivers/media/video/cx25840/cx25840-core.h | |||
| @@ -23,6 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | #include <linux/videodev2.h> | 24 | #include <linux/videodev2.h> |
| 25 | #include <media/v4l2-device.h> | 25 | #include <media/v4l2-device.h> |
| 26 | #include <media/v4l2-chip-ident.h> | ||
| 26 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
| 27 | 28 | ||
| 28 | /* ENABLE_PVR150_WORKAROUND activates a workaround for a hardware bug that is | 29 | /* ENABLE_PVR150_WORKAROUND activates a workaround for a hardware bug that is |
| @@ -48,9 +49,6 @@ struct cx25840_state { | |||
| 48 | int vbi_line_offset; | 49 | int vbi_line_offset; |
| 49 | u32 id; | 50 | u32 id; |
| 50 | u32 rev; | 51 | u32 rev; |
| 51 | int is_cx25836; | ||
| 52 | int is_cx23885; | ||
| 53 | int is_cx231xx; | ||
| 54 | int is_initialized; | 52 | int is_initialized; |
| 55 | wait_queue_head_t fw_wait; /* wake up when the fw load is finished */ | 53 | wait_queue_head_t fw_wait; /* wake up when the fw load is finished */ |
| 56 | struct work_struct fw_work; /* work entry for fw load */ | 54 | struct work_struct fw_work; /* work entry for fw load */ |
| @@ -61,6 +59,24 @@ static inline struct cx25840_state *to_state(struct v4l2_subdev *sd) | |||
| 61 | return container_of(sd, struct cx25840_state, sd); | 59 | return container_of(sd, struct cx25840_state, sd); |
| 62 | } | 60 | } |
| 63 | 61 | ||
| 62 | static inline bool is_cx2583x(struct cx25840_state *state) | ||
| 63 | { | ||
| 64 | return state->id == V4L2_IDENT_CX25836 || | ||
| 65 | state->id == V4L2_IDENT_CX25837; | ||
| 66 | } | ||
| 67 | |||
| 68 | static inline bool is_cx231xx(struct cx25840_state *state) | ||
| 69 | { | ||
| 70 | return state->id == V4L2_IDENT_CX2310X_AV; | ||
| 71 | } | ||
| 72 | |||
| 73 | static inline bool is_cx2388x(struct cx25840_state *state) | ||
| 74 | { | ||
| 75 | return state->id == V4L2_IDENT_CX23885_AV || | ||
| 76 | state->id == V4L2_IDENT_CX23887_AV || | ||
| 77 | state->id == V4L2_IDENT_CX23888_AV; | ||
| 78 | } | ||
| 79 | |||
| 64 | /* ----------------------------------------------------------------------- */ | 80 | /* ----------------------------------------------------------------------- */ |
| 65 | /* cx25850-core.c */ | 81 | /* cx25850-core.c */ |
| 66 | int cx25840_write(struct i2c_client *client, u16 addr, u8 value); | 82 | int cx25840_write(struct i2c_client *client, u16 addr, u8 value); |
diff --git a/drivers/media/video/cx25840/cx25840-firmware.c b/drivers/media/video/cx25840/cx25840-firmware.c index 1f483c1d0dbe..8150200511da 100644 --- a/drivers/media/video/cx25840/cx25840-firmware.c +++ b/drivers/media/video/cx25840/cx25840-firmware.c | |||
| @@ -67,9 +67,9 @@ static const char *get_fw_name(struct i2c_client *client) | |||
| 67 | 67 | ||
| 68 | if (firmware[0]) | 68 | if (firmware[0]) |
| 69 | return firmware; | 69 | return firmware; |
| 70 | if (state->is_cx23885) | 70 | if (is_cx2388x(state)) |
| 71 | return "v4l-cx23885-avcore-01.fw"; | 71 | return "v4l-cx23885-avcore-01.fw"; |
| 72 | if (state->is_cx231xx) | 72 | if (is_cx231xx(state)) |
| 73 | return "v4l-cx231xx-avcore-01.fw"; | 73 | return "v4l-cx231xx-avcore-01.fw"; |
| 74 | return "v4l-cx25840.fw"; | 74 | return "v4l-cx25840.fw"; |
| 75 | } | 75 | } |
| @@ -112,13 +112,13 @@ int cx25840_loadfw(struct i2c_client *client) | |||
| 112 | int MAX_BUF_SIZE = FWSEND; | 112 | int MAX_BUF_SIZE = FWSEND; |
| 113 | u32 gpio_oe = 0, gpio_da = 0; | 113 | u32 gpio_oe = 0, gpio_da = 0; |
| 114 | 114 | ||
| 115 | if (state->is_cx23885) { | 115 | if (is_cx2388x(state)) { |
| 116 | /* Preserve the GPIO OE and output bits */ | 116 | /* Preserve the GPIO OE and output bits */ |
| 117 | gpio_oe = cx25840_read(client, 0x160); | 117 | gpio_oe = cx25840_read(client, 0x160); |
| 118 | gpio_da = cx25840_read(client, 0x164); | 118 | gpio_da = cx25840_read(client, 0x164); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | if ((state->is_cx231xx) && MAX_BUF_SIZE > 16) { | 121 | if (is_cx231xx(state) && MAX_BUF_SIZE > 16) { |
| 122 | v4l_err(client, " Firmware download size changed to 16 bytes max length\n"); | 122 | v4l_err(client, " Firmware download size changed to 16 bytes max length\n"); |
| 123 | MAX_BUF_SIZE = 16; /* cx231xx cannot accept more than 16 bytes at a time */ | 123 | MAX_BUF_SIZE = 16; /* cx231xx cannot accept more than 16 bytes at a time */ |
| 124 | } | 124 | } |
| @@ -156,7 +156,7 @@ int cx25840_loadfw(struct i2c_client *client) | |||
| 156 | size = fw->size; | 156 | size = fw->size; |
| 157 | release_firmware(fw); | 157 | release_firmware(fw); |
| 158 | 158 | ||
| 159 | if (state->is_cx23885) { | 159 | if (is_cx2388x(state)) { |
| 160 | /* Restore GPIO configuration after f/w load */ | 160 | /* Restore GPIO configuration after f/w load */ |
| 161 | cx25840_write(client, 0x160, gpio_oe); | 161 | cx25840_write(client, 0x160, gpio_oe); |
| 162 | cx25840_write(client, 0x164, gpio_da); | 162 | cx25840_write(client, 0x164, gpio_da); |
