aboutsummaryrefslogtreecommitdiffstats
path: root/sound/i2c/other
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2012-07-11 06:50:20 -0400
committerArnd Bergmann <arnd@arndb.de>2012-07-11 06:50:20 -0400
commit0dc19510430b20b3b2d6d1b9b796fd42fa2af64a (patch)
treea512cf400d74d72272ce6cf5c4d782538213d433 /sound/i2c/other
parentb52a2c472d7fcf215e31dffdd382651e1b99f138 (diff)
parentbd0a521e88aa7a06ae7aabaed7ae196ed4ad867a (diff)
Merge tag 'v3.5-rc6' into next/soc
Linux 3.5-rc6 Dependency for imx/soc changes
Diffstat (limited to 'sound/i2c/other')
-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 582aace20ea3..7eca25fae413 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/*
@@ -317,7 +323,6 @@ static int tea575x_s_ctrl(struct v4l2_ctrl *ctrl)
317} 323}
318 324
319static const struct v4l2_file_operations tea575x_fops = { 325static const struct v4l2_file_operations tea575x_fops = {
320 .owner = THIS_MODULE,
321 .unlocked_ioctl = video_ioctl2, 326 .unlocked_ioctl = video_ioctl2,
322 .open = v4l2_fh_open, 327 .open = v4l2_fh_open,
323 .release = v4l2_fh_release, 328 .release = v4l2_fh_release,
@@ -337,7 +342,6 @@ static const struct v4l2_ioctl_ops tea575x_ioctl_ops = {
337}; 342};
338 343
339static const struct video_device tea575x_radio = { 344static const struct video_device tea575x_radio = {
340 .fops = &tea575x_fops,
341 .ioctl_ops = &tea575x_ioctl_ops, 345 .ioctl_ops = &tea575x_ioctl_ops,
342 .release = video_device_release_empty, 346 .release = video_device_release_empty,
343}; 347};
@@ -349,7 +353,7 @@ static const struct v4l2_ctrl_ops tea575x_ctrl_ops = {
349/* 353/*
350 * initialize all the tea575x chips 354 * initialize all the tea575x chips
351 */ 355 */
352int snd_tea575x_init(struct snd_tea575x *tea) 356int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner)
353{ 357{
354 int retval; 358 int retval;
355 359
@@ -374,6 +378,9 @@ int snd_tea575x_init(struct snd_tea575x *tea)
374 tea->vd.lock = &tea->mutex; 378 tea->vd.lock = &tea->mutex;
375 tea->vd.v4l2_dev = tea->v4l2_dev; 379 tea->vd.v4l2_dev = tea->v4l2_dev;
376 tea->vd.ctrl_handler = &tea->ctrl_handler; 380 tea->vd.ctrl_handler = &tea->ctrl_handler;
381 tea->fops = tea575x_fops;
382 tea->fops.owner = owner;
383 tea->vd.fops = &tea->fops;
377 set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags); 384 set_bit(V4L2_FL_USE_FH_PRIO, &tea->vd.flags);
378 /* disable hw_freq_seek if we can't use it */ 385 /* disable hw_freq_seek if we can't use it */
379 if (tea->cannot_read_data) 386 if (tea->cannot_read_data)