max8906 charging driver

Kernel development related

max8906 charging driver

Postby Dopi » Tue Nov 16, 2010 2:35 pm

Hi all,

this is just a little bit of brainstorming in order to find out hwo the charger part of max8906 works.

Here are the charger registers:
Code: Select all
    //========================================================
    // B A T T E R Y C H A R G E R S
    //========================================================
    /* Slave addr Reg addr */
    { 0x78, 0x7C }, // REG_CHG_CNTL1,
    { 0x78, 0x7D }, // REG_CHG_CNTL2,
    { 0x78, 0x7E }, // REG_CHG_IRQ1,
    { 0x78, 0x7F }, // REG_CHG_IRQ2,
    { 0x78, 0x80 }, // REG_CHG_IRQ1_MASK,
    { 0x78, 0x81 }, // REG_CHG_IRQ2_MASK,
    { 0x78, 0x82 }, // REG_CHG_STAT,
    { 0x78, 0x78 }, // REG_BBATTCNFG,


These are the register flags:
Code: Select all
   
    // CHG_CNTL1 register
    /* slave addr addr mask clear shift */
    { 0x78, 0x7C, 0x80, 0x7F, 0x07 }, // nCHGEN
    { 0x78, 0x7C, 0x60, 0x9F, 0x05 }, // CHG_TOPOFF_TH
    { 0x78, 0x7C, 0x18, 0xE7, 0x03 }, // CHG_RST_HYS
    { 0x78, 0x7C, 0x07, 0xF8, 0x00 }, // AC_FCHG


nCHGEN should be a low active enable.

CHG_TOPOFF_TH I assume is controlling the current to end charging. In this case we have 2 bit.

For another maxim battery charger (4-bit) the definition was: ( End of charge current threshold level (typical case) 0000 = 50mA, 0001 = 60mA, 0010 = 70mA, 0011 = 80mA, 0100 = 90mA, 0101 = 100mA, 0110 = 110mA, 0111 = 120mA, 1000 = 130mA, 1001 = 140mA, 1010 = 150mA, 1011 = 160mA, 1100 = 170mA, 1101 = 180mA, 1110 = 190mA, 1111 = 200mA ).

In our case it could be 00 = 50mA, 01 = 100mA, 10 = 150mA, 11 = 200mA.

CHG_RST_HYS currently no idea what this is.

AC_FCHG ... something with FastCHarGing ?!?

Code: Select all
    // CHG_CNTL2 register
    /* slave addr addr mask clear shift */
    { 0x78, 0x7D, 0xC0, 0x3F, 0x06 }, // VBUS_FCHG
    { 0x78, 0x7D, 0x30, 0xCF, 0x04 }, // FCHG_TMR
    { 0x78, 0x7D, 0x08, 0xF7, 0x03 }, // MBAT_REG_TH
    { 0x78, 0x7D, 0x07, 0xF8, 0x00 }, // MBATT_THERM_REG


VBUS_FCHG FastCHarGing for USB ?!?

FCHG_TMR FastCHarGing TiMeR ?!?

