Jump to content

Advent Vega kernel source code now available!


Guest PaulOBrien

Recommended Posts

Guest ejtagle

With those debugging options enabled here are the 2 serial dumps.

4.1.2: http://pastebin.com/hBAf850J

4.2.1: http://pastebin.com/yzkW0NiQ

In 4.2.1 I see

<6>gpio bank wake found: wake24 for irq=119

<6>Enabling wake24

This little bit seems to be the biggest difference I noticed...

EDIT: I did use the EXACT same kernel on both roms. There were no tweaks to it at all.

Wake24 is the TEGRA_GPIO_PV2 input. It is usually the power button. Somehow, 4.1.2 does not completely enable wake for it, but 4.2.x does... Check your *,kl (keylayout) files in your lunch target for your device... Also check your *.kcm files...maybe there is something there...

Link to comment
Share on other sites

Guest fosser2

Wake24 is the TEGRA_GPIO_PV2 input. It is usually the power button. Somehow, 4.1.2 does not completely enable wake for it, but 4.2.x does... Check your *,kl (keylayout) files in your lunch target for your device... Also check your *.kcm files...maybe there is something there...

I just went through and diffed all .kl and .kcm files from 4.1.2 --> 4.2.1 and they were all identical. So it seems nothing on that end has changed.

Link to comment
Share on other sites

Guest fosser2

Maybe what has changed is the way the framework uses those files... Try to remove the WAKE keyword from the power button...

In the kernel I disabled our custom power button code and reverted our tps6586x.c back to stock configuration. Looping still occurred.

This output still bothers me.


<6>gpio bank wake found: wake24 for irq=119

<6>Enabling wake24

I'm wondering how I could figure out what irq 119 is. Any ideas on that?

Edited by fosser2
Link to comment
Share on other sites

Guest ejtagle

In the kernel I disabled our custom power button code and reverted our tps6586x.c back to stock configuration. Looping still occurred.

This output still bothers me.


<6>gpio bank wake found: wake24 for irq=119

<6>Enabling wake24

I'm wondering how I could figure out what irq 119 is. Any ideas on that?

irq 119 is INT_GPIO6 ... You can deduce that by looking at the headers (mach/irq.h). INT_GPIO6 is the interrupt source associated to the bank #6 of GPIOs. And Bank 6 is the one that contains the power button GPIO....

Link to comment
Share on other sites

Guest ejtagle

Hi,

the HP Touchpad has working Bluetooth on Android 4.2. They are using AR6003 Wifi/BT.

http://forum.xda-dev...d.php?t=1472892

https://github.com/E.../tree/jellybean

I am going to try out their way on my Folio 100 as it also has a AR6003 Wifi...

The idea was to switch the CSR chipset from BCSP to H4. I wrote an utility to do that, but it did not work as expected. Once switched to H4, the CSR chip does not respond anymore... Maybe is the rom version that does not support that mode... ? ... Mayve you will be luckier than i. The repo you posted contains an utility called bcattach that seems to do the same thing that i tried: Sends commands in BCSP to switch to H4 the chip. I will try to reverse engineer the hex strings to check if something extra is done... Perhaps it will work ... ? ... :)

Link to comment
Share on other sites

Guest DerArtem

The idea was to switch the CSR chipset from BCSP to H4. I wrote an utility to do that, but it did not work as expected. Once switched to H4, the CSR chip does not respond anymore... Maybe is the rom version that does not support that mode... ? ... Mayve you will be luckier than i. The repo you posted contains an utility called bcattach that seems to do the same thing that i tried: Sends commands in BCSP to switch to H4 the chip. I will try to reverse engineer the hex strings to check if something extra is done... Perhaps it will work ... ? ... :)

Maybe just try out this tool. Maybe it will work out of the box - just change the GPIO's. The only think I don't understand is that the HP and also the Vega are both using ttyHSx with hciattach for BT communication. On the Folio I don't use /dev/ttyHSx nor hciattach at all. The whole BT stuff is directly provided just by the ar6000.ko. Should there be a serial port for BT? How can I check if my BT chip responds to one of the ttyHSx ports?

Link to comment
Share on other sites

Guest ejtagle

H

Maybe just try out this tool. Maybe it will work out of the box - just change the GPIO's. The only think I don't understand is that the HP and also the Vega are both using ttyHSx with hciattach for BT communication. On the Folio I don't use /dev/ttyHSx nor hciattach at all. The whole BT stuff is directly provided just by the ar6000.ko. Should there be a serial port for BT? How can I check if my BT chip responds to one of the ttyHSx ports?

