void set_voltage(uint32_t value) { int i; g_voltage = value; if (!value) { writel(0x7, &sft->reg); return; } /* Reset */ writel(0, &sft->reg); /* The power chip datasheet is here: * http://www.onsemi.com/pub_link/Collateral/ADP3208D.PDF * The high 16bits is the value*/ /* Set shifter to xx */ for (i = 0; i < 5; i++) { writel(value | 0x1, &sft->reg); shift_done(); } /* Shift to reg */ for (i = 0; i < 5; i++) { writel(0x2, &sft->reg); shift_done(); } /* Output enable, low active */ writel(0x3, &sft->reg); }
void set_voltage(uint32_t value) { int i; if (g_voltage == value) return; g_voltage = value; if (value == 0x8f00) { writel(0x7, &sft->reg); delay(VOLTAGE_DELAY); return; } /* Reset */ writel(0, &sft->reg); /* The power chip datasheet is here: * http://www.onsemi.com/pub_link/Collateral/ADP3208D.PDF * REV_BITS((VALUE < 1) & 1) << 16: is the value, the */ /* Set shifter to xx */ for (i = 0; i < 5; i++) { writel(value | 0x1, &sft->reg); shift_done(); } /* Shift to reg */ for (i = 0; i < 5; i++) { writel(0x2, &sft->reg); shift_done(); } /* Output enable, low active */ writel(0x3, &sft->reg); delay(VOLTAGE_DELAY); }