yashsingh1/xdaforums huggingface dataset:
[Samsung Galaxy Tab Plus] Facegarden:
Ah, Interesting... Looking back at it again, you're right. I noticed D+ and D- are shorted and left it at that, but I didn't check their voltage levels - they're at 1.25v to GND.

Now I wonder if I can somehow rig up some resistors to get it to start drawing 2A without disturbing USB communications.

I'd rather just find a way to remove that check, which is what I imagine all the other fast charge hacks do.

I guess I should see if my 10.1 can be modified to fast charge from USB with my custom cable before I bother with all this.

I mean, it would still be nice regardless...

-Taylor
[Samsung Galaxy Tab Plus] garyd9:
I'd be extremely hesitant to modify the kernel to allow that. You can already charge from a computer USB port (even if the tab claims its not charging, it is trickle charging.)

However, these things limit themselves from unknown chargers for a safety reason. If you pull too many amps from some voltage regulators (and computer usb ports), and all the "magic smoke" comes out of the VR or port.

I have a perfect example on my shelf in front of me. It's a charger from a car to USB. The package claimed it was good for 1100 milliamps, but when I had a sustained pull of about 900millamps on it, it died. Not a major loss for a $5 car adapter, but you wouldn't be happy if one of the USB ports on your $1500 notebook computer met the same fate.