Check your init.folio100.rc ... you seem to be using nv_hciattach. Even if not specifying the serial port, ttyHS2 is assumed. nv_hciattach is just a wrapper around hciattach that previously configures the serial port baud and parity, then uses BCCMD (part of bluez) to load into the bluetooth chipset the bluecore6.psr file (including the bluetooth mac address!) and then finally invokes hciattach that does the bcsp initialization, and then switches the uart driver to the tty line discipline HCI_BCSP. From that point onwards, bluez was taking control from the newly created netlink interface called HCI (that is used to send HCI commands to the bt chip)

But, now, bluedroid does not know how to use the HCI netlink layer. It just wants to talk thru a serial port, and the only protocol supported is H4 (instead of BCSP)... You can use the bccmd bluez tool to check if your bt chip is attached to the serial port ttyHS2.

Link to comment
Share on other sites

Guest redeyedjedi

Hello all... First off, thanks ej and scanno for all your ocntributions, I have been working with fosser2 trying to get our g tabs up to par with you guys, but we are suffering with a no sleep issue, as you already know. and to derartem, i have used code from you for our tabs to have a webcam to use instead of internal camera. THANKS!

I just wanted to point out that even tho we have added the bdroid cfg file for our build of 4.2.1, we are NOT using bluedroid, we are still using BLUEZ and it works. so, if you cant get any bluetooth, you can feel free to browse my git, to see our setup (hack-job) to have functional bluetooth.

https://github.com/redeyedjedi?tab=repositories

Link to comment
Share on other sites

Guest DerArtem

H

Check your init.folio100.rc ... you seem to be using nv_hciattach. Even if not specifying the serial port, ttyHS2 is assumed. nv_hciattach is just a wrapper around hciattach that previously configures the serial port baud and parity, then uses BCCMD (part of bluez) to load into the bluetooth chipset the bluecore6.psr file (including the bluetooth mac address!) and then finally invokes hciattach that does the bcsp initialization, and then switches the uart driver to the tty line discipline HCI_BCSP. From that point onwards, bluez was taking control from the newly created netlink interface called HCI (that is used to send HCI commands to the bt chip)

But, now, bluedroid does not know how to use the HCI netlink layer. It just wants to talk thru a serial port, and the only protocol supported is H4 (instead of BCSP)... You can use the bccmd bluez tool to check if your bt chip is attached to the serial port ttyHS2.

No, I have just double checked it. It seems to be different on the Folio 100. I have removed hciattach and nv_hciattach and bluetooth still works. (And there is also no hciattach in the init). Everything is done by the ar6000.ko. It creates a "HCI Bridge". Here is a dmesg of loading ar6000.ko:


<3>[    2.505299] AR6K: ar6000_prealloc_init success. : 20

<6>[    2.505674] AR6K: ar6000_dma_buffer_alloc(size = 32768) = ccda8000

<1>[    2.514737] AR6000: configuration opcode 7 is only used for RTOS systems, not Linux systems

<1>[    2.535261] android_readwrite_file: file /data/.psm.info filp_open error

<1>[    2.590893] ath6k/AR6003/hw2.0/athwlan.bin.z77 firmware will be loaded

<1>[    3.007579] BDADDR 0x0:0x24:0x7e:0x70:0xb0:0x11

<1>[    3.020050] AR6K: ** HIF layer does not support scatter requests (17)

<6>[    3.020215] AR6K: ar6000_virtual_scatter_buffer_alloc(req = 0, size = 16776) = ccc40000

<6>[    3.020374] AR6K: ar6000_virtual_scatter_buffer_alloc(req = 1, size = 16776) = ccc48000

<6>[    3.020469] AR6K: ar6000_virtual_scatter_buffer_alloc(req = 2, size = 16776) = ccdb0000

<6>[    3.020626] AR6K: ar6000_virtual_scatter_buffer_alloc(req = 3, size = 16776) = ccdb8000

<1>[    3.020785]  GMBOX Advertised: Address:0x7000 , size:16384

<1>[    3.021882] HCI Bridge: running in normal mode...

<1>[    3.022069] HCI: notifying attached client to transport...

<1>[    3.022160] HCI ready (hci:0xCD9407A0, headroom:1, tailroom:0 blockpad:128)

<1>[    3.022512] HCI : InitTxCreditState - credits avail: 10, size: 256

<1>[    3.168006] deadc0de: FPGA/ASIC PS File Name ar3k/30101coex/PS_ASIC.pst

<1>[    3.194317] File Open Operation Successful

<1>[    3.194429]  TAG ID 23

<1>[    3.194518]  TAG ID 300

