diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-05 07:53:54 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:04:30 -0500 |
commit | 539c96d0fd86bfdcfac75c88b74aa5798439293d (patch) | |
tree | fb72c663b71fb2e9eef6eeaf859e774c8bb027a8 /drivers/media/video/em28xx/em28xx.h | |
parent | 6596a4f6032f13f1bef47550fcf1d4134cd978a4 (diff) |
V4L/DVB (6947): Improve audio setup handling
It is possible to select audio inputs via em28xx or via ac97 functions.
This patch allows configuring a board to use either one way.
It also do some cleanups at audio setup configurations.
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx.h')
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 93007cc72f4d..abde13ecb4a8 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -151,10 +151,17 @@ enum enum28xx_itype { | |||
151 | EM28XX_RADIO, | 151 | EM28XX_RADIO, |
152 | }; | 152 | }; |
153 | 153 | ||
154 | enum em28xx_amux { | ||
155 | EM28XX_AMUX_VIDEO, | ||
156 | EM28XX_AMUX_LINE_IN, | ||
157 | EM28XX_AMUX_AC97_VIDEO, | ||
158 | EM28XX_AMUX_AC97_LINE_IN, | ||
159 | }; | ||
160 | |||
154 | struct em28xx_input { | 161 | struct em28xx_input { |
155 | enum enum28xx_itype type; | 162 | enum enum28xx_itype type; |
156 | unsigned int vmux; | 163 | unsigned int vmux; |
157 | unsigned int amux; | 164 | enum em28xx_amux amux; |
158 | }; | 165 | }; |
159 | 166 | ||
160 | #define INPUT(nr) (&em28xx_boards[dev->model].input[nr]) | 167 | #define INPUT(nr) (&em28xx_boards[dev->model].input[nr]) |
@@ -321,8 +328,9 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, | |||
321 | int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len); | 328 | int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len); |
322 | int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, | 329 | int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, |
323 | u8 bitmask); | 330 | u8 bitmask); |
324 | int em28xx_write_ac97(struct em28xx *dev, u8 reg, u8 * val); | 331 | int em28xx_set_audio_source(struct em28xx *dev); |
325 | int em28xx_audio_analog_set(struct em28xx *dev); | 332 | int em28xx_audio_analog_set(struct em28xx *dev); |
333 | |||
326 | int em28xx_colorlevels_set_default(struct em28xx *dev); | 334 | int em28xx_colorlevels_set_default(struct em28xx *dev); |
327 | int em28xx_capture_start(struct em28xx *dev, int start); | 335 | int em28xx_capture_start(struct em28xx *dev, int start); |
328 | int em28xx_outfmt_set_yuv422(struct em28xx *dev); | 336 | int em28xx_outfmt_set_yuv422(struct em28xx *dev); |
@@ -394,6 +402,7 @@ extern const unsigned int em28xx_bcount; | |||
394 | 402 | ||
395 | /* em202 registers */ | 403 | /* em202 registers */ |
396 | #define MASTER_AC97 0x02 | 404 | #define MASTER_AC97 0x02 |
405 | #define LINE_IN_AC97 0x10 | ||
397 | #define VIDEO_AC97 0x14 | 406 | #define VIDEO_AC97 0x14 |
398 | 407 | ||
399 | /* register settings */ | 408 | /* register settings */ |
@@ -418,28 +427,6 @@ extern const unsigned int em28xx_bcount; | |||
418 | printk(KERN_WARNING "%s: "fmt,\ | 427 | printk(KERN_WARNING "%s: "fmt,\ |
419 | dev->name , ##arg); } while (0) | 428 | dev->name , ##arg); } while (0) |
420 | 429 | ||
421 | inline static int em28xx_audio_source(struct em28xx *dev, int input) | ||
422 | { | ||
423 | if(dev->is_em2800){ | ||
424 | u8 tmp = EM2800_AUDIO_SRC_TUNER; | ||
425 | if(input == EM28XX_AUDIO_SRC_LINE) | ||
426 | tmp = EM2800_AUDIO_SRC_LINE; | ||
427 | em28xx_write_regs(dev, EM2800_AUDIOSRC_REG, &tmp, 1); | ||
428 | } | ||
429 | return em28xx_write_reg_bits(dev, AUDIOSRC_REG, input, 0xc0); | ||
430 | } | ||
431 | |||
432 | inline static int em28xx_audio_usb_mute(struct em28xx *dev, int mute) | ||
433 | { | ||
434 | return em28xx_write_reg_bits(dev, XCLK_REG, mute ? 0x00 : 0x80, 0x80); | ||
435 | } | ||
436 | |||
437 | inline static int em28xx_audio_analog_setup(struct em28xx *dev) | ||
438 | { | ||
439 | /* unmute video mixer with default volume level */ | ||
440 | return em28xx_write_ac97(dev, VIDEO_AC97, "\x08\x08"); | ||
441 | } | ||
442 | |||
443 | inline static int em28xx_compression_disable(struct em28xx *dev) | 430 | inline static int em28xx_compression_disable(struct em28xx *dev) |
444 | { | 431 | { |
445 | /* side effect of disabling scaler and mixer */ | 432 | /* side effect of disabling scaler and mixer */ |