Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 191a5717 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "clk: qcom: clk-debug: List regs only if respective clk is qcom-regmap clk"

parents 1ac67925 1e2d93e1
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2016, 2019, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2016, 2019-2020, The Linux Foundation. All rights reserved. */

#include <linux/clk.h>
#include <linux/export.h>
@@ -512,18 +512,20 @@ static const struct file_operations list_rates_fops = {

static void clk_debug_print_hw(struct clk_hw *hw, struct seq_file *f)
{
	struct clk_regmap *rclk = to_clk_regmap(hw);
	struct clk_regmap *rclk;

	if (IS_ERR_OR_NULL(hw))
		return;

	clk_debug_print_hw(clk_hw_get_parent(hw), f);

	seq_printf(f, "%s\n", clk_hw_get_name(hw));

	if (clk_is_regmap_clk(hw)) {
		rclk = to_clk_regmap(hw);
		if (rclk->ops && rclk->ops->list_registers)
			rclk->ops->list_registers(f, hw);
	}
}

static int print_hw_show(struct seq_file *m, void *unused)
{
+34 −1
Original line number Diff line number Diff line
@@ -10,6 +10,8 @@

#include "clk-regmap.h"

static LIST_HEAD(clk_regmap_list);

/**
 * clk_is_enabled_regmap - standard is_enabled() for regmap users
 *
@@ -230,6 +232,30 @@ void clk_unprepare_regmap(struct clk_hw *hw)
}
EXPORT_SYMBOL(clk_unprepare_regmap);

/**
 * clk_is_regmap_clk - Checks if clk is a regmap clk
 *
 * @hw: clk to check on
 *
 * Iterate over maintained clk regmap list to know
 * if concern clk is regmap
 *
 * Returns true on success, false otherwise.
 */
bool clk_is_regmap_clk(struct clk_hw *hw)
{
	struct clk_regmap *rclk;

	if (hw) {
		list_for_each_entry(rclk, &clk_regmap_list, list_node)
			if (&rclk->hw  == hw)
				return true;
	}

	return false;
}
EXPORT_SYMBOL(clk_is_regmap_clk);

/**
 * devm_clk_register_regmap - register a clk_regmap clock
 *
@@ -238,14 +264,21 @@ EXPORT_SYMBOL(clk_unprepare_regmap);
 * Clocks that use regmap for their register I/O should register their
 * clk_regmap struct via this function so that the regmap is initialized
 * and so that the clock is registered with the common clock framework.
 * Also maintain clk-regmap clks list for providers use.
 */
int devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk)
{
	int ret;

	if (dev && dev_get_regmap(dev, NULL))
		rclk->regmap = dev_get_regmap(dev, NULL);
	else if (dev && dev->parent)
		rclk->regmap = dev_get_regmap(dev->parent, NULL);

	return devm_clk_hw_register(dev, &rclk->hw);
	ret = devm_clk_hw_register(dev, &rclk->hw);
	if (!ret)
		list_add(&rclk->list_node, &clk_regmap_list);

	return ret;
}
EXPORT_SYMBOL_GPL(devm_clk_register_regmap);
+4 −1
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0-only */
/* Copyright (c) 2014, 2016-2019, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2014, 2016-2020, The Linux Foundation. All rights reserved. */

#ifndef __QCOM_CLK_REGMAP_H__
#define __QCOM_CLK_REGMAP_H__
@@ -49,6 +49,7 @@ struct clk_regmap {
	bool enable_is_inverted;
	struct clk_vdd_class_data vdd_data;
	struct clk_regmap_ops *ops;
	struct list_head list_node;
};
#define to_clk_regmap(_hw) container_of(_hw, struct clk_regmap, hw)

@@ -63,6 +64,8 @@ int clk_post_change_regmap(struct clk_hw *hw, unsigned long old_rate,
			unsigned long cur_rate);
int devm_clk_register_regmap(struct device *dev, struct clk_regmap *rclk);

bool clk_is_regmap_clk(struct clk_hw *hw);

struct clk_register_data {
	char *name;
	u32 offset;