Skip to content
This repository has been archived by the owner on May 1, 2018. It is now read-only.

rmmod touch driver and bluetooth on sleep #20

Closed
sigboe opened this issue Jan 1, 2018 · 17 comments
Closed

rmmod touch driver and bluetooth on sleep #20

sigboe opened this issue Jan 1, 2018 · 17 comments

Comments

@sigboe
Copy link
Collaborator

sigboe commented Jan 1, 2018

I find that lots of time when sleeping for longer periods the touch screen driver does not recover. Same with bluetooth.

To fix this I modified a script that unloads the kernel driver while sleeping. Never had an issue after that.

@cawilliamson since you are so good with PKGBUILDs now. Could you pack this up? And maybe add it to the meta-package.

/lib/systemd/system-sleep/suspend-modules

https://gist.github.com/sigboe/2602f9318b8f55ca92c7755a5b70644d

It depends on gawk and of course need to be executable, to add a module to the suspend list just do like this

/etc/suspend-modules.d/bluetooth.conf

btusb

and for good measure do the wifi too since its on the same chip

/etc/suspend-modules.d/wifi.conf

iwlwifi

to do the touch screen a feel lines seams to help out.

/etc/suspend-modules.d/touch.conf

goodix
i2c_algo_bit
i2c_cht_wc
@Herst
Copy link
Contributor

Herst commented Jan 1, 2018

Concerning the touchscreen, is this the same issue as discussed at nexus511/gpd-ubuntu-packages#10? This one I as seeing as well occasionally. I wasn't aware of any workaround.

@sigboe
Copy link
Collaborator Author

sigboe commented Jan 1, 2018

@Herst yes, and this will work on Ubuntu as a fix as well

@Herst
Copy link
Contributor

Herst commented Jan 1, 2018

Yay, great! In that case you might want to let the people in the other thread let it know as well (and collect all the praise since not even Hans was yet successful in finding any fix).

@sigboe
Copy link
Collaborator Author

sigboe commented Jan 1, 2018

done @Herst

I am sure if hans wants to put time into it he can make a proper fix, its the I²C bus that does not recover always when power to the chip is turned on or off (I will wager on at least). Fix will be in better recovery of the state of the chip, like cleaning registers and such.

cawilliamson added a commit that referenced this issue Jan 1, 2018
- [#20] added support for rmmoding modules BEFORE sleep - thanks sigboe!
- [#20] added support for modprobing modules AFTER sleep - thanks sigboe!
@cawilliamson
Copy link
Contributor

cawilliamson commented Jan 1, 2018

@sigboe I've added this as requested and it looks to be working well but one thing:

i2c_algo_bit
i2c_cht_wc

I don't think these are needed are they? As far as I'm aware i2c_algo_bit at least is used by i915 - not sure about i2c_cht_wc. As such - I doubt it will actually unload anyway - give it a shot on a running system.

Let me know if you need any changes made. 👍

@sigboe
Copy link
Collaborator Author

sigboe commented Jan 1, 2018

If they are not needed then they are not needed 👍

Since adding them there I presume they will be loaded after first resume.

@petrmatula190
Copy link

petrmatula190 commented Jan 2, 2018

Hi guys, I have the same problem on ubuntu 16.04 in my Pocket with all kernels (from 4.12 to latest 4.15 from Hans). My fix in in two systemd units for unload/reload goodix kernel driver before sleeep/after resume. It can be usable for you.
https://github.com/petrmatula190/gpd-pocket-ubuntu-respin/tree/master/touch

I created pull request to stockmind repo:
stockmind/gpd-pocket-ubuntu-respin#84

EDIT: fix in /etc/suspend-modules.d/ not working sometimes in my case, but my solution is totally fix it in my case.

@sigboe
Copy link
Collaborator Author

sigboe commented Jan 2, 2018

@petrmatula190 I see your solution is aligned to best practice. However could you post the output of

cat /etc/suspend-modules 2> /dev/null; awk 1 /etc/suspend-modules.d/*.conf 2> /dev/null

It might be a typo in the text files, or maybe missing .conf ending.

While your method is the one I initially looked into doing, the benefit of this implementation is the easy add and removal of modules. Since the kernel we are running is ever evolving and release candidate. While I will not feel offended or anything if your method is the one that will be used.

@petrmatula190
Copy link

petrmatula190 commented Jan 3, 2018

@sigboe I tried it and folders /etc/suspend-modules and /etc/suspend-modules.d/ not exist in my ubuntu 16.04. But Hans (@jwrdegoede) create commit with fix for it in kernel: jwrdegoede/linux-sunxi@1f5c4f2

I am compiling this latest kernel now. I will share my results.

EDIT:
There is my compiled kernel with this commit and used .config from @stockmind repo + working audio (need copy HiFi.conf).
https://drive.google.com/file/d/1Bxdmyk4TnQbnty3AKtUuwrOUAnotNgwP/view?usp=drivesdk

@Herst
Copy link
Contributor

Herst commented Jan 3, 2018

Since the package pulls the current master from Hans' repo, isn't that fix included once you do makepkg?

@sigboe
Copy link
Collaborator Author

sigboe commented Jan 3, 2018

@Herst Yes, testing it now to see if I can reproduce the bug without this fix and latest kernel.

@petrmatula190
Copy link

petrmatula190 commented Jan 3, 2018

@Herst Yes, this fix is in master in Hans repo. I compiled it on last night.

@sigboe So, do you have fixed state, without issue after resume? I had around 30 resumes, no problem :-)

@sigboe
Copy link
Collaborator Author

sigboe commented Jan 3, 2018

Have not experienced it yet, but I want to sleep trough the night to see what happens. Since that was the most likely point I got the issue before.

@sigboe
Copy link
Collaborator Author

sigboe commented Jan 3, 2018

@Herst and I want to try to crash the bluetooth driver that this workaround avoided

And I dont have the signature to sign binaries for this repo, so I cant push binaries.

@petrmatula190
Copy link

@sigboe Ok. I had my Pocket in sleep until lunch (around 9 hours). But i need more time to testing too. I will se it in next week or two.

@sigboe
Copy link
Collaborator Author

sigboe commented Jan 3, 2018

@petrmatula190 (edit ops, I meant you)
I am sure its fixed, and we will know sooner rather than later. Right now I am running without this fix and sleeping and waking, and will try a long sleep tonight. I dont remember how often I lost bluetooth, but I will remove this fix from the repo (or rather move it to a new branch) tomorrow if I cant reproduce the bugs in the new kernel.

If that is okay with @voobscout @cawilliamson

I am also looking forward to a new binary release, with the changes here I can drop hosting a separate repo just to make the ArchISO (fixes curtesy of @cawilliamson and some more easy work to be done).

Also we need to push the microphone fix that was released, Ill look into that now.

@sigboe
Copy link
Collaborator Author

sigboe commented Jan 4, 2018

I see this issue as resolved with this commit ac1c6e2

@sigboe sigboe closed this as completed Jan 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants