Jump to content

Advent Vega kernel source code now available!


Guest PaulOBrien

Recommended Posts

Guest Scanno

@Eduardo,

Regarding the SDCard / SDHCI problem the following:

- We get the following error (in dmesg) from the function sdhci_tegra_probe:


  rc = enable_irq_wake(gpio_to_irq(plat->cd_gpio));

  if (rc < 0)

   dev_err(mmc_dev(host->mmc),

    "SD card wake-up event registration"

	 "failed with eroor: %d\n", rc);

The error value = -22, Looked this up and it is an invalid argument. Tried to follow down to the cause of this and i end up with the conclusion that there is an invalid IRQ. In irqdesc.c:

struct irq_desc *irq_to_desc(unsigned int irq)

{

return (irq < NR_IRQS) ? irq_desc + irq : NULL;

}

Now i have not done any serious C programming in the last 10 years, but i think that the IRQ given (the result of gpio_to_irq(plat->cd_gpio) given as parameter in enable_irq_wake could be incorrect and the evaluation in irq_to_desc leads to the (irq<NR_IRQS) is false and NULL is returned. This leads to the return of value EINVAL (=22) in the function irq_set_irq_wake in manage.c

int irq_set_irq_wake(unsigned int irq, unsigned int on)

{

unsigned long flags;

struct irq_desc *desc = irq_get_desc_buslock(irq, &flags);

int ret = 0;

if (!desc)

  return -EINVAL;


Hope you can solve this or give me a hint what to change.

Regards,

Scanno

Link to comment
Share on other sites

Guest brucelee666

Scanno,

Just catching up was not around yesterday, not surprised the 2802 sd card fix made the errors return as I think the 2802 files were roughly the same as those used in the 39 kernel.

On a side note looks like nvidia have released an updated kernel "rel-15r7" seems to be an update of the "android-tegra-3.1" looking at log data we are currently using and running a quick diff on it there seems to be a number of updates that could cause issues:-

nvmap.h moved from mach to linux

large number of changes to usb (probably biggest overall change to previous 3.1)

changes to frequency cpu governor (see changes in ventana_panel for some changes)

changes to sdhci/mmc

changes to clocks

changes to power management (cpu suspend)

changes to audio

probably others but some may not effect us, some will be a simple change and some probably usb will need a bit of work.

Needs more investigating and Eduardos expertise to say if its worth moving (think it is as it seems to be latest release) and how much work to get current patches working.

edit - After initial look heres what I think may need changing/updating from the files Eduardo included in his last patch:-

config - CONFIG_USB_FSL_USB2=y is now CONFIG_USB_TEGRA=y

mach-tegra - kconfig new errata added, makefile also amended

mach/include/sdhci.h - add int has_no_vreg; that I think Eduardo added to prev 3.1 file

board-shuttle-gpu.c - change #include <mach/nvmap.h> to #include <linux/nvmap.h>

board-shuttle-usb.c - changes similar to that seen in board-ventana for usb/utmi/otg

board-shuttle-gpu.c - change ifdef GOV_ON_EARLYSUSPEND to same as ventana-panel.c setup

tegra2-clocks.c - poss change but prev 3.1 did not work so need to look

usb_phy.c - everything changed from prev 3.1 so may need to just add Eduardos changes to new file

drivers/mmc/core/core.c - has been modified from prev 3.1 orig, so may need to just add Eduardos changes to new file

drivers/mmc/host/sdhci-tegra.c, sdhci.c, sdhci.h - all modified from prev 3.1 orig, so may need to just add Eduardos changes to new file

drivers/regulator/fixed.c - modified from prev 3.1 orig, so may need to just add Eduardos changes to new file

drivers/usb/host/ehci.h, ehci-tegra.c - modified from prev 3.1 orig, so may need to just add Eduardos changes to new file

include/platform_data/tegra_usb.h - modified from prev 3.1 orig, so may need to just add Eduardos changes to new file

include/regulator.h - modified from prev 3.1 orig, so may need to just add Eduardos changes to new file

Edited by brucelee666
Link to comment
Share on other sites

Guest ejtagle

@Eduardo,

Regarding the SDCard / SDHCI problem the following:

- We get the following error (in dmesg) from the function sdhci_tegra_probe:


  rc = enable_irq_wake(gpio_to_irq(plat->cd_gpio));

  if (rc < 0)

   dev_err(mmc_dev(host->mmc),

	"SD card wake-up event registration"

	 "failed with eroor: %d\n", rc);

The error value = -22, Looked this up and it is an invalid argument. Tried to follow down to the cause of this and i end up with the conclusion that there is an invalid IRQ. In irqdesc.c:

struct irq_desc *irq_to_desc(unsigned int irq)

{

return (irq < NR_IRQS) ? irq_desc + irq : NULL;

}

Now i have not done any serious C programming in the last 10 years, but i think that the IRQ given (the result of gpio_to_irq(plat->cd_gpio) given as parameter in enable_irq_wake could be incorrect and the evaluation in irq_to_desc leads to the (irq<NR_IRQS) is false and NULL is returned. This leads to the return of value EINVAL (=22) in the function irq_set_irq_wake in manage.c

int irq_set_irq_wake(unsigned int irq, unsigned int on)

{

unsigned long flags;

struct irq_desc *desc = irq_get_desc_buslock(irq, &flags);

int ret = 0;

if (!desc)

  return -EINVAL;


Hope you can solve this or give me a hint what to change.

Regards,

Scanno

Don;t worry about this problem. It is caused by the fact that not all gpio lines can be used as wake sources in the Tegra2 soc. The only implication of it is that the device would not detect card removal or insertion when suspended. But the sdhci stack is smart enough to read the gpio values as soon as the tablet resumes and handle the card insertion/removal properly ;)

Link to comment
Share on other sites

Guest brucelee666

Just to let you know the only file needed from the 2802 patch to get ext sd card working is the "drivers/mmc/host/sdhci.c", the changes made to the 2706 file stop it from mounting (see diff of both files to see what changed).

Using this file also brings back the wifi issue when you put tablet to sleep and try to wake, basically wifi powers down and does not wake it seems - it did give a debug error which pointed to AR6kSDK "host/hif/sdio/linux_sdio/src/hif.c" and the "HIFMaskInterrupt" function as it was this debug_assert value that was displayed.

This has been modified in the later sdk seen in derartem git relating to adding extra debug info if it "ret == -TIMEDOUT" ?

if (ret) {

if (ret == -ETIMEDOUT) {

AR_DEBUG_PRINTF(ATH_DEBUG_WARN,

("AR6000: Timeout to mask interrupt. Card removed?\n"));

} else {

AR_DEBUG_PRINTF(ATH_DEBUG_ERROR,

("AR6000: Unable to mask interrupt %d\n", ret));

AR_DEBUG_ASSERT(ret == 0);

}

}

Edited by brucelee666
Link to comment
Share on other sites

Guest ejtagle

Well, i compared the 3.1 sound files for ventana and ours, and found an slight difference. Hopefully, that difference will fix audio through speakers.. :) ... Attached! ... The only change is in tegra_alc5624.c

Speaking about the sdhci modifications i did to the original 3.1 kernel sources... There were 2:

-Cleaned up the wakelock management ... Probably we could live without it

-Added a patch from mainline 3.5 that is NOT in the nv tegra repo. That patch seems to be critical for the ar6000 card, and strangely enough, nvidia recommends backporting to the 3.1 kernel, but noone did it. Please, read this carefully: http://www.mail-archive.com/[email protected]/msg06466.html ... You can find the patch inside my modified sdhci.c file ...

nv3.1-29jun.rar

Link to comment
Share on other sites

Guest Scanno

Well, i compared the 3.1 sound files for ventana and ours, and found an slight difference. Hopefully, that difference will fix audio through speakers.. :) ... Attached! ... The only change is in tegra_alc5624.c

Speaking about the sdhci modifications i did to the original 3.1 kernel sources... There were 2:

-Cleaned up the wakelock management ... Probably we could live without it

-Added a patch from mainline 3.5 that is NOT in the nv tegra repo. That patch seems to be critical for the ar6000 card, and strangely enough, nvidia recommends backporting to the 3.1 kernel, but noone did it. Please, read this carefully: http://www.mail-arch...g/msg06466.html ... You can find the patch inside my modified sdhci.c file ...

Thanks will look at that.

Just a quick question. With the sdhci.c from 2802 the dcard works.. BUT i cannot move apps to the sdcard using the native ICS method. Seems like the mounting of the apps fail. Also installing apps from Play Store that go to the SDCard on install, cannot be installed. So there is something wrong with mounting. With the same VegaCream build the 2.6.39 kernel works and the 3.1.10 fails.

EDIT:

Sound through speakers not working with 2906 patch. Wanted to enable the FORCE_AUTO_SPK_HP_SWITCH define you descried earlier, but that has gone ?

EDIT2:

Ah i see you completely removed the #define from the source. Sadly it still does not work.

Edited by Scanno
Link to comment
Share on other sites

Guest brucelee666

Scanno,

re. sd-card, you can copy files from and to the sd-card so it is mounting, it appears its the /mnt/secure/asec that is causing the issues with moving apps to sd.

Get the following vold errors when trying to do this:-

vold - failed to unlink asec '/mnt/secure/asec/(name of apk.asec) no such file or directory

voldcmdlistener - asec create app name

vold - error opening devmapper no such file or directory

vold - asec device mapping failed no such file or directory

packagehelper - failed to create secure container (app name)

packagehelper - forcibly destroying container (app name)

voldcmdlistener - asec destroy app name

vold - failed to unlink asec '/mnt/secure/asec/(name of apk.asec) no such file or directory

Link to comment
Share on other sites

Guest Cass67
Scanno,

re. sd-card, you can copy files from and to the sd-card so it is mounting, it appears its the /mnt/secure/asec that is causing the issues with moving apps to sd.

Get the following vold errors when trying to do this:-

vold - failed to unlink asec '/mnt/secure/asec/(name of apk.asec) no such file or directory

voldcmdlistener - asec create app name

vold - error opening devmapper no such file or directory

vold - asec device mapping failed no such file or directory

packagehelper - failed to create secure container (app name)

packagehelper - forcibly destroying container (app name)

voldcmdlistener - asec destroy app name

vold - failed to unlink asec '/mnt/secure/asec/(name of apk.asec) no such file or directory

There is an option in kernel config that need to be enabled for devmapper to work. Forget just now what its called but grepping for dm will probably get it. Could be dmraid I'm thinking of..

Link to comment
Share on other sites

Guest Scanno

There is an option in kernel config that need to be enabled for devmapper to work. Forget just now what its called but grepping for dm will probably get it. Could be dmraid I'm thinking of..

I am hoping that it is a kernel config option. But it is strange that it is not enabled because I am using the .config from the 2.6.39 kernel as base. So if it is enabled there, it should be enabled in the 3.1.10 kernel right ? Unless it s being disabled by the autoconfig.

Anyway if you find out what the option is, let us know. Right now I really have to do some cleaning up in the house.... Been way to busy with this kernel stuff and android. Monday back to work so the fun is over:unsure:

Link to comment
Share on other sites

Guest brucelee666

There is an option in kernel config that need to be enabled for devmapper to work. Forget just now what its called but grepping for dm will probably get it. Could be dmraid I'm thinking of..

Thanks Cass,

You did not give me a direct answer but for some strange reason it was enough info for my brain to go right to the config options :D guess some of this kernel stuffs starting to make a little more sense, these are (both added and now move to sdocard and move back from tablet seems to work):-

CONFIG_BLK_DEV_DM=y

CONFIG_DM_CRYPT=y

edit - Although move to sd-card now works and does not give asec messages above it would still seem its not actually moving to sd, once clicked in settings the app size goes down but instead of sd card size increase its actually USB storage app size that goes from zero to ##.##mb ?

Edited by brucelee666
Link to comment
Share on other sites

Guest Scanno

Thanks Cass,

You did not give me a direct answer but for some strange reason it was enough info for my brain to go right to the config options :D guess some of this kernel stuffs starting to make a little more sense, these are (both added and now move to sdocard and move back from tablet seems to work):-

CONFIG_BLK_DEV_DM=y

CONFIG_DM_CRYPT=y

edit - Although move to sd-card now works and does not give asec messages above it would still seem its not actually moving to sd, once clicked in settings the app size goes down but instead of sd card size increase its actually USB storage app size that goes from zero to ##.##mb ?

That is correct behaviour. SD card size is for additional data stored by the app. USB storage app is correct.

EDIT:

CONFIG_BLK_DEV_DM=y

CONFIG_DM_CRYPT=y

Get removed from .config when i start compiling

Edited by Scanno
Link to comment
Share on other sites

Guest brucelee666

That is correct behaviour. SD card size is for additional data stored by the app. USB storage app is correct.

Thanks,

Just realised that hopefully you get it to work by also adding the config options - then its back to looking at sleep wifi issue (will read Eduardos post above re. critical patch for ar6000) that still seems present if sd card mounting and move to sd seems to be working as you would expect.

Link to comment
Share on other sites

Guest Scanno

Thanks,

Just realised that hopefully you get it to work by also adding the config options - then its back to looking at sleep wifi issue (will read Eduardos post above re. critical patch for ar6000) that still seems present if sd card mounting and move to sd seems to be working as you would expect.

Nope not working for me... the options get removed from .config when i start compiling.

Can you send me your .config ?

EDIT:

Never mind got it now... Did you also enable:

CONFIG_MD_AUTODETECT=y

EDIT2:

Still got errors and my previous app put to SDCard do not get mounted:


17:48:11.773 Error Vold 87  Error opening devmapper (No such file or directory)

17:48:11.773 Error Vold 87  Error opening devmapper (No such file or directory)

17:48:11.773 Error Vold 87  ASEC device mapping failed (No such file or directory)

17:48:11.773 Debug dalvikvm 507  GC_CONCURRENT freed 391K, 8% free 6382K/6919K, paused 3ms+2ms

17:48:11.773 Info PackageHelper 166  Failed to mount container com.polarbit.RecklessRacingPlay-1 rc : -1

17:48:11.774 Error PackageManager 166  Failed to mount cid : com.polarbit.RecklessRacingPlay-1 when installing from sdcard

Edited by Scanno
Link to comment
Share on other sites

Guest brucelee666

Sc

Nope not working for me... the options get removed from .config when i start compiling.

Can you send me your .config ?

EDIT:

Never mind got it now... Did you also enable:

CONFIG_MD_AUTODETECT=y

Scanno,

Apologies I also added CONFIG_MD then said no to most of the other items it asked - attached latest config just for you to check.

2906_31config.rar

Link to comment
Share on other sites

Guest Scanno

Sc

Scanno,

Apologies I also added CONFIG_MD then said no to most of the other items it asked - attached latest config just for you to check.

Yep... i already have it working :-)

Link to comment
Share on other sites

Guest Scanno

Thanks,

Just realised that hopefully you get it to work by also adding the config options - then its back to looking at sleep wifi issue (will read Eduardos post above re. critical patch for ar6000) that still seems present if sd card mounting and move to sd seems to be working as you would expect.

I have added the two functions mentioned in the patch to the 2802 sdhci.c (copied from 2906 patch) but that has as result that wifi gets locked. But perhaps i did not implement it correctly. But perhaps you have more luck.

Link to comment
Share on other sites

Guest ejtagle

This is pretty strange... I find no reason for sdhci cards not to work with the latest kernel ... Did anyone try to eject and reinsert the mmc xard while the device was powered on ? ... You should see in dmesg that the card is being redetected... Also, if you do a cat /proc/interrupts, you should get at least one extra interrupt in the GPIO mmc3 ... We must find out if the problem is that the card detect line is not being read properly, or if the sdhci stack is not handling it properly. It could also be that the card is not detected if plugged at boot ...

Link to comment
Share on other sites

Guest brucelee666

Scanno,

Attached a modified sdhci for you to try, still mounts sd and seemed to re-connect to wifi which it was not doing with previous 2802.

This is now near Eduardos patch level the only differnce is this code:-

/* If polling, assume that the card is always present. */

