Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[KERNEL DEVELOPMENT] T800: touchscreen- and keyboarddriver

OP nvertigo67

14th January 2015, 06:05 PM   |  #1  
OP Senior Member
Thanks Meter: 559
 
415 posts
Join Date:Joined: Dec 2011
Donate to Me
More
I'm not sure, if this is the right forum - but 'cause I really, really need some help on this it can't be the wrong forum.

I'm trying to build cm11 (and soon cm12) for t800. For two issues I need extended features in kernel drivers:

1. xbmc and some games do not accept touch input. I tracked this down to the following problem: some time ago some touch handling has been moved from rom to driver level (not sure if in aosp itself or in cm). So we need something similar to this patch in drivers/input/touchscreen/synaptics_dsx/*.

2. I order to allow disabling capacitive buttons properly, we need a additional sysfs interface file in drivers/input/keyboard/tc300k.c. As an exsample you can lool at this patch.

I would be really more than happy if a gifted kernel developer could put some love here.

If someone is reading this and knows about someone who could do this but is not reading here, please point him or her to this posting.

I'm quite desperated about knowing the reason, but being not smart enough to fix it my self (this was euphemistic for "pissed off". )

Thank you in advance.
Last edited by nvertigo67; 28th January 2015 at 04:31 PM.
The Following User Says Thank You to nvertigo67 For This Useful Post: [ View ]
14th January 2015, 10:34 PM   |  #2  
Senior Member
Flag San Francisco
Thanks Meter: 1,173
 
465 posts
Join Date:Joined: Feb 2010
Donate to Me
Quote:
Originally Posted by nvertigo67

I'm not sure, if this is the right forum - but 'cause I really, really need some help on this it can't be the wrong forum.

I'm trying to build cm11 (and soon cm12) for t800 (t700 has the same issues). For two issues I need extended features in kernel drivers:

1. xbmc and some games do not accept touch input. I tracked this down to the following problem: some time ago some touch handling has been moved from rom to driver level (not sure if in aosp itself or in cm). So we need something similar to this patch in drivers/input/touchscreen/synaptics_dsx/*.

2. I order to allow disabling capacitive buttons properly, we need a additional sysfs interface file in drivers/input/keyboard/tc300k.c. As an exsample you can lool at this patch.

I would be really more than happy if a gifted kernel developer could put some love here.

If someone is reading this and knows about someone who could do this but is not reading here, please point him or her to this posting.

I'm quite desperated about knowing the reason, but being not smart enough to fix it my self (this was euphemistic for "pissed off". )

Thank you in advance.

I can handle number 2. Looks straight forward enough. Number one looks a bit more intrusive and I would want to think about it before I did that change.
The Following 2 Users Say Thank You to eousphoros For This Useful Post: [ View ]
15th January 2015, 08:28 AM   |  #3  
OP Senior Member
Thanks Meter: 559
 
415 posts
Join Date:Joined: Dec 2011
Donate to Me
More
Quote:
Originally Posted by eousphoros

I can handle number 2. Looks straight forward enough. Number one looks a bit more intrusive and I would want to think about it before I did that change.

Hey, thats great news!
The Following User Says Thank You to nvertigo67 For This Useful Post: [ View ]
16th January 2015, 03:34 AM   |  #4  
Senior Member
Flag San Francisco
Thanks Meter: 1,173
 
465 posts
Join Date:Joined: Feb 2010
Donate to Me
Number 2 was pretty easy @nvertigo67 (just for visibility)

root@klimtwifi:/sys/devices/virtual/sec/sec_touchkey # cat touchkey_enabled
1
root@klimtwifi:/sys/devices/virtual/sec/sec_touchkey # echo 0 > touchkey_enabled <
root@klimtwifi:/sys/devices/virtual/sec/sec_touchkey # cat touchkey_enabled
0

No more capacitive buttons!

Here is the diff

Code:
diff --git a/drivers/input/keyboard/cypress/cypress-touchkey.c b/drivers/input/keyboard/cypress/cypress-touchkey.c
index d019d0d3..b2c71dd 100644
--- a/drivers/input/keyboard/cypress/cypress-touchkey.c
+++ b/drivers/input/keyboard/cypress/cypress-touchkey.c
@@ -1881,6 +1881,34 @@ static ssize_t set_touchkey_firm_status_show(struct device *dev,
 
        return count;
 }
+
+static ssize_t show_touchkey_enabled(struct device *dev,
+                                    struct device_attribute *attr,
+                                    char *buf)
+{
+       struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
+
+       dev_dbg(&tkey_i2c->client->dev, "%s\n", __func__);
+       return snprintf(buf, PAGE_SIZE, "%u\n", tkey_i2c->enabled);
+}
+
+static ssize_t touchkey_enabled_store(struct device *dev,
+                                      struct device_attribute *attr,
+                                      const char *buf, size_t size)
+{
+        struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
+       unsigned int input;
+
+       if (sscanf(buf, "%u", &input) != 1)
+               return -EINVAL;
+
+       if (input == 0)
+               touchkey_stop(tkey_i2c);
+
+       dev_dbg(&tkey_i2c->client->dev, "%s\n", __func__);
+       return size;
+}
+
 #ifdef TOUCHKEY_BOOSTER
 static ssize_t touchkey_boost_level(struct device *dev,
                                                struct device_attribute *attr, const char *buf,
@@ -1930,6 +1958,8 @@ static DEVICE_ATTR(touchkey_firm_version_phone, S_IRUGO | S_IWUSR | S_IWGRP,
                   set_touchkey_firm_version_show, NULL);
 static DEVICE_ATTR(touchkey_firm_version_panel, S_IRUGO | S_IWUSR | S_IWGRP,
                   set_touchkey_firm_version_read_show, NULL);
+static DEVICE_ATTR(touchkey_enabled, S_IRUGO | S_IWUSR | S_IWGRP,
+                  show_touchkey_enabled, touchkey_enabled_store);
 #ifdef LED_LDO_WITH_REGULATOR
 static DEVICE_ATTR(touchkey_brightness, S_IRUGO | S_IWUSR | S_IWGRP,
                   NULL, brightness_control);
@@ -1963,6 +1993,7 @@ static DEVICE_ATTR(boost_level, S_IWUSR | S_IWGRP, NULL, touchkey_boost_level);
 #endif
 
 static struct attribute *touchkey_attributes[] = {
+        &dev_attr_touchkey_enabled.attr,
        &dev_attr_brightness.attr,
 #ifdef TK_USE_RECENT
        &dev_attr_touchkey_recent.attr,
---
Though the one "issue" is to re-enable them you would need to reboot. But thats just because I was being lazy.
Last edited by eousphoros; 16th January 2015 at 03:42 AM.
The Following User Says Thank You to eousphoros For This Useful Post: [ View ]
16th January 2015, 08:44 AM   |  #5  
OP Senior Member
Thanks Meter: 559
 
415 posts
Join Date:Joined: Dec 2011
Donate to Me
More
Quote:
Originally Posted by eousphoros

Number 2 was pretty easy @nvertigo67 (just for visibility)

root@klimtwifi:/sys/devices/virtual/sec/sec_touchkey # cat touchkey_enabled
1
root@klimtwifi:/sys/devices/virtual/sec/sec_touchkey # echo 0 > touchkey_enabled <
root@klimtwifi:/sys/devices/virtual/sec/sec_touchkey # cat touchkey_enabled
0

No more capacitive buttons!

Here is the diff

Code:
diff --git a/drivers/input/keyboard/cypress/cypress-touchkey.c b/drivers/input/keyboard/cypress/cypress-touchkey.c
index d019d0d3..b2c71dd 100644
--- a/drivers/input/keyboard/cypress/cypress-touchkey.c
+++ b/drivers/input/keyboard/cypress/cypress-touchkey.c
@@ -1881,6 +1881,34 @@ static ssize_t set_touchkey_firm_status_show(struct device *dev,
 
        return count;
 }
+
+static ssize_t show_touchkey_enabled(struct device *dev,
+                                    struct device_attribute *attr,
+                                    char *buf)
+{
+       struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
+
+       dev_dbg(&tkey_i2c->client->dev, "%s\n", __func__);
+       return snprintf(buf, PAGE_SIZE, "%u\n", tkey_i2c->enabled);
+}
+
+static ssize_t touchkey_enabled_store(struct device *dev,
+                                      struct device_attribute *attr,
+                                      const char *buf, size_t size)
+{
+        struct touchkey_i2c *tkey_i2c = dev_get_drvdata(dev);
+       unsigned int input;
+
+       if (sscanf(buf, "%u", &input) != 1)
+               return -EINVAL;
+
+       if (input == 0)
+               touchkey_stop(tkey_i2c);
+
+       dev_dbg(&tkey_i2c->client->dev, "%s\n", __func__);
+       return size;
+}
+
 #ifdef TOUCHKEY_BOOSTER
 static ssize_t touchkey_boost_level(struct device *dev,
                                                struct device_attribute *attr, const char *buf,
@@ -1930,6 +1958,8 @@ static DEVICE_ATTR(touchkey_firm_version_phone, S_IRUGO | S_IWUSR | S_IWGRP,
                   set_touchkey_firm_version_show, NULL);
 static DEVICE_ATTR(touchkey_firm_version_panel, S_IRUGO | S_IWUSR | S_IWGRP,
                   set_touchkey_firm_version_read_show, NULL);
+static DEVICE_ATTR(touchkey_enabled, S_IRUGO | S_IWUSR | S_IWGRP,
+                  show_touchkey_enabled, touchkey_enabled_store);
 #ifdef LED_LDO_WITH_REGULATOR
 static DEVICE_ATTR(touchkey_brightness, S_IRUGO | S_IWUSR | S_IWGRP,
                   NULL, brightness_control);
@@ -1963,6 +1993,7 @@ static DEVICE_ATTR(boost_level, S_IWUSR | S_IWGRP, NULL, touchkey_boost_level);
 #endif
 
 static struct attribute *touchkey_attributes[] = {
+        &dev_attr_touchkey_enabled.attr,
        &dev_attr_brightness.attr,
 #ifdef TK_USE_RECENT
        &dev_attr_touchkey_recent.attr,
---
Though the one "issue" is to re-enable them you would need to reboot. But thats just because I was being lazy.

Cool! That's a nice one.

For the learning part (not so important, but I'm curious): Some time ago I've have tries to disable the cypress driver, 'cause we have tc300k keys and no cypress. But after disabling cypress tc300k refused to build: some prototypes were missing, 'cause of some ifdefs include the appropriate headers only if cypress is enabled. So I changed the ifdefs... tc300k compiled again, but the capacitive keys were not working with the resulting kernel: do you understand the dependency of tc300k and cypress?

And now for the real jedi-question (I expect an answer here of course! ): Why doesn't sammy reflect this dependency in Kconfig?

Again: thank you very much!

(BTW: I use "/sys/class/input/input8/enabled" in powerHAL and will use "/sys/devices/virtual/sec/sec_touchkey/touchkey_enabled" in keydisabler.java. Does this persist a reboot? Or is keydisabler.java disable this on each reboot? [I'm just thinking out loud... ] Do you plan to extend your patch for enabling capacitive buttons online again?)

I have started writing this just after wakeup, 'cause I 'm so exited about this fix (issue is itching my ego for months). After a cup of coffee I realize it's a quite caotic posting - hope you get the points though...
16th January 2015, 09:07 AM   |  #6  
Senior Member
Flag San Francisco
Thanks Meter: 1,173
 
465 posts
Join Date:Joined: Feb 2010
Donate to Me
As I goto bed I write this so excuse the brevity. I will answer all the questions tomorrow. This is just a quick first draft.

This does not persist between reboots
I could extend this to reenable the buttons if there is interest. Just need to chase the rabbit a little further down the hole.
Not sure about tc300k. Do Klimt and Chagall use the same bits for the capacitive buttons?
The Following User Says Thank You to eousphoros For This Useful Post: [ View ]
16th January 2015, 10:19 AM   |  #7  
OP Senior Member
Thanks Meter: 559
 
415 posts
Join Date:Joined: Dec 2011
Donate to Me
More
Quote:
Originally Posted by eousphoros

As I goto bed I write this so excuse the brevity. I will answer all the questions tomorrow. This is just a quick first draft.

This does not persist between reboots
I could extend this to reenable the buttons if there is interest. Just need to chase the rabbit a little further down the hole.
Not sure about tc300k. Do Klimt and Chagall use the same bits for the capacitive buttons?

Good night. Take your time. For your question: we will know when you wake up - i will try a build...
Thanx again and sleep well.
16th January 2015, 02:09 PM   |  #8  
OP Senior Member
Thanks Meter: 559
 
415 posts
Join Date:Joined: Dec 2011
Donate to Me
More
klimt and chagall have different touchkey drivers.
Code:
/ # ls -la /sys/bus/i2c/drivers/
drwxr-xr-x   25 root         root                 0 Jan 16 12:27 .
drwxr-xr-x    4 root         root                 0 Jan 16 12:27 ..
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 AK09911C
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 BMA255
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 BMG160
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 CM3323
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 S5K6B2
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 cameraeeprom
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 dummy
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 exynos_edid
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 exynos_hdcp
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 ice4
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 ir-kbd-i2c
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 max77803
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 s2abb01
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 sec-fuelgauge
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 sec-pmic
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 sec_touchkey
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 sii8240_cbus
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 sii8240_disc
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 sii8240_hdmi
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 sii8240_tmds
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 sii8240_tpi
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 synaptics_rmi4_i2c
drwxr-xr-x    2 root         root                 0 Jan 16 12:27 tc300k
No cypress driver - but tc300k.

So, not surprising:
Code:
/ #ls -la /sys/devices/virtual/sec/sec_touchkey/touchkey_enable
ls: /sys/devices/virtual/sec/sec_touchkey/touchkey_enable: No such file or directory
But anyway: thank you for tying to help - and we learned something new about the difference between chagall and klimt (in real life you can tell their pictures more easily... )

The Following User Says Thank You to nvertigo67 For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes