Lines Matching +full:reg +full:- +full:mux

1 // SPDX-License-Identifier: GPL-2.0
9 #include <linux/clk-provider.h>
12 #include "mux.h"
15 const struct sprd_mux_ssel *mux) in sprd_mux_helper_get_parent() argument
17 unsigned int reg; in sprd_mux_helper_get_parent() local
22 regmap_read(common->regmap, common->reg, &reg); in sprd_mux_helper_get_parent()
23 parent = reg >> mux->shift; in sprd_mux_helper_get_parent()
24 parent &= (1 << mux->width) - 1; in sprd_mux_helper_get_parent()
26 if (!mux->table) in sprd_mux_helper_get_parent()
29 num_parents = clk_hw_get_num_parents(&common->hw); in sprd_mux_helper_get_parent()
31 for (i = 0; i < num_parents - 1; i++) in sprd_mux_helper_get_parent()
32 if (parent >= mux->table[i] && parent < mux->table[i + 1]) in sprd_mux_helper_get_parent()
35 return num_parents - 1; in sprd_mux_helper_get_parent()
43 return sprd_mux_helper_get_parent(&cm->common, &cm->mux); in sprd_mux_get_parent()
47 const struct sprd_mux_ssel *mux, in sprd_mux_helper_set_parent() argument
50 unsigned int reg; in sprd_mux_helper_set_parent() local
52 if (mux->table) in sprd_mux_helper_set_parent()
53 index = mux->table[index]; in sprd_mux_helper_set_parent()
55 regmap_read(common->regmap, common->reg, &reg); in sprd_mux_helper_set_parent()
56 reg &= ~GENMASK(mux->width + mux->shift - 1, mux->shift); in sprd_mux_helper_set_parent()
57 regmap_write(common->regmap, common->reg, in sprd_mux_helper_set_parent()
58 reg | (index << mux->shift)); in sprd_mux_helper_set_parent()
68 return sprd_mux_helper_set_parent(&cm->common, &cm->mux, index); in sprd_mux_set_parent()