net: ipa: introduce ipa_clock_rate()
authorAlex Elder <elder@linaro.org>
Fri, 3 Jul 2020 21:23:34 +0000 (16:23 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Jul 2020 21:37:33 +0000 (14:37 -0700)
Create a new function that returns the current rate of the IPA core
clock.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ipa/ipa_clock.c
drivers/net/ipa/ipa_clock.h

index c5204fd58ac4b3e1eb6d918fedbbab5c4267c823..0fbc8b1bdf416ed099be64ab90fdd102cb27312b 100644 (file)
@@ -256,6 +256,12 @@ void ipa_clock_put(struct ipa *ipa)
        mutex_unlock(&clock->mutex);
 }
 
+/* Return the current IPA core clock rate */
+u32 ipa_clock_rate(struct ipa *ipa)
+{
+       return ipa->clock ? (u32)clk_get_rate(ipa->clock->core) : 0;
+}
+
 /* Initialize IPA clocking */
 struct ipa_clock *ipa_clock_init(struct device *dev)
 {
index bc52b35e6bb23519bf81509979cd660e0a849c4e..0f4e2877a6df2df1d51b20ce3966fe3f98be4bf5 100644 (file)
@@ -10,6 +10,14 @@ struct device;
 
 struct ipa;
 
+/**
+ * ipa_clock_rate() - Return the current IPA core clock rate
+ * @ipa:       IPA structure
+ *
+ * Return: The current clock rate (in Hz), or 0.
+ */
+u32 ipa_clock_rate(struct ipa *ipa);
+
 /**
  * ipa_clock_init() - Initialize IPA clocking
  * @dev:       IPA device