Loading drivers/clk/qcom/clk-debug.c +19 −7 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2016, 2019-2020 The Linux Foundation. All rights reserved. */ /* Copyright (c) 2016, 2019-2021 The Linux Foundation. All rights reserved. */ #include <linux/clk.h> #include <linux/export.h> Loading @@ -15,6 +15,7 @@ #include "clk-regmap.h" #include "clk-debug.h" #include "common.h" #include "gdsc-debug.h" static struct clk_hw *measure; Loading Loading @@ -413,16 +414,22 @@ EXPORT_SYMBOL(map_debug_bases); /** * qcom_clk_dump - dump the HW specific registers associated with this clock * and regulator * @clk: clock source * @regulator: regulator * @calltrace: indicates whether calltrace is required * * This function attempts to print all the registers associated with the * clock and it's parents. * clock, it's parents and regulator. */ void qcom_clk_dump(struct clk *clk, bool calltrace) void qcom_clk_dump(struct clk *clk, struct regulator *regulator, bool calltrace) { struct clk_hw *hw; if (!IS_ERR_OR_NULL(regulator)) gdsc_debug_print_regs(regulator); if (IS_ERR_OR_NULL(clk)) return; Loading @@ -437,22 +444,27 @@ EXPORT_SYMBOL(qcom_clk_dump); /** * qcom_clk_bulk_dump - dump the HW specific registers associated with clocks * @clks: the clk_bulk_data table of consumer * and regulator * @num_clks: the number of clk_bulk_data * @clks: the clk_bulk_data table of consumer * @regulator: regulator source * @calltrace: indicates whether calltrace is required * * This function attempts to print all the registers associated with the * clock and it's parents for all the clocks in the list. * clocks in the list and regulator. */ void qcom_clk_bulk_dump(int num_clks, struct clk_bulk_data *clks, bool calltrace) struct regulator *regulator, bool calltrace) { int i; if (!IS_ERR_OR_NULL(regulator)) gdsc_debug_print_regs(regulator); if (IS_ERR_OR_NULL(clks)) return; for (i = 0; i < num_clks; i++) qcom_clk_dump(clks[i].clk, calltrace); qcom_clk_dump(clks[i].clk, NULL, calltrace); } EXPORT_SYMBOL(qcom_clk_bulk_dump); drivers/clk/qcom/gdsc-debug.h 0 → 100644 +11 −0 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. */ #ifndef __QCOM_GDSC_DEBUG_H__ #define __QCOM_GDSC_DEBUG_H__ void gdsc_debug_print_regs(struct regulator *regulator); #endif /* __QCOM_GDSC_DEBUG_H__ */ drivers/clk/qcom/gdsc-regulator.c +32 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ #include <linux/kernel.h> Loading @@ -22,6 +22,8 @@ #include <linux/clk/qcom.h> #include <dt-bindings/regulator/qcom,rpmh-regulator-levels.h> #include "../../regulator/internal.h" #include "gdsc-debug.h" /* GDSCR */ #define PWR_ON_MASK BIT(31) Loading Loading @@ -615,13 +617,38 @@ static struct regulator_ops gdsc_ops = { .get_mode = gdsc_get_mode, }; static const struct regmap_config gdsc_regmap_config = { static struct regmap_config gdsc_regmap_config = { .reg_bits = 32, .reg_stride = 4, .val_bits = 32, .max_register = 0x8, .fast_io = true, }; void gdsc_debug_print_regs(struct regulator *regulator) { struct gdsc *sc = rdev_get_drvdata(regulator->rdev); uint32_t regvals[3] = {0}; int ret; if (!sc) { pr_err("Failed to get GDSC Handle\n"); return; } ret = regmap_bulk_read(sc->regmap, REG_OFFSET, regvals, gdsc_regmap_config.max_register ? 3 : 1); if (ret) { pr_err("Failed to read %s registers\n", sc->rdesc.name); return; } pr_info("Dumping %s Registers:\n", sc->rdesc.name); pr_info("GDSCR: 0x%.8x CFG: 0x%.8x CFG2: 0x%.8x\n", regvals[0], regvals[1], regvals[2]); } EXPORT_SYMBOL(gdsc_debug_print_regs); static int gdsc_parse_dt_data(struct gdsc *sc, struct device *dev, struct regulator_init_data **init_data) { Loading Loading @@ -732,6 +759,9 @@ static int gdsc_get_resources(struct gdsc *sc, struct platform_device *pdev) if (sc->gdscr == NULL) return -ENOMEM; if (of_property_read_bool(dev->of_node, "qcom,no-config-gdscr")) gdsc_regmap_config.max_register = 0; sc->regmap = devm_regmap_init_mmio(dev, sc->gdscr, &gdsc_regmap_config); if (!sc->regmap) { dev_err(dev, "Couldn't get regmap\n"); Loading include/linux/clk/qcom.h +5 −3 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2016, 2020 The Linux Foundation. All rights reserved. * Copyright (c) 2016, 2020-2021 The Linux Foundation. All rights reserved. */ #ifndef __LINUX_CLK_QCOM_H_ #define __LINUX_CLK_QCOM_H_ #include <linux/clk.h> #include <linux/regulator/consumer.h> enum branch_mem_flags { CLKFLAG_RETAIN_PERIPH, Loading @@ -17,8 +18,9 @@ enum branch_mem_flags { CLKFLAG_PERIPH_OFF_CLEAR, }; void qcom_clk_dump(struct clk *clk, bool calltrace); void qcom_clk_bulk_dump(int num_clks, struct clk_bulk_data *clks, void qcom_clk_dump(struct clk *clk, struct regulator *regulator, bool calltrace); void qcom_clk_bulk_dump(int num_clks, struct clk_bulk_data *clks, struct regulator *regulator, bool calltrace); #endif /* __LINUX_CLK_QCOM_H_ */ Loading
drivers/clk/qcom/clk-debug.c +19 −7 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* Copyright (c) 2016, 2019-2020 The Linux Foundation. All rights reserved. */ /* Copyright (c) 2016, 2019-2021 The Linux Foundation. All rights reserved. */ #include <linux/clk.h> #include <linux/export.h> Loading @@ -15,6 +15,7 @@ #include "clk-regmap.h" #include "clk-debug.h" #include "common.h" #include "gdsc-debug.h" static struct clk_hw *measure; Loading Loading @@ -413,16 +414,22 @@ EXPORT_SYMBOL(map_debug_bases); /** * qcom_clk_dump - dump the HW specific registers associated with this clock * and regulator * @clk: clock source * @regulator: regulator * @calltrace: indicates whether calltrace is required * * This function attempts to print all the registers associated with the * clock and it's parents. * clock, it's parents and regulator. */ void qcom_clk_dump(struct clk *clk, bool calltrace) void qcom_clk_dump(struct clk *clk, struct regulator *regulator, bool calltrace) { struct clk_hw *hw; if (!IS_ERR_OR_NULL(regulator)) gdsc_debug_print_regs(regulator); if (IS_ERR_OR_NULL(clk)) return; Loading @@ -437,22 +444,27 @@ EXPORT_SYMBOL(qcom_clk_dump); /** * qcom_clk_bulk_dump - dump the HW specific registers associated with clocks * @clks: the clk_bulk_data table of consumer * and regulator * @num_clks: the number of clk_bulk_data * @clks: the clk_bulk_data table of consumer * @regulator: regulator source * @calltrace: indicates whether calltrace is required * * This function attempts to print all the registers associated with the * clock and it's parents for all the clocks in the list. * clocks in the list and regulator. */ void qcom_clk_bulk_dump(int num_clks, struct clk_bulk_data *clks, bool calltrace) struct regulator *regulator, bool calltrace) { int i; if (!IS_ERR_OR_NULL(regulator)) gdsc_debug_print_regs(regulator); if (IS_ERR_OR_NULL(clks)) return; for (i = 0; i < num_clks; i++) qcom_clk_dump(clks[i].clk, calltrace); qcom_clk_dump(clks[i].clk, NULL, calltrace); } EXPORT_SYMBOL(qcom_clk_bulk_dump);
drivers/clk/qcom/gdsc-debug.h 0 → 100644 +11 −0 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2021, The Linux Foundation. All rights reserved. */ #ifndef __QCOM_GDSC_DEBUG_H__ #define __QCOM_GDSC_DEBUG_H__ void gdsc_debug_print_regs(struct regulator *regulator); #endif /* __QCOM_GDSC_DEBUG_H__ */
drivers/clk/qcom/gdsc-regulator.c +32 −2 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved. */ #include <linux/kernel.h> Loading @@ -22,6 +22,8 @@ #include <linux/clk/qcom.h> #include <dt-bindings/regulator/qcom,rpmh-regulator-levels.h> #include "../../regulator/internal.h" #include "gdsc-debug.h" /* GDSCR */ #define PWR_ON_MASK BIT(31) Loading Loading @@ -615,13 +617,38 @@ static struct regulator_ops gdsc_ops = { .get_mode = gdsc_get_mode, }; static const struct regmap_config gdsc_regmap_config = { static struct regmap_config gdsc_regmap_config = { .reg_bits = 32, .reg_stride = 4, .val_bits = 32, .max_register = 0x8, .fast_io = true, }; void gdsc_debug_print_regs(struct regulator *regulator) { struct gdsc *sc = rdev_get_drvdata(regulator->rdev); uint32_t regvals[3] = {0}; int ret; if (!sc) { pr_err("Failed to get GDSC Handle\n"); return; } ret = regmap_bulk_read(sc->regmap, REG_OFFSET, regvals, gdsc_regmap_config.max_register ? 3 : 1); if (ret) { pr_err("Failed to read %s registers\n", sc->rdesc.name); return; } pr_info("Dumping %s Registers:\n", sc->rdesc.name); pr_info("GDSCR: 0x%.8x CFG: 0x%.8x CFG2: 0x%.8x\n", regvals[0], regvals[1], regvals[2]); } EXPORT_SYMBOL(gdsc_debug_print_regs); static int gdsc_parse_dt_data(struct gdsc *sc, struct device *dev, struct regulator_init_data **init_data) { Loading Loading @@ -732,6 +759,9 @@ static int gdsc_get_resources(struct gdsc *sc, struct platform_device *pdev) if (sc->gdscr == NULL) return -ENOMEM; if (of_property_read_bool(dev->of_node, "qcom,no-config-gdscr")) gdsc_regmap_config.max_register = 0; sc->regmap = devm_regmap_init_mmio(dev, sc->gdscr, &gdsc_regmap_config); if (!sc->regmap) { dev_err(dev, "Couldn't get regmap\n"); Loading
include/linux/clk/qcom.h +5 −3 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* * Copyright (c) 2016, 2020 The Linux Foundation. All rights reserved. * Copyright (c) 2016, 2020-2021 The Linux Foundation. All rights reserved. */ #ifndef __LINUX_CLK_QCOM_H_ #define __LINUX_CLK_QCOM_H_ #include <linux/clk.h> #include <linux/regulator/consumer.h> enum branch_mem_flags { CLKFLAG_RETAIN_PERIPH, Loading @@ -17,8 +18,9 @@ enum branch_mem_flags { CLKFLAG_PERIPH_OFF_CLEAR, }; void qcom_clk_dump(struct clk *clk, bool calltrace); void qcom_clk_bulk_dump(int num_clks, struct clk_bulk_data *clks, void qcom_clk_dump(struct clk *clk, struct regulator *regulator, bool calltrace); void qcom_clk_bulk_dump(int num_clks, struct clk_bulk_data *clks, struct regulator *regulator, bool calltrace); #endif /* __LINUX_CLK_QCOM_H_ */