if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)

present =true;

This is the code from the 2802 patch as the code in the latest patches at this point is what stops the sd-card from mounting.

As I said give it a test and see what happens, needs longer test and its late enough now so will leave that till later.

sdhci_mod.rar

Edited by brucelee666
Link to comment
Share on other sites

Guest ejtagle

Scanno,

Attached a modified sdhci for you to try, still mounts sd and seemed to re-connect to wifi which it was not doing with previous 2802.

This is now near Eduardos patch level the only differnce is this code:-

/* If polling, assume that the card is always present. */

if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)

present =true;

This is the code from the 2802 patch as the code in the latest patches at this point is what stops the sd-card from mounting.

As I said give it a test and see what happens, needs longer test and its late enough now so will leave that till later.

Pretty strange, i may say... This would mean the card detect line is unreliable when used to determine if a card is present or not... It would be interesting to print the tegra_host->card_present and gpio_get_value(plat->cd_gpio) at the tegra_sdhci_get_cd() function. Perhaps the problem is that a small delay is needed in sdhci-tegra.c

tegra_gpio_enable(plat->cd_gpio);

gpio_direction_input(plat->cd_gpio);

msleep(10); /* time to stabilize ?? */

tegra_host->card_present = (gpio_get_value(plat->cd_gpio) == 0);

