void mt_power_gs_compare(char *scenario, \
                         unsigned int *mt6582_power_gs, unsigned int mt6582_power_gs_len, \
                         unsigned int *mt6323_power_gs, unsigned int mt6323_power_gs_len, \
                         unsigned int *mt6333_power_gs, unsigned int mt6333_power_gs_len)
{
    unsigned int i, val1, val2;

    // MT6582
    for (i = 0 ; i < mt6582_power_gs_len ; i += 3)
    {
        val1 = gs_read(mt6582_power_gs[i]) & mt6582_power_gs[i+1];
        val2 = mt6582_power_gs[i+2] & mt6582_power_gs[i+1];
        if (val1 != val2)
        {
            printk("%s - MT6582 - 0x%x - 0x%x - 0x%x - 0x%x - ", \
                    scenario, mt6582_power_gs[i], gs_read(mt6582_power_gs[i]), mt6582_power_gs[i+1], mt6582_power_gs[i+2]);
            mt_power_gs_diff_output(val1, val2);
        }
    }

    // MT6323
    for (i = 0 ; i < mt6323_power_gs_len ; i += 3)
    {
        val1 = gs6323_pmic_read(mt6323_power_gs[i]) & mt6323_power_gs[i+1];
        val2 = mt6323_power_gs[i+2] & mt6323_power_gs[i+1];
        if (val1 != val2)
        {
            printk("%s - MT6323 - 0x%x - 0x%x - 0x%x - 0x%x - ", \
                    scenario, mt6323_power_gs[i], gs6323_pmic_read(mt6323_power_gs[i]), mt6323_power_gs[i+1], mt6323_power_gs[i+2]);
            mt_power_gs_diff_output(val1, val2);
        }
    }

    #if SUPPORT_MT6333
    // MT6333
    for (i = 0 ; i < mt6333_power_gs_len ; i += 3)
    {
        val1 = gs6333_pmic_read(mt6333_power_gs[i]) & mt6333_power_gs[i+1];
        val2 = mt6333_power_gs[i+2] & mt6333_power_gs[i+1];
        if (val1 != val2)
        {
            printk("%s - MT6333 - 0x%x - 0x%x - 0x%x - 0x%x - ", \
                    scenario, mt6333_power_gs[i], gs6333_pmic_read(mt6333_power_gs[i]), mt6333_power_gs[i+1], mt6333_power_gs[i+2]);
            mt_power_gs_diff_output(val1, val2);
        }
    }
    #endif

    mt_power_gs_compare_pll();
}
Beispiel #2
0
gs_t gs_read_file (const gs_string_t filename) 
{
  gs_t p;
  GS_ASSERT (filename != NULL, "open failed.\n");
  p = (gs_t) gs_read (filename);
  gs_program = p;
  return p;
}
Beispiel #3
0
/*
 * Initialize G-Line storage.  Pass 1 when glines don't need to be reloaded.
 * Returns 0 on failure, 1 otherwise.
 */