<1>[    3.194612]  TAG ID 19

<1>[    3.194785]  TAG ID 2

<1>[    3.194912]  TAG ID 3

<1>[    3.195009]  TAG ID 21

<1>[    3.195101]  TAG ID 22

<1>[    3.195207]  TAG ID 31

<1>[    3.195378]  TAG ID 61

<1>[    3.195474]  TAG ID 38

<1>[    3.195576] Number of Tags 10

<1>[    3.195661] ** Total Length 392

<1>[    3.195819] Patch File Name ar3k/30101coex/RamPatch.txt

<1>[    3.208829]  Index [35]

<1>[    3.208936] PS Thread Started CRC 3 Patch Count 36  Tag Count 10

<1>[    3.209088] Num Cmd Entries 49 Size  392

<1>[    3.209173] VALUE of CRC:3 At index 0

<1>[    3.209318] *** Write Patch****

<1>[    3.209478] *** Enable Patch****

<1>[    3.209561] *** PS Reset**** 2048[0x800]

<1>[    3.209643] *** PS Write****  

<1>[    3.209791] BD ADDR not present

<1>[    3.209873] PS Count 10 Patch Count 36

<1>[    3.209957] Check PS ID 17

<1>[    3.210173] Check PS ID 2c

<1>[    3.210254] Check PS ID 13

<1>[    3.210334] Check PS ID 2

<1>[    3.210415] Check PS ID 3

<1>[    3.210557] Check PS ID 15

<1>[    3.210638] Check PS ID 16

<1>[    3.210718] Check PS ID 1f

<1>[    3.210797] Check PS ID 3d

<1>[    3.210876] Check PS ID 26

<1>[    4.756292] BDADDR File Name ar3k/30101coex/ar3kbdaddr.pst

<1>[    4.756435] android_readwrite_file: file /system/wifi/ar3k/30101coex/ar3kbdaddr.pst filp_open error

<1>[    4.756626] PSSendOps: firmware file open error

<1>[    4.756724] TLPM - PwrMgmtEnabled=0, IdleTimeout=1000, WakeupTimeout=10

<1>[    4.871678] AR3K Config: Baud Changed to 3000000

<1>[    5.199458] AR3K Config: Baud changed to 3000000 for AR6K

<1>[    5.199673] HCI Bridge: registering HCI...

<1>[    5.200661] HCI Bridge: HCI registered

<1>[    5.201951] AR6K: targetconf_ver : 4

<1>[    5.202063] AR6K: targetconf_ver : 4

[...]

<3>[   13.369506] init: no such service 'hciattach'

Link to comment
Share on other sites

Guest DerArtem

Hello all... First off, thanks ej and scanno for all your ocntributions, I have been working with fosser2 trying to get our g tabs up to par with you guys, but we are suffering with a no sleep issue, as you already know. and to derartem, i have used code from you for our tabs to have a webcam to use instead of internal camera. THANKS!

I just wanted to point out that even tho we have added the bdroid cfg file for our build of 4.2.1, we are NOT using bluedroid, we are still using BLUEZ and it works. so, if you cant get any bluetooth, you can feel free to browse my git, to see our setup (hack-job) to have functional bluetooth.

https://github.com/r...ab=repositories

Many thanks, we will check this out. For the suspend stuff - I had a similar issue. I think that this fixed it:

https://github.com/D...d7e1badadf291a2

The problem is that the power button GPIO is always high when the tablet it turned on, but goes to low when we enter suspend. When pressing the button during suspend it goes to high and triggers an interrupt.

I had no problem with this all the time, but then there was some update in Android and my suspend stuff suddently stopped working and I had to fix it...

While the tablet is turned on the power button is controlled by nvec and not the GPIO. But during suspend the GPIO is used.

Edited by DerArtem
Link to comment
Share on other sites

Guest ejtagle

Many thanks, we will check this out. For the suspend stuff - I had a similar issue. I think that this fixed it:

https://github.com/D...d7e1badadf291a2

The problem is that the power button GPIO is always high when the tablet it turned on, but goes to low when we enter suspend. When pressing the button during suspend it goes to high and triggers an interrupt.

I had no problem with this all the time, but then there was some update in Android and my suspend stuff suddently stopped working and I had to fix it...

While the tablet is turned on the power button is controlled by nvec and not the GPIO. But during suspend the GPIO is used.

Humm... seems you will have a similar problem ... the HCI netlink interface can't be used by bluedroid. But, it is possible to write a plugin for bluedroid that does the bridging... In fact, i started to write such thing, but is unfinished... As far as I understand it, it should not be complex to finish... My current approach for the ar6002 was to implement the BCSP protocol ... I am starting to test it ...But i could also use the HCI approach... both should work.

