Do You Check for App Updates Regularly?

Do you let app updates happen automatically or do you regularly check for them? We’re … more

Find The Best Apps With Google’s Picks & Other Tricks

The Google Play Store, weighing in with more than 1.4 million apps at last … more

Dynamic Pop for Note 4 (N910T & 910W8)

With the release of the Canadian Lollipop ROM for the Note 4, T-Mobile users can also enjoy the … more

Sunday Debate: Better to Buy Older or Newer Hardware?

Join us in a fun Sunday Debate on New vs. Old. Come with your opinions and feel … more
Post Reply Subscribe to Thread Email Thread

Dock resistors (Dock, Car, Headset)

10th March 2014, 07:39 PM |#1  
OP Member
Thanks Meter: 2
 
32 posts
Join Date:Joined: Apr 2009
I was searching for the correct resistor value to enable the advanced function on my generic compatible dock.
Looked at the kernel and found on drivers/misc/cable_detect_8xxx.c the function cable_detect_get_type
...
if (adc > 150 && adc < 220)
type = DOCK_STATE_CAR;
else if (adc > 370 && adc < 440)
type = DOCK_STATE_USB_HEADSET;
else if (adc > 440 && adc < 550)
type = DOCK_STATE_DMB;
else if (adc > 550 && adc < 900)
type = DOCK_STATE_DESK;
else
type = DOCK_STATE_UNDEFINED;
...

and second_detect
...
if ((pInfo->mhl_version_ctrl_flag) || (adc_value >= 776 && adc_value <= 1020))
#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
type = DOCK_STATE_MHL;
#else
type = DOCK_STATE_UNDEFINED;
#endif
else if(adc_value >= 1021 && adc_value <= 1224)
#ifdef CONFIG_USB_OTG_HOST_CHG
type = DOCK_STATE_HOST_CHG_DOCK;
#else
type = DOCK_STATE_AUDIO_DOCK;
#endif
else
#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
type = DOCK_STATE_USB_HOST;
#else
type = DOCK_STATE_UNDEFINED;
#endif
...

Need help to find how to convert these values to resistor values.
Thank you
Last edited by CyberPK; 10th March 2014 at 08:11 PM.
 
 
10th March 2014, 10:13 PM |#2  
jthatch12's Avatar
Senior Member
Flag Philly
Thanks Meter: 1,565
 
2,098 posts
Join Date:Joined: Mar 2012
Donate to Me
More
Quote:
Originally Posted by CyberPK

I was searching for the correct resistor value to enable the advanced function on my generic compatible dock.
Looked at the kernel and found on drivers/misc/cable_detect_8xxx.c the function cable_detect_get_type
...
if (adc > 150 && adc < 220)
type = DOCK_STATE_CAR;
else if (adc > 370 && adc < 440)
type = DOCK_STATE_USB_HEADSET;
else if (adc > 440 && adc < 550)
type = DOCK_STATE_DMB;
else if (adc > 550 && adc < 900)
type = DOCK_STATE_DESK;
else
type = DOCK_STATE_UNDEFINED;
...

and second_detect
...
if ((pInfo->mhl_version_ctrl_flag) || (adc_value >= 776 && adc_value <= 1020))
#ifdef CONFIG_FB_MSM_HDMI_MHL_SII9234
type = DOCK_STATE_MHL;
#else
type = DOCK_STATE_UNDEFINED;
#endif
else if(adc_value >= 1021 && adc_value <= 1224)
#ifdef CONFIG_USB_OTG_HOST_CHG
type = DOCK_STATE_HOST_CHG_DOCK;
#else
type = DOCK_STATE_AUDIO_DOCK;
#endif
else
#if (defined(CONFIG_USB_OTG) && defined(CONFIG_USB_OTG_HOST))
type = DOCK_STATE_USB_HOST;
#else
type = DOCK_STATE_UNDEFINED;
#endif
...

Need help to find how to convert these values to resistor values.
Thank you


Learn how analog to digital conversion works. If you cannot figure that out, you're in over your head.
15th March 2014, 06:43 PM |#3  
OP Member
Thanks Meter: 2
 
32 posts
Join Date:Joined: Apr 2009
Calculator Resistor values between pin4/5 for HTC ONE explained
Quote:
Originally Posted by jthatch12

Learn how analog to digital conversion works. If you cannot figure that out, you're in over your head.

Thank you for your USELESS comment.
I've figured out that the values are the mV read on the pin4 after the application of a resistor between pin4 and pin5.

It is a simple Voltage divider (http://en.wikipedia.org/wiki/Voltage_divider)
Misured Voltage between pin4 and pin5 (Vin) = 1,8V = 1800 mV
Misured shortcut current between pin4 and pin5 = 0,18uA
Calculated pullup resistor (Z1): 100000 ohm

So tha math in simple:
Z2 = (Z1*adc)/(Vin-adc)
or
Z2 = Z1 / ((Vin/adc)-1)

DOCK_STATE_CAR -> 150mV < adc < 220mV -> 9091Ω < Z2 < 13924Ω | use 10000Ω
DOCK_STATE_USB_HEADSET -> 370mV < adc < 440mV -> 25874Ω < Z2 < 32353Ω | use 27000Ω
DOCK_STATE_DMB -> 440mV < adc < 550mV -> 32353Ω < Z2 < 44000Ω | use 39000Ω
DOCK_STATE_DESK -> 550mV < adc < 900mV -> 44000Ω < Z2 < 100000Ω | use 56000Ω or 68000Ω or 82000Ω

IF
-100mV < adc < 100mV -> -5263Ω < Z2 < 5882Ω ----> 0Ω < Z2 < 5882Ω | simply shortcut
ENABLE pin1 output of 5v and read again pin4 and pin5

MHL -> 776mV < adc < 1020mV
HOST_CHG_DOCK/DOCK_STATE_AUDIO_DOCK -> 1021mV < adc < 1224mV
USB HOST any other value

Regards
Last edited by CyberPK; 15th March 2014 at 06:47 PM.
15th March 2014, 07:20 PM |#4  
alray's Avatar
Senior Member
Thanks Meter: 1,887
 
4,801 posts
Join Date:Joined: May 2012
Donate to Me
More
Quote:
Originally Posted by CyberPK

Thank you for your USELESS comment.

Quote:

2.3 Flaming / Lack of respect: XDA is about sharing and this does not involve virtual yelling (flaming) or rudeness.


If you found his comment useless then just don't reply to it, no needs to start a fight here.
Please stay polite and respectful
thanks
15th March 2014, 08:18 PM |#5  
OP Member
Thanks Meter: 2
 
32 posts
Join Date:Joined: Apr 2009
Quote:
Originally Posted by alray

If you found his comment useless then just don't reply to it, no needs to start a fight here.
Please stay polite and respectful
thanks

ok... thank you...
The Following User Says Thank You to CyberPK For This Useful Post: [ View ]
21st March 2014, 06:40 PM |#6  
jthatch12's Avatar
Senior Member
Flag Philly
Thanks Meter: 1,565
 
2,098 posts
Join Date:Joined: Mar 2012
Donate to Me
More
FYI I was not " 2.3 Flaming / Lack of respect: XDA is about sharing and this does not involve virtual yelling (flaming) or rudeness." I was simply stating a fact. ADC stands for ANALOG TO DIGITAL CONVERSION.... shocker, I know. I am an electrical engineer and I see all too often people screwing stuff up.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes