/** * rc_set_cfg_update() - Ramp Controller configuration update * @qrc: Main driver structure * @ce: Configuration entry to update * * Return: Zero for success or negative number for failure
*/ staticint rc_set_cfg_update(struct qcom_ramp_controller *qrc, u8 ce)
{ conststruct qcom_ramp_controller_desc *d = qrc->desc; struct regmap *r = qrc->regmap;
u32 ack, val; int ret;
/* The ack bit is between bits 16-31 of RC_REG_CFG_UPDATE */
ack = FIELD_PREP(RC_CFG_ACK, BIT(ce));
/* Write the configuration type first... */
ret = regmap_set_bits(r, d->cmd_reg + RC_REG_CFG_UPDATE, ce); if (ret) return ret;
/* ...and after that, enable the update bit to sync the changes */
ret = regmap_set_bits(r, d->cmd_reg + RC_REG_CFG_UPDATE, RC_CFG_UPDATE_EN); if (ret) return ret;
/* Wait for the changes to go through */
ret = regmap_read_poll_timeout(r, d->cmd_reg + RC_REG_CFG_UPDATE, val,
val & ack, 1, RC_UPDATE_TIMEOUT_US); if (ret) return ret;
/* * Configuration update success! The CFG_UPDATE register will not be * cleared automatically upon applying the configuration, so we have * to do that manually in order to leave the ramp controller in a * predictable and clean state.
*/
ret = regmap_write(r, d->cmd_reg + RC_REG_CFG_UPDATE, 0); if (ret) return ret;
/* Wait for the update bit cleared ack */ return regmap_read_poll_timeout(r, d->cmd_reg + RC_REG_CFG_UPDATE,
val, !(val & RC_CFG_ACK), 1,
RC_UPDATE_TIMEOUT_US);
}
/** * rc_write_cfg - Send configuration sequence * @qrc: Main driver structure * @seq: Register sequence to send before asking for update * @ce: Configuration SID * @nsids: Total number of SIDs * * Returns: Zero for success or negative number for error
*/ staticint rc_write_cfg(struct qcom_ramp_controller *qrc, conststruct reg_sequence *seq,
u16 ce, u8 nsids)
{ int ret;
u8 i;
/* Check if, and wait until the ramp controller is ready */
ret = rc_wait_for_update(qrc); if (ret) return ret;
/* Write the sequence */
ret = regmap_multi_reg_write(qrc->regmap, seq, nsids); if (ret) return ret;
/* Pull the trigger: do config update starting from the last sid */ for (i = 0; i < nsids; i++) {
ret = rc_set_cfg_update(qrc, (u8)ce - i); if (ret) return ret;
}
return 0;
}
/** * rc_ramp_ctrl_enable() - Enable Ramp up/down Control * @qrc: Main driver structure * * Return: Zero for success or negative number for error
*/ staticint rc_ramp_ctrl_enable(struct qcom_ramp_controller *qrc)
{ conststruct qcom_ramp_controller_desc *d = qrc->desc; int i, ret;
for (i = 0; i < d->num_ramp_en; i++) {
ret = rc_write_cfg(qrc, &d->cfg_ramp_en[i], RC_DCVS_CFG_SID, 1); if (ret) return ret;
}
return 0;
}
/** * qcom_ramp_controller_start() - Initialize and start the ramp controller * @qrc: Main driver structure * * The Ramp Controller needs to be initialized by programming the relevant * registers with SoC-specific configuration: once programming is done, * the hardware will take care of the rest (no further handling required). * * Return: Zero for success or negative number for error
*/ staticint qcom_ramp_controller_start(struct qcom_ramp_controller *qrc)
{ conststruct qcom_ramp_controller_desc *d = qrc->desc; int ret;
/* Program LMH, DFS, Link SIDs */
ret = rc_write_cfg(qrc, d->cfg_lmh_sid, RC_LMH_SID, d->num_lmh_sids); if (ret) return ret;
ret = rc_write_cfg(qrc, d->cfg_dfs_sid, RC_DFS_SID, d->num_dfs_sids); if (ret) return ret;
ret = rc_write_cfg(qrc, d->cfg_link_sid, RC_LINK_SID, d->num_link_sids); if (ret) return ret;
/* Everything is ready! Enable the ramp up/down control */ return rc_ramp_ctrl_enable(qrc);
}
ret = rc_write_cfg(qrc, qrc->desc->cfg_ramp_dis,
RC_DCVS_CFG_SID, qrc->desc->num_ramp_dis); if (ret)
dev_err(&pdev->dev, "Failed to send disable sequence\n");
}
MODULE_AUTHOR("AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>");
MODULE_DESCRIPTION("Qualcomm Ramp Controller driver");
MODULE_LICENSE("GPL");
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet am 2026-04-29)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.