The main idea is to modify hci_h4.c (from bluedroid), so, instead of transmitting or receiving HCI messages though the UART, it could just transmit and receive them using the HCI netlink layer (it is nearly trivial to implement)... The most complex thing about this is to understand the bluedroid source ... It is completely undocumented, horribly organized ... :S

The other option is to revert to bluez...

(Attached what i did start to write to interface HCI to bluedroid... completely unfinished. But, i think it should not be complex to complete... the hci_* functions can be taken from bluez... I´ll try to finish the HCI code...

hci_bluez.rar

Edited by ejtagle
Link to comment
Share on other sites

Guest ejtagle

I think (personal opinion) that to add HCI/BCSP support to bluedroid (even if i hate it) is the best way to remain compatible with future Android versions ... :(

Link to comment
Share on other sites

Guest fosser2

Many thanks, we will check this out. For the suspend stuff - I had a similar issue. I think that this fixed it:

https://github.com/D...d7e1badadf291a2

The problem is that the power button GPIO is always high when the tablet it turned on, but goes to low when we enter suspend. When pressing the button during suspend it goes to high and triggers an interrupt.

I had no problem with this all the time, but then there was some update in Android and my suspend stuff suddently stopped working and I had to fix it...

While the tablet is turned on the power button is controlled by nvec and not the GPIO. But during suspend the GPIO is used.

If I remove the wake file and push the power button to shut our tablet off, the tablet is instantly turned off. We need the cancel sleep function in our tablet. I also want to say that I do not believe this file is even causing the sleep issues because even with it removed the sleep looping situation is still occurring...

Link to comment
Share on other sites

Guest ejtagle

Related to Bluetooth... After some investigation, seems the HCI netlink layer accepts H4 formatted packets, and also reports back in H4... So, with a bit of luck, I guess we could make bluedroid use the HCI socket (and the bluetooth kernel subsystem!) without much trouble or modifications... :) ... I will try this approach...

Link to comment
Share on other sites

Guest fosser2

Hey ejtagle,

We were able to trace the sleep issue to the interrupt timer TMR2. This is a timer used specifically by AVP. Upon disabling AVP in the kernel sleep was instantly fixed. But obviously we can't do that because we lose all video. Now I'm wondering what you guys did to counteract this or what you changed in 4.2 that referenced AVP. As always thank you in advance for the help.

EDIT: When we booted 4.2 soon after boot in dmesg we would see the following NEW message

http://pastebin.com/WXdKCSyN

Since 4.2 was functioning properly I ignored it, but I guess it kinda came back and bit us. Do you have any thoughts on it?

Edited by fosser2
Link to comment
Share on other sites

Guest MikhailM

Related to Bluetooth... After some investigation, seems the HCI netlink layer accepts H4 formatted packets, and also reports back in H4... So, with a bit of luck, I guess we could make bluedroid use the HCI socket (and the bluetooth kernel subsystem!) without much trouble or modifications... :) ... I will try this approach...

Hi, Ejtagle,

This refers to another problem with hte Vega and PoV tablets and Scanno's CM10.1 Alpha 9d rom. The Lulzactoveq governor that you kindly provided is causing the tablets to go into SoD. I would post a log, it I knew when to take it. With Interactive or Ondemand there is no problem with waking up the tablet with either the Power of Volume buttons. Also, using CPU Spy shows that the when sleeping the tablet does not really enter deep sleep and continues to use a lot of battery charge. Any ideas or assistance?

Link to comment
Share on other sites

Guest ejtagle

Hi, Ejtagle,

This refers to another problem with hte Vega and PoV tablets and Scanno's CM10.1 Alpha 9d rom. The Lulzactoveq governor that you kindly provided is causing the tablets to go into SoD. I would post a log, it I knew when to take it. With Interactive or Ondemand there is no problem with waking up the tablet with either the Power of Volume buttons. Also, using CPU Spy shows that the when sleeping the tablet does not really enter deep sleep and continues to use a lot of battery charge. Any ideas or assistance?

I did not write the lulzactiveq governor. I just have integrated it into the kernel... It was supposed to be the best governor , but, as it was written with exinos CPUS in mind, it could be the one preventing suspension... We could either try to fix it, try another governor (the Adam folks are using lulzactive, without the q, we could try it, or we could use the default interactive governor... I guess, as there is a workaround for this problem (intercative governor is not bad...), I ll focus on Bluetooth (pretty close to have it working! ;) ).., then will check the governor, to find out if something is wrong with it... And it could , of cause, have problems, as it was never tested on tegra2 SoCs before...

