Lines Matching full:shark

77 	struct shark_device *shark = tea->private_data;  in shark_write_reg()  local
80 memset(shark->transfer_buffer, 0, TB_LEN); in shark_write_reg()
81 shark->transfer_buffer[0] = 0x81; /* Write register command */ in shark_write_reg()
83 shark->transfer_buffer[i + 1] = (reg >> (40 - i * 8)) & 0xff; in shark_write_reg()
86 7, shark->transfer_buffer); in shark_write_reg()
88 res = usb_interrupt_msg(shark->usbdev, in shark_write_reg()
89 usb_sndintpipe(shark->usbdev, SHARK_OUT_EP), in shark_write_reg()
90 shark->transfer_buffer, TB_LEN, in shark_write_reg()
102 struct shark_device *shark = tea->private_data; in shark_read_reg() local
106 memset(shark->transfer_buffer, 0, TB_LEN); in shark_read_reg()
107 shark->transfer_buffer[0] = 0x82; in shark_read_reg()
108 res = usb_interrupt_msg(shark->usbdev, in shark_read_reg()
109 usb_sndintpipe(shark->usbdev, SHARK_OUT_EP), in shark_read_reg()
110 shark->transfer_buffer, TB_LEN, in shark_read_reg()
117 res = usb_interrupt_msg(shark->usbdev, in shark_read_reg()
118 usb_rcvintpipe(shark->usbdev, SHARK_IN_EP), in shark_read_reg()
119 shark->transfer_buffer, TB_LEN, in shark_read_reg()
127 reg |= shark->transfer_buffer[i] << (16 - i * 8); in shark_read_reg()
130 3, shark->transfer_buffer); in shark_read_reg()
144 struct shark_device *shark = in shark_led_work() local
149 if (!test_and_clear_bit(i, &shark->brightness_new)) in shark_led_work()
152 brightness = atomic_read(&shark->brightness[i]); in shark_led_work()
153 memset(shark->transfer_buffer, 0, TB_LEN); in shark_led_work()
154 shark->transfer_buffer[0] = 0x83 + i; in shark_led_work()
155 shark->transfer_buffer[1] = brightness; in shark_led_work()
156 res = usb_interrupt_msg(shark->usbdev, in shark_led_work()
157 usb_sndintpipe(shark->usbdev, in shark_led_work()
159 shark->transfer_buffer, TB_LEN, in shark_led_work()
162 v4l2_err(&shark->v4l2_dev, "set LED %s error: %d\n", in shark_led_work()
163 shark->led_names[i], res); in shark_led_work()
170 struct shark_device *shark = in shark_led_set_blue() local
173 atomic_set(&shark->brightness[BLUE_LED], value); in shark_led_set_blue()
174 set_bit(BLUE_LED, &shark->brightness_new); in shark_led_set_blue()
175 schedule_work(&shark->led_work); in shark_led_set_blue()
181 struct shark_device *shark = in shark_led_set_red() local
184 atomic_set(&shark->brightness[RED_LED], value); in shark_led_set_red()
185 set_bit(RED_LED, &shark->brightness_new); in shark_led_set_red()
186 schedule_work(&shark->led_work); in shark_led_set_red()
204 static int shark_register_leds(struct shark_device *shark, struct device *dev) in shark_register_leds() argument
208 atomic_set(&shark->brightness[BLUE_LED], 127); in shark_register_leds()
209 INIT_WORK(&shark->led_work, shark_led_work); in shark_register_leds()
211 shark->leds[i] = shark_led_templates[i]; in shark_register_leds()
212 snprintf(shark->led_names[i], sizeof(shark->led_names[0]), in shark_register_leds()
213 shark->leds[i].name, shark->v4l2_dev.name); in shark_register_leds()
214 shark->leds[i].name = shark->led_names[i]; in shark_register_leds()
215 retval = led_classdev_register(dev, &shark->leds[i]); in shark_register_leds()
217 v4l2_err(&shark->v4l2_dev, in shark_register_leds()
219 shark->led_names[i]); in shark_register_leds()
226 static void shark_unregister_leds(struct shark_device *shark) in shark_unregister_leds() argument
231 led_classdev_unregister(&shark->leds[i]); in shark_unregister_leds()
233 cancel_work_sync(&shark->led_work); in shark_unregister_leds()
236 static inline void shark_resume_leds(struct shark_device *shark) in shark_resume_leds() argument
241 set_bit(i, &shark->brightness_new); in shark_resume_leds()
243 schedule_work(&shark->led_work); in shark_resume_leds()
246 static int shark_register_leds(struct shark_device *shark, struct device *dev) in shark_register_leds() argument
248 v4l2_warn(&shark->v4l2_dev, in shark_register_leds()
252 static inline void shark_unregister_leds(struct shark_device *shark) { } in shark_unregister_leds() argument
253 static inline void shark_resume_leds(struct shark_device *shark) { } in shark_resume_leds() argument
259 struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); in usb_shark_disconnect() local
261 mutex_lock(&shark->tea.mutex); in usb_shark_disconnect()
262 v4l2_device_disconnect(&shark->v4l2_dev); in usb_shark_disconnect()
263 radio_tea5777_exit(&shark->tea); in usb_shark_disconnect()
264 mutex_unlock(&shark->tea.mutex); in usb_shark_disconnect()
266 shark_unregister_leds(shark); in usb_shark_disconnect()
268 v4l2_device_put(&shark->v4l2_dev); in usb_shark_disconnect()
273 struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); in usb_shark_release() local
275 v4l2_device_unregister(&shark->v4l2_dev); in usb_shark_release()
276 kfree(shark->transfer_buffer); in usb_shark_release()
277 kfree(shark); in usb_shark_release()
283 struct shark_device *shark; in usb_shark_probe() local
286 shark = kzalloc(sizeof(struct shark_device), GFP_KERNEL); in usb_shark_probe()
287 if (!shark) in usb_shark_probe()
290 shark->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL); in usb_shark_probe()
291 if (!shark->transfer_buffer) in usb_shark_probe()
294 v4l2_device_set_name(&shark->v4l2_dev, DRV_NAME, &shark_instance); in usb_shark_probe()
296 retval = shark_register_leds(shark, &intf->dev); in usb_shark_probe()
300 shark->v4l2_dev.release = usb_shark_release; in usb_shark_probe()
301 retval = v4l2_device_register(&intf->dev, &shark->v4l2_dev); in usb_shark_probe()
303 v4l2_err(&shark->v4l2_dev, "couldn't register v4l2_device\n"); in usb_shark_probe()
307 shark->usbdev = interface_to_usbdev(intf); in usb_shark_probe()
308 shark->tea.v4l2_dev = &shark->v4l2_dev; in usb_shark_probe()
309 shark->tea.private_data = shark; in usb_shark_probe()
310 shark->tea.ops = &shark_tea_ops; in usb_shark_probe()
311 shark->tea.has_am = true; in usb_shark_probe()
312 shark->tea.write_before_read = true; in usb_shark_probe()
313 strscpy(shark->tea.card, "Griffin radioSHARK2", in usb_shark_probe()
314 sizeof(shark->tea.card)); in usb_shark_probe()
315 usb_make_path(shark->usbdev, shark->tea.bus_info, in usb_shark_probe()
316 sizeof(shark->tea.bus_info)); in usb_shark_probe()
318 retval = radio_tea5777_init(&shark->tea, THIS_MODULE); in usb_shark_probe()
320 v4l2_err(&shark->v4l2_dev, "couldn't init tea5777\n"); in usb_shark_probe()
327 v4l2_device_unregister(&shark->v4l2_dev); in usb_shark_probe()
329 shark_unregister_leds(shark); in usb_shark_probe()
331 kfree(shark->transfer_buffer); in usb_shark_probe()
333 kfree(shark); in usb_shark_probe()
347 struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); in usb_shark_resume() local
350 mutex_lock(&shark->tea.mutex); in usb_shark_resume()
351 ret = radio_tea5777_set_freq(&shark->tea); in usb_shark_resume()
352 mutex_unlock(&shark->tea.mutex); in usb_shark_resume()
354 shark_resume_leds(shark); in usb_shark_resume()