drivers/clk/actions/owl-composite.c

Source file repositories/reference/linux-study-clean/drivers/clk/actions/owl-composite.c

File Facts

System
Linux kernel
Corpus path
drivers/clk/actions/owl-composite.c
Extension
.c
Size
5279 bytes
Lines
208
Domain
Driver Families
Bucket
drivers/clk
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0+
//
// OWL composite clock driver
//
// Copyright (c) 2014 Actions Semi Inc.
// Author: David Liu <liuwei@actions-semi.com>
//
// Copyright (c) 2018 Linaro Ltd.
// Author: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

#include <linux/clk-provider.h>
#include <linux/regmap.h>

#include "owl-composite.h"

static u8 owl_comp_get_parent(struct clk_hw *hw)
{
	struct owl_composite *comp = hw_to_owl_comp(hw);

	return owl_mux_helper_get_parent(&comp->common, &comp->mux_hw);
}

static int owl_comp_set_parent(struct clk_hw *hw, u8 index)
{
	struct owl_composite *comp = hw_to_owl_comp(hw);

	return owl_mux_helper_set_parent(&comp->common, &comp->mux_hw, index);
}

static void owl_comp_disable(struct clk_hw *hw)
{
	struct owl_composite *comp = hw_to_owl_comp(hw);
	struct owl_clk_common *common = &comp->common;

	owl_gate_set(common, &comp->gate_hw, false);
}

static int owl_comp_enable(struct clk_hw *hw)
{
	struct owl_composite *comp = hw_to_owl_comp(hw);
	struct owl_clk_common *common = &comp->common;

	owl_gate_set(common, &comp->gate_hw, true);

	return 0;
}

static int owl_comp_is_enabled(struct clk_hw *hw)
{
	struct owl_composite *comp = hw_to_owl_comp(hw);
	struct owl_clk_common *common = &comp->common;

	return owl_gate_clk_is_enabled(common, &comp->gate_hw);
}

static int owl_comp_div_determine_rate(struct clk_hw *hw,
				       struct clk_rate_request *req)
{
	struct owl_composite *comp = hw_to_owl_comp(hw);
	struct owl_divider_hw *div = &comp->rate.div_hw;

	return divider_determine_rate(&comp->common.hw, req, div->table,
				      div->width, div->div_flags);
}

static unsigned long owl_comp_div_recalc_rate(struct clk_hw *hw,
					  unsigned long parent_rate)
{
	struct owl_composite *comp = hw_to_owl_comp(hw);

	return owl_divider_helper_recalc_rate(&comp->common, &comp->rate.div_hw,
					parent_rate);
}

static int owl_comp_div_set_rate(struct clk_hw *hw, unsigned long rate,
				unsigned long parent_rate)
{
	struct owl_composite *comp = hw_to_owl_comp(hw);

	return owl_divider_helper_set_rate(&comp->common, &comp->rate.div_hw,
					rate, parent_rate);
}

static int owl_comp_fact_determine_rate(struct clk_hw *hw,
					struct clk_rate_request *req)
{
	struct owl_composite *comp = hw_to_owl_comp(hw);
	long rate;

	rate = owl_factor_helper_round_rate(&comp->common,

Annotation

Implementation Notes