blob: 1d70f1de3875bfecef611d75890001a44b4a2633 [file] [log] [blame]
Alex Elderba764c42020-03-05 22:28:19 -06001/* SPDX-License-Identifier: GPL-2.0 */
2
3/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2018-2020 Linaro Ltd.
5 */
6#ifndef _IPA_CLOCK_H_
7#define _IPA_CLOCK_H_
8
9struct device;
10
11struct ipa;
12
13/**
Alex Elder78b348f2020-07-03 16:23:34 -050014 * ipa_clock_rate() - Return the current IPA core clock rate
15 * @ipa: IPA structure
16 *
17 * Return: The current clock rate (in Hz), or 0.
18 */
19u32 ipa_clock_rate(struct ipa *ipa);
20
21/**
Alex Elderba764c42020-03-05 22:28:19 -060022 * ipa_clock_init() - Initialize IPA clocking
23 * @dev: IPA device
24 *
Alex Eldere3eea082020-07-13 07:24:18 -050025 * Return: A pointer to an ipa_clock structure, or a pointer-coded error
Alex Elderba764c42020-03-05 22:28:19 -060026 */
27struct ipa_clock *ipa_clock_init(struct device *dev);
28
29/**
30 * ipa_clock_exit() - Inverse of ipa_clock_init()
31 * @clock: IPA clock pointer
32 */
33void ipa_clock_exit(struct ipa_clock *clock);
34
35/**
36 * ipa_clock_get() - Get an IPA clock reference
37 * @ipa: IPA pointer
38 *
39 * This call blocks if this is the first reference.
40 */
41void ipa_clock_get(struct ipa *ipa);
42
43/**
44 * ipa_clock_get_additional() - Get an IPA clock reference if not first
45 * @ipa: IPA pointer
46 *
47 * This returns immediately, and only takes a reference if not the first
48 */
49bool ipa_clock_get_additional(struct ipa *ipa);
50
51/**
52 * ipa_clock_put() - Drop an IPA clock reference
53 * @ipa: IPA pointer
54 *
55 * This drops a clock reference. If the last reference is being dropped,
56 * the clock is stopped and RX endpoints are suspended. This call will
57 * not block unless the last reference is dropped.
58 */
59void ipa_clock_put(struct ipa *ipa);
60
61#endif /* _IPA_CLOCK_H_ */