I think the cd line is working, otherwise, plugging and unplugging the card would not work (we can check if that cd line works by doing a cat /proc/interrupts ... at least one interrupt per card eject/insert)..

Really strange. But i am ok with your file, if it works... But i really would like to know the reason behind this problem...

Link to comment
Share on other sites

Guest Scanno
Scanno,

Attached a modified sdhci for you to try, still mounts sd and seemed to re-connect to wifi which it was not doing with previous 2802.

This is now near Eduardos patch level the only differnce is this code:-

/* If polling, assume that the card is always present. */

if (host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION)

present =true;

This is the code from the 2802 patch as the code in the latest patches at this point is what stops the sd-card from mounting.

As I said give it a test and see what happens, needs longer test and its late enough now so will leave that till later.

And we have a winner :P

Seems to be working... Let's see if after a few hours in suspend it will wake up again...

But so far with this sdhci.c and the audio from 2802 everything seems to work fine.

Thanks

Link to comment
Share on other sites

Guest brucelee666

And we have a winner :P

Seems to be working... Let's see if after a few hours in suspend it will wake up again...

But so far with this sdhci.c and the audio from 2802 everything seems to work fine.

Thanks

Scanno,

Just to say when I logged off early this morning I put tablet to sleep so for info:- Tablet sleep time 3:00am Battery - 99%, Tablet wake time 12:30pm Battery - 84% (15% in 9 1/2 hours sleep) and when woken it re-connected to wi-fi first time automatically on wake (I guess a step forward as it was not doing this before,also all the sdhci messages seen in dmesg you mentioned before also gone).

