// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2011-2017, The Linux Foundation
*/
#include <linux/errno.h> #include"slimbus.h"
/** * slim_ctrl_clk_pause() - Called by slimbus controller to enter/exit * 'clock pause' * @ctrl: controller requesting bus to be paused or woken up * @wakeup: Wakeup this controller from clock pause. * @restart: Restart time value per spec used for clock pause. This value * isn't used when controller is to be woken up. * * Slimbus specification needs this sequence to turn-off clocks for the bus. * The sequence involves sending 3 broadcast messages (reconfiguration * sequence) to inform all devices on the bus. * To exit clock-pause, controller typically wakes up active framer device. * This API executes clock pause reconfiguration sequence if wakeup is false. * If wakeup is true, controller's wakeup is called. * For entering clock-pause, -EBUSY is returned if a message txn in pending.
*/ int slim_ctrl_clk_pause(struct slim_controller *ctrl, bool wakeup, u8 restart)
{ int i, ret = 0; unsignedlong flags; struct slim_sched *sched = &ctrl->sched; struct slim_val_inf msg = {0, 0, NULL, NULL};
if (wakeup == false && restart > SLIM_CLK_UNSPECIFIED) return -EINVAL;
mutex_lock(&sched->m_reconf); if (wakeup) { if (sched->clk_state == SLIM_CLK_ACTIVE) {
mutex_unlock(&sched->m_reconf); return 0;
}
/* * Fine-tune calculation based on clock gear, * message-bandwidth after bandwidth management
*/
ret = wait_for_completion_timeout(&sched->pause_comp,
msecs_to_jiffies(100)); if (!ret) {
mutex_unlock(&sched->m_reconf);
pr_err("Previous clock pause did not finish"); return -ETIMEDOUT;
}
ret = 0;
/* * Slimbus framework will call controller wakeup * Controller should make sure that it sets active framer * out of clock pause
*/ if (sched->clk_state == SLIM_CLK_PAUSED && ctrl->wakeup)
ret = ctrl->wakeup(ctrl); if (!ret)
sched->clk_state = SLIM_CLK_ACTIVE;
mutex_unlock(&sched->m_reconf);
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.