/linux-4.4.14/drivers/media/radio/ |
H A D | radio-shark2.c | 81 struct shark_device *shark = tea->private_data; shark_write_reg() local 84 memset(shark->transfer_buffer, 0, TB_LEN); shark_write_reg() 85 shark->transfer_buffer[0] = 0x81; /* Write register command */ shark_write_reg() 87 shark->transfer_buffer[i + 1] = (reg >> (40 - i * 8)) & 0xff; shark_write_reg() 90 7, shark->transfer_buffer); shark_write_reg() 92 res = usb_interrupt_msg(shark->usbdev, shark_write_reg() 93 usb_sndintpipe(shark->usbdev, SHARK_OUT_EP), shark_write_reg() 94 shark->transfer_buffer, TB_LEN, shark_write_reg() 106 struct shark_device *shark = tea->private_data; shark_read_reg() local 110 memset(shark->transfer_buffer, 0, TB_LEN); shark_read_reg() 111 shark->transfer_buffer[0] = 0x82; shark_read_reg() 112 res = usb_interrupt_msg(shark->usbdev, shark_read_reg() 113 usb_sndintpipe(shark->usbdev, SHARK_OUT_EP), shark_read_reg() 114 shark->transfer_buffer, TB_LEN, shark_read_reg() 121 res = usb_interrupt_msg(shark->usbdev, shark_read_reg() 122 usb_rcvintpipe(shark->usbdev, SHARK_IN_EP), shark_read_reg() 123 shark->transfer_buffer, TB_LEN, shark_read_reg() 131 reg |= shark->transfer_buffer[i] << (16 - i * 8); shark_read_reg() 134 3, shark->transfer_buffer); shark_read_reg() 148 struct shark_device *shark = shark_led_work() local 153 if (!test_and_clear_bit(i, &shark->brightness_new)) shark_led_work() 156 brightness = atomic_read(&shark->brightness[i]); shark_led_work() 157 memset(shark->transfer_buffer, 0, TB_LEN); shark_led_work() 158 shark->transfer_buffer[0] = 0x83 + i; shark_led_work() 159 shark->transfer_buffer[1] = brightness; shark_led_work() 160 res = usb_interrupt_msg(shark->usbdev, shark_led_work() 161 usb_sndintpipe(shark->usbdev, shark_led_work() 163 shark->transfer_buffer, TB_LEN, shark_led_work() 166 v4l2_err(&shark->v4l2_dev, "set LED %s error: %d\n", shark_led_work() 167 shark->led_names[i], res); shark_led_work() 174 struct shark_device *shark = shark_led_set_blue() local 177 atomic_set(&shark->brightness[BLUE_LED], value); shark_led_set_blue() 178 set_bit(BLUE_LED, &shark->brightness_new); shark_led_set_blue() 179 schedule_work(&shark->led_work); shark_led_set_blue() 185 struct shark_device *shark = shark_led_set_red() local 188 atomic_set(&shark->brightness[RED_LED], value); shark_led_set_red() 189 set_bit(RED_LED, &shark->brightness_new); shark_led_set_red() 190 schedule_work(&shark->led_work); shark_led_set_red() 208 static int shark_register_leds(struct shark_device *shark, struct device *dev) shark_register_leds() argument 212 atomic_set(&shark->brightness[BLUE_LED], 127); shark_register_leds() 213 INIT_WORK(&shark->led_work, shark_led_work); shark_register_leds() 215 shark->leds[i] = shark_led_templates[i]; shark_register_leds() 216 snprintf(shark->led_names[i], sizeof(shark->led_names[0]), shark_register_leds() 217 shark->leds[i].name, shark->v4l2_dev.name); shark_register_leds() 218 shark->leds[i].name = shark->led_names[i]; shark_register_leds() 219 retval = led_classdev_register(dev, &shark->leds[i]); shark_register_leds() 221 v4l2_err(&shark->v4l2_dev, shark_register_leds() 223 shark->led_names[i]); shark_register_leds() 230 static void shark_unregister_leds(struct shark_device *shark) shark_unregister_leds() argument 235 led_classdev_unregister(&shark->leds[i]); shark_unregister_leds() 237 cancel_work_sync(&shark->led_work); shark_unregister_leds() 240 static inline void shark_resume_leds(struct shark_device *shark) shark_resume_leds() argument 245 set_bit(i, &shark->brightness_new); shark_resume_leds() 247 schedule_work(&shark->led_work); shark_resume_leds() 250 static int shark_register_leds(struct shark_device *shark, struct device *dev) shark_register_leds() argument 252 v4l2_warn(&shark->v4l2_dev, shark_register_leds() 256 static inline void shark_unregister_leds(struct shark_device *shark) { } shark_resume_leds() argument 257 static inline void shark_resume_leds(struct shark_device *shark) { } shark_resume_leds() argument 263 struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); usb_shark_disconnect() local 265 mutex_lock(&shark->tea.mutex); usb_shark_disconnect() 266 v4l2_device_disconnect(&shark->v4l2_dev); usb_shark_disconnect() 267 radio_tea5777_exit(&shark->tea); usb_shark_disconnect() 268 mutex_unlock(&shark->tea.mutex); usb_shark_disconnect() 270 shark_unregister_leds(shark); usb_shark_disconnect() 272 v4l2_device_put(&shark->v4l2_dev); usb_shark_disconnect() 277 struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); usb_shark_release() local 279 v4l2_device_unregister(&shark->v4l2_dev); usb_shark_release() 280 kfree(shark->transfer_buffer); usb_shark_release() 281 kfree(shark); usb_shark_release() 287 struct shark_device *shark; usb_shark_probe() local 290 shark = kzalloc(sizeof(struct shark_device), GFP_KERNEL); usb_shark_probe() 291 if (!shark) usb_shark_probe() 294 shark->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL); usb_shark_probe() 295 if (!shark->transfer_buffer) usb_shark_probe() 298 v4l2_device_set_name(&shark->v4l2_dev, DRV_NAME, &shark_instance); usb_shark_probe() 300 retval = shark_register_leds(shark, &intf->dev); usb_shark_probe() 304 shark->v4l2_dev.release = usb_shark_release; usb_shark_probe() 305 retval = v4l2_device_register(&intf->dev, &shark->v4l2_dev); usb_shark_probe() 307 v4l2_err(&shark->v4l2_dev, "couldn't register v4l2_device\n"); usb_shark_probe() 311 shark->usbdev = interface_to_usbdev(intf); usb_shark_probe() 312 shark->tea.v4l2_dev = &shark->v4l2_dev; usb_shark_probe() 313 shark->tea.private_data = shark; usb_shark_probe() 314 shark->tea.ops = &shark_tea_ops; usb_shark_probe() 315 shark->tea.has_am = true; usb_shark_probe() 316 shark->tea.write_before_read = true; usb_shark_probe() 317 strlcpy(shark->tea.card, "Griffin radioSHARK2", usb_shark_probe() 318 sizeof(shark->tea.card)); usb_shark_probe() 319 usb_make_path(shark->usbdev, shark->tea.bus_info, usb_shark_probe() 320 sizeof(shark->tea.bus_info)); usb_shark_probe() 322 retval = radio_tea5777_init(&shark->tea, THIS_MODULE); usb_shark_probe() 324 v4l2_err(&shark->v4l2_dev, "couldn't init tea5777\n"); usb_shark_probe() 331 v4l2_device_unregister(&shark->v4l2_dev); usb_shark_probe() 333 shark_unregister_leds(shark); usb_shark_probe() 335 kfree(shark->transfer_buffer); usb_shark_probe() 337 kfree(shark); usb_shark_probe() 351 struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); usb_shark_resume() local 354 mutex_lock(&shark->tea.mutex); usb_shark_resume() 355 ret = radio_tea5777_set_freq(&shark->tea); usb_shark_resume() 356 mutex_unlock(&shark->tea.mutex); usb_shark_resume() 358 shark_resume_leds(shark); usb_shark_resume()
|
H A D | radio-shark.c | 7 * The info necessary to drive the shark was taken from the small userspace 8 * shark.c program by Michael Rolig, which he kindly placed in the Public 86 struct shark_device *shark = tea->private_data; shark_write_val() local 90 if (shark->last_val == val) shark_write_val() 93 memset(shark->transfer_buffer, 0, TB_LEN); shark_write_val() 94 shark->transfer_buffer[0] = 0xc0; /* Write shift register command */ shark_write_val() 96 shark->transfer_buffer[i] |= (val >> (24 - i * 8)) & 0xff; shark_write_val() 98 res = usb_interrupt_msg(shark->usbdev, shark_write_val() 99 usb_sndintpipe(shark->usbdev, SHARK_OUT_EP), shark_write_val() 100 shark->transfer_buffer, TB_LEN, shark_write_val() 103 shark->last_val = val; shark_write_val() 105 v4l2_err(&shark->v4l2_dev, "set-freq error: %d\n", res); shark_write_val() 110 struct shark_device *shark = tea->private_data; shark_read_val() local 114 memset(shark->transfer_buffer, 0, TB_LEN); shark_read_val() 115 shark->transfer_buffer[0] = 0x80; shark_read_val() 116 res = usb_interrupt_msg(shark->usbdev, shark_read_val() 117 usb_sndintpipe(shark->usbdev, SHARK_OUT_EP), shark_read_val() 118 shark->transfer_buffer, TB_LEN, shark_read_val() 121 v4l2_err(&shark->v4l2_dev, "request-status error: %d\n", res); shark_read_val() 122 return shark->last_val; shark_read_val() 125 res = usb_interrupt_msg(shark->usbdev, shark_read_val() 126 usb_rcvintpipe(shark->usbdev, SHARK_IN_EP), shark_read_val() 127 shark->transfer_buffer, TB_LEN, shark_read_val() 130 v4l2_err(&shark->v4l2_dev, "get-status error: %d\n", res); shark_read_val() 131 return shark->last_val; shark_read_val() 135 val |= shark->transfer_buffer[i] << (24 - i * 8); shark_read_val() 137 shark->last_val = val; shark_read_val() 140 * The shark does not allow actually reading the stereo / mono pin :( shark_read_val() 146 shark->tea.stereo = true; shark_read_val() 148 shark->tea.stereo = false; shark_read_val() 161 struct shark_device *shark = shark_led_work() local 166 if (!test_and_clear_bit(i, &shark->brightness_new)) shark_led_work() 169 brightness = atomic_read(&shark->brightness[i]); shark_led_work() 170 memset(shark->transfer_buffer, 0, TB_LEN); shark_led_work() 172 shark->transfer_buffer[0] = 0xA0 + i; shark_led_work() 173 shark->transfer_buffer[1] = brightness; shark_led_work() 175 shark->transfer_buffer[0] = brightness ? 0xA9 : 0xA8; shark_led_work() 176 res = usb_interrupt_msg(shark->usbdev, shark_led_work() 177 usb_sndintpipe(shark->usbdev, 0x05), shark_led_work() 178 shark->transfer_buffer, TB_LEN, shark_led_work() 181 v4l2_err(&shark->v4l2_dev, "set LED %s error: %d\n", shark_led_work() 182 shark->led_names[i], res); shark_led_work() 189 struct shark_device *shark = shark_led_set_blue() local 192 atomic_set(&shark->brightness[BLUE_LED], value); shark_led_set_blue() 193 set_bit(BLUE_LED, &shark->brightness_new); shark_led_set_blue() 194 clear_bit(BLUE_IS_PULSE, &shark->brightness_new); shark_led_set_blue() 195 schedule_work(&shark->led_work); shark_led_set_blue() 201 struct shark_device *shark = container_of(led_cdev, shark_led_set_blue_pulse() local 204 atomic_set(&shark->brightness[BLUE_PULSE_LED], 256 - value); shark_led_set_blue_pulse() 205 set_bit(BLUE_PULSE_LED, &shark->brightness_new); shark_led_set_blue_pulse() 206 set_bit(BLUE_IS_PULSE, &shark->brightness_new); shark_led_set_blue_pulse() 207 schedule_work(&shark->led_work); shark_led_set_blue_pulse() 213 struct shark_device *shark = shark_led_set_red() local 216 atomic_set(&shark->brightness[RED_LED], value); shark_led_set_red() 217 set_bit(RED_LED, &shark->brightness_new); shark_led_set_red() 218 schedule_work(&shark->led_work); shark_led_set_red() 242 static int shark_register_leds(struct shark_device *shark, struct device *dev) shark_register_leds() argument 246 atomic_set(&shark->brightness[BLUE_LED], 127); shark_register_leds() 247 INIT_WORK(&shark->led_work, shark_led_work); shark_register_leds() 249 shark->leds[i] = shark_led_templates[i]; shark_register_leds() 250 snprintf(shark->led_names[i], sizeof(shark->led_names[0]), shark_register_leds() 251 shark->leds[i].name, shark->v4l2_dev.name); shark_register_leds() 252 shark->leds[i].name = shark->led_names[i]; shark_register_leds() 253 retval = led_classdev_register(dev, &shark->leds[i]); shark_register_leds() 255 v4l2_err(&shark->v4l2_dev, shark_register_leds() 257 shark->led_names[i]); shark_register_leds() 264 static void shark_unregister_leds(struct shark_device *shark) shark_unregister_leds() argument 269 led_classdev_unregister(&shark->leds[i]); shark_unregister_leds() 271 cancel_work_sync(&shark->led_work); shark_unregister_leds() 274 static inline void shark_resume_leds(struct shark_device *shark) shark_resume_leds() argument 276 if (test_bit(BLUE_IS_PULSE, &shark->brightness_new)) shark_resume_leds() 277 set_bit(BLUE_PULSE_LED, &shark->brightness_new); shark_resume_leds() 279 set_bit(BLUE_LED, &shark->brightness_new); shark_resume_leds() 280 set_bit(RED_LED, &shark->brightness_new); shark_resume_leds() 281 schedule_work(&shark->led_work); shark_resume_leds() 284 static int shark_register_leds(struct shark_device *shark, struct device *dev) shark_register_leds() argument 286 v4l2_warn(&shark->v4l2_dev, shark_register_leds() 290 static inline void shark_unregister_leds(struct shark_device *shark) { } shark_resume_leds() argument 291 static inline void shark_resume_leds(struct shark_device *shark) { } shark_resume_leds() argument 297 struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); usb_shark_disconnect() local 299 mutex_lock(&shark->tea.mutex); usb_shark_disconnect() 300 v4l2_device_disconnect(&shark->v4l2_dev); usb_shark_disconnect() 301 snd_tea575x_exit(&shark->tea); usb_shark_disconnect() 302 mutex_unlock(&shark->tea.mutex); usb_shark_disconnect() 304 shark_unregister_leds(shark); usb_shark_disconnect() 306 v4l2_device_put(&shark->v4l2_dev); usb_shark_disconnect() 311 struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); usb_shark_release() local 313 v4l2_device_unregister(&shark->v4l2_dev); usb_shark_release() 314 kfree(shark->transfer_buffer); usb_shark_release() 315 kfree(shark); usb_shark_release() 321 struct shark_device *shark; usb_shark_probe() local 324 shark = kzalloc(sizeof(struct shark_device), GFP_KERNEL); usb_shark_probe() 325 if (!shark) usb_shark_probe() 328 shark->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL); usb_shark_probe() 329 if (!shark->transfer_buffer) usb_shark_probe() 332 v4l2_device_set_name(&shark->v4l2_dev, DRV_NAME, &shark_instance); usb_shark_probe() 334 retval = shark_register_leds(shark, &intf->dev); usb_shark_probe() 338 shark->v4l2_dev.release = usb_shark_release; usb_shark_probe() 339 retval = v4l2_device_register(&intf->dev, &shark->v4l2_dev); usb_shark_probe() 341 v4l2_err(&shark->v4l2_dev, "couldn't register v4l2_device\n"); usb_shark_probe() 345 shark->usbdev = interface_to_usbdev(intf); usb_shark_probe() 346 shark->tea.v4l2_dev = &shark->v4l2_dev; usb_shark_probe() 347 shark->tea.private_data = shark; usb_shark_probe() 348 shark->tea.radio_nr = -1; usb_shark_probe() 349 shark->tea.ops = &shark_tea_ops; usb_shark_probe() 350 shark->tea.cannot_mute = true; usb_shark_probe() 351 shark->tea.has_am = true; usb_shark_probe() 352 strlcpy(shark->tea.card, "Griffin radioSHARK", usb_shark_probe() 353 sizeof(shark->tea.card)); usb_shark_probe() 354 usb_make_path(shark->usbdev, shark->tea.bus_info, usb_shark_probe() 355 sizeof(shark->tea.bus_info)); usb_shark_probe() 357 retval = snd_tea575x_init(&shark->tea, THIS_MODULE); usb_shark_probe() 359 v4l2_err(&shark->v4l2_dev, "couldn't init tea5757\n"); usb_shark_probe() 366 v4l2_device_unregister(&shark->v4l2_dev); usb_shark_probe() 368 shark_unregister_leds(shark); usb_shark_probe() 370 kfree(shark->transfer_buffer); usb_shark_probe() 372 kfree(shark); usb_shark_probe() 386 struct shark_device *shark = v4l2_dev_to_shark(v4l2_dev); usb_shark_resume() local 388 mutex_lock(&shark->tea.mutex); usb_shark_resume() 389 snd_tea575x_set_freq(&shark->tea); usb_shark_resume() 390 mutex_unlock(&shark->tea.mutex); usb_shark_resume() 392 shark_resume_leds(shark); usb_shark_resume()
|
H A D | Makefile | 14 obj-$(CONFIG_RADIO_SHARK) += radio-shark.o
|
/linux-4.4.14/arch/alpha/kernel/ |
H A D | setup.c | 922 &shark_mv, /* shark */ get_sysvec()
|