Eduardo - will add the delay you mentioned and see If I can get any more info for you, while I am here a question - In your patch the IT7260 driver seems to be the old version and not the newer one released (see wooshy1 git) that has the "reverse engineered from it7260 app", can you just confirm if it should be the one in the patches or the one with the "reverse" comments, thanks ?

Edited by brucelee666
Link to comment
Share on other sites

Guest ejtagle

Scanno,

Just to say when I logged off early this morning I put tablet to sleep so for info:- Tablet sleep time 3:00am Battery - 99%, Tablet wake time 12:30pm Battery - 84% (15% in 9 1/2 hours sleep) and when woken it re-connected to wi-fi first time automatically on wake (I guess a step forward as it was not doing this before,also all the sdhci messages seen in dmesg you mentioned before also gone).

Eduardo - will add the delay you mentioned and see If I can get any more info for you, while I am here a question - In your patch the IT7260 driver seems to be the old version and not the newer one released (see wooshy1 git) that has the "reverse engineered from it7260 app", can you just confirm if it should be the one in the patches or the one with the "reverse" comments, thanks ?

brucelee666: We have to use the newer touchscreen driver. It was a mistake on my part to include the older one in the patches...

Regarding the card detect line, maybe the problem is, i seem to remember, that the cd line uses inverse logic compared to what the sdhci-tegra.c file expects... The sdhci-tegra.c expects the gpio line to be 0 when a card is inserted... Maybe the shuttle hw sets it to 1 when a card is inserted... you can easily check that by mounting the debugfs filesystem somewhere and doing a cat gpio

and see the value for the cd line when a card is inserted...

Edit: According to my notes, this is the case... So, i attach a (preferred by me ;) solution to this problem, that instead of discarding the CD line value, uses it ;) ... I am only attaching the changed files... You should revert sdhci.c to the one I supplied in my previous patch .. Sorry... I usually like to know the causes of problems, i believe that workarounds should be avoided unless really needed ... ;)

Regards.

Eduardo

nv-3.1-30jun-delta.rar

Edited by ejtagle
Link to comment
Share on other sites

Guest brucelee666

Eduardo,

re. ts driver - I thought that was the case, I have been using the newer ver in my kernels anyway not the one you included in your patch just thought it best to ask.

re. sdhci - No need to say sorry I agree my goal in posting the sdhci file was first to get both sd and wifi working (which it seems to do) but mainly to pinpoint exactly what piece of code was breaking it in the hope you/someone could hopefully fix it so the workaround/removal of code was not required which hopefully (will now test) you have now done with the latest patch, thanks.

Link to comment
Share on other sites

Guest ejtagle

The only thing remaining is audio... I am curious on why the original 2802 patches work, but the newer ones do not work... Newer ones are closer to nvidia 3.1 ... So they should be better, but they aren't... And a question for all of you:

The ALC5624 has a hardware audio equalizer and stereo expansion engine that is currently disabled. I have some info on how to enable it... we could add some user configurable setting to let the user pick between no equalization, or some equaliztions. And we can get it nearly for free, without CPU resources used, as everything is done inside the ALC5624 ... I think it could be interesting, specially for the loudspeaker output... Do you think it is worthwhile to implement it ?

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.