diff options
author | Andy Walls <awalls@radix.net> | 2009-09-26 22:47:21 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:40:17 -0500 |
commit | 2a03f03471d3232037e656570ccaf3ff2ffd01e8 (patch) | |
tree | aeb169037d4323ec62b1d3362f784e5072242f5d /drivers/media/video/cx25840/cx25840-audio.c | |
parent | c7dd1ecdc0112b9700ed6ad20a6e4e07d125044b (diff) |
V4L/DVB (13088): cx25840: Convert chip/core family checks to static inline functions
Change logic to check for various chip or core families to inline functions.
Checks for specific chips should be made against the state->id field now. This
is in preparation for chip/core specific code for setting up PLLs for the
CX2388[578] family of cores, that all run with different crystal frequencies.
Signed-off-by: Andy Walls <awalls@radix.net>
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 | 44 |
1 files changed, 22 insertions, 22 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 | } |