Link to comment
Share on other sites

Guest ejtagle

Hey ejtagle,

We were able to trace the sleep issue to the interrupt timer TMR2. This is a timer used specifically by AVP. Upon disabling AVP in the kernel sleep was instantly fixed. But obviously we can't do that because we lose all video. Now I'm wondering what you guys did to counteract this or what you changed in 4.2 that referenced AVP. As always thank you in advance for the help.

EDIT: When we booted 4.2 soon after boot in dmesg we would see the following NEW message

http://pastebin.com/WXdKCSyN

Since 4.2 was functioning properly I ignored it, but I guess it kinda came back and bit us. Do you have any thoughts on it?

What did you exactly disable ? .. AVP is an extra processor used to decode video and audio... without it, no video decoding... There are 2 AVP implementations on kernel... one of them must be disabled... It is completely obsolete... The other is the one that must be enabled...

Link to comment
Share on other sites

Guest MikhailM

I did not write the lulzactiveq governor. I just have integrated it into the kernel... It was supposed to be the best governor , but, as it was written with exinos CPUS in mind, it could be the one preventing suspension... We could either try to fix it, try another governor (the Adam folks are using lulzactive, without the q, we could try it, or we could use the default interactive governor... I guess, as there is a workaround for this problem (intercative governor is not bad...), I ll focus on Bluetooth (pretty close to have it working! ;) ).., then will check the governor, to find out if something is wrong with it... And it could , of cause, have problems, as it was never tested on tegra2 SoCs before...

Thank you for the reply, Ejtagle,

The Lulzactoveq governor is not a priority in any way. We are doing fine with Interactive. Bluetooth is indeed something a lot of people need (not me) and also the question of the Vega/PoV not managing to go into deep sleep, as it means the battery is drained rapidly while the tablet appears to be asleep.

Link to comment
Share on other sites

Guest fosser2

What did you exactly disable ? .. AVP is an extra processor used to decode video and audio... without it, no video decoding... There are 2 AVP implementations on kernel... one of them must be disabled... It is completely obsolete... The other is the one that must be enabled...

The 2 options that I disabled were:

CONFIG_TEGRA_AVP

CONFIG_TEGRA_MEDIASERVER

Without these the tablet sleeps just fine, but obviously has no video...

Here is a link to our current configuration minus those 2 options above.

https://github.com/fosser2/android-tegra-nv-3.1.10-rel-15r7/blob/experimental/arch/arm/configs/tegra_smba1002_defconfig

Edited by fosser2
Link to comment
Share on other sites

Guest ejtagle

The 2 options that I disabled were:

CONFIG_TEGRA_AVP

CONFIG_TEGRA_MEDIASERVER

Without these the tablet sleeps just fine, but obviously has no video...

Here is a link to our current configuration minus those 2 options above.

https://github.com/f...a1002_defconfig

Yes, you need avp and you need mediaserver. Without them, there will be no hw accelerated video decoding... The question is why are you getting int2 wakeups, when avp is supposed to be shut down most of the time...

Maybe the AVP coprocessor is not properly initialized... Wrong firmware version ? :S

Edited by ejtagle
Link to comment
Share on other sites

Guest fosser2

Yes, you need avp and you need mediaserver. Without them, there will be no hw accelerated video decoding... The question is why are you getting int2 wakeups, when avp is supposed to be shut down most of the time...

Maybe the AVP coprocessor is not properly initialized... Wrong firmware version ? :S

Well... you are very right...

I diffed our 8 avp related bins

nvrm_avp.bin

nvrm_avp_0ff00000.bin

nvrm_avp_8e000000.bin

nvrm_avp_9e000000.bin

nvrm_avp_00001000.bin ==

nvrm_avp_be000000.bin

nvrm_avp_e0000000.bin ==

nvrm_avp_eff00000.bin

We had 2 the same and 6 different. I swapped out all 8 for the ones on scanno's git and like magic sleep is working... I'm just happy its finally working again :)

I really really appreciate the help you guys are on this thread!

EDIT: guess not... Ok this might sound crazy but I have to watch a video FIRST before I attempt to sleep my tablet. If I reboot my tablet and put it to sleep right away it does the sleep loop. As soon as I watch a video and then sleep its fine until I restart again. Ejtagle do you have any thoughts on this?

http://pastebin.com/LcmkjDEH

Lines 1081-3250 = Before video

Lines 3293-3407 = Video

Lines 3409-3493 = SLEEP

Line 3499 = Proof it stayed in LP1

Edited by fosser2
Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.