void __init twl4030_power_init(struct twl4030_power_data *triton2_scripts) { int err = 0; int i; struct twl4030_resconfig *resconfig; err = twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, KEY_1, R_PROTECT_KEY); err |= twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, KEY_2, R_PROTECT_KEY); if (err) printk(KERN_ERR "TWL4030 Unable to unlock registers\n"); for (i = 0; i < triton2_scripts->size; i++) { err = load_triton_script(triton2_scripts->scripts[i]); if (err) break; } resconfig = triton2_scripts->resource_config; if (resconfig) { while (resconfig->resource) { twl4030_configure_resource(resconfig); resconfig++; } } if (twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY)) printk(KERN_ERR "TWL4030 Unable to relock registers\n"); }
void __init twl4030_power_init(struct twl4030_power_data *twl4030_scripts) { int err = 0; int i; struct twl4030_resconfig *resconfig; u8 address = twl4030_start_script_address; err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1, TWL4030_PM_MASTER_PROTECT_KEY); if (err) goto unlock; err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG2, TWL4030_PM_MASTER_PROTECT_KEY); if (err) goto unlock; for (i = 0; i < twl4030_scripts->num; i++) { err = load_twl4030_script(twl4030_scripts->scripts[i], address); if (err) goto load; address += twl4030_scripts->scripts[i]->size; } resconfig = twl4030_scripts->resource_config; if (resconfig) { while (resconfig->resource) { err = twl4030_configure_resource(resconfig); if (err) goto resource; resconfig++; } } err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, TWL4030_PM_MASTER_PROTECT_KEY); if (err) pr_err("TWL4030 Unable to relock registers\n"); return; unlock: if (err) pr_err("TWL4030 Unable to unlock registers\n"); return; load: if (err) pr_err("TWL4030 failed to load scripts\n"); return; resource: if (err) pr_err("TWL4030 failed to configure resource\n"); return; }
static int twl4030_power_configure_resources(struct twl4030_power_data *pdata) { struct twl4030_resconfig *resconfig = pdata->resource_config; int err; if (resconfig) { while (resconfig->resource) { err = twl4030_configure_resource(resconfig); if (err) return err; resconfig++; } } return 0; }
static int twl4030_power_configure_resources(const struct twl4030_power_data *pdata) { struct twl4030_resconfig *resconfig = pdata->resource_config; struct twl4030_resconfig *boardconf = pdata->board_config; int err; if (resconfig) { if (boardconf) twl4030_patch_rconfig(resconfig, boardconf); while (resconfig->resource) { err = twl4030_configure_resource(resconfig); if (err) return err; resconfig++; } } return 0; }
void __devinit twl4030_power_init(struct twl4030_power_data *twl4030_scripts) { int err = 0; int i; struct twl4030_resconfig *resconfig; u8 val, address = twl4030_start_script_address; err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG1, TWL4030_PM_MASTER_PROTECT_KEY); if (err) goto unlock; err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, TWL4030_PM_MASTER_KEY_CFG2, TWL4030_PM_MASTER_PROTECT_KEY); if (err) goto unlock; for (i = 0; i < twl4030_scripts->num; i++) { err = load_twl4030_script(twl4030_scripts->scripts[i], address); if (err) goto load; address += twl4030_scripts->scripts[i]->size; } resconfig = twl4030_scripts->resource_config; if (resconfig) { while (resconfig->resource) { err = twl4030_configure_resource(resconfig); if (err) goto resource; resconfig++; } } if (twl4030_scripts->use_poweroff && !pm_power_off) { err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &val, TWL4030_PM_MASTER_CFG_P123_TRANSITION); if (err) { pr_warning("TWL4030 Unable to read registers\n"); } else if (!(val & SEQ_OFFSYNC)) { val |= SEQ_OFFSYNC; err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, val, TWL4030_PM_MASTER_CFG_P123_TRANSITION); if (err) { pr_err("TWL4030 Unable to setup SEQ_OFFSYNC\n"); goto relock; } } pm_power_off = twl4030_power_off; } relock: err = twl_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, TWL4030_PM_MASTER_PROTECT_KEY); if (err) pr_err("TWL4030 Unable to relock registers\n"); return; unlock: if (err) pr_err("TWL4030 Unable to unlock registers\n"); return; load: if (err) pr_err("TWL4030 failed to load scripts\n"); return; resource: if (err) pr_err("TWL4030 failed to configure resource\n"); return; }