Code: Select all
    // CHG_IRQ1 register
    /* slave addr addr mask clear shift */
    { 0x78, 0x7E, 0x80, 0x7F, 0x07 }, // VAC_R
    { 0x78, 0x7E, 0x40, 0xBF, 0x06 }, // VAC_F
    { 0x78, 0x7E, 0x20, 0xDF, 0x05 }, // VAC_OVP
    { 0x78, 0x7E, 0x10, 0xEF, 0x04 }, // VBUS_R
    { 0x78, 0x7E, 0x08, 0xF7, 0x03 }, // VBUS_F
    { 0x78, 0x7E, 0x04, 0xFB, 0x02 }, // VBUS_OVP

    // CHG_IRQ2 register
    /* slave addr addr mask clear shift */
    { 0x78, 0x7F, 0x80, 0x7F, 0x07 }, // CHG_TMR_FAULT
    { 0x78, 0x7F, 0x40, 0xBF, 0x06 }, // CHG_TOPOFF
    { 0x78, 0x7F, 0x20, 0xDF, 0x05 }, // CHG_DONE
    { 0x78, 0x7F, 0x10, 0xEF, 0x04 }, // CHG_RST
    { 0x78, 0x7F, 0x08, 0xF7, 0x03 }, // MBATTLOWR
    { 0x78, 0x7F, 0x04, 0xFB, 0x02 }, // MBATTLOWF

    // CHG_IRQ1_MASK register
    /* slave addr addr mask clear shift */
    { 0x78, 0x80, 0x80, 0x7F, 0x07 }, // VAC_R_MASK
    { 0x78, 0x80, 0x40, 0xBF, 0x06 }, // VAC_F_MASK
    { 0x78, 0x80, 0x20, 0xDF, 0x05 }, // VAC_OVP_MASK
    { 0x78, 0x80, 0x10, 0xEF, 0x04 }, // VBUS_R_MASK
    { 0x78, 0x80, 0x08, 0xF7, 0x03 }, // VBUS_F_MASK
    { 0x78, 0x80, 0x04, 0xFB, 0x02 }, // VBUS_OVP_MASK

    // CHG_IRQ2_MASK register
    /* slave addr addr mask clear shift */
    { 0x78, 0x81, 0x80, 0x7F, 0x07 }, // CHG_TMR_FAULT_MASK
    { 0x78, 0x81, 0x40, 0xBF, 0x06 }, // CHG_TOPOFF_MASK
    { 0x78, 0x81, 0x20, 0xDF, 0x05 }, // CHG_DONE_MASK
    { 0x78, 0x81, 0x10, 0xEF, 0x04 }, // CHG_RST_MASK
    { 0x78, 0x81, 0x08, 0xF7, 0x03 }, // MBATTLOWR_MASK
    { 0x78, 0x81, 0x04, 0xFB, 0x02 }, // MBATTLOWF_MASK

    // CHG_STAT register
    /* slave addr addr mask clear shift */
    { 0x78, 0x82, 0x80, 0x7F, 0x07 }, // VAC_OK
    { 0x78, 0x82, 0x40, 0xBF, 0x06 }, // VBUS_OK
    { 0x78, 0x82, 0x20, 0xDF, 0x05 }, // CHG_TMR
    { 0x78, 0x82, 0x10, 0xEF, 0x04 }, // CHG_EN_STAT
    { 0x78, 0x82, 0x0C, 0xF3, 0x02 }, // CHG_MODE
    { 0x78, 0x82, 0x02, 0xFD, 0x01 }, // MBATT_DET
    { 0x78, 0x82, 0x01, 0xFE, 0x00 }, // MBATTLOW

I think the interrupts should be not too difficult to decode.

Code: Select all
    // BBATTCNFG register
    /* slave addr addr mask clear shift */
    { 0x78, 0x78, 0x80, 0x7F, 0x07 }, // APPALLOFF
    { 0x78, 0x78, 0x03, 0xFC, 0x00 }, // VBBATTCV

Needs to be analyzed.
Ad banners support the JetDroid forum. Please consider clicking them once in a while.
User avatar
Dopi
Dev Team
Dev Team
 
Posts: 926
Joined: Sun Aug 22, 2010 9:47 pm

Advertisement

Re: max8906 charging driver

Postby Dopi » Tue Nov 16, 2010 3:47 pm

In case anyone suggests we should try to listen to the I2C communication to figure out the commands. I just located the position of the I2C pull-ip resistors for the PWR_SCL_3.0V and PWR_SDA_3.0V. They are in a difficult location for probing and soldering. But you should better see by yourself ... (look for the tiny red circle in the picture center)

PWR_I2C_PURES.png
You do not have the required permissions to view the files attached to this post.
Ad banners support the JetDroid forum. Please consider clicking them once in a while.
User avatar
Dopi
Dev Team
Dev Team
 
Posts: 926
Joined: Sun Aug 22, 2010 9:47 pm

Re: max8906 charging driver

Postby Byeranger » Tue Nov 16, 2010 6:52 pm

Sorry this has nothing to do with this topic :oops:
But is the IC with the nice round sticker on it our beloved 800mhz cpu?
Byeranger
Forum Moderator
Forum Moderator
 
Posts: 162
Joined: Thu Oct 21, 2010 3:26 pm
Location: Holland

Re: max8906 charging driver

Postby Dopi » Tue Nov 16, 2010 7:48 pm

Byeranger wrote:Sorry this has nothing to do with this topic :oops:
But is the IC with the nice round sticker on it our beloved 800mhz cpu?


This is indeed quite off topic ;) But yes, this is the S3C6410 application processor. Even more amazing is that inside that package there is not only the CPU but also RAM and flash memory - everything stacked upon each other. A very dense package.

Cheers,
Dopi
Ad banners support the JetDroid forum. Please consider clicking them once in a while.
User avatar
Dopi
Dev Team
Dev Team
 
Posts: 926
Joined: Sun Aug 22, 2010 9:47 pm

Re: max8906 charging driver

Postby vaclavpe » Thu Nov 18, 2010 8:17 am

Hi Dopi,

I disassembled my Jet and found that I am no physically able to solder wires to above mentioned resistors. They are too small for me. Furthermore all components are under some kind of protective finish.

So, I will be very glad if somebody here has more experience with phone repair, solders the wires and sniffs the I2C communication. For me it would be enough to have data like this:
Code: Select all
S(start) 0x78 0x61 ...etc... T(stop)

Vasek
vaclavpe
Dev Team
Dev Team
 
Posts: 116
Joined: Wed Oct 27, 2010 8:58 am
Location: Prague, Czech

