void kgsl_pwrctrl_pwrrail(struct kgsl_device *device, int state) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; if (state == KGSL_PWRFLAGS_OFF) { if (test_and_clear_bit(KGSL_PWRFLAGS_POWER_ON, &pwr->power_flags)) { trace_kgsl_rail(device, state); if (internal_pwr_rail_ctl(pwr->pwr_rail, false)) { KGSL_DRV_ERR(device, "call internal_pwr_rail_ctl failed\n"); return; } if (pwr->gpu_reg) regulator_disable(pwr->gpu_reg); } } else if (state == KGSL_PWRFLAGS_ON) { if (!test_and_set_bit(KGSL_PWRFLAGS_POWER_ON, &pwr->power_flags)) { trace_kgsl_rail(device, state); if (internal_pwr_rail_ctl(pwr->pwr_rail, true)) { KGSL_PWR_ERR(device, "call internal_pwr_rail_ctl failed\n"); return; } if (pwr->gpu_reg) { int status = regulator_enable(pwr->gpu_reg); if (status) KGSL_DRV_ERR(device, "regulator_enable " "failed: %d\n", status); } } } }
void kgsl_pwrctrl_pwrrail(struct kgsl_device *device, int state) { struct kgsl_pwrctrl *pwr = &device->pwrctrl; if (state == KGSL_PWRFLAGS_OFF) { if (test_and_clear_bit(KGSL_PWRFLAGS_POWER_ON, &pwr->power_flags)) { internal_pwr_rail_ctl(pwr->pwr_rail, 0); trace_kgsl_rail(device, state); if (pwr->gpu_reg) regulator_disable(pwr->gpu_reg); } } else if (state == KGSL_PWRFLAGS_ON) { if (!test_and_set_bit(KGSL_PWRFLAGS_POWER_ON, &pwr->power_flags)) { internal_pwr_rail_ctl(pwr->pwr_rail, 1); trace_kgsl_rail(device, state); if (pwr->gpu_reg) regulator_enable(pwr->gpu_reg); } } }