int
glinestore_init(int noreload)
{
    char buf1[1024];
    FILE *jf;

    ircsnprintf(journalfilename, sizeof(journalfilename), "%s/.glines", runpath);

    if (journal >= 0)
    {
        if (noreload)
            return 1;

        close(journal);
        journal = -1;
    }

    /* "a+" to create if it doesn't exist */
    jf = fopen(journalfilename, "a+");
    if (!jf)
    {
        ircsnprintf(buf1, sizeof(buf1), "ERROR: Unable to open G-Line storage"
                    " file .glines: %s", strerror(errno));
        gs_error(buf1);
        return 0;
    }
    rewind(jf);

    /* replay journal */
    while (fgets(buf1, sizeof(buf1), jf))
    {
        char *s = strchr(buf1, '\n');

        /* no newline, consider it malformed and stop here */
        if (!s)
            break;

        *s = 0;

        if (!gs_read(buf1))
            break;
    }

    fclose(jf);

    /* this will reopen the journal for appending */
    return glinestore_compact();
}
Beispiel #4
0
void mt_power_gs_compare(char *scenario, \
                         unsigned int *ap_cg_gs, unsigned int ap_cg_gs_len, \
                         unsigned int *ap_dcm_gs, unsigned int ap_dcm_gs_len, \
                         unsigned int *pmic_ldo_buck_gs, unsigned int pmic_ldo_buck_gs_len, \
                         unsigned int *pmic_chg_buck_gs, unsigned int pmic_chg_buck_gs_len)
{
    unsigned int i, val1, val2;

    // AP CG
    for (i = 0; i < ap_cg_gs_len; i += 3)
    {
        aee_sram_printk("%d\n", i);
        val1 = gs_read(ap_cg_gs[i]) & ap_cg_gs[i + 1];
        val2 = ap_cg_gs[i + 2] & ap_cg_gs[i + 1];
        if (val1 != val2)
        {
            printk("%s - AP CG - 0x%x - 0x%x - 0x%x - 0x%x - ", \
                    scenario, ap_cg_gs[i], gs_read(ap_cg_gs[i]), ap_cg_gs[i + 1], ap_cg_gs[i + 2]);
            mt_power_gs_diff_output(val1, val2);
        }
    }

    // AP DCM
    for (i = 0; i < ap_dcm_gs_len; i += 3)
    {
        aee_sram_printk("%d\n", i);
        val1 = gs_read(ap_dcm_gs[i]) & ap_dcm_gs[i + 1];
        val2 = ap_dcm_gs[i + 2] & ap_dcm_gs[i + 1];
        if (val1 != val2)
        {
            printk("%s - AP DCM - 0x%x - 0x%x - 0x%x - 0x%x - ", \
                    scenario, ap_dcm_gs[i], gs_read(ap_dcm_gs[i]), ap_dcm_gs[i + 1], ap_dcm_gs[i + 2]);
            mt_power_gs_diff_output(val1, val2);
        }
    }

    // LDO BUCK
    for (i = 0; i < pmic_ldo_buck_gs_len; i += 3)
    {
        aee_sram_printk("%d\n", i);
        val1 = gs6323_pmic_read(pmic_ldo_buck_gs[i]) & pmic_ldo_buck_gs[i + 1];
        val2 = pmic_ldo_buck_gs[i + 2] & pmic_ldo_buck_gs[i + 1];
        if (val1 != val2)
        {
            printk("%s - LDO BUCK - 0x%x - 0x%x - 0x%x - 0x%x - ", \
                    scenario, pmic_ldo_buck_gs[i], gs6323_pmic_read(pmic_ldo_buck_gs[i]), pmic_ldo_buck_gs[i + 1], pmic_ldo_buck_gs[i + 2]);
            mt_power_gs_diff_output(val1, val2);
        }
    }

    // CHG BUCK
    for (i = 0; i < pmic_chg_buck_gs_len; i += 3)
    {
        aee_sram_printk("%d\n", i);
        val1 = gs6333_pmic_read(pmic_chg_buck_gs[i]) & pmic_chg_buck_gs[i + 1];
        val2 = pmic_chg_buck_gs[i + 2] & pmic_chg_buck_gs[i + 1];
        if (val1 != val2)
        {
            printk("%s - CHG BUCK - 0x%x - 0x%x - 0x%x - 0x%x - ", \
                    scenario, pmic_chg_buck_gs[i], gs6333_pmic_read(pmic_chg_buck_gs[i]), pmic_chg_buck_gs[i + 1], pmic_chg_buck_gs[i + 2]);
            mt_power_gs_diff_output(val1, val2);
        }
    }

    mt_power_gs_compare_pll();
}
void Golden_Setting_Compare_for_Suspend(void)
{
    u32 i, counter_6589, counter_6320;
    u32 MT_6589_Len, MT_6320_Len;
    u32 chip_version = 0;
    u32 *MT6320_Suspend_Golden_ptr;

    // check MT6320_E1 or MT6320_E2
    chip_version = upmu_get_cid();
    if(chip_version == PMIC6320_E1_CID_CODE)
    {
        MT_6320_Len = sizeof(MT6320_E1_Suspend_Golden) / sizeof(u32);
        MT6320_Suspend_Golden_ptr = (u32 *)MT6320_E1_Suspend_Golden;
    }
    else if(chip_version == PMIC6320_E2_CID_CODE)
    {
        MT_6320_Len = sizeof(MT6320_E2_Suspend_Golden) / sizeof(u32);
        MT6320_Suspend_Golden_ptr = (u32 *)MT6320_E2_Suspend_Golden;
    }
    else
    {
        MT_6320_Len = sizeof(MT6320_E2_Suspend_Golden) / sizeof(u32);
        MT6320_Suspend_Golden_ptr = (u32 *)MT6320_E2_Suspend_Golden;
    }

    MT_6589_Len = sizeof(MT6589_Suspend_Golden) / sizeof(u32);
    counter_6589 = 0;
    counter_6320 = 0;

    // MT6589 ======================================================================================================
    for( i=0 ; i<MT_6589_Len ; i+=3 )
    {
        if( (gs_read(MT6589_Suspend_Golden[i]) & MT6589_Suspend_Golden[i+1]) != (MT6589_Suspend_Golden[i+2] & MT6589_Suspend_Golden[i+1]))
        {
            counter_6589++;
            clc_notice("MT6589 Suspend register[0x%x] = 0x%x (mask : 0x%x, value : 0x%x)\n", MT6589_Suspend_Golden[i], gs_read(MT6589_Suspend_Golden[i]), MT6589_Suspend_Golden[i+1], MT6589_Suspend_Golden[i+2] );
        }
    }

    if(counter_6589 == 0)
    {
        clc_notice("MT6589 Suspend golden setting : pass.\n");
    }

    Golden_Setting_Compare_PLL();

    // MT6320 ======================================================================================================
    for( i=0 ; i<MT_6320_Len ; i+=3 )
    {
        if( (gs_pmic_read(MT6320_Suspend_Golden_ptr[i]) & MT6320_Suspend_Golden_ptr[i+1]) != (MT6320_Suspend_Golden_ptr[i+2] & MT6320_Suspend_Golden_ptr[i+1]))
        {
            counter_6320++;
            clc_notice("MT6320 Suspend register[0x%x] = 0x%x (mask : 0x%x, value : 0x%x)\n", MT6320_Suspend_Golden_ptr[i], gs_pmic_read(MT6320_Suspend_Golden_ptr[i]), MT6320_Suspend_Golden_ptr[i+1], MT6320_Suspend_Golden_ptr[i+2] );
        }
    }

    if(counter_6320 == 0)
    {
        clc_notice("MT6320 Suspend golden setting : pass.\n");
    }

    Golden_Setting_Compare_PMIC_LDO();

    // ============================================================================================================
}