diff options
-rw-r--r-- | drivers/staging/asus_oled/asus_oled.c | 66 |
1 files changed, 33 insertions, 33 deletions
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c index 41bf409a393..591fc1418f7 100644 --- a/drivers/staging/asus_oled/asus_oled.c +++ b/drivers/staging/asus_oled/asus_oled.c | |||
@@ -80,20 +80,20 @@ struct oled_dev_desc_str { | |||
80 | }; | 80 | }; |
81 | 81 | ||
82 | /* table of devices that work with this driver */ | 82 | /* table of devices that work with this driver */ |
83 | static struct usb_device_id id_table [] = { | 83 | static struct usb_device_id id_table[] = { |
84 | { USB_DEVICE(0x0b05, 0x1726) }, // Asus G1/G2 (and variants) | 84 | { USB_DEVICE(0x0b05, 0x1726) }, // Asus G1/G2 (and variants) |
85 | { USB_DEVICE(0x0b05, 0x175b) }, // Asus G50V (and possibly others - G70? G71?) | 85 | { USB_DEVICE(0x0b05, 0x175b) }, // Asus G50V (and possibly others - G70? G71?) |
86 | { }, | 86 | { }, |
87 | }; | 87 | }; |
88 | 88 | ||
89 | /* parameters of specific devices */ | 89 | /* parameters of specific devices */ |
90 | static struct oled_dev_desc_str oled_dev_desc_table [] = { | 90 | static struct oled_dev_desc_str oled_dev_desc_table[] = { |
91 | { 0x0b05, 0x1726, 128, PACK_MODE_G1, "G1/G2" }, | 91 | { 0x0b05, 0x1726, 128, PACK_MODE_G1, "G1/G2" }, |
92 | { 0x0b05, 0x175b, 256, PACK_MODE_G50, "G50" }, | 92 | { 0x0b05, 0x175b, 256, PACK_MODE_G50, "G50" }, |
93 | { }, | 93 | { }, |
94 | }; | 94 | }; |
95 | 95 | ||
96 | MODULE_DEVICE_TABLE (usb, id_table); | 96 | MODULE_DEVICE_TABLE(usb, id_table); |
97 | 97 | ||
98 | #define SETUP_PACKET_HEADER(packet, val1, val2, val3, val4, val5, val6, val7) \ | 98 | #define SETUP_PACKET_HEADER(packet, val1, val2, val3, val4, val5, val6, val7) \ |
99 | do { \ | 99 | do { \ |
@@ -107,7 +107,7 @@ MODULE_DEVICE_TABLE (usb, id_table); | |||
107 | packet->header.value6 = val5; \ | 107 | packet->header.value6 = val5; \ |
108 | packet->header.value7 = val6; \ | 108 | packet->header.value7 = val6; \ |
109 | packet->header.value8 = val7; \ | 109 | packet->header.value8 = val7; \ |
110 | } while(0); | 110 | } while (0); |
111 | 111 | ||
112 | struct asus_oled_header { | 112 | struct asus_oled_header { |
113 | uint8_t magic1; | 113 | uint8_t magic1; |
@@ -165,7 +165,7 @@ static void enable_oled(struct asus_oled_dev *odev, uint8_t enabl) | |||
165 | else | 165 | else |
166 | packet->bitmap[0] = 0xae; | 166 | packet->bitmap[0] = 0xae; |
167 | 167 | ||
168 | for (a=0; a<1; a++) { | 168 | for (a = 0; a < 1; a++) { |
169 | retval = usb_bulk_msg(odev->udev, | 169 | retval = usb_bulk_msg(odev->udev, |
170 | usb_sndbulkpipe(odev->udev, 2), | 170 | usb_sndbulkpipe(odev->udev, 2), |
171 | packet, | 171 | packet, |
@@ -254,7 +254,7 @@ static void send_packets(struct usb_device *udev, struct asus_oled_packet *packe | |||
254 | } | 254 | } |
255 | } | 255 | } |
256 | 256 | ||
257 | static void send_packet(struct usb_device *udev, struct asus_oled_packet *packet, size_t offset, size_t len, char *buf, uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5, uint8_t b6){ | 257 | static void send_packet(struct usb_device *udev, struct asus_oled_packet *packet, size_t offset, size_t len, char *buf, uint8_t b1, uint8_t b2, uint8_t b3, uint8_t b4, uint8_t b5, uint8_t b6) { |
258 | int retval; | 258 | int retval; |
259 | int act_len; | 259 | int act_len; |
260 | 260 | ||
@@ -296,7 +296,7 @@ static void send_data(struct asus_oled_dev *odev) | |||
296 | return; | 296 | return; |
297 | } | 297 | } |
298 | 298 | ||
299 | if (odev->pack_mode==PACK_MODE_G1){ | 299 | if (odev->pack_mode == PACK_MODE_G1) { |
300 | // When sending roll-mode data the display updated only first packet. | 300 | // When sending roll-mode data the display updated only first packet. |
301 | // I have no idea why, but when static picture is send just before | 301 | // I have no idea why, but when static picture is send just before |
302 | // rolling picture - everything works fine. | 302 | // rolling picture - everything works fine. |
@@ -310,7 +310,7 @@ static void send_data(struct asus_oled_dev *odev) | |||
310 | send_packets(odev->udev, packet, odev->buf, odev->pic_mode, packet_num); | 310 | send_packets(odev->udev, packet, odev->buf, odev->pic_mode, packet_num); |
311 | } | 311 | } |
312 | else | 312 | else |
313 | if (odev->pack_mode==PACK_MODE_G50){ | 313 | if (odev->pack_mode == PACK_MODE_G50) { |
314 | send_packets_g50(odev->udev, packet, odev->buf); | 314 | send_packets_g50(odev->udev, packet, odev->buf); |
315 | } | 315 | } |
316 | 316 | ||
@@ -328,7 +328,7 @@ static int append_values(struct asus_oled_dev *odev, uint8_t val, size_t count) | |||
328 | x += odev->x_shift; | 328 | x += odev->x_shift; |
329 | y += odev->y_shift; | 329 | y += odev->y_shift; |
330 | 330 | ||
331 | switch(odev->pack_mode) | 331 | switch (odev->pack_mode) |
332 | { | 332 | { |
333 | case PACK_MODE_G1: | 333 | case PACK_MODE_G1: |
334 | // i = (x/128)*640 + 127 - x + (y/8)*128; | 334 | // i = (x/128)*640 + 127 - x + (y/8)*128; |
@@ -382,7 +382,7 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev, const char *buf, siz | |||
382 | if (count < 1) | 382 | if (count < 1) |
383 | return 0; | 383 | return 0; |
384 | 384 | ||
385 | if (tolower(buf[0]) == 'b'){ | 385 | if (tolower(buf[0]) == 'b') { |
386 | // binary mode, set the entire memory | 386 | // binary mode, set the entire memory |
387 | 387 | ||
388 | size_t i; | 388 | size_t i; |
@@ -395,16 +395,16 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev, const char *buf, siz | |||
395 | 395 | ||
396 | memset(odev->buf, 0xff, odev->buf_size); | 396 | memset(odev->buf, 0xff, odev->buf_size); |
397 | 397 | ||
398 | for (i=1; i < count && i<=32*32; i++){ | 398 | for (i = 1; i < count && i <= 32 * 32; i++) { |
399 | odev->buf[i-1] = buf[i]; | 399 | odev->buf[i-1] = buf[i]; |
400 | odev->buf_offs = i-1; | 400 | odev->buf_offs = i-1; |
401 | } | 401 | } |
402 | 402 | ||
403 | odev->width=odev->dev_width / 8; | 403 | odev->width = odev->dev_width / 8; |
404 | odev->height=ASUS_OLED_DISP_HEIGHT; | 404 | odev->height = ASUS_OLED_DISP_HEIGHT; |
405 | odev->x_shift=0; | 405 | odev->x_shift = 0; |
406 | odev->y_shift=0; | 406 | odev->y_shift = 0; |
407 | odev->last_val=0; | 407 | odev->last_val = 0; |
408 | 408 | ||
409 | send_data(odev); | 409 | send_data(odev); |
410 | 410 | ||
@@ -420,7 +420,7 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev, const char *buf, siz | |||
420 | goto error_header; | 420 | goto error_header; |
421 | } | 421 | } |
422 | 422 | ||
423 | switch(tolower(buf[1])) { | 423 | switch (tolower(buf[1])) { |
424 | case ASUS_OLED_STATIC: | 424 | case ASUS_OLED_STATIC: |
425 | case ASUS_OLED_ROLL: | 425 | case ASUS_OLED_ROLL: |
426 | case ASUS_OLED_FLASH: | 426 | case ASUS_OLED_FLASH: |
@@ -519,18 +519,18 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev, const char *buf, siz | |||
519 | int ret; | 519 | int ret; |
520 | 520 | ||
521 | if (buf[offs] == '1' || buf[offs] == '#') { | 521 | if (buf[offs] == '1' || buf[offs] == '#') { |
522 | if ( (ret = append_values(odev, 1, 1)) < 0) | 522 | if ((ret = append_values(odev, 1, 1)) < 0) |
523 | return ret; | 523 | return ret; |
524 | } | 524 | } |
525 | else if (buf[offs] == '0' || buf[offs] == ' ') { | 525 | else if (buf[offs] == '0' || buf[offs] == ' ') { |
526 | if ( (ret = append_values(odev, 0, 1)) < 0) | 526 | if ((ret = append_values(odev, 0, 1)) < 0) |
527 | return ret; | 527 | return ret; |
528 | } | 528 | } |
529 | else if (buf[offs] == '\n') { | 529 | else if (buf[offs] == '\n') { |
530 | // New line detected. Lets assume, that all characters till the end of the | 530 | // New line detected. Lets assume, that all characters till the end of the |
531 | // line were equal to the last character in this line. | 531 | // line were equal to the last character in this line. |
532 | if (odev->buf_offs % odev->width != 0) | 532 | if (odev->buf_offs % odev->width != 0) |
533 | if ( (ret = append_values(odev, odev->last_val, | 533 | if ((ret = append_values(odev, odev->last_val, |
534 | odev->width - (odev->buf_offs % odev->width))) < 0) | 534 | odev->width - (odev->buf_offs % odev->width))) < 0) |
535 | return ret; | 535 | return ret; |
536 | } | 536 | } |
@@ -604,7 +604,7 @@ static int asus_oled_probe(struct usb_interface *interface, const struct usb_dev | |||
604 | } | 604 | } |
605 | } | 605 | } |
606 | 606 | ||
607 | if ( !desc || dev_width < 1 || pack_mode == PACK_MODE_LAST) { | 607 | if (!desc || dev_width < 1 || pack_mode == PACK_MODE_LAST) { |
608 | dev_err(&interface->dev, "Missing or incomplete device description!\n"); | 608 | dev_err(&interface->dev, "Missing or incomplete device description!\n"); |
609 | return -ENODEV; | 609 | return -ENODEV; |
610 | } | 610 | } |
@@ -631,7 +631,7 @@ static int asus_oled_probe(struct usb_interface *interface, const struct usb_dev | |||
631 | odev->enabled = 1; | 631 | odev->enabled = 1; |
632 | odev->dev = NULL; | 632 | odev->dev = NULL; |
633 | 633 | ||
634 | usb_set_intfdata (interface, odev); | 634 | usb_set_intfdata(interface, odev); |
635 | 635 | ||
636 | if ((retval = device_create_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(enabled)))) { | 636 | if ((retval = device_create_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(enabled)))) { |
637 | goto err_files; | 637 | goto err_files; |
@@ -641,8 +641,8 @@ static int asus_oled_probe(struct usb_interface *interface, const struct usb_dev | |||
641 | goto err_files; | 641 | goto err_files; |
642 | } | 642 | } |
643 | 643 | ||
644 | odev->dev = device_create(oled_class, &interface->dev, MKDEV(0,0), | 644 | odev->dev = device_create(oled_class, &interface->dev, MKDEV(0, 0), |
645 | NULL,"oled_%d", ++oled_num); | 645 | NULL, "oled_%d", ++oled_num); |
646 | 646 | ||
647 | if (IS_ERR(odev->dev)) { | 647 | if (IS_ERR(odev->dev)) { |
648 | retval = PTR_ERR(odev->dev); | 648 | retval = PTR_ERR(odev->dev); |
@@ -651,11 +651,11 @@ static int asus_oled_probe(struct usb_interface *interface, const struct usb_dev | |||
651 | 651 | ||
652 | dev_set_drvdata(odev->dev, odev); | 652 | dev_set_drvdata(odev->dev, odev); |
653 | 653 | ||
654 | if ( (retval = device_create_file(odev->dev, &dev_attr_enabled))) { | 654 | if ((retval = device_create_file(odev->dev, &dev_attr_enabled))) { |
655 | goto err_class_enabled; | 655 | goto err_class_enabled; |
656 | } | 656 | } |
657 | 657 | ||
658 | if ( (retval = device_create_file(odev->dev, &dev_attr_picture))) { | 658 | if ((retval = device_create_file(odev->dev, &dev_attr_picture))) { |
659 | goto err_class_picture; | 659 | goto err_class_picture; |
660 | } | 660 | } |
661 | 661 | ||
@@ -677,7 +677,7 @@ err_files: | |||
677 | device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(enabled)); | 677 | device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(enabled)); |
678 | device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(picture)); | 678 | device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(picture)); |
679 | 679 | ||
680 | usb_set_intfdata (interface, NULL); | 680 | usb_set_intfdata(interface, NULL); |
681 | usb_put_dev(odev->udev); | 681 | usb_put_dev(odev->udev); |
682 | kfree(odev); | 682 | kfree(odev); |
683 | 683 | ||
@@ -688,15 +688,15 @@ static void asus_oled_disconnect(struct usb_interface *interface) | |||
688 | { | 688 | { |
689 | struct asus_oled_dev *odev; | 689 | struct asus_oled_dev *odev; |
690 | 690 | ||
691 | odev = usb_get_intfdata (interface); | 691 | odev = usb_get_intfdata(interface); |
692 | usb_set_intfdata (interface, NULL); | 692 | usb_set_intfdata(interface, NULL); |
693 | 693 | ||
694 | device_remove_file(odev->dev, &dev_attr_picture); | 694 | device_remove_file(odev->dev, &dev_attr_picture); |
695 | device_remove_file(odev->dev, &dev_attr_enabled); | 695 | device_remove_file(odev->dev, &dev_attr_enabled); |
696 | device_unregister(odev->dev); | 696 | device_unregister(odev->dev); |
697 | 697 | ||
698 | device_remove_file(&interface->dev, & ASUS_OLED_DEVICE_ATTR(picture)); | 698 | device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(picture)); |
699 | device_remove_file(&interface->dev, & ASUS_OLED_DEVICE_ATTR(enabled)); | 699 | device_remove_file(&interface->dev, &ASUS_OLED_DEVICE_ATTR(enabled)); |
700 | 700 | ||
701 | usb_put_dev(odev->udev); | 701 | usb_put_dev(odev->udev); |
702 | 702 | ||
@@ -759,6 +759,6 @@ static void __exit asus_oled_exit(void) | |||
759 | usb_deregister(&oled_driver); | 759 | usb_deregister(&oled_driver); |
760 | } | 760 | } |
761 | 761 | ||
762 | module_init (asus_oled_init); | 762 | module_init(asus_oled_init); |
763 | module_exit (asus_oled_exit); | 763 | module_exit(asus_oled_exit); |
764 | 764 | ||