toneport.c (6eb3db91f2b68cbbcc1b4256333dc683afb54a73) toneport.c (89444601e5878042812e33da0c17807197c2669c)
1/*
2 * Line 6 Linux USB driver
3 *
4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
5 * Emil Myhrman (emil.myhrman@gmail.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as

--- 329 unchanged lines hidden (view full) ---

338 led = &toneport->leds[i];
339 if (!led->registered)
340 break;
341 led_classdev_unregister(&led->dev);
342 led->registered = false;
343 }
344}
345
1/*
2 * Line 6 Linux USB driver
3 *
4 * Copyright (C) 2004-2010 Markus Grabner (grabner@icg.tugraz.at)
5 * Emil Myhrman (emil.myhrman@gmail.com)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as

--- 329 unchanged lines hidden (view full) ---

338 led = &toneport->leds[i];
339 if (!led->registered)
340 break;
341 led_classdev_unregister(&led->dev);
342 led->registered = false;
343 }
344}
345
346static bool toneport_has_source_select(struct usb_line6_toneport *toneport)
347{
348 switch (toneport->type) {
349 case LINE6_TONEPORT_UX1:
350 case LINE6_TONEPORT_UX2:
351 case LINE6_PODSTUDIO_UX1:
352 case LINE6_PODSTUDIO_UX2:
353 return true;
354
355 default:
356 return false;
357 }
358}
359
346/*
347 Setup Toneport device.
348*/
349static void toneport_setup(struct usb_line6_toneport *toneport)
350{
351 int ticks;
352 struct usb_line6 *line6 = &toneport->line6;
353 struct usb_device *usbdev = line6->usbdev;
354
355 /* sync time on device with host: */
356 ticks = (int)get_seconds();
357 line6_write_data(line6, 0x80c6, &ticks, 4);
358
359 /* enable device: */
360 toneport_send_cmd(usbdev, 0x0301, 0x0000);
361
362 /* initialize source select: */
360/*
361 Setup Toneport device.
362*/
363static void toneport_setup(struct usb_line6_toneport *toneport)
364{
365 int ticks;
366 struct usb_line6 *line6 = &toneport->line6;
367 struct usb_device *usbdev = line6->usbdev;
368
369 /* sync time on device with host: */
370 ticks = (int)get_seconds();
371 line6_write_data(line6, 0x80c6, &ticks, 4);
372
373 /* enable device: */
374 toneport_send_cmd(usbdev, 0x0301, 0x0000);
375
376 /* initialize source select: */
363 switch (toneport->type) {
364 case LINE6_TONEPORT_UX1:
365 case LINE6_TONEPORT_UX2:
366 case LINE6_PODSTUDIO_UX1:
367 case LINE6_PODSTUDIO_UX2:
377 if (toneport_has_source_select(toneport))
368 toneport_send_cmd(usbdev,
369 toneport_source_info[toneport->source].code,
370 0x0000);
378 toneport_send_cmd(usbdev,
379 toneport_source_info[toneport->source].code,
380 0x0000);
371 default:
372 break;
373 }
374
375 if (toneport_has_led(toneport->type))
376 toneport_update_led(toneport);
377
378 mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ);
379}
380
381/*

--- 34 unchanged lines hidden (view full) ---

416 /* register monitor control: */
417 err = snd_ctl_add(line6->card,
418 snd_ctl_new1(&toneport_control_monitor,
419 line6->line6pcm));
420 if (err < 0)
421 return err;
422
423 /* register source select control: */
381
382 if (toneport_has_led(toneport->type))
383 toneport_update_led(toneport);
384
385 mod_timer(&toneport->timer, jiffies + TONEPORT_PCM_DELAY * HZ);
386}
387
388/*

--- 34 unchanged lines hidden (view full) ---

423 /* register monitor control: */
424 err = snd_ctl_add(line6->card,
425 snd_ctl_new1(&toneport_control_monitor,
426 line6->line6pcm));
427 if (err < 0)
428 return err;
429
430 /* register source select control: */
424 switch (toneport->type) {
425 case LINE6_TONEPORT_UX1:
426 case LINE6_TONEPORT_UX2:
427 case LINE6_PODSTUDIO_UX1:
428 case LINE6_PODSTUDIO_UX2:
431 if (toneport_has_source_select(toneport)) {
429 err =
430 snd_ctl_add(line6->card,
431 snd_ctl_new1(&toneport_control_source,
432 line6->line6pcm));
433 if (err < 0)
434 return err;
432 err =
433 snd_ctl_add(line6->card,
434 snd_ctl_new1(&toneport_control_source,
435 line6->line6pcm));
436 if (err < 0)
437 return err;
435
436 default:
437 break;
438 }
439
440 line6_read_serial_number(line6, &toneport->serial_number);
441 line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1);
442
443 if (toneport_has_led(toneport->type)) {
444 err = toneport_init_leds(toneport);
445 if (err < 0)

--- 130 unchanged lines hidden ---
438 }
439
440 line6_read_serial_number(line6, &toneport->serial_number);
441 line6_read_data(line6, 0x80c2, &toneport->firmware_version, 1);
442
443 if (toneport_has_led(toneport->type)) {
444 err = toneport_init_leds(toneport);
445 if (err < 0)

--- 130 unchanged lines hidden ---