Re: max8906 charging driver

Postby Thijs » Thu Nov 18, 2010 10:28 am

hi,

I assume I2C connects multiple devices.. so there should be more valid points where measuring is possible. Or isn't it?

best regards
Thijs
Dev Team
Dev Team
 
Posts: 114
Joined: Fri Sep 10, 2010 6:28 pm

Re: max8906 charging driver

Postby Dopi » Thu Nov 18, 2010 1:57 pm

Thijs wrote:I assume I2C connects multiple devices.. so there should be more valid points where measuring is possible. Or isn't it?


In this case the I2C bus only connects to the PMU. I will check again but I am 99% confident. Thus it is only 2 ICs (S3C and MAX8906) and one pair or resistors (on for SDA, one for SCL). If there are no test-points we can't easily tap the bus.

Given the limited number of flags available in the PMU charger registers I think trial and error (maybe with another battery) is not a bad option.

Cheers,
Dopi
Ad banners support the JetDroid forum. Please consider clicking them once in a while.
User avatar
Dopi
Dev Team
Dev Team
 
Posts: 926
Joined: Sun Aug 22, 2010 9:47 pm

Re: max8906 charging driver

Postby vaclavpe » Wed Dec 01, 2010 9:10 pm

Hello all,
on PMIC, there is pin PWREN driven by signal AP_PMIC_EN from CPU.

Dopi, is this pin somehow usable when charging is needed ? Maybe that is why I can not read anything from ADC registers and just zeros ? Strange is that RTC inside works without problems.

It is connected to XPWRRGTON so no GPIO pin. So IMHO this signal is powered automatically.

Vasek
vaclavpe
Dev Team
Dev Team
 
Posts: 116
Joined: Wed Oct 27, 2010 8:58 am
Location: Prague, Czech

Re: max8906 charging driver

Postby vaclavpe » Wed Dec 01, 2010 9:25 pm

Just one remark. during experiments with measurement of battery, I tried to read several MAX8906 registers. Here are results:
Code: Select all
<4>[    1.779143] [MAX8906 dbg]: TSC_STA_INT=0x1B
<4>[    1.788830] [MAX8906 dbg]: TSC_INT_MSK=0x0D
<4>[    1.798265] [MAX8906 dbg]: TSC_CNFG1  =0x11
<4>[    1.807790] [MAX8906 dbg]: TSC_CNFG2  =0x00
<4>[    1.843057] [MAX8906 dbg]: TSC_CNFG3  =0x00
<4>[    1.852381] [MAX8906 dbg]: TSC_CNFG4  =0x00
<4>[    1.861714] [MAX8906 dbg]: TSC_RES_CF1=0x00
<4>[    1.870776] [MAX8906 dbg]: TSC_AVG_CF1=0x00
<4>[    1.879783] [MAX8906 dbg]: TSC_ACQ_CF1=0xFF
<4>[    1.888902] [MAX8906 dbg]: TSC_ACQ_CF2=0xFF
<4>[    1.897845] [MAX8906 dbg]: TSC_ACQ_CF3=0xFF
<4>[    1.906899] [MAX8906 dbg]: 0x60=0x00
<4>[    1.915803] [MAX8906 dbg]: 0x61=0x00
<4>[    1.924667] [MAX8906 dbg]: 0x62=0x00
<4>[    1.933693] [MAX8906 dbg]: 0x63=0x00
<4>[    1.942544] [MAX8906 dbg]: 0x64=0x00
<4>[    1.951555] [MAX8906 dbg]: 0x65=0x00
<4>[    1.960400] [MAX8906 dbg]: 0x66=0x00
<4>[    1.969169] [MAX8906 dbg]: 0x67=0x00
<4>[    1.978019] [MAX8906 dbg]: 0x68=0x00
<4>[    1.986678] [MAX8906 dbg]: 0x69=0x00
<4>[    1.995442] [MAX8906 dbg]: 0x6a=0x00

Registers 0x60-0x6a should contain some ADC results. But, nevertheless, zeroes are not the right values...
vaclavpe
Dev Team
Dev Team
 
Posts: 116
Joined: Wed Oct 27, 2010 8:58 am
Location: Prague, Czech

Re: max8906 charging driver

Postby Dopi » Fri Dec 03, 2010 2:15 pm

vaclavpe wrote:Registers 0x60-0x6a should contain some ADC results. But, nevertheless, zeroes are not the right values...

Is it possible that we have to enable the ADCs in some other register?

Cheers,
Dopi
Ad banners support the JetDroid forum. Please consider clicking them once in a while.
User avatar
Dopi
Dev Team
Dev Team
 
Posts: 926
Joined: Sun Aug 22, 2010 9:47 pm

Next

Return to JetKernel

Who is online

Users browsing this forum: No registered users and 1 guest

  • Advertisement
cron