29 #include <linux/kernel.h>
31 #include <linux/module.h>
32 #include <linux/slab.h>
38 #if defined(CONFIG_LEDS_CLASS) || \
39 (defined(CONFIG_LEDS_CLASS_MODULE) && defined(CONFIG_RADIO_SHARK_MODULE))
40 #define SHARK_USE_LEDS 1
50 #define SHARK_IN_EP 0x83
51 #define SHARK_OUT_EP 0x05
53 #define TEA575X_BIT_MONO (1<<22)
54 #define TEA575X_BIT_BAND_MASK (3<<20)
55 #define TEA575X_BIT_BAND_FM (0<<20)
58 #define DRV_NAME "radioshark"
60 #define v4l2_dev_to_shark(d) container_of(d, struct shark_device, v4l2_dev)
75 unsigned long brightness_new;
87 int i,
res, actual_len;
95 for (i = 0; i < 4; i++)
111 int i,
res, actual_len;
134 for (i = 0; i < 4; i++)
146 shark->
tea.stereo =
true;
148 shark->
tea.stereo =
false;
154 .write_val = shark_write_val,
155 .read_val = shark_read_val,
158 #ifdef SHARK_USE_LEDS
165 for (i = 0; i < 3; i++) {
177 usb_sndintpipe(shark->
usbdev, 0x05),
182 shark->led_names[i], res);
186 static void shark_led_set_blue(
struct led_classdev *led_cdev,
198 static void shark_led_set_blue_pulse(
struct led_classdev *led_cdev,
210 static void shark_led_set_red(
struct led_classdev *led_cdev,
225 .max_brightness = 127,
226 .brightness_set = shark_led_set_blue,
229 .name =
"%s:blue-pulse:",
231 .max_brightness = 255,
232 .brightness_set = shark_led_set_blue_pulse,
238 .brightness_set = shark_led_set_red,
247 INIT_WORK(&shark->led_work, shark_led_work);
248 for (i = 0; i <
NO_LEDS; i++) {
249 shark->leds[
i] = shark_led_templates[
i];
250 snprintf(shark->led_names[i],
sizeof(shark->led_names[0]),
251 shark->leds[i].name, shark->
v4l2_dev.name);
252 shark->leds[
i].name = shark->led_names[
i];
256 "couldn't register led: %s\n",
257 shark->led_names[i]);
264 static void shark_unregister_leds(
struct shark_device *shark)
274 static void shark_resume_leds(
struct shark_device *shark)
287 "CONFIG_LED_CLASS not enabled, LED support disabled\n");
290 static inline void shark_unregister_leds(
struct shark_device *shark) { }
291 static inline void shark_resume_leds(
struct shark_device *shark) { }
296 struct v4l2_device *v4l2_dev = usb_get_intfdata(intf);
304 shark_unregister_leds(shark);
330 goto err_alloc_buffer;
334 retval = shark_register_leds(shark, &intf->dev);
338 shark->
v4l2_dev.release = usb_shark_release;
345 shark->
usbdev = interface_to_usbdev(intf);
347 shark->
tea.private_data = shark;
348 shark->
tea.radio_nr = -1;
349 shark->
tea.ops = &shark_tea_ops;
350 shark->
tea.cannot_mute =
true;
351 shark->
tea.has_am =
true;
352 strlcpy(shark->
tea.card,
"Griffin radioSHARK",
353 sizeof(shark->
tea.card));
354 usb_make_path(shark->
usbdev, shark->
tea.bus_info,
355 sizeof(shark->
tea.bus_info));
368 shark_unregister_leds(shark);
385 struct v4l2_device *v4l2_dev = usb_get_intfdata(intf);
392 shark_resume_leds(shark);
400 { .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION |
404 .bcdDevice_lo = 0x0001,
405 .bcdDevice_hi = 0x0001,
406 .bInterfaceClass = 3,
412 static struct usb_driver usb_shark_driver = {
414 .probe = usb_shark_probe,
415 .disconnect = usb_shark_disconnect,
416 .id_table = usb_shark_device_table,
418 .suspend = usb_shark_suspend,
419 .resume = usb_shark_resume,
420 .reset_resume = usb_shark_resume,