aboutsummaryrefslogtreecommitdiffstats
path: root/sound/i2c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2012-06-27 07:57:09 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-06-27 07:57:09 -0400
commita99817ca60d206be3645d156f755cf065e949c58 (patch)
treef95bcc12ba6f3de4181685ffb7042009439599d4 /sound/i2c
parent81d75e9f56522ed340d7c72471b35ac8e25d823d (diff)
parent099987f0aaf28771261b91a41240b9228f2e32b2 (diff)
Merge branch 'v4l_for_linus' into staging/for_v3.6
* v4l_for_linus: (44 commits) [media] smia: Fix compile failures [media] Fix VIDIOC_DQEVENT docbook entry [media] s5p-fimc: Fix control creation function [media] s5p-mfc: Fix checkpatch error in s5p_mfc_shm.h file [media] s5p-mfc: Fix setting controls [media] v4l/s5p-mfc: added image size align in VIDIOC_TRY_FMT [media] v4l/s5p-mfc: corrected encoder v4l control definitions [media] v4l: mem2mem_testdev: Fix race conditions in driver [media] s5p-mfc: Bug fix of timestamp/timecode copy mechanism [media] cxd2820r: Fix an incorrect modulation type bitmask [media] em28xx: Show a warning if the board does not support remote controls [media] em28xx: Add remote control support for Terratec's Cinergy HTC Stick HD [media] USB: Staging: media: lirc: initialize spinlocks before usage [media] Revert "[media] media: mx2_camera: Fix mbus format handling" [media] bw-qcam: driver and pixfmt documentation fixes [media] cx88: fix firmware load on big-endian systems [media] cx18: support big-endian systems [media] ivtv: fix support for big-endian systems [media] tuner-core: return the frequency range of the correct tuner [media] v4l2-dev.c: fix g_parm regression in determine_valid_ioctls() ... Conflicts: Documentation/DocBook/media/v4l/vidioc-create-bufs.xml drivers/media/video/em28xx/em28xx-cards.c
Diffstat (limited to 'sound/i2c')
-rw-r--r--sound/i2c/other/tea575x-tuner.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c
index ba2bc511d777..b29b88f93c9e 100644
--- a/sound/i2c/other/tea575x-tuner.c
+++ b/sound/i2c/other/tea575x-tuner.c
@@ -37,8 +37,8 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
37MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips"); 37MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips");
38MODULE_LICENSE("GPL"); 38MODULE_LICENSE("GPL");
39 39
40#define FREQ_LO (76U * 16000) 40#define FREQ_LO ((tea->tea5759 ? 760 : 875) * 1600U)
41#define FREQ_HI (108U * 16000) 41#define FREQ_HI ((tea->tea5759 ? 910 : 1080) * 1600U)
42 42
43/* 43/*
44 * definitions 44 * definitions
@@ -120,9 +120,9 @@ static u32 snd_tea575x_read(struct snd_tea575x *tea)
120 return data; 120 return data;
121} 121}
122 122
123static u32 snd_tea575x_get_freq(struct snd_tea575x *tea) 123static u32 snd_tea575x_val_to_freq(struct snd_tea575x *tea, u32 val)
124{ 124{
125 u32 freq = snd_tea575x_read(tea) & TEA575X_BIT_FREQ_MASK; 125 u32 freq = val & TEA575X_BIT_FREQ_MASK;
126 126
127 if (freq == 0) 127 if (freq == 0)
128 return freq; 128 return freq;
@@ -139,6 +139,11 @@ static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
139 return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */ 139 return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */
140} 140}
141 141
142static u32 snd_tea575x_get_freq(struct snd_tea575x *tea)
143{
144 return snd_tea575x_val_to_freq(tea, snd_tea575x_read(tea));
145}
146
142static void snd_tea575x_set_freq(struct snd_tea575x *tea) 147static void snd_tea575x_set_freq(struct snd_tea575x *tea)
143{ 148{
144 u32 freq = tea->freq; 149 u32 freq = tea->freq;
@@ -156,6 +161,7 @@ static void snd_tea575x_set_freq(struct snd_tea575x *tea)
156 tea->val &= ~TEA575X_BIT_FREQ_MASK; 161 tea->val &= ~TEA575X_BIT_FREQ_MASK;
157 tea->val |= freq & TEA575X_BIT_FREQ_MASK; 162 tea->val |= freq & TEA575X_BIT_FREQ_MASK;
158 snd_tea575x_write(tea, tea->val); 163 snd_tea575x_write(tea, tea->val);
164 tea->freq = snd_tea575x_val_to_freq(tea, tea->val);
159} 165}
160 166
161/* 167/*
@@ -319,7 +325,6 @@ static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl)
319} 325}
320 326
321static const struct v4l2_file_operations tea575x_fops = { 327static const struct v4l2_file_operations tea575x_fops = {
322 .owner = THIS_MODULE,
323 .unlocked_ioctl = video_ioctl2, 328 .unlocked_ioctl = video_ioctl2,
324 .open = v4l2_fh_open, 329 .open = v4l2_fh_open,
325 .release = v4l2_fh_release, 330 .release = v4l2_fh_release,
@@ -339,7 +344,6 @@ static const struct v4l2_ioctl_ops tea575x_ioctl_ops = {
339}; 344};
340 345
341static const struct video_device tea575x_radio = { 346static const struct video_device tea575x_radio = {
342 .fops = &tea575x_fops,
343 .ioctl_ops = &tea575x_ioctl_ops, 347 .ioctl_ops = &tea575x_ioctl_ops,
344 .release = video_device_release_empty, 348 .release = video_device_release_empty,
345}; 349};
@@ -351,7 +355,7 @@ static const struct v4l2_ctrl_ops tea575x_ctrl_ops = {
351/* 355/*
352 * initialize all the tea575x chips 356 * initialize all the tea575x chips
353 */ 357 */
354int snd_tea575x_init(struct snd_tea575x *tea) 358int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner)
355{ 359{
356 int retval; 360 int retval;
357 361
@@ -376,6 +380,9 @@ int snd_tea575x_init(struct snd_tea575x *tea)
376 tea->vd.lock = &tea->mutex; 380 tea->vd.lock = &tea->mutex;
377 tea->vd.v4l2_dev = tea->v4l2_dev; 381 tea->vd.v4l2_dev = tea->v4l2_dev;
378 tea->vd.ctrl_handler = &tea->ctrl_handler; 382 tea->vd.ctrl_handler = &tea->ctrl_handler;
383 tea->fops = tea575x_fops;
384 tea->fops.owner = owner;
385 tea->vd.fops = &tea->fops;
379 set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags); 386 set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags);
380 /* disable hw_freq_seek if we can't use it */ 387 /* disable hw_freq_seek if we can't use it */
381 if (tea->cannot_read_data) 388 if (tea->cannot_read_data)