aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/ABI/testing/sysfs-driver-wacom23
-rw-r--r--drivers/input/tablet/wacom.h10
-rw-r--r--drivers/input/tablet/wacom_sys.c98
3 files changed, 94 insertions, 37 deletions
diff --git a/Documentation/ABI/testing/sysfs-driver-wacom b/Documentation/ABI/testing/sysfs-driver-wacom
index b5601859de5a..82d4df136444 100644
--- a/Documentation/ABI/testing/sysfs-driver-wacom
+++ b/Documentation/ABI/testing/sysfs-driver-wacom
@@ -13,11 +13,11 @@ What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/led
13Date: August 2011 13Date: August 2011
14Contact: linux-input@vger.kernel.org 14Contact: linux-input@vger.kernel.org
15Description: 15Description:
16 Attribute group for control of the status LEDs and the OLED 16 Attribute group for control of the status LEDs and the OLEDs.
17 displays found on the Wacom Intuos 4 M, L, and XL tablets. This 17 This attribute group is only available for Intuos 4 M, L,
18 attribute group is not available for other Wacom tablets. 18 and XL (with LEDs and OLEDs) and Cintiq 21UX2 (LEDs only).
19 Therefore its presence implicitly signifies the presence of 19 Therefore its presence implicitly signifies the presence of
20 said LEDs and OLED displays on the tablet device. 20 said LEDs and OLEDs on the tablet device.
21 21
22What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status0_luminance 22What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status0_luminance
23Date: August 2011 23Date: August 2011
@@ -36,12 +36,21 @@ Description:
36 when the stylus touches the tablet surface, or any button is 36 when the stylus touches the tablet surface, or any button is
37 pressed on the stylus. 37 pressed on the stylus.
38 38
39What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led_select 39What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led0_select
40Date: August 2011 40Date: August 2011
41Contact: linux-input@vger.kernel.org 41Contact: linux-input@vger.kernel.org
42Description: 42Description:
43 Writing to this file sets which one of the four status LEDs is 43 Writing to this file sets which one of the four (for Intuos 4)
44 active (0..3). The other three LEDs are always inactive. 44 or of the right four (for Cintiq 21UX2) status LEDs is active (0..3).
45 The other three LEDs on the same side are always inactive.
46
47What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/status_led1_select
48Date: September 2011
49Contact: linux-input@vger.kernel.org
50Description:
51 Writing to this file sets which one of the left four (for Cintiq 21UX2)
52 status LEDs is active (0..3). The other three LEDs on the left are always
53 inactive.
45 54
46What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/buttons_luminance 55What: /sys/bus/usb/devices/<busnum>-<devnum>:<cfg>.<intf>/wacom_led/buttons_luminance
47Date: August 2011 56Date: August 2011
diff --git a/drivers/input/tablet/wacom.h b/drivers/input/tablet/wacom.h
index 561f1072343b..0783864a7dc2 100644
--- a/drivers/input/tablet/wacom.h
+++ b/drivers/input/tablet/wacom.h
@@ -11,7 +11,7 @@
11 * Copyright (c) 2000 Daniel Egger <egger@suse.de> 11 * Copyright (c) 2000 Daniel Egger <egger@suse.de>
12 * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com> 12 * Copyright (c) 2001 Frederic Lepied <flepied@mandrakesoft.com>
13 * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be> 13 * Copyright (c) 2004 Panagiotis Issaris <panagiotis.issaris@mech.kuleuven.ac.be>
14 * Copyright (c) 2002-2009 Ping Cheng <pingc@wacom.com> 14 * Copyright (c) 2002-2011 Ping Cheng <pingc@wacom.com>
15 * 15 *
16 * ChangeLog: 16 * ChangeLog:
17 * v0.1 (vp) - Initial release 17 * v0.1 (vp) - Initial release
@@ -93,7 +93,7 @@
93/* 93/*
94 * Version Information 94 * Version Information
95 */ 95 */
96#define DRIVER_VERSION "v1.52" 96#define DRIVER_VERSION "v1.53"
97#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>" 97#define DRIVER_AUTHOR "Vojtech Pavlik <vojtech@ucw.cz>"
98#define DRIVER_DESC "USB Wacom tablet driver" 98#define DRIVER_DESC "USB Wacom tablet driver"
99#define DRIVER_LICENSE "GPL" 99#define DRIVER_LICENSE "GPL"
@@ -115,9 +115,9 @@ struct wacom {
115 bool open; 115 bool open;
116 char phys[32]; 116 char phys[32];
117 struct wacom_led { 117 struct wacom_led {
118 u8 select; /* status led selector (0..3) */ 118 u8 select[2]; /* status led selector (0..3) */
119 u8 llv; /* status led brightness no button (1..127) */ 119 u8 llv; /* status led brightness no button (1..127) */
120 u8 hlv; /* status led brightness button pressed (1..127) */ 120 u8 hlv; /* status led brightness button pressed (1..127) */
121 u8 img_lum; /* OLED matrix display brightness */ 121 u8 img_lum; /* OLED matrix display brightness */
122 } led; 122 } led;
123}; 123};
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index 4f5e62a1621d..abe5920e2cdb 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -493,14 +493,19 @@ static void wacom_remove_shared_data(struct wacom_wac *wacom)
493static int wacom_led_control(struct wacom *wacom) 493static int wacom_led_control(struct wacom *wacom)
494{ 494{
495 unsigned char *buf; 495 unsigned char *buf;
496 int retval; 496 int retval, led = 0;
497 497
498 buf = kzalloc(9, GFP_KERNEL); 498 buf = kzalloc(9, GFP_KERNEL);
499 if (!buf) 499 if (!buf)
500 return -ENOMEM; 500 return -ENOMEM;
501 501
502 if (wacom->wacom_wac.features.type == WACOM_21UX2)
503 led = (wacom->led.select[1] << 4) | 0x40;
504
505 led |= wacom->led.select[0] | 0x4;
506
502 buf[0] = WAC_CMD_LED_CONTROL; 507 buf[0] = WAC_CMD_LED_CONTROL;
503 buf[1] = wacom->led.select >= 0 ? wacom->led.select | 4 : 0; 508 buf[1] = led;
504 buf[2] = wacom->led.llv; 509 buf[2] = wacom->led.llv;
505 buf[3] = wacom->led.hlv; 510 buf[3] = wacom->led.hlv;
506 buf[4] = wacom->led.img_lum; 511 buf[4] = wacom->led.img_lum;
@@ -552,8 +557,7 @@ out:
552 return retval; 557 return retval;
553} 558}
554 559
555static ssize_t wacom_led_select_store(struct device *dev, 560static ssize_t wacom_led_select_store(struct device *dev, int set_id,
556 struct device_attribute *attr,
557 const char *buf, size_t count) 561 const char *buf, size_t count)
558{ 562{
559 struct wacom *wacom = dev_get_drvdata(dev); 563 struct wacom *wacom = dev_get_drvdata(dev);
@@ -566,7 +570,7 @@ static ssize_t wacom_led_select_store(struct device *dev,
566 570
567 mutex_lock(&wacom->lock); 571 mutex_lock(&wacom->lock);
568 572
569 wacom->led.select = id; 573 wacom->led.select[set_id] = id & 0x3;
570 err = wacom_led_control(wacom); 574 err = wacom_led_control(wacom);
571 575
572 mutex_unlock(&wacom->lock); 576 mutex_unlock(&wacom->lock);
@@ -574,7 +578,17 @@ static ssize_t wacom_led_select_store(struct device *dev,
574 return err < 0 ? err : count; 578 return err < 0 ? err : count;
575} 579}
576 580
577static DEVICE_ATTR(status_led_select, S_IWUSR, NULL, wacom_led_select_store); 581#define DEVICE_LED_SELECT_ATTR(SET_ID) \
582static ssize_t wacom_led##SET_ID##_select_store(struct device *dev, \
583 struct device_attribute *attr, const char *buf, size_t count) \
584{ \
585 return wacom_led_select_store(dev, SET_ID, buf, count); \
586} \
587static DEVICE_ATTR(status_led##SET_ID##_select, S_IWUSR, NULL, \
588 wacom_led##SET_ID##_select_store)
589
590DEVICE_LED_SELECT_ATTR(0);
591DEVICE_LED_SELECT_ATTR(1);
578 592
579static ssize_t wacom_luminance_store(struct wacom *wacom, u8 *dest, 593static ssize_t wacom_luminance_store(struct wacom *wacom, u8 *dest,
580 const char *buf, size_t count) 594 const char *buf, size_t count)
@@ -648,10 +662,21 @@ DEVICE_BTNIMG_ATTR(5);
648DEVICE_BTNIMG_ATTR(6); 662DEVICE_BTNIMG_ATTR(6);
649DEVICE_BTNIMG_ATTR(7); 663DEVICE_BTNIMG_ATTR(7);
650 664
651static struct attribute *wacom_led_attrs[] = { 665static struct attribute *cintiq_led_attrs[] = {
666 &dev_attr_status_led0_select.attr,
667 &dev_attr_status_led1_select.attr,
668 NULL
669};
670
671static struct attribute_group cintiq_led_attr_group = {
672 .name = "wacom_led",
673 .attrs = cintiq_led_attrs,
674};
675
676static struct attribute *intuos4_led_attrs[] = {
652 &dev_attr_status0_luminance.attr, 677 &dev_attr_status0_luminance.attr,
653 &dev_attr_status1_luminance.attr, 678 &dev_attr_status1_luminance.attr,
654 &dev_attr_status_led_select.attr, 679 &dev_attr_status_led0_select.attr,
655 &dev_attr_buttons_luminance.attr, 680 &dev_attr_buttons_luminance.attr,
656 &dev_attr_button0_rawimg.attr, 681 &dev_attr_button0_rawimg.attr,
657 &dev_attr_button1_rawimg.attr, 682 &dev_attr_button1_rawimg.attr,
@@ -664,43 +689,66 @@ static struct attribute *wacom_led_attrs[] = {
664 NULL 689 NULL
665}; 690};
666 691
667static struct attribute_group wacom_led_attr_group = { 692static struct attribute_group intuos4_led_attr_group = {
668 .name = "wacom_led", 693 .name = "wacom_led",
669 .attrs = wacom_led_attrs, 694 .attrs = intuos4_led_attrs,
670}; 695};
671 696
672static int wacom_initialize_leds(struct wacom *wacom) 697static int wacom_initialize_leds(struct wacom *wacom)
673{ 698{
674 int error; 699 int error;
675 700
676 if (wacom->wacom_wac.features.type >= INTUOS4 && 701 /* Initialize default values */
677 wacom->wacom_wac.features.type <= INTUOS4L) { 702 switch (wacom->wacom_wac.features.type) {
678 703 case INTUOS4:
679 /* Initialize default values */ 704 case INTUOS4L:
680 wacom->led.select = 0; 705 wacom->led.select[0] = 0;
706 wacom->led.select[1] = 0;
681 wacom->led.llv = 10; 707 wacom->led.llv = 10;
682 wacom->led.hlv = 20; 708 wacom->led.hlv = 20;
683 wacom->led.img_lum = 10; 709 wacom->led.img_lum = 10;
684 wacom_led_control(wacom); 710 error = sysfs_create_group(&wacom->intf->dev.kobj,
711 &intuos4_led_attr_group);
712 break;
713
714 case WACOM_21UX2:
715 wacom->led.select[0] = 0;
716 wacom->led.select[1] = 0;
717 wacom->led.llv = 0;
718 wacom->led.hlv = 0;
719 wacom->led.img_lum = 0;
685 720
686 error = sysfs_create_group(&wacom->intf->dev.kobj, 721 error = sysfs_create_group(&wacom->intf->dev.kobj,
687 &wacom_led_attr_group); 722 &cintiq_led_attr_group);
688 if (error) { 723 break;
689 dev_err(&wacom->intf->dev, 724
690 "cannot create sysfs group err: %d\n", error); 725 default:
691 return error; 726 return 0;
692 } 727 }
728
729 if (error) {
730 dev_err(&wacom->intf->dev,
731 "cannot create sysfs group err: %d\n", error);
732 return error;
693 } 733 }
734 wacom_led_control(wacom);
694 735
695 return 0; 736 return 0;
696} 737}
697 738
698static void wacom_destroy_leds(struct wacom *wacom) 739static void wacom_destroy_leds(struct wacom *wacom)
699{ 740{
700 if (wacom->wacom_wac.features.type >= INTUOS4 && 741 switch (wacom->wacom_wac.features.type) {
701 wacom->wacom_wac.features.type <= INTUOS4L) { 742 case INTUOS4:
743 case INTUOS4L:
702 sysfs_remove_group(&wacom->intf->dev.kobj, 744 sysfs_remove_group(&wacom->intf->dev.kobj,
703 &wacom_led_attr_group); 745 &intuos4_led_attr_group);
746 break;
747
748 case WACOM_21UX2:
749 sysfs_remove_group(&wacom->intf->dev.kobj,
750 &cintiq_led_attr_group);
751 break;
704 } 752 }
705} 753}
706 754