aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/cx25840/cx25840-audio.c20
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c102
-rw-r--r--drivers/media/video/cx25840/cx25840-firmware.c10
-rw-r--r--drivers/media/video/cx25840/cx25840-vbi.c4
4 files changed, 117 insertions, 19 deletions
diff --git a/drivers/media/video/cx25840/cx25840-audio.c b/drivers/media/video/cx25840/cx25840-audio.c
index fe6bc411d71f..cb9a7981e408 100644
--- a/drivers/media/video/cx25840/cx25840-audio.c
+++ b/drivers/media/video/cx25840/cx25840-audio.c
@@ -170,7 +170,7 @@ void cx25840_audio_set_path(struct i2c_client *client)
170 set_audclk_freq(client, state->audclk_freq); 170 set_audclk_freq(client, state->audclk_freq);
171} 171}
172 172
173inline static int get_volume(struct i2c_client *client) 173static int get_volume(struct i2c_client *client)
174{ 174{
175 /* Volume runs +18dB to -96dB in 1/2dB steps 175 /* Volume runs +18dB to -96dB in 1/2dB steps
176 * change to fit the msp3400 -114dB to +12dB range */ 176 * change to fit the msp3400 -114dB to +12dB range */
@@ -181,7 +181,7 @@ inline static int get_volume(struct i2c_client *client)
181 return vol << 9; 181 return vol << 9;
182} 182}
183 183
184inline static void set_volume(struct i2c_client *client, int volume) 184static void set_volume(struct i2c_client *client, int volume)
185{ 185{
186 /* First convert the volume to msp3400 values (0-127) */ 186 /* First convert the volume to msp3400 values (0-127) */
187 int vol = volume >> 9; 187 int vol = volume >> 9;
@@ -198,7 +198,7 @@ inline static void set_volume(struct i2c_client *client, int volume)
198 cx25840_write(client, 0x8d4, 228 - (vol * 2)); 198 cx25840_write(client, 0x8d4, 228 - (vol * 2));
199} 199}
200 200
201inline static int get_bass(struct i2c_client *client) 201static int get_bass(struct i2c_client *client)
202{ 202{
203 /* bass is 49 steps +12dB to -12dB */ 203 /* bass is 49 steps +12dB to -12dB */
204 204
@@ -208,13 +208,13 @@ inline static int get_bass(struct i2c_client *client)
208 return bass; 208 return bass;
209} 209}
210 210
211inline static void set_bass(struct i2c_client *client, int bass) 211static void set_bass(struct i2c_client *client, int bass)
212{ 212{
213 /* PATH1_EQ_BASS_VOL */ 213 /* PATH1_EQ_BASS_VOL */
214 cx25840_and_or(client, 0x8d9, ~0x3f, 48 - (bass * 48 / 0xffff)); 214 cx25840_and_or(client, 0x8d9, ~0x3f, 48 - (bass * 48 / 0xffff));
215} 215}
216 216
217inline static int get_treble(struct i2c_client *client) 217static int get_treble(struct i2c_client *client)
218{ 218{
219 /* treble is 49 steps +12dB to -12dB */ 219 /* treble is 49 steps +12dB to -12dB */
220 220
@@ -224,13 +224,13 @@ inline static int get_treble(struct i2c_client *client)
224 return treble; 224 return treble;
225} 225}
226 226
227inline static void set_treble(struct i2c_client *client, int treble) 227static void set_treble(struct i2c_client *client, int treble)
228{ 228{
229 /* PATH1_EQ_TREBLE_VOL */ 229 /* PATH1_EQ_TREBLE_VOL */
230 cx25840_and_or(client, 0x8db, ~0x3f, 48 - (treble * 48 / 0xffff)); 230 cx25840_and_or(client, 0x8db, ~0x3f, 48 - (treble * 48 / 0xffff));
231} 231}
232 232
233inline static int get_balance(struct i2c_client *client) 233static int get_balance(struct i2c_client *client)
234{ 234{
235 /* balance is 7 bit, 0 to -96dB */ 235 /* balance is 7 bit, 0 to -96dB */
236 236
@@ -244,7 +244,7 @@ inline static int get_balance(struct i2c_client *client)
244 return balance << 8; 244 return balance << 8;
245} 245}
246 246
247inline static void set_balance(struct i2c_client *client, int balance) 247static void set_balance(struct i2c_client *client, int balance)
248{ 248{
249 int bal = balance >> 8; 249 int bal = balance >> 8;
250 if (bal > 0x80) { 250 if (bal > 0x80) {
@@ -260,13 +260,13 @@ inline static void set_balance(struct i2c_client *client, int balance)
260 } 260 }
261} 261}
262 262
263inline static int get_mute(struct i2c_client *client) 263static int get_mute(struct i2c_client *client)
264{ 264{
265 /* check SRC1_MUTE_EN */ 265 /* check SRC1_MUTE_EN */
266 return cx25840_read(client, 0x8d3) & 0x2 ? 1 : 0; 266 return cx25840_read(client, 0x8d3) & 0x2 ? 1 : 0;
267} 267}
268 268
269inline static void set_mute(struct i2c_client *client, int mute) 269static void set_mute(struct i2c_client *client, int mute)
270{ 270{
271 struct cx25840_state *state = i2c_get_clientdata(client); 271 struct cx25840_state *state = i2c_get_clientdata(client);
272 272
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 2bf057ec626c..d7ece6eecb5c 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -121,7 +121,7 @@ static void log_status(struct i2c_client *client);
121 121
122/* ----------------------------------------------------------------------- */ 122/* ----------------------------------------------------------------------- */
123 123
124static inline void init_dll1(struct i2c_client *client) 124static void init_dll1(struct i2c_client *client)
125{ 125{
126 /* This is the Hauppauge sequence used to 126 /* This is the Hauppauge sequence used to
127 * initialize the Delay Lock Loop 1 (ADC DLL). */ 127 * initialize the Delay Lock Loop 1 (ADC DLL). */
@@ -135,7 +135,7 @@ static inline void init_dll1(struct i2c_client *client)
135 cx25840_write(client, 0x15b, 0x10); 135 cx25840_write(client, 0x15b, 0x10);
136} 136}
137 137
138static inline void init_dll2(struct i2c_client *client) 138static void init_dll2(struct i2c_client *client)
139{ 139{
140 /* This is the Hauppauge sequence used to 140 /* This is the Hauppauge sequence used to
141 * initialize the Delay Lock Loop 2 (ADC DLL). */ 141 * initialize the Delay Lock Loop 2 (ADC DLL). */
@@ -562,6 +562,91 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
562 562
563/* ----------------------------------------------------------------------- */ 563/* ----------------------------------------------------------------------- */
564 564
565static struct v4l2_queryctrl cx25840_qctrl[] = {
566 {
567 .id = V4L2_CID_BRIGHTNESS,
568 .type = V4L2_CTRL_TYPE_INTEGER,
569 .name = "Brightness",
570 .minimum = 0,
571 .maximum = 255,
572 .step = 1,
573 .default_value = 128,
574 .flags = 0,
575 }, {
576 .id = V4L2_CID_CONTRAST,
577 .type = V4L2_CTRL_TYPE_INTEGER,
578 .name = "Contrast",
579 .minimum = 0,
580 .maximum = 255,
581 .step = 1,
582 .default_value = 64,
583 .flags = 0,
584 }, {
585 .id = V4L2_CID_SATURATION,
586 .type = V4L2_CTRL_TYPE_INTEGER,
587 .name = "Saturation",
588 .minimum = 0,
589 .maximum = 255,
590 .step = 1,
591 .default_value = 64,
592 .flags = 0,
593 }, {
594 .id = V4L2_CID_HUE,
595 .type = V4L2_CTRL_TYPE_INTEGER,
596 .name = "Hue",
597 .minimum = -128,
598 .maximum = 127,
599 .step = 1,
600 .default_value = 0,
601 .flags = 0,
602 }, {
603 .id = V4L2_CID_AUDIO_VOLUME,
604 .type = V4L2_CTRL_TYPE_INTEGER,
605 .name = "Volume",
606 .minimum = 0,
607 .maximum = 65535,
608 .step = 65535/100,
609 .default_value = 58880,
610 .flags = 0,
611 }, {
612 .id = V4L2_CID_AUDIO_BALANCE,
613 .type = V4L2_CTRL_TYPE_INTEGER,
614 .name = "Balance",
615 .minimum = 0,
616 .maximum = 65535,
617 .step = 65535/100,
618 .default_value = 32768,
619 .flags = 0,
620 }, {
621 .id = V4L2_CID_AUDIO_MUTE,
622 .type = V4L2_CTRL_TYPE_BOOLEAN,
623 .name = "Mute",
624 .minimum = 0,
625 .maximum = 1,
626 .step = 1,
627 .default_value = 1,
628 .flags = 0,
629 }, {
630 .id = V4L2_CID_AUDIO_BASS,
631 .type = V4L2_CTRL_TYPE_INTEGER,
632 .name = "Bass",
633 .minimum = 0,
634 .maximum = 65535,
635 .step = 65535/100,
636 .default_value = 32768,
637 }, {
638 .id = V4L2_CID_AUDIO_TREBLE,
639 .type = V4L2_CTRL_TYPE_INTEGER,
640 .name = "Treble",
641 .minimum = 0,
642 .maximum = 65535,
643 .step = 65535/100,
644 .default_value = 32768,
645 },
646};
647
648/* ----------------------------------------------------------------------- */
649
565static int cx25840_command(struct i2c_client *client, unsigned int cmd, 650static int cx25840_command(struct i2c_client *client, unsigned int cmd,
566 void *arg) 651 void *arg)
567{ 652{
@@ -623,6 +708,19 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
623 case VIDIOC_S_CTRL: 708 case VIDIOC_S_CTRL:
624 return set_v4lctrl(client, (struct v4l2_control *)arg); 709 return set_v4lctrl(client, (struct v4l2_control *)arg);
625 710
711 case VIDIOC_QUERYCTRL:
712 {
713 struct v4l2_queryctrl *qc = arg;
714 int i;
715
716 for (i = 0; i < ARRAY_SIZE(cx25840_qctrl); i++)
717 if (qc->id && qc->id == cx25840_qctrl[i].id) {
718 memcpy(qc, &cx25840_qctrl[i], sizeof(*qc));
719 return 0;
720 }
721 return -EINVAL;
722 }
723
626 case VIDIOC_G_STD: 724 case VIDIOC_G_STD:
627 *(v4l2_std_id *)arg = cx25840_get_v4lstd(client); 725 *(v4l2_std_id *)arg = cx25840_get_v4lstd(client);
628 break; 726 break;
diff --git a/drivers/media/video/cx25840/cx25840-firmware.c b/drivers/media/video/cx25840/cx25840-firmware.c
index 12a73e64f756..e1a7823d82cd 100644
--- a/drivers/media/video/cx25840/cx25840-firmware.c
+++ b/drivers/media/video/cx25840/cx25840-firmware.c
@@ -37,7 +37,7 @@ module_param(firmware, charp, 0444);
37MODULE_PARM_DESC(fastfw, "Load firmware fast [0=100MHz 1=333MHz (default)]"); 37MODULE_PARM_DESC(fastfw, "Load firmware fast [0=100MHz 1=333MHz (default)]");
38MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]"); 38MODULE_PARM_DESC(firmware, "Firmware image [default: " FWFILE "]");
39 39
40static inline void set_i2c_delay(struct i2c_client *client, int delay) 40static void set_i2c_delay(struct i2c_client *client, int delay)
41{ 41{
42 struct i2c_algo_bit_data *algod = client->adapter->algo_data; 42 struct i2c_algo_bit_data *algod = client->adapter->algo_data;
43 43
@@ -51,7 +51,7 @@ static inline void set_i2c_delay(struct i2c_client *client, int delay)
51 } 51 }
52} 52}
53 53
54static inline void start_fw_load(struct i2c_client *client) 54static void start_fw_load(struct i2c_client *client)
55{ 55{
56 /* DL_ADDR_LB=0 DL_ADDR_HB=0 */ 56 /* DL_ADDR_LB=0 DL_ADDR_HB=0 */
57 cx25840_write(client, 0x800, 0x00); 57 cx25840_write(client, 0x800, 0x00);
@@ -65,7 +65,7 @@ static inline void start_fw_load(struct i2c_client *client)
65 set_i2c_delay(client, 3); 65 set_i2c_delay(client, 3);
66} 66}
67 67
68static inline void end_fw_load(struct i2c_client *client) 68static void end_fw_load(struct i2c_client *client)
69{ 69{
70 if (fastfw) 70 if (fastfw)
71 set_i2c_delay(client, 10); 71 set_i2c_delay(client, 10);
@@ -76,7 +76,7 @@ static inline void end_fw_load(struct i2c_client *client)
76 cx25840_write(client, 0x803, 0x03); 76 cx25840_write(client, 0x803, 0x03);
77} 77}
78 78
79static inline int check_fw_load(struct i2c_client *client, int size) 79static int check_fw_load(struct i2c_client *client, int size)
80{ 80{
81 /* DL_ADDR_HB DL_ADDR_LB */ 81 /* DL_ADDR_HB DL_ADDR_LB */
82 int s = cx25840_read(client, 0x801) << 8; 82 int s = cx25840_read(client, 0x801) << 8;
@@ -91,7 +91,7 @@ static inline int check_fw_load(struct i2c_client *client, int size)
91 return 0; 91 return 0;
92} 92}
93 93
94static inline int fw_write(struct i2c_client *client, u8 * data, int size) 94static int fw_write(struct i2c_client *client, u8 * data, int size)
95{ 95{
96 int sent; 96 int sent;
97 97
diff --git a/drivers/media/video/cx25840/cx25840-vbi.c b/drivers/media/video/cx25840/cx25840-vbi.c
index 13ba4e15ddea..04d879da7d63 100644
--- a/drivers/media/video/cx25840/cx25840-vbi.c
+++ b/drivers/media/video/cx25840/cx25840-vbi.c
@@ -22,7 +22,7 @@
22 22
23#include "cx25840.h" 23#include "cx25840.h"
24 24
25static inline int odd_parity(u8 c) 25static int odd_parity(u8 c)
26{ 26{
27 c ^= (c >> 4); 27 c ^= (c >> 4);
28 c ^= (c >> 2); 28 c ^= (c >> 2);
@@ -31,7 +31,7 @@ static inline int odd_parity(u8 c)
31 return c & 1; 31 return c & 1;
32} 32}
33 33
34static inline int decode_vps(u8 * dst, u8 * p) 34static int decode_vps(u8 * dst, u8 * p)
35{ 35{
36 static const u8 biphase_tbl[] = { 36 static const u8 biphase_tbl[] = {
37 0xf0, 0x78, 0x70, 0xf0, 0xb4, 0x3c, 0x34, 0xb4, 37 0xf0, 0x78, 0x70, 0xf0, 0xb4, 0x3c, 0x34, 0xb4,