From fc488517cc0d50bcc9e4ffa90fee5755f9c914fc Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Thu, 12 Jul 2012 17:39:18 -0300 Subject: [media] snd_tea575x: Add support for tuning AM Add support for tuning AM (on devices with the necessary additional hardware components), and advertise the available bands using the new VIDIOC_ENUM_FREQ_BANDS ioctl. Signed-off-by: Hans de Goede CC: Ondrej Zary Signed-off-by: Mauro Carvalho Chehab --- sound/i2c/other/tea575x-tuner.c | 197 ++++++++++++++++++++++++++++++++-------- 1 file changed, 161 insertions(+), 36 deletions(-) (limited to 'sound') diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index d14edb7d648..88bbd88c066 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -37,9 +37,6 @@ MODULE_AUTHOR("Jaroslav Kysela "); MODULE_DESCRIPTION("Routines for control of TEA5757/5759 Philips AM/FM radio tuner chips"); MODULE_LICENSE("GPL"); -#define FREQ_LO ((tea->tea5759 ? 760 : 875) * 1600U) -#define FREQ_HI ((tea->tea5759 ? 910 : 1080) * 1600U) - /* * definitions */ @@ -50,8 +47,8 @@ MODULE_LICENSE("GPL"); #define TEA575X_BIT_BAND_MASK (3<<20) #define TEA575X_BIT_BAND_FM (0<<20) #define TEA575X_BIT_BAND_MW (1<<20) -#define TEA575X_BIT_BAND_LW (1<<21) -#define TEA575X_BIT_BAND_SW (1<<22) +#define TEA575X_BIT_BAND_LW (2<<20) +#define TEA575X_BIT_BAND_SW (3<<20) #define TEA575X_BIT_PORT_0 (1<<19) /* user bit */ #define TEA575X_BIT_PORT_1 (1<<18) /* user bit */ #define TEA575X_BIT_SEARCH_MASK (3<<16) /* search level */ @@ -62,6 +59,37 @@ MODULE_LICENSE("GPL"); #define TEA575X_BIT_DUMMY (1<<15) /* buffer */ #define TEA575X_BIT_FREQ_MASK 0x7fff +enum { BAND_FM, BAND_FM_JAPAN, BAND_AM }; + +static const struct v4l2_frequency_band bands[] = { + { + .type = V4L2_TUNER_RADIO, + .index = 0, + .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | + V4L2_TUNER_CAP_FREQ_BANDS, + .rangelow = 87500 * 16, + .rangehigh = 108000 * 16, + .modulation = V4L2_BAND_MODULATION_FM, + }, + { + .type = V4L2_TUNER_RADIO, + .index = 0, + .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO | + V4L2_TUNER_CAP_FREQ_BANDS, + .rangelow = 76000 * 16, + .rangehigh = 91000 * 16, + .modulation = V4L2_BAND_MODULATION_FM, + }, + { + .type = V4L2_TUNER_RADIO, + .index = 1, + .capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS, + .rangelow = 530 * 16, + .rangehigh = 1710 * 16, + .modulation = V4L2_BAND_MODULATION_AM, + }, +}; + /* * lowlevel part */ @@ -133,16 +161,29 @@ static u32 snd_tea575x_val_to_freq(struct snd_tea575x *tea, u32 val) if (freq == 0) return freq; - /* freq *= 12.5 */ - freq *= 125; - freq /= 10; - /* crystal fixup */ - if (tea->tea5759) - freq += TEA575X_FMIF; - else + switch (tea->band) { + case BAND_FM: + /* freq *= 12.5 */ + freq *= 125; + freq /= 10; + /* crystal fixup */ freq -= TEA575X_FMIF; + break; + case BAND_FM_JAPAN: + /* freq *= 12.5 */ + freq *= 125; + freq /= 10; + /* crystal fixup */ + freq += TEA575X_FMIF; + break; + case BAND_AM: + /* crystal fixup */ + freq -= TEA575X_AMIF; + break; + } - return clamp(freq * 16, FREQ_LO, FREQ_HI); /* from kHz */ + return clamp(freq * 16, bands[tea->band].rangelow, + bands[tea->band].rangehigh); /* from kHz */ } static u32 snd_tea575x_get_freq(struct snd_tea575x *tea) @@ -152,19 +193,35 @@ static u32 snd_tea575x_get_freq(struct snd_tea575x *tea) static void snd_tea575x_set_freq(struct snd_tea575x *tea) { - u32 freq = tea->freq; + u32 freq = tea->freq / 16; /* to kHz */ + u32 band = 0; - freq /= 16; /* to kHz */ - /* crystal fixup */ - if (tea->tea5759) - freq -= TEA575X_FMIF; - else + switch (tea->band) { + case BAND_FM: + band = TEA575X_BIT_BAND_FM; + /* crystal fixup */ freq += TEA575X_FMIF; - /* freq /= 12.5 */ - freq *= 10; - freq /= 125; + /* freq /= 12.5 */ + freq *= 10; + freq /= 125; + break; + case BAND_FM_JAPAN: + band = TEA575X_BIT_BAND_FM; + /* crystal fixup */ + freq -= TEA575X_FMIF; + /* freq /= 12.5 */ + freq *= 10; + freq /= 125; + break; + case BAND_AM: + band = TEA575X_BIT_BAND_MW; + /* crystal fixup */ + freq += TEA575X_AMIF; + break; + } - tea->val &= ~TEA575X_BIT_FREQ_MASK; + tea->val &= ~(TEA575X_BIT_FREQ_MASK | TEA575X_BIT_BAND_MASK); + tea->val |= band; tea->val |= freq & TEA575X_BIT_FREQ_MASK; snd_tea575x_write(tea, tea->val); tea->freq = snd_tea575x_val_to_freq(tea, tea->val); @@ -190,23 +247,57 @@ static int vidioc_querycap(struct file *file, void *priv, return 0; } +static int vidioc_enum_freq_bands(struct file *file, void *priv, + struct v4l2_frequency_band *band) +{ + struct snd_tea575x *tea = video_drvdata(file); + int index; + + if (band->tuner != 0) + return -EINVAL; + + switch (band->index) { + case 0: + if (tea->tea5759) + index = BAND_FM_JAPAN; + else + index = BAND_FM; + break; + case 1: + if (tea->has_am) { + index = BAND_AM; + break; + } + /* Fall through */ + default: + return -EINVAL; + } + + *band = bands[index]; + if (!tea->cannot_read_data) + band->capability |= V4L2_TUNER_CAP_HWSEEK_BOUNDED; + + return 0; +} + static int vidioc_g_tuner(struct file *file, void *priv, struct v4l2_tuner *v) { struct snd_tea575x *tea = video_drvdata(file); + struct v4l2_frequency_band band_fm = { 0, }; if (v->index > 0) return -EINVAL; snd_tea575x_read(tea); + vidioc_enum_freq_bands(file, priv, &band_fm); - strcpy(v->name, "FM"); + memset(v, 0, sizeof(*v)); + strlcpy(v->name, tea->has_am ? "FM/AM" : "FM", sizeof(v->name)); v->type = V4L2_TUNER_RADIO; - v->capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO; - if (!tea->cannot_read_data) - v->capability |= V4L2_TUNER_CAP_HWSEEK_BOUNDED; - v->rangelow = FREQ_LO; - v->rangehigh = FREQ_HI; + v->capability = band_fm.capability; + v->rangelow = tea->has_am ? bands[BAND_AM].rangelow : band_fm.rangelow; + v->rangehigh = band_fm.rangehigh; v->rxsubchans = tea->stereo ? V4L2_TUNER_SUB_STEREO : V4L2_TUNER_SUB_MONO; v->audmode = (tea->val & TEA575X_BIT_MONO) ? V4L2_TUNER_MODE_MONO : V4L2_TUNER_MODE_STEREO; @@ -218,13 +309,17 @@ static int vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *v) { struct snd_tea575x *tea = video_drvdata(file); + u32 orig_val = tea->val; if (v->index) return -EINVAL; tea->val &= ~TEA575X_BIT_MONO; if (v->audmode == V4L2_TUNER_MODE_MONO) tea->val |= TEA575X_BIT_MONO; - snd_tea575x_write(tea, tea->val); + /* Only apply changes if currently tuning FM */ + if (tea->band != BAND_AM && tea->val != orig_val) + snd_tea575x_set_freq(tea); + return 0; } @@ -248,8 +343,15 @@ static int vidioc_s_frequency(struct file *file, void *priv, if (f->tuner != 0 || f->type != V4L2_TUNER_RADIO) return -EINVAL; - tea->val &= ~TEA575X_BIT_SEARCH; - tea->freq = clamp(f->frequency, FREQ_LO, FREQ_HI); + if (tea->has_am && f->frequency < (20000 * 16)) + tea->band = BAND_AM; + else if (tea->tea5759) + tea->band = BAND_FM_JAPAN; + else + tea->band = BAND_FM; + + tea->freq = clamp(f->frequency, bands[tea->band].rangelow, + bands[tea->band].rangehigh); snd_tea575x_set_freq(tea); return 0; } @@ -259,13 +361,35 @@ static int vidioc_s_hw_freq_seek(struct file *file, void *fh, { struct snd_tea575x *tea = video_drvdata(file); unsigned long timeout; - int i; + int i, spacing; if (tea->cannot_read_data) return -ENOTTY; if (a->tuner || a->wrap_around) return -EINVAL; + if (a->rangelow || a->rangehigh) { + for (i = 0; i < ARRAY_SIZE(bands); i++) { + if ((i == BAND_FM && tea->tea5759) || + (i == BAND_FM_JAPAN && !tea->tea5759) || + (i == BAND_AM && !tea->has_am)) + continue; + if (bands[i].rangelow == a->rangelow && + bands[i].rangehigh == a->rangehigh) + break; + } + if (i == ARRAY_SIZE(bands)) + return -EINVAL; /* No matching band found */ + if (i != tea->band) { + tea->band = i; + tea->freq = clamp(tea->freq, bands[i].rangelow, + bands[i].rangehigh); + snd_tea575x_set_freq(tea); + } + } + + spacing = (tea->band == BAND_AM) ? 5 : 50; /* kHz */ + /* clear the frequency, HW will fill it in */ tea->val &= ~TEA575X_BIT_FREQ_MASK; tea->val |= TEA575X_BIT_SEARCH; @@ -297,10 +421,10 @@ static int vidioc_s_hw_freq_seek(struct file *file, void *fh, if (freq == 0) /* shouldn't happen */ break; /* - * if we moved by less than 50 kHz, or in the wrong - * direction, continue seeking + * if we moved by less than the spacing, or in the + * wrong direction, continue seeking */ - if (abs(tea->freq - freq) < 16 * 50 || + if (abs(tea->freq - freq) < 16 * spacing || (a->seek_upward && freq < tea->freq) || (!a->seek_upward && freq > tea->freq)) { snd_tea575x_write(tea, tea->val); @@ -344,6 +468,7 @@ static const struct v4l2_ioctl_ops tea575x_ioctl_ops = { .vidioc_g_frequency = vidioc_g_frequency, .vidioc_s_frequency = vidioc_s_frequency, .vidioc_s_hw_freq_seek = vidioc_s_hw_freq_seek, + .vidioc_enum_freq_bands = vidioc_enum_freq_bands, .vidioc_log_status = v4l2_ctrl_log_status, .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, .vidioc_unsubscribe_event = v4l2_event_unsubscribe, -- cgit v1.2.3 From 559c2009003bb8092e4927a4bac99cbf75834979 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sat, 11 Aug 2012 12:55:22 -0300 Subject: [media] radio-shark: Add support for suspend & resume Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/radio-shark.c | 43 ++++++++++++++++++++++++++++++++++++++- include/sound/tea575x-tuner.h | 1 + sound/i2c/other/tea575x-tuner.c | 3 ++- 3 files changed, 45 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/drivers/media/radio/radio-shark.c b/drivers/media/radio/radio-shark.c index e1970bf031a..248bc3a3083 100644 --- a/drivers/media/radio/radio-shark.c +++ b/drivers/media/radio/radio-shark.c @@ -59,7 +59,8 @@ MODULE_LICENSE("GPL"); #define v4l2_dev_to_shark(d) container_of(d, struct shark_device, v4l2_dev) -enum { BLUE_LED, BLUE_PULSE_LED, RED_LED, NO_LEDS }; +/* Note BLUE_IS_PULSE comes after NO_LEDS as it is a status bit, not a LED */ +enum { BLUE_LED, BLUE_PULSE_LED, RED_LED, NO_LEDS, BLUE_IS_PULSE }; struct shark_device { struct usb_device *usbdev; @@ -190,6 +191,7 @@ static void shark_led_set_blue(struct led_classdev *led_cdev, atomic_set(&shark->brightness[BLUE_LED], value); set_bit(BLUE_LED, &shark->brightness_new); + clear_bit(BLUE_IS_PULSE, &shark->brightness_new); schedule_work(&shark->led_work); } @@ -201,6 +203,7 @@ static void shark_led_set_blue_pulse(struct led_classdev *led_cdev, atomic_set(&shark->brightness[BLUE_PULSE_LED], 256 - value); set_bit(BLUE_PULSE_LED, &shark->brightness_new); + set_bit(BLUE_IS_PULSE, &shark->brightness_new); schedule_work(&shark->led_work); } @@ -240,6 +243,7 @@ static int shark_register_leds(struct shark_device *shark, struct device *dev) { int i, retval; + atomic_set(&shark->brightness[BLUE_LED], 127); INIT_WORK(&shark->led_work, shark_led_work); for (i = 0; i < NO_LEDS; i++) { shark->leds[i] = shark_led_templates[i]; @@ -266,6 +270,16 @@ static void shark_unregister_leds(struct shark_device *shark) cancel_work_sync(&shark->led_work); } + +static void shark_resume_leds(struct shark_device *shark) +{ + if (test_bit(BLUE_IS_PULSE, &shark->brightness_new)) + set_bit(BLUE_PULSE_LED, &shark->brightness_new); + else + set_bit(BLUE_LED, &shark->brightness_new); + set_bit(RED_LED, &shark->brightness_new); + schedule_work(&shark->led_work); +} #else static int shark_register_leds(struct shark_device *shark, struct device *dev) { @@ -274,6 +288,7 @@ static int shark_register_leds(struct shark_device *shark, struct device *dev) return 0; } static inline void shark_unregister_leds(struct shark_device *shark) { } +static inline void shark_resume_leds(struct shark_device *shark) { } #endif static void usb_shark_disconnect(struct usb_interface *intf) @@ -359,6 +374,27 @@ err_alloc_buffer: return retval; } +#ifdef CONFIG_PM +int usb_shark_suspend(struct usb_interface *intf, pm_message_t message) +{ + return 0; +} + +int usb_shark_resume(struct usb_interface *intf) +{ + struct v4l2_device *v4l2_dev = usb_get_intfdata(intf); + struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); + + mutex_lock(&shark->tea.mutex); + snd_tea575x_set_freq(&shark->tea); + mutex_unlock(&shark->tea.mutex); + + shark_resume_leds(shark); + + return 0; +} +#endif + /* Specify the bcdDevice value, as the radioSHARK and radioSHARK2 share ids */ static struct usb_device_id usb_shark_device_table[] = { { .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION | @@ -378,5 +414,10 @@ static struct usb_driver usb_shark_driver = { .probe = usb_shark_probe, .disconnect = usb_shark_disconnect, .id_table = usb_shark_device_table, +#ifdef CONFIG_PM + .suspend = usb_shark_suspend, + .resume = usb_shark_resume, + .reset_resume = usb_shark_resume, +#endif }; module_usb_driver(usb_shark_driver); diff --git a/include/sound/tea575x-tuner.h b/include/sound/tea575x-tuner.h index 2a695356855..098c4de4494 100644 --- a/include/sound/tea575x-tuner.h +++ b/include/sound/tea575x-tuner.h @@ -73,5 +73,6 @@ struct snd_tea575x { int snd_tea575x_init(struct snd_tea575x *tea, struct module *owner); void snd_tea575x_exit(struct snd_tea575x *tea); +void snd_tea575x_set_freq(struct snd_tea575x *tea); #endif /* __SOUND_TEA575X_TUNER_H */ diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 88bbd88c066..cd79ed590f9 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -191,7 +191,7 @@ static u32 snd_tea575x_get_freq(struct snd_tea575x *tea) return snd_tea575x_val_to_freq(tea, snd_tea575x_read(tea)); } -static void snd_tea575x_set_freq(struct snd_tea575x *tea) +void snd_tea575x_set_freq(struct snd_tea575x *tea) { u32 freq = tea->freq / 16; /* to kHz */ u32 band = 0; @@ -571,3 +571,4 @@ module_exit(alsa_tea575x_module_exit) EXPORT_SYMBOL(snd_tea575x_init); EXPORT_SYMBOL(snd_tea575x_exit); +EXPORT_SYMBOL(snd_tea575x_set_freq); -- cgit v1.2.3 From ec6f4328108f1c83d5ac907c0d978fa886ef9627 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 14 Sep 2012 07:41:18 -0300 Subject: [media] v4l2: make vidioc_s_freq_hw_seek const Write-only ioctls should have a const argument in the ioctl op. Do this conversion for vidioc_s_freq_hw_seek. Adding const for write-only ioctls was decided during the 2012 Media Workshop. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/radio-mr800.c | 2 +- drivers/media/radio/radio-tea5777.c | 32 +++++++++++++----------- drivers/media/radio/radio-wl1273.c | 2 +- drivers/media/radio/si470x/radio-si470x-common.c | 4 +-- drivers/media/radio/wl128x/fmdrv_v4l2.c | 2 +- include/media/v4l2-ioctl.h | 2 +- sound/i2c/other/tea575x-tuner.c | 2 +- 7 files changed, 24 insertions(+), 22 deletions(-) (limited to 'sound') diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index 3182b26d6ef..720bf0da599 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c @@ -348,7 +348,7 @@ static int vidioc_g_frequency(struct file *file, void *priv, } static int vidioc_s_hw_freq_seek(struct file *file, void *priv, - struct v4l2_hw_freq_seek *seek) + const struct v4l2_hw_freq_seek *seek) { static u8 buf[8] = { 0x3d, 0x32, 0x0f, 0x08, 0x3d, 0x32, 0x0f, 0x08 diff --git a/drivers/media/radio/radio-tea5777.c b/drivers/media/radio/radio-tea5777.c index ef828982979..c1a2ea6e87a 100644 --- a/drivers/media/radio/radio-tea5777.c +++ b/drivers/media/radio/radio-tea5777.c @@ -385,59 +385,61 @@ static int vidioc_s_frequency(struct file *file, void *priv, } static int vidioc_s_hw_freq_seek(struct file *file, void *fh, - struct v4l2_hw_freq_seek *a) + const struct v4l2_hw_freq_seek *a) { struct radio_tea5777 *tea = video_drvdata(file); unsigned long timeout; + u32 rangelow = a->rangelow; + u32 rangehigh = a->rangehigh; int i, res, spacing; u32 orig_freq; if (a->tuner || a->wrap_around) return -EINVAL; - if (a->rangelow || a->rangehigh) { + if (rangelow || rangehigh) { for (i = 0; i < ARRAY_SIZE(bands); i++) { if (i == BAND_AM && !tea->has_am) continue; - if (bands[i].rangelow >= a->rangelow && - bands[i].rangehigh <= a->rangehigh) + if (bands[i].rangelow >= rangelow && + bands[i].rangehigh <= rangehigh) break; } if (i == ARRAY_SIZE(bands)) return -EINVAL; /* No matching band found */ tea->band = i; - if (tea->freq < a->rangelow || tea->freq > a->rangehigh) { - tea->freq = clamp(tea->freq, a->rangelow, - a->rangehigh); + if (tea->freq < rangelow || tea->freq > rangehigh) { + tea->freq = clamp(tea->freq, rangelow, + rangehigh); res = radio_tea5777_set_freq(tea); if (res) return res; } } else { - a->rangelow = bands[tea->band].rangelow; - a->rangehigh = bands[tea->band].rangehigh; + rangelow = bands[tea->band].rangelow; + rangehigh = bands[tea->band].rangehigh; } spacing = (tea->band == BAND_AM) ? (5 * 16) : (200 * 16); /* kHz */ orig_freq = tea->freq; tea->write_reg |= TEA5777_W_PROGBLIM_MASK; - if (tea->seek_rangelow != a->rangelow) { + if (tea->seek_rangelow != rangelow) { tea->write_reg &= ~TEA5777_W_UPDWN_MASK; - tea->freq = a->rangelow; + tea->freq = rangelow; res = radio_tea5777_set_freq(tea); if (res) goto leave; - tea->seek_rangelow = a->rangelow; + tea->seek_rangelow = rangelow; } - if (tea->seek_rangehigh != a->rangehigh) { + if (tea->seek_rangehigh != rangehigh) { tea->write_reg |= TEA5777_W_UPDWN_MASK; - tea->freq = a->rangehigh; + tea->freq = rangehigh; res = radio_tea5777_set_freq(tea); if (res) goto leave; - tea->seek_rangehigh = a->rangehigh; + tea->seek_rangehigh = rangehigh; } tea->write_reg &= ~TEA5777_W_PROGBLIM_MASK; diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c index a22ad1c1f3d..71968a61073 100644 --- a/drivers/media/radio/radio-wl1273.c +++ b/drivers/media/radio/radio-wl1273.c @@ -1682,7 +1682,7 @@ static int wl1273_fm_vidioc_s_frequency(struct file *file, void *priv, #define WL1273_DEFAULT_SEEK_LEVEL 7 static int wl1273_fm_vidioc_s_hw_freq_seek(struct file *file, void *priv, - struct v4l2_hw_freq_seek *seek) + const struct v4l2_hw_freq_seek *seek) { struct wl1273_device *radio = video_get_drvdata(video_devdata(file)); struct wl1273_core *core = radio->core; diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index 9bb65e170d9..74a5c901471 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -296,7 +296,7 @@ int si470x_set_freq(struct si470x_device *radio, unsigned int freq) * si470x_set_seek - set seek */ static int si470x_set_seek(struct si470x_device *radio, - struct v4l2_hw_freq_seek *seek) + const struct v4l2_hw_freq_seek *seek) { int band, retval; unsigned int freq; @@ -701,7 +701,7 @@ static int si470x_vidioc_s_frequency(struct file *file, void *priv, * si470x_vidioc_s_hw_freq_seek - set hardware frequency seek */ static int si470x_vidioc_s_hw_freq_seek(struct file *file, void *priv, - struct v4l2_hw_freq_seek *seek) + const struct v4l2_hw_freq_seek *seek) { struct si470x_device *radio = video_drvdata(file); diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c index db2248ee949..f816ea68e46 100644 --- a/drivers/media/radio/wl128x/fmdrv_v4l2.c +++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c @@ -403,7 +403,7 @@ static int fm_v4l2_vidioc_s_freq(struct file *file, void *priv, /* Set hardware frequency seek. If current mode is NOT RX, set it RX. */ static int fm_v4l2_vidioc_s_hw_freq_seek(struct file *file, void *priv, - struct v4l2_hw_freq_seek *seek) + const struct v4l2_hw_freq_seek *seek) { struct fmdev *fmdev = video_drvdata(file); int ret; diff --git a/include/media/v4l2-ioctl.h b/include/media/v4l2-ioctl.h index 21f624586d5..865f95d92ba 100644 --- a/include/media/v4l2-ioctl.h +++ b/include/media/v4l2-ioctl.h @@ -233,7 +233,7 @@ struct v4l2_ioctl_ops { int (*vidioc_log_status) (struct file *file, void *fh); int (*vidioc_s_hw_freq_seek) (struct file *file, void *fh, - struct v4l2_hw_freq_seek *a); + const struct v4l2_hw_freq_seek *a); /* Debugging ioctls */ #ifdef CONFIG_VIDEO_ADV_DEBUG diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index cd79ed590f9..4a8fad674f0 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -357,7 +357,7 @@ static int vidioc_s_frequency(struct file *file, void *priv, } static int vidioc_s_hw_freq_seek(struct file *file, void *fh, - struct v4l2_hw_freq_seek *a) + const struct v4l2_hw_freq_seek *a) { struct snd_tea575x *tea = video_drvdata(file); unsigned long timeout; -- cgit v1.2.3 From 617ade61ea88a370c89960918eddfa10c41316f5 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Fri, 21 Sep 2012 09:33:35 -0300 Subject: [media] radio drivers: in non-blocking mode return EAGAIN in hwseek VIDIOC_S_HW_FREQ_SEEK should return EAGAIN when called in non-blocking mode. This might change in the future if we add support for this in the future, but right now this is not supported. Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/radio/radio-mr800.c | 3 +++ drivers/media/radio/radio-tea5777.c | 3 +++ drivers/media/radio/radio-wl1273.c | 3 +++ drivers/media/radio/si470x/radio-si470x-common.c | 3 +++ drivers/media/radio/wl128x/fmdrv_v4l2.c | 3 +++ sound/i2c/other/tea575x-tuner.c | 3 +++ 6 files changed, 18 insertions(+) (limited to 'sound') diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index 720bf0da599..9c5a267b60b 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c @@ -360,6 +360,9 @@ static int vidioc_s_hw_freq_seek(struct file *file, void *priv, if (seek->tuner != 0 || !seek->wrap_around) return -EINVAL; + if (file->f_flags & O_NONBLOCK) + return -EWOULDBLOCK; + retval = amradio_send_cmd(radio, AMRADIO_SET_SEARCH_LVL, 0, buf, 8, false); if (retval) diff --git a/drivers/media/radio/radio-tea5777.c b/drivers/media/radio/radio-tea5777.c index c1a2ea6e87a..4b5190d4fea 100644 --- a/drivers/media/radio/radio-tea5777.c +++ b/drivers/media/radio/radio-tea5777.c @@ -397,6 +397,9 @@ static int vidioc_s_hw_freq_seek(struct file *file, void *fh, if (a->tuner || a->wrap_around) return -EINVAL; + if (file->f_flags & O_NONBLOCK) + return -EWOULDBLOCK; + if (rangelow || rangehigh) { for (i = 0; i < ARRAY_SIZE(bands); i++) { if (i == BAND_AM && !tea->has_am) diff --git a/drivers/media/radio/radio-wl1273.c b/drivers/media/radio/radio-wl1273.c index b53ecbc67f1..9b0c9fa0beb 100644 --- a/drivers/media/radio/radio-wl1273.c +++ b/drivers/media/radio/radio-wl1273.c @@ -1693,6 +1693,9 @@ static int wl1273_fm_vidioc_s_hw_freq_seek(struct file *file, void *priv, if (seek->tuner != 0 || seek->type != V4L2_TUNER_RADIO) return -EINVAL; + if (file->f_flags & O_NONBLOCK) + return -EWOULDBLOCK; + if (mutex_lock_interruptible(&core->lock)) return -EINTR; diff --git a/drivers/media/radio/si470x/radio-si470x-common.c b/drivers/media/radio/si470x/radio-si470x-common.c index 74a5c901471..18989388ddc 100644 --- a/drivers/media/radio/si470x/radio-si470x-common.c +++ b/drivers/media/radio/si470x/radio-si470x-common.c @@ -708,6 +708,9 @@ static int si470x_vidioc_s_hw_freq_seek(struct file *file, void *priv, if (seek->tuner != 0) return -EINVAL; + if (file->f_flags & O_NONBLOCK) + return -EWOULDBLOCK; + return si470x_set_seek(radio, seek); } diff --git a/drivers/media/radio/wl128x/fmdrv_v4l2.c b/drivers/media/radio/wl128x/fmdrv_v4l2.c index 8a672a31a65..048de453603 100644 --- a/drivers/media/radio/wl128x/fmdrv_v4l2.c +++ b/drivers/media/radio/wl128x/fmdrv_v4l2.c @@ -408,6 +408,9 @@ static int fm_v4l2_vidioc_s_hw_freq_seek(struct file *file, void *priv, struct fmdev *fmdev = video_drvdata(file); int ret; + if (file->f_flags & O_NONBLOCK) + return -EWOULDBLOCK; + if (fmdev->curr_fmmode != FM_MODE_RX) { ret = fmc_set_mode(fmdev, FM_MODE_RX); if (ret != 0) { diff --git a/sound/i2c/other/tea575x-tuner.c b/sound/i2c/other/tea575x-tuner.c index 4a8fad674f0..3c6c1e3226f 100644 --- a/sound/i2c/other/tea575x-tuner.c +++ b/sound/i2c/other/tea575x-tuner.c @@ -368,6 +368,9 @@ static int vidioc_s_hw_freq_seek(struct file *file, void *fh, if (a->tuner || a->wrap_around) return -EINVAL; + if (file->f_flags & O_NONBLOCK) + return -EWOULDBLOCK; + if (a->rangelow || a->rangehigh) { for (i = 0; i < ARRAY_SIZE(bands); i++) { if ((i == BAND_FM && tea->tea5759) || -- cgit v1.2.3 From f39a0dd62a1a0e674078c3273977bf055a21f80d Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Wed, 22 Aug 2012 14:57:01 -0300 Subject: [media] media/radio/shark2: Fix build error caused by missing dependencies Without this patch, building rand-0y2jSKT results in: WARNING: drivers/usb/musb/musb_hdrc.o(.devinit.text+0x9b8): Section mismatch in reference from the function musb_init_controller() to the function .init.text:dma_controller_create() The function __devinit musb_init_controller() references a function __init dma_controller_create(). If dma_controller_create is only used by musb_init_controller then annotate dma_controller_create with a matching annotation. ERROR: "snd_tea575x_init" [drivers/media/radio/radio-shark.ko] undefined! ERROR: "snd_tea575x_exit" [drivers/media/radio/radio-shark.ko] undefined! make[2]: *** [__modpost] Error 1 make[1]: *** [modules] Error 2 make: *** [sub-make] Error 2 Signed-off-by: Mauro Carvalho Chehab --- sound/pci/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound') diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index ff3af6e77d6..f99fa251228 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -2,8 +2,8 @@ config SND_TEA575X tristate - depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 || RADIO_MAXIRADIO - default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO + depends on SND_FM801_TEA575X_BOOL || SND_ES1968_RADIO || RADIO_SF16FMR2 || RADIO_MAXIRADIO || RADIO_SHARK + default SND_FM801 || SND_ES1968 || RADIO_SF16FMR2 || RADIO_MAXIRADIO || RADIO_SHARK menuconfig SND_PCI bool "PCI sound devices" -- cgit v1.2.3