• A
    regulator: tps65217: Convert to use linear ranges · 6290d606
    Axel Lin 提交于
    Below is the equation in original code:
    
    tps65217_uv1_ranges:
            0  ... 24: uV = vsel * 25000 + 900000;
            25 ... 52: uV = (vsel - 24) * 50000 + 1500000;
                          = (vsel - 25) * 50000 + 1550000;
            53 ... 55: uV = (vsel - 52) * 100000 + 2900000;
                          = (vsel - 53) * 100000 + 3000000;
            56 ... 62: uV = 3300000;
    
    tps65217_uv2_ranges:
            0  ...  8: uV = vsel * 50000 + 1500000;
            9  ... 13: uV = (vsel - 8) * 100000 + 1900000;
                          = (vsel - 9) * 100000 + 2000000;
            14 ... 31: uV = (vsel - 13) * 50000 + 2400000;
                          = (vsel - 14) * 50000 + 2450000;
    
    The voltage tables are composed of linear ranges.
    This patch converts this driver to use multiple linear ranges APIs.
    
    In original code, voltage range for DCDC1 is 900000 ~ 1800000 and voltage range
    for DCDC3 is 900000 ~ 1500000.  This patch separates the range 25~52 in
    tps65217_uv1_ranges table to two linear ranges: 25~30 and 31~52.
    This change makes it possible to reuse the same linear_ranges table for DCDCx.
    Signed-off-by: NAxel Lin <axel.lin@ingics.com>
    Signed-off-by: NMark Brown <broonie@linaro.org>
    6290d606
tps65217-regulator.c 9.9 KB