Lines Matching full:power

23  * DOC: IPA Power Management
26 * interconnects (buses) it depends on are enabled. Runtime power
38 * enum ipa_power_flag - IPA power flags
43 * @IPA_POWER_FLAG_COUNT: Number of defined power flags
54 * struct ipa_power - IPA power management information
67 spinlock_t spinlock; /* used with STOPPED/STARTED power flags */
74 static int ipa_interconnect_init(struct ipa_power *power, in ipa_interconnect_init() argument
82 interconnect = &power->interconnect[0]; in ipa_interconnect_init()
83 for (i = 0; i < power->interconnect_count; i++) { in ipa_interconnect_init()
92 ret = of_icc_bulk_get(power->dev, power->interconnect_count, in ipa_interconnect_init()
93 power->interconnect); in ipa_interconnect_init()
98 icc_bulk_disable(power->interconnect_count, power->interconnect); in ipa_interconnect_init()
101 ret = icc_bulk_set_bw(power->interconnect_count, power->interconnect); in ipa_interconnect_init()
103 icc_bulk_put(power->interconnect_count, power->interconnect); in ipa_interconnect_init()
109 static void ipa_interconnect_exit(struct ipa_power *power) in ipa_interconnect_exit() argument
111 icc_bulk_put(power->interconnect_count, power->interconnect); in ipa_interconnect_exit()
114 /* Enable IPA power, enabling interconnects and the core clock */
117 struct ipa_power *power = ipa->power; in ipa_power_enable() local
120 ret = icc_bulk_enable(power->interconnect_count, power->interconnect); in ipa_power_enable()
124 ret = clk_prepare_enable(power->core); in ipa_power_enable()
126 dev_err(power->dev, "error %d enabling core clock\n", ret); in ipa_power_enable()
127 icc_bulk_disable(power->interconnect_count, in ipa_power_enable()
128 power->interconnect); in ipa_power_enable()
137 struct ipa_power *power = ipa->power; in ipa_power_disable() local
139 clk_disable_unprepare(power->core); in ipa_power_disable()
141 icc_bulk_disable(power->interconnect_count, power->interconnect); in ipa_power_disable()
150 __clear_bit(IPA_POWER_FLAG_RESUMED, ipa->power->flags); in ipa_runtime_suspend()
182 __set_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags); in ipa_suspend()
205 __clear_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags); in ipa_resume()
219 return ipa->power ? (u32)clk_get_rate(ipa->power->core) : 0; in ipa_core_clock_rate()
228 if (!__test_and_set_bit(IPA_POWER_FLAG_RESUMED, ipa->power->flags)) in ipa_power_suspend_handler()
229 if (test_bit(IPA_POWER_FLAG_SYSTEM, ipa->power->flags)) in ipa_power_suspend_handler()
239 * Transmit can be running concurrent with power resume, and there's a
247 * power flag is set. And if the queue is started, the STARTED flag is set.
257 * from the power ->runtime_resume operation.
261 struct ipa_power *power = ipa->power; in ipa_power_modem_queue_stop() local
264 spin_lock_irqsave(&power->spinlock, flags); in ipa_power_modem_queue_stop()
266 if (!__test_and_clear_bit(IPA_POWER_FLAG_STARTED, power->flags)) { in ipa_power_modem_queue_stop()
268 __set_bit(IPA_POWER_FLAG_STOPPED, power->flags); in ipa_power_modem_queue_stop()
271 spin_unlock_irqrestore(&power->spinlock, flags); in ipa_power_modem_queue_stop()
281 struct ipa_power *power = ipa->power; in ipa_power_modem_queue_wake() local
284 spin_lock_irqsave(&power->spinlock, flags); in ipa_power_modem_queue_wake()
286 if (__test_and_clear_bit(IPA_POWER_FLAG_STOPPED, power->flags)) { in ipa_power_modem_queue_wake()
287 __set_bit(IPA_POWER_FLAG_STARTED, power->flags); in ipa_power_modem_queue_wake()
291 spin_unlock_irqrestore(&power->spinlock, flags); in ipa_power_modem_queue_wake()
297 clear_bit(IPA_POWER_FLAG_STARTED, ipa->power->flags); in ipa_power_modem_queue_active()
300 static int ipa_power_retention_init(struct ipa_power *power) in ipa_power_retention_init() argument
302 struct qmp *qmp = qmp_get(power->dev); in ipa_power_retention_init()
311 power->qmp = qmp; in ipa_power_retention_init()
316 static void ipa_power_retention_exit(struct ipa_power *power) in ipa_power_retention_exit() argument
318 qmp_put(power->qmp); in ipa_power_retention_exit()
319 power->qmp = NULL; in ipa_power_retention_exit()
322 /* Control register retention on power collapse */
326 struct ipa_power *power = ipa->power; in ipa_power_retention() local
329 if (!power->qmp) in ipa_power_retention()
332 ret = qmp_send(power->qmp, fmt, enable ? '1' : '0'); in ipa_power_retention()
334 dev_err(power->dev, "error %d sending QMP %sable request\n", in ipa_power_retention()
357 /* Initialize IPA power management */
361 struct ipa_power *power; in ipa_power_init() local
380 size = struct_size(power, interconnect, data->interconnect_count); in ipa_power_init()
381 power = kzalloc(size, GFP_KERNEL); in ipa_power_init()
382 if (!power) { in ipa_power_init()
386 power->dev = dev; in ipa_power_init()
387 power->core = clk; in ipa_power_init()
388 spin_lock_init(&power->spinlock); in ipa_power_init()
389 power->interconnect_count = data->interconnect_count; in ipa_power_init()
391 ret = ipa_interconnect_init(power, data->interconnect_data); in ipa_power_init()
395 ret = ipa_power_retention_init(power); in ipa_power_init()
403 return power; in ipa_power_init()
406 ipa_interconnect_exit(power); in ipa_power_init()
408 kfree(power); in ipa_power_init()
416 void ipa_power_exit(struct ipa_power *power) in ipa_power_exit() argument
418 struct device *dev = power->dev; in ipa_power_exit()
419 struct clk *clk = power->core; in ipa_power_exit()
423 ipa_power_retention_exit(power); in ipa_power_exit()
424 ipa_interconnect_exit(power); in ipa_power_exit()
425 kfree(power); in ipa_power_exit()