* [PATCH 0/2] soc: amlogic: meson-clk-measure: g12a/b DVFS support
@ 2019-07-29 13:02 Neil Armstrong
2019-07-29 13:02 ` [PATCH 1/2] soc: amlogic: meson-clk-measure: protect measure with a mutex Neil Armstrong
2019-07-29 13:02 ` [PATCH 2/2] soc: amlogic: meson-clk-measure: add G12B second cluster cpu clk Neil Armstrong
0 siblings, 2 replies; 3+ messages in thread
From: Neil Armstrong @ 2019-07-29 13:02 UTC (permalink / raw)
To: khilman; +Cc: Neil Armstrong, linux-arm-kernel, linux-amlogic, linux-kernel
This patchset :
- protects the measure with a mutex, between concurrent user space debugfs reads
- adds entries for the G12B secondary cluster SYS_PLL and CPU clock
Neil Armstrong (2):
soc: amlogic: meson-clk-measure: protect measure with a mutex
soc: amlogic: meson-clk-measure: add G12B second cluster cpu clk
drivers/soc/amlogic/meson-clk-measure.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
--
2.22.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] soc: amlogic: meson-clk-measure: protect measure with a mutex
2019-07-29 13:02 [PATCH 0/2] soc: amlogic: meson-clk-measure: g12a/b DVFS support Neil Armstrong
@ 2019-07-29 13:02 ` Neil Armstrong
2019-07-29 13:02 ` [PATCH 2/2] soc: amlogic: meson-clk-measure: add G12B second cluster cpu clk Neil Armstrong
1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2019-07-29 13:02 UTC (permalink / raw)
To: khilman
Cc: Neil Armstrong, linux-arm-kernel, linux-amlogic, linux-kernel,
Martin Blumenstingl
In order to protect clock measuring when multiple process asks for
a measure, protect the main measure function with mutexes.
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/soc/amlogic/meson-clk-measure.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/amlogic/meson-clk-measure.c b/drivers/soc/amlogic/meson-clk-measure.c
index 19d4cbc93a17..c470e24f1dfa 100644
--- a/drivers/soc/amlogic/meson-clk-measure.c
+++ b/drivers/soc/amlogic/meson-clk-measure.c
@@ -11,6 +11,8 @@
#include <linux/debugfs.h>
#include <linux/regmap.h>
+static DEFINE_MUTEX(measure_lock);
+
#define MSR_CLK_DUTY 0x0
#define MSR_CLK_REG0 0x4
#define MSR_CLK_REG1 0x8
@@ -360,6 +362,10 @@ static int meson_measure_id(struct meson_msr_id *clk_msr_id,
unsigned int val;
int ret;
+ ret = mutex_lock_interruptible(&measure_lock);
+ if (ret)
+ return ret;
+
regmap_write(priv->regmap, MSR_CLK_REG0, 0);
/* Set measurement duration */
@@ -377,8 +383,10 @@ static int meson_measure_id(struct meson_msr_id *clk_msr_id,
ret = regmap_read_poll_timeout(priv->regmap, MSR_CLK_REG0,
val, !(val & MSR_BUSY), 10, 10000);
- if (ret)
+ if (ret) {
+ mutex_unlock(&measure_lock);
return ret;
+ }
/* Disable */
regmap_update_bits(priv->regmap, MSR_CLK_REG0, MSR_ENABLE, 0);
@@ -386,6 +394,8 @@ static int meson_measure_id(struct meson_msr_id *clk_msr_id,
/* Get the value in multiple of gate time counts */
regmap_read(priv->regmap, MSR_CLK_REG2, &val);
+ mutex_unlock(&measure_lock);
+
if (val >= MSR_VAL_MASK)
return -EINVAL;
--
2.22.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] soc: amlogic: meson-clk-measure: add G12B second cluster cpu clk
2019-07-29 13:02 [PATCH 0/2] soc: amlogic: meson-clk-measure: g12a/b DVFS support Neil Armstrong
2019-07-29 13:02 ` [PATCH 1/2] soc: amlogic: meson-clk-measure: protect measure with a mutex Neil Armstrong
@ 2019-07-29 13:02 ` Neil Armstrong
1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2019-07-29 13:02 UTC (permalink / raw)
To: khilman
Cc: Neil Armstrong, linux-arm-kernel, linux-amlogic, linux-kernel,
Martin Blumenstingl
Add the G12B second CPU cluster CPU and SYS_PLL measure IDs.
These IDs returns 0Hz on G12A.
Reviewed-by: Kevin Hilman <khilman@baylibre.com>
Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
---
drivers/soc/amlogic/meson-clk-measure.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/soc/amlogic/meson-clk-measure.c b/drivers/soc/amlogic/meson-clk-measure.c
index c470e24f1dfa..f09b404b39d3 100644
--- a/drivers/soc/amlogic/meson-clk-measure.c
+++ b/drivers/soc/amlogic/meson-clk-measure.c
@@ -324,6 +324,8 @@ static struct meson_msr_id clk_msr_g12a[CLK_MSR_MAX] = {
CLK_MSR_ID(84, "co_tx"),
CLK_MSR_ID(89, "hdmi_todig"),
CLK_MSR_ID(90, "hdmitx_sys"),
+ CLK_MSR_ID(91, "sys_cpub_div16"),
+ CLK_MSR_ID(92, "sys_pll_cpub_div16"),
CLK_MSR_ID(94, "eth_phy_rx"),
CLK_MSR_ID(95, "eth_phy_pll"),
CLK_MSR_ID(96, "vpu_b"),
--
2.22.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-07-29 13:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-29 13:02 [PATCH 0/2] soc: amlogic: meson-clk-measure: g12a/b DVFS support Neil Armstrong
2019-07-29 13:02 ` [PATCH 1/2] soc: amlogic: meson-clk-measure: protect measure with a mutex Neil Armstrong
2019-07-29 13:02 ` [PATCH 2/2] soc: amlogic: meson-clk-measure: add G12B second cluster cpu clk Neil Armstrong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).