(I also know there were no spikes from the car - It's fed through a line I ran myself for my ham radio gear - and, short of a lightning strike, would never have more than 14 volts on it.)

Even if I do change my mind on this, it'll be Very Low on the priority list. Right now, my primary concern is trying to get things stable for some users still experiencing problems, then to try and increase the efficiency some more. By then, ICS will probably be out, and I'll have to start all over with new kernel sources.

Take care

Gary
[Samsung Galaxy Tab Plus] Facegarden:
Well, I'm actually using it with the stock charger, I just have the data lines disconnected so it can't sense that its hooked up to a stock charger. Unfortunately, with my current host+charge cable, it only draws about 400ma, which isn't quite enough to keep it charged with my application running. I was really hoping I could set it to suck 2A from whatever is plugged into it, but I just don't know how thats all controlled internally. This is for an internal system we'd like hooked up and running all the time, but we need USB host *and* high current charging for that.

The way it used to work in pershoot's kernel was that he added support, but the user still had to enable it by running:

#su

#echo 1 > /sys/class/power_supply/battery/force_usb_charging

So pershoot had it set so that force_usb_charging was set to 0 normally, but users could enable it. If the user has to do that, you don't really have to worry about people who don't know what they're doing frying chargers.

I just installed pershoot's kernel on my 10.1 though, and it now seems to be enabled by default.

Unfortunately, I can't really figure out what's required to support USB charging on this device.

It may not matter though. Even with that option enabled, I'm having trouble getting my 10.1 to actually draw more than 500ma from my cable with the data lines clipped... Hmm...

If you don't want to add it to your kernel, I understand, but do you have any info on how I could add it? I tried to create a force_usb_charging entry in the /battery directory and even with it mounted as read/write and CHmodded to 777 I couldn't create the file. And I don't even know if that's sufficient - it probably isn't since apparently its kernel dependent.

Do you know anything about that?

-Taylor
[Samsung Galaxy Tab Plus] Entropy512:
It would require a kernel change - you obviously are a special case. Unfortunately, a lot of times users can't use features like that responsibly.

If it's possible to safely enable iPad charger detection that would be very useful (and mostly safe) - The problem is the iPad relies on two different voltages - I think 2.0 volts on one line and 2.4 or 2.8 on the other. So I am positive I can detect one on the 10.1 but not sure about the other. If it's possible on the 10.1 there's a good chance of it being possible on the 7 Plus.
[Samsung Galaxy Tab Plus] garyd9:
I'm not certain I can get the SMB136 chip to do that. Read my random notes...

Keep in mind that I can't find a full datasheet for this chip, so I'm only being guided by the code that's already in place and a bit of reasonable guesses. However, it appears that this chip supports three charging modes:

1. High Current

2. USB IN 500

3. USB IN 100

When it's set to the first, it appears I can tell it any voltage I want between 500mA and 1500mA (thats the max for this chip.) However, when used like this, it disconnects USB data. In other words, you might as well just have a V+ and GND.

In the other two modes, it seems to force the current in to 500mA and 100mA respectively. The parameter to set the current doesn't seem to have any impact whatsoever. (Confirmed with an iPad charger capable of 10 watts @ 5volts (2 amps))

There might be some other modes for this chip, but I have no way to know what they are (and what they do) without a datasheet. (Taking guesses really isn't an option when playing with charging circuits.)

Get me a data sheet for this chip, or even for a similar chip that has numbers that match with what I can see in the source (ie: smb137), and I'll be able to mess around some more.

Take care

Gary
[Samsung Galaxy Tab Plus] chip.hughes:
Does this kernel have ext2 support?
[Samsung Galaxy Tab Plus] jeffcavicchi:
Stuff like this makes me feel as though I should have buckled down and studied engineering in college rather than Comparative Literature...

Nice work, Gary - great to have such a knowledgeable developer working on our device!
[Samsung Galaxy Tab Plus] garyd9:
Did you really have to quote the whole thing? Now I can't even edit the post to get rid of my ravings. :eek:
[Samsung Galaxy Tab Plus] Zadeis:
Honestly I almost did the same thing last night since I'm going to school also for stuff like this and felt the same way :D
[Samsung Galaxy Tab Plus] Entropy512:
As to seeing left-shifts of zeros - It's a common thing in hardware so that you ha ve source code which explicitly says "I am setting this flag to 0". (The idea being that sometimes it might be nonzero, and you just have to change the 0 to something else, rather than add in the whole line.)

e.g. it's easier to have a bunch of flag-setting stuff, and pop in 0s where it's 0, than to not have the flag-setting stuff at all. (it makes hardware people go AAAARRRGH NOW I HAVE TO CALCULATE WHAT'S GOING INTO THAT REGISTER!!!!!)

As to the SMB136 taking over - not surprised, if you recall the first post of my I777 kernel thread, it's the same deal in the GS2, except we have a MAX8922. For whatever reason, the MAX8997 has charger circuitry, it is in the source, but it is never used!

Makes sense to disable all USB when on high-current charging, considering that unless you override the detection modes, anything that triggers high-current charging will not be able to support USB data transfer.
[Samsung Galaxy Tab Plus] jeffcavicchi:
Fixed it for ya!

All I left were the non-technical ravings...:D
[Samsung Galaxy Tab Plus] garyd9:
You know.. its sad when you start having bad dreams about kernel source.

When my wife woke me up this morning (the first time - at 6:30am), I apparently told her I was dreaming that the charge on the kids was depleted, and I couldn't get them to accept a new charge. My guess was that I pushed too much current into them and it may have damaged their cells. Best of all, I apparently asked her if she could trickle charge them to see if that would get things working again.

(I don't remember any of this.)
[Samsung Galaxy Tab Plus] jeffcavicchi:
I need to figure out how to deplete the charge on my kids - might mean I could get more than 5 hours of sleep a night for once!]

As far as I can tell, children under the age of 8 have a nearly unlimited battery life!
[Samsung Galaxy Tab Plus] garyd9:
I have a call in to Summit Microelectronics (the people who make the smb136.) Perhaps I can get them to send me a full datasheet on the part (along with programming information.) It never hurts to ask. They might even send me a free sample.
[Samsung Galaxy Tab Plus] garyd9:
Please don't post the same question in multiple subforums. From the "development" point of view, I'd suggest examining the output from the following command (run on your tablet): cat /proc/filesystems
[Samsung Galaxy Tab Plus] Entropy512:
That would be useful - also try looking for other kernels that support the SMB136. That's how I found more info on the MAX8998's charge control registers.

Maxim is usually good about datasheets, but the 8997/8998 are exceptions. We're lucky in that the datasheet for the 8922 in the I9100/I777 is available. (even if it provided us information that was disappointing - at least you know not to waste time on trying to change the current of a chip that only supports three current levels!)
[Samsung Galaxy Tab Plus] garyd9:
Yeah - did that last night. The original galaxy tab uses the SMB136 as well, and it appears that anyone messing with it didn't get very far.

Worst case scenerio, I can easily set up a parameter in the sysfs for forcing HC mode - but that will disable USB data.
[Samsung Galaxy Tab Plus] garyd9:
If you are feeling adventurous... Install a terminal program on the tablet, open the terminal, and type the following command (don't hit enter yet):

dmesg | grep sec_check

Now plug the tablet into that charger and execute the above command. This will spit out 1 or more lines that you'll have to post for me.

More info (some information below only based on educated guesses):

When a USB device supplies current, it runs a kernel function called "sec_check_dedicated_charger()" that does some checks on the usb data lines and computes an average voltage based on it. A computer USB _seems_ to always generate an avg_vol of 0. The samsung charger spits out an avg_vol between 800 and 1800 (0.8 and 1.8) (puts the charger rate to 1500mA.) An iphone charger gives an avg_vol around 2000. (I'm enabling 750mA for those in the next kernel. In theory it can support 1000mA, but I'm paranoid.)
[Samsung Galaxy Tab Plus] Entropy512:
What I wanted to do (but never got around to, certain aspects of the 10.1 make developing kernels for it a pain) was to see if there's a second ADC for those data lines. On the 10.1 there was an undocumented ADC channel I never got around to putting debug info for (e.g. print out its value when running the charger check to dmesg).

My GUESS is that the ADC you're reading is for only one of the two data lines. If you can get a reading for BOTH (independently) you can more reliably detect iChargers.

iPhone chargers are 1A, iPad chargers are 2A and have different voltages on the two lines. One is 2.0, the other is 2.4 or 2.8. So if you could find an ADC that reliably reads the other line, you could enable 2A charging support with iPad chargers.
[Samsung Galaxy Tab Plus] garyd9:
Good guess. Based on what I can see, it's only checking the same line twice and averaging:

adc_1 = s3c_adc_read(battery->padc, 5);
adc_2 = s3c_adc_read(battery->padc, 5);
vol_1 = (adc_1 * 3300) / 4095;
vol_2 = (adc_2 * 3300) / 4095;
avg_vol = (vol_1 + vol_2)/2;

The problem here is that it's quickly moving into an area I'm inexperienced in. "s3c_adc_read()" is obviously something that's reading the ADC, but unless and until I'm more comfortable with things, I probably won't do too much else with it.

At the very least, I need a better f'ing editor to jump around the code in. I'm actually trying to avoid emacs, as I'll very easily revert into the emacs keymappings and then be all messed up with my day job (MS visual studio.)

(I miss ctags...)
[Samsung Galaxy Tab Plus] garyd9:
Summit returned my call. No go. They only will deal with large companies (such as samsung) and have all kinds of qualification checks. Oh, well.
[Samsung Galaxy Tab Plus] jeffcavicchi:
Bummer - although probably not that surprising.
[Samsung Galaxy Tab Plus] Facegarden:
Oh god I've created a monster...

Gary thank you so much for looking into this! I apologize for putting the bug in your ear but it looks like you've found out some good info nonetheless.

I see the 3 charge modes on the charger chip, with high current cutting off USB device mode, but I wonder about USB host mode? It requires a custom made cable so most people can't test it, but of course I've made such a cable!

If you feel like sending me a kernel to test that you think will allow High Current mode all the time, we totally don't mind if we fry our tablet and won't blame you.

Or whatever else you think is prudent, I'll gladly test. If you have a donation box I can send you something just for trying!

Thanks,

-Taylor
[Samsung Galaxy Tab Plus] garyd9:
From what I've been able to determine so far, turning on HC will actually disconnect the D+/- lines. I'll be testing that theory out a bit later by enabling HC @500mA and seeing if USB host still works. If that works, I'll jump over to a powered hub and try pulls at 1000mA with HC forced on (again testing for data.)

I've already confirmed that the chip won't pull more than 500mA when it's in USB mode.

I don't see why a custom cable would be needed for this, however. I use the same cable to charge @1500mA as I use for USB data transfers... it's just a matter of what the data lines present.

I'll also warn you that if I do put something like this in the kernel, it will not be enabled by default. In fact, it'll be a PITA to enable. Probably will make you write to the sysfs _after_ the USB cable is connected (and it'll reset if the cable is disconnected.)

(That should stop people from setting it in init.d and frying something when they unplug from one thing and into another. I've always felt it was my responsibility to try and prevent people from shooting themselves in the foot when using something I've done.)
[Samsung Galaxy Tab Plus] Facegarden:
The normal charging cable leaves the tablet in USB device mode.

There are cables available that put the tablet in USB Host mode, which requires a couple of resistors across one of the input lines. However none of those cables also include power input.

I've wired up a cable like so:

http://xdaforums.com/showthread.php?t=1149442

But also hooked up the V_BUS_1 pins (P7 and P8) to the +5v line on my charger (and of course the GND is hooked up to one of the GND pins).

That way I can put my Tablet in USB HOST mode (note this is not the same as USB Device mode, like plugging it into a PC) yet I can still charge it.

For example, using my cable, I could plug in a USB keyboard to the tablet but still keep charging it. You can't use any commercially available cables to do that.

-Taylor
[Samsung Galaxy Tab Plus] Facegarden:
Hey that's awesome!

As long as the thing will continue to draw enough current to keep the batteries from draining with the screen on full brightness, thats all I really need.

When do I get to test it? :)

Also, thats really handy that you can get battery charge current levels separately from overall current levels. I was using a USB current meter that we made that goes inline with a USB cable, so it was hard to tell how much current was going to the system and how much was going to the batteries, and/or if the batteries were being charged or discharged.

I actually didn't know the system reported current levels, as a lot of Samsung devices don't (according to the "Current Widget" dev).

So yeah, I'll gladly test whenever! :)

-Taylor
[Samsung Galaxy Tab Plus] garyd9:
Probably tomorrow. I need to test at 1000mA (have to drain the battery first), add a sysfs interface, clean up the code, test the sysfs interface, etc.

The only part of the change that will publicly available will be the iphone charger increased current. I'll want the USB change to be abused more before I document it.
[Samsung Galaxy Tab Plus] Facegarden:
Alrighty, sounds good. Well if you want to shoot something experimental my way today, that would be cool too. :D --> tlalexander (at) gmail

If not, next week is cool!

Anyway, I sent ya a little donation for your efforts, thank you so much!

-Taylor
[Samsung Galaxy Tab Plus] chip.hughes:
Thanks. Sorry for my confusion. I don't post much, mostly a voyeur. Hope to get used to the rules before I get banned.
[Samsung Galaxy Tab Plus] Entropy512:
No Galaxy S or S2 phone reports discharge current - and they report total charge + system current when charging. Even more annoying - the current limit of the charger is the total, and so if the system current is high, charging is SLOW.

I believe many (if not all) of the HC tablets from Samsung do have discharge monitoring. I think the Tab 10.1 might even use the SMB136...
[Samsung Galaxy Tab Plus] garyd9:
New version uploaded:

20120128:

Support for iphone charger detection - pull up to 750mA from detected iphone chargers (1500mA from the samsung charger, and 500mA from everything else including a computer USB port.)

Testing USB "high current" charging. This is currently not enabled by default (and until I'm happy that it's stable and safe, I won't be documenting it.)

I have several iphone chargers in my house, plugged into various sockets all over that I often will plug this tablet into. The factory kernel would only pull 1/2 the supported current from those chargers. Now it'll pull 3/4's the supported current for slightly faster charges.

The USB high current stuff is new and I'm not extremely confident about it just yet. Therefore, while it exists in the kernel, it's disabled. If you REALLY want to know how to enable it, the first post in this thread contains links to the source code repo's I work from.

Take care

Gary
[Samsung Galaxy Tab Plus] painter_:
I have been running the updated kernel all day and it is stable. When I plug it into my Nook Color's charger (2A) the tablet does not display the red X in the battery display. I did not check it to see what it is pulling but it did seem to charge faster. I also tried to plug it into a USB hub. again no red x but i did not leave it plugged in for a long time, only long enough to copy some recorded TV to it.
[Samsung Galaxy Tab Plus] garyd9:
Sometimes, things just seem to work out...

I ordered a galaxy note today, and started to do a bit of research on "what's inside" the phone. Seems that it uses the summit smb136 for charging the battery.

The kernel for that phone appears to limit the charging current to 950mA for the AC charger and 500mA for all other chargers. (I think the charger that comes with that phone is only good for 1000mA, so I won't mess with that, but I might as well port over my other smb136 changes...)
[Samsung Galaxy Tab Plus] Facegarden:
How does one read the current at all (even if its just charge + system) on a Galaxy device?

According to this Issue page for the CurrentWidget app, there's no current information available at all.

http://code.google.com/p/currentwidget/issues/detail?id=29

If there is a way to get some kind of number, I'd love to help them update the CurrentWidget.

-Taylor
[Samsung Galaxy Tab Plus] garyd9:
There are quite a few different devices that use the 'galaxy' name... The S2 might not support what you are looking for, but the 7+ certainly does (in the sysfs - same directory as the file I told you about a few days ago.. explore some...)
[Samsung Galaxy Tab Plus] Facegarden:
Cool, yeah I did explore some on the 7+ and found those files, I just didn't know if that was the "normal" way of getting that info - I haven't gone over the source for Current Widget to see how they were doing it.

But yeah, I'll have to explore. Technically I was looking for this for the Galaxy Nexus. Since the comment on Current Widget said all galaxy devices, I didn't know if they were just being too careless with their wording or if they just didn't know about this method of getting the current info.

Thanks again,

-Taylor
[Samsung Galaxy Tab Plus] garyd9:
It's an android device. Explore and you'll find several thousand things you didn't realize before. :)

In other news-- I'm spending a few days playing with a New Toy (galaxy note), so might be a bit distracted for a couple days. If there's something with this kernel that needs my attention quickly, please PM me!

Gary
[Samsung Galaxy Tab Plus] Entropy512:
https://github.com/Entropy512/linux_kernel_sgh-i777/commit/a1a44c90a91e01c0f98bba21688759278646f79a on GS2.

Tab 7 Plus is a completely different device - unlike GalaxyS and S2 phones, it may be possible to read discharge current.

All original GalaxyS and Exynos S2 devices have the capability to read this current - but sometimes (randomly), Samsung leaves it out of the kernel.

As an example, Froyo kernels on Infuse had support out of the box, Rogers Gingerbread needed patching.
[Samsung Galaxy Tab Plus] garyd9:
added warning that this kernel is not currently compatible with the wifi updates samsung made in their LA3 firmware update. Until I track down what they changed (and didn't publish), you can either stay with the previous (KL) firmware, or don't install this kernel.

Gary
[Samsung Galaxy Tab Plus] gingerboy92:
hey.. just asking.. any news from richardtrip about the p6200's kernel?
[Samsung Galaxy Tab Plus] painter_:
garyd9, I saw a post stating you were rolling back to the KL1 firmware. Does this translate that the Kernel will not be updated to support the L3A firmware?
[Samsung Galaxy Tab Plus] garyd9:
I'm not sure. The problem is that samsung has changed something in the kernel for LA3 and not documented it... In order to get my kernel compatible with LA3, I have to track down that change (or changes) and make the same change(s) in my kernel in order for it to work with the wifi driver they refuse to release source for.

That could be a considerable amount of work and would also likely make the new kernel builds incompatible with PREVIOUS firmware versions (such as KL1.) However, after running LA3 for a few days, I don't see that they've actually fixed anything. In fact, it appears that they made the wifi driver even worse than it was before! (It's bad enough that I went back to KL1 myself.) Keep in mind that I run these kernels myself. So, if I want to support LA3, I have to use LA3. I only have one device, so I can only test with a single firmware version.

At this point - as of right now - I'm extremely hesitant to move to LA3. If Samsung were to actually fullfill their legal responsibility to release source for GPL and GPL derived code, then it might make things easier to go to LA3. That hasn't happened yet.

(By the way, even though Samsung claims that they are distributing the atheros driver under the BSD license, the driver has GPLv2 licensing strings embedded. Someone screwed up...)

Gary