Projectname
large_stringclasses
15 values
Filepath
large_stringlengths
4
106
⌀
Function
large_stringlengths
11
3.45k
Label
list
Linux Kernel
drivers/clk/clk-cdce706.c
static int cdce706_register_plls(struct cdce706_dev_data *cdce) { struct clk_init_data init = { .ops = &cdce706_pll_ops, .parent_names = cdce706_clkin_name, .num_parents = ARRAY_SIZE(cdce706_clkin_name), }; unsigned i; int ret; unsigned mux; ret = cdce706_reg_read(cdce, CDCE706_PLL_MUX, ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-cdce706.c
static int cdce706_register_dividers(struct cdce706_dev_data *cdce) { struct clk_init_data init = { .ops = &cdce706_divider_ops, .parent_names = cdce706_divider_parent_name, .num_parents = ARRAY_SIZE(cdce706_divider_parent_name), .flags = CLK_SET_RATE_PARENT, }; unsigned i; int ret; ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-cdce925.c
static void cdce925_pll_find_rate(unsigned long rate, unsigned long parent_rate, u16 *n, u16 *m) { unsigned long un; unsigned long um; unsigned long g; if (rate <= parent_rate) { rate = parent_rate; *n = 0; *m = 0; } else { /* In PLL mode, need to apply min/...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-cdce925.c
static u8 cdce925_pll_calc_p(u16 n, u16 m) { u8 p; u16 r = n / m; if (r >= 16) return 0; p = 4; while (r > 1) { r >>= 1; --p; } return p; }
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-cdce925.c
static u16 cdce925_calc_divider(unsigned long rate, unsigned long parent_rate) { unsigned long divider; if (!rate) return 0; if (rate >= parent_rate) return 1; divider = DIV_ROUND_CLOSEST(parent_rate, rate); if (divider > 0x7F) divider = 0x7F; return (u16)divider; }
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-cdce925.c
static unsigned long cdce925_clk_best_parent_rate(struct clk_hw *hw, unsigned long rate) { struct clk *pll = clk_get_parent(hw->clk); struct clk *root = clk_get_parent(pll); unsigned long root_rate = clk_get_rate(root); unsigned long best_rate_error = rate; u1...
[ 1, 1 ]
Linux Kernel
drivers/clk/clk-cdce925.c
static u16 cdce925_y1_calc_divider(unsigned long rate, unsigned long parent_rate) { unsigned long divider; if (!rate) return 0; if (rate >= parent_rate) return 1; divider = DIV_ROUND_CLOSEST(parent_rate, rate); if (divider > 0x3FF) divider = 0x3FF; return (u...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-cdce925.c
static int cdce925_regmap_i2c_read(void *context, const void *reg, size_t reg_size, void *val, size_t val_size) { struct device *dev = context; struct i2c_client *i2c = to_i2c_client(dev); struct i2c_msg xfer[2]; int ret; u8 reg_data[2]; ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-composite.c
static u8 clk_composite_get_parent(struct clk_hw *hw) { struct clk_composite *composite = to_clk_composite(hw); const struct clk_ops *mux_ops = composite->mux_ops; struct clk_hw *mux_hw = composite->mux_hw; __clk_hw_set_clk(mux_hw, hw); return mux_ops->get_parent(mux_hw); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-composite.c
static long clk_composite_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) { struct clk_composite *composite = to_clk_composite(hw); const struct clk_ops *rate_ops = composite->rate_ops; struct clk_hw *rate_hw = composite->rate_hw; __clk_hw_set_clk(r...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-composite.c
static int clk_composite_is_enabled(struct clk_hw *hw) { struct clk_composite *composite = to_clk_composite(hw); const struct clk_ops *gate_ops = composite->gate_ops; struct clk_hw *gate_hw = composite->gate_hw; __clk_hw_set_clk(gate_hw, hw); return gate_ops->is_enabled(gate_hw); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-composite.c
static void clk_composite_disable(struct clk_hw *hw) { struct clk_composite *composite = to_clk_composite(hw); const struct clk_ops *gate_ops = composite->gate_ops; struct clk_hw *gate_hw = composite->gate_hw; __clk_hw_set_clk(gate_hw, hw); gate_ops->disable(gate_hw); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-composite.c
void clk_unregister_composite(struct clk *clk) { struct clk_composite *composite; struct clk_hw *hw; hw = __clk_get_hw(clk); if (!hw) return; composite = to_clk_composite(hw); clk_unregister(clk); kfree(composite); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-composite.c
static struct clk_hw *__devm_clk_hw_register_composite( struct device *dev, const char *name, const char *const *parent_names, const struct clk_parent_data *pdata, int num_parents, struct clk_hw *mux_hw, const struct clk_ops *mux_ops, struct clk_hw *rate_hw, const struct clk_ops *rate_ops, struct clk_h...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-conf.c
static int __set_clk_parents(struct device_node *node, bool clk_supplier) { struct of_phandle_args clkspec; int index, rc, num_parents; struct clk *clk, *pclk; num_parents = of_count_phandle_with_args(node, "assigned-clock-parents", "#clock-cells"); if (num_parents ...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-conf.c
static int __set_clk_rates(struct device_node *node, bool clk_supplier) { struct of_phandle_args clkspec; struct property *prop; const __be32 *cur; int rc, index = 0; struct clk *clk; u32 rate; of_property_for_each_u32(node, "assigned-clock-rates", prop, cur, rate) { if (rate) { rc = of_parse_p...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-conf.c
int of_clk_set_defaults(struct device_node *node, bool clk_supplier) { int rc; if (!node) return 0; rc = __set_clk_parents(node, clk_supplier); if (rc < 0) return rc; return __set_clk_rates(node, clk_supplier); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-cs2000-cp.c
static int cs2000_wait_pll_lock(struct cs2000_priv *priv) { struct device *dev = priv_to_dev(priv); unsigned int i, val; int ret; for (i = 0; i < 256; i++) { ret = regmap_read(priv->regmap, DEVICE_CTRL, &val); if (ret < 0) return ret; if (!(val & PLL_UNLOCK)) return 0; udelay(1); ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-cs2000-cp.c
static int cs2000_ratio_set(struct cs2000_priv *priv, int ch, u32 rate_in, u32 rate_out) { u32 val; unsigned int i; int ret; if (CH_SIZE_ERR(ch)) return -EINVAL; val = cs2000_rate_to_ratio(rate_in, rate_out, priv->lf_ratio); for (i = 0; i < RATIO_REG_SIZE; i++) { ret =...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-cs2000-cp.c
static int __cs2000_set_rate(struct cs2000_priv *priv, int ch, unsigned long rate, unsigned long parent_rate) { int ret; ret = regmap_update_bits(priv->regmap, GLOBAL_CFG, FREEZE, FREEZE); if (ret < 0) return ret; ret = cs2000_select_ratio_mode(priv, rate, parent_rate); if...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-cs2000-cp.c
static int cs2000_set_saved_rate(struct cs2000_priv *priv) { int ch = 0; return __cs2000_set_rate(priv, ch, priv->saved_rate, priv->saved_parent_rate); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-cs2000-cp.c
static int cs2000_version_print(struct cs2000_priv *priv) { struct device *dev = priv_to_dev(priv); const char *revision; unsigned int val; int ret; ret = regmap_read(priv->regmap, DEVICE_ID, &val); if (ret < 0) return ret; if (val >> 3) return -EIO; switch (val & REVISION_MASK) { case REVI...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-cs2000-cp.c
static void cs2000_remove(struct i2c_client *client) { struct cs2000_priv *priv = i2c_get_clientdata(client); struct device *dev = priv_to_dev(priv); struct device_node *np = dev->of_node; of_clk_del_provider(np); clk_hw_unregister(&priv->hw); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-devres.c
static int devm_clk_match(struct device *dev, void *res, void *data) { struct clk **c = res; if (!c || !*c) { WARN_ON(!c || !*c); return 0; } return *c == data; }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-devres.c
struct clk *devm_get_clk_from_child(struct device *dev, struct device_node *np, const char *con_id) { struct clk **ptr, *clk; ptr = devres_alloc(devm_clk_release, sizeof(*ptr), GFP_KERNEL); if (!ptr) return ERR_PTR(-ENOMEM); clk = of_clk_get_by_name(np, con_id); if (...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-divider.c
static unsigned int _get_table_div(const struct clk_div_table *table, unsigned int val) { const struct clk_div_table *clkt; for (clkt = table; clkt->div; clkt++) if (clkt->val == val) return clkt->div; return 0; }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-divider.c
static unsigned int _get_div(const struct clk_div_table *table, unsigned int val, unsigned long flags, u8 width) { if (flags & CLK_DIVIDER_ONE_BASED) return val; if (flags & CLK_DIVIDER_POWER_OF_TWO) return 1 << val; if (flags & CLK_DIVIDER_MAX_AT_ZERO) return val ? val :...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-divider.c
static int _div_round_closest(const struct clk_div_table *table, unsigned long parent_rate, unsigned long rate, unsigned long flags) { int up, down; unsigned long up_rate, down_rate; up = DIV_ROUND_UP_ULL((u64)parent_rate, rate); down = parent_rate /...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-divider.c
static int _div_round(const struct clk_div_table *table, unsigned long parent_rate, unsigned long rate, unsigned long flags) { if (flags & CLK_DIVIDER_ROUND_CLOSEST) return _div_round_closest(table, parent_rate, rate, flags); return _div_round_up(table, parent_rate,...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-divider.c
long divider_round_rate_parent(struct clk_hw *hw, struct clk_hw *parent, unsigned long rate, unsigned long *prate, const struct clk_div_table *table, u8 width, unsigned long flags) { struct clk_rate_request req; int ret; ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-divider.c
static int clk_divider_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) { struct clk_divider *divider = to_clk_divider(hw); if (divider->flags & CLK_DIVIDER_READ_ONLY) { u32 val; val = clk_div_readl(divider) >> divider->shift; val &= clk_div_mask(di...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-en7523.c
static unsigned int en7523_get_base_rate(void __iomem *base, unsigned int i) { const struct en_clk_desc *desc = &en7523_base_clks[i]; u32 val; if (!desc->base_bits) return desc->base_value; val = readl(base + desc->base_reg); val >>= desc->base_shift; val &= (1 << desc->base_bits) - 1; if (val >= ...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-en7523.c
static void en7523_pci_unprepare(struct clk_hw *hw) { struct en_clk_gate *cg = container_of(hw, struct en_clk_gate, hw); void __iomem *np_base = cg->base; u32 val; val = readl(np_base + REG_PCI_CONTROL); val &= ~REG_PCI_CONTROL_REFCLK_EN1; writel(val, np_base + REG_PCI_CONTROL); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-en7523.c
static void en7523_register_clocks(struct device *dev, struct clk_hw_onecell_data *clk_data, void __iomem *base, void __iomem *np_base) { struct clk_hw *hw; u32 rate; int i; for (i = 0; i < ARRAY_SIZE(en7523_base_clks); i++) { const str...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-en7523.c
static int en7523_clk_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; struct clk_hw_onecell_data *clk_data; void __iomem *base, *np_base; int r; base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(base)) return PTR_ERR(base); np_base = devm_platform_iorema...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fixed-factor.c
static long clk_factor_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) { struct clk_fixed_factor *fix = to_clk_fixed_factor(hw); if (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) { unsigned long best_parent; best_parent = (rate / fix->mult) * fix->d...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fixed-factor.c
static void devm_clk_hw_register_fixed_factor_release(struct device *dev, void *res) { struct clk_fixed_factor *fix = res; clk_hw_unregister(&fix->hw); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fixed-factor.c
static int of_fixed_factor_clk_probe(struct platform_device *pdev) { struct clk_hw *clk; clk = _of_fixed_factor_clk_setup(pdev->dev.of_node); if (IS_ERR(clk)) return PTR_ERR(clk); platform_set_drvdata(pdev, clk); return 0; }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fixed-mmio.c
static struct clk_hw *fixed_mmio_clk_setup(struct device_node *node) { struct clk_hw *clk; const char *clk_name = node->name; void __iomem *base; u32 freq; int ret; base = of_iomap(node, 0); if (!base) { pr_err("%pOFn: failed to map address\n", node); return ERR_PTR(-EIO); } freq = readl(ba...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fixed-mmio.c
static int of_fixed_mmio_clk_probe(struct platform_device *pdev) { struct clk_hw *clk; clk = fixed_mmio_clk_setup(pdev->dev.of_node); if (IS_ERR(clk)) return PTR_ERR(clk); platform_set_drvdata(pdev, clk); return 0; }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fixed-rate.c
static unsigned long clk_fixed_rate_recalc_accuracy(struct clk_hw *hw, unsigned long parent_accuracy) { struct clk_fixed_rate *fixed = to_clk_fixed_rate(hw); if (fixed->flags & CLK_FIXED_RATE_PARENT_ACCURACY) return parent_accuracy; return fixed->fixed_accuracy; }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fixed-rate.c
static void devm_clk_hw_register_fixed_rate_release(struct device *dev, void *res) { struct clk_fixed_rate *fix = res; clk_hw_unregister(&fix->hw); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fixed-rate.c
static struct clk_hw *_of_fixed_clk_setup(struct device_node *node) { struct clk_hw *hw; const char *clk_name = node->name; u32 rate; u32 accuracy = 0; int ret; if (of_property_read_u32(node, "clock-frequency", &rate)) return ERR_PTR(-EIO); of_property_read_u32(node, "clock-accuracy", &accuracy); ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fixed-rate.c
void __init of_fixed_clk_setup(struct device_node *node) { _of_fixed_clk_setup(node); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fractional-divider.c
static unsigned long clk_fd_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { struct u32_fract fract; u64 ret; clk_fd_get_div(hw, &fract); if (!fract.numerator || !fract.denominator) return parent_rate; ret = (u64)parent_rate * fract.numerator; do_di...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fractional-divider.c
static void clk_fd_debug_init(struct clk_hw *hw, struct dentry *dentry) { debugfs_create_file("numerator", 0444, dentry, hw, &clk_fd_numerator_fops); debugfs_create_file("denominator", 0444, dentry, hw, &clk_fd_denominator_fops); } #endif
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fractional-divider.c
void clk_hw_unregister_fractional_divider(struct clk_hw *hw) { struct clk_fractional_divider *fd; fd = to_clk_fd(hw); clk_hw_unregister(hw); kfree(fd); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-fsl-sai.c
static int fsl_sai_clk_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct fsl_sai_clk *sai_clk; struct clk_parent_data pdata = {.index = 0}; void __iomem *base; struct clk_hw *hw; struct resource *res; sai_clk = devm_kzalloc(dev, sizeof(*sai_clk), GFP_KERNEL); if (!sai_clk) ...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-gate.c
static void clk_gate_endisable(struct clk_hw *hw, int enable) { struct clk_gate *gate = to_clk_gate(hw); int set = gate->flags & CLK_GATE_SET_TO_DISABLE ? 1 : 0; unsigned long flags; u32 reg; set ^= enable; if (gate->lock) spin_lock_irqsave(gate->lock, flags); else __acquire(gate->lock); if (...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gate.c
void clk_hw_unregister_gate(struct clk_hw *hw) { struct clk_gate *gate; gate = to_clk_gate(hw); clk_hw_unregister(hw); kfree(gate); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gate_test.c
static void clk_gate_register_test_dev(struct kunit *test) { struct clk_hw *ret; struct platform_device *pdev; pdev = platform_device_register_simple("test_gate_device", -1, NULL, 0); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, pdev); ret = clk_hw_register_gate(&pdev->dev, "test_gate", NULL, 0, NULL, 0, 0, NU...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gate_test.c
static void clk_gate_test_parent_rate(struct kunit *test) { struct clk_gate_test_context *ctx = test->priv; struct clk_hw *parent = ctx->parent; struct clk_hw *hw = ctx->hw; unsigned long prate = clk_hw_get_rate(parent); unsigned long rate = clk_hw_get_rate(hw); KUNIT_EXPECT_EQ(test, prate, rate); }
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-gate_test.c
static void clk_gate_test_disable(struct kunit *test) { struct clk_gate_test_context *ctx = test->priv; struct clk_hw *parent = ctx->parent; struct clk_hw *hw = ctx->hw; struct clk *clk = hw->clk; u32 enable_val = BIT(5); u32 disable_val = 0; KUNIT_ASSERT_EQ(test, clk_prepare_enable(clk), 0); KUNIT_AS...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gate_test.c
static void clk_gate_test_invert_enable(struct kunit *test) { struct clk_gate_test_context *ctx = test->priv; struct clk_hw *parent = ctx->parent; struct clk_hw *hw = ctx->hw; struct clk *clk = hw->clk; u32 enable_val = 0; KUNIT_ASSERT_EQ(test, clk_prepare_enable(clk), 0); KUNIT_EXPECT_EQ(test, enable_...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gate_test.c
static void clk_gate_test_invert_disable(struct kunit *test) { struct clk_gate_test_context *ctx = test->priv; struct clk_hw *parent = ctx->parent; struct clk_hw *hw = ctx->hw; struct clk *clk = hw->clk; u32 enable_val = 0; u32 disable_val = BIT(15); KUNIT_ASSERT_EQ(test, clk_prepare_enable(clk), 0); ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gate_test.c
static void clk_gate_test_is_disabled(struct kunit *test) { struct clk_hw *hw; struct clk_gate_test_context *ctx; ctx = clk_gate_test_alloc_ctx(test); ctx->fake_reg = BIT(4); hw = clk_hw_register_gate(NULL, "test_gate", NULL, 0, ctx->fake_mem, 7, 0, NULL); KUNIT_ASSERT_NOT_ERR_...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gate_test.c
static void clk_gate_test_is_enabled_inverted(struct kunit *test) { struct clk_hw *hw; struct clk_gate_test_context *ctx; ctx = clk_gate_test_alloc_ctx(test); ctx->fake_reg = BIT(31); hw = clk_hw_register_gate(NULL, "test_gate", NULL, 0, ctx->fake_mem, 2, CLK_GATE_SET_TO_DISABLE,...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gemini.c
static int gemini_pci_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { struct clk_gemini_pci *pciclk = to_pciclk(hw); if (rate == 33000000) return regmap_update_bits(pciclk->map, GEMINI_GLOBAL_MISC_CONTROL, PCI_CLK_66MHZ,...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gemini.c
static struct clk_hw *gemini_pci_clk_setup(const char *name, const char *parent_name, struct regmap *map) { struct clk_gemini_pci *pciclk; struct clk_init_data init; int ret; pciclk = kzalloc(sizeof(*pciclk), GFP_KERNEL); ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gemini.c
static int gemini_reset_status(struct reset_controller_dev *rcdev, unsigned long id) { struct gemini_reset *gr = to_gemini_reset(rcdev); u32 val; int ret; ret = regmap_read(gr->map, GEMINI_GLOBAL_SOFT_RESET, &val); if (ret) return ret; return !!(val & BIT(id)); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gpio.c
static int clk_sleeping_gpio_gate_prepare(struct clk_hw *hw) { struct clk_gpio *clk = to_clk_gpio(hw); gpiod_set_value_cansleep(clk->gpiod, 1); return 0; }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gpio.c
static void clk_sleeping_gpio_gate_unprepare(struct clk_hw *hw) { struct clk_gpio *clk = to_clk_gpio(hw); gpiod_set_value_cansleep(clk->gpiod, 0); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gpio.c
static u8 clk_gpio_mux_get_parent(struct clk_hw *hw) { struct clk_gpio *clk = to_clk_gpio(hw); return gpiod_get_value_cansleep(clk->gpiod); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gpio.c
static int clk_gpio_mux_set_parent(struct clk_hw *hw, u8 index) { struct clk_gpio *clk = to_clk_gpio(hw); gpiod_set_value_cansleep(clk->gpiod, index); return 0; }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-gpio.c
static struct clk_hw *clk_hw_register_gpio_mux(struct device *dev, struct gpio_desc *gpiod) { return clk_register_gpio(dev, 2, gpiod, &clk_gpio_mux_ops); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-hi655x.c
static int hi655x_clk_prepare(struct clk_hw *hw) { return hi655x_clk_enable(hw, true); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-hi655x.c
static int hi655x_clk_is_prepared(struct clk_hw *hw) { struct hi655x_clk *hi655x_clk = container_of(hw, struct hi655x_clk, clk_hw); struct hi655x_pmic *hi655x = hi655x_clk->hi655x; int ret; uint32_t val; ret = regmap_read(hi655x->regmap, HI655X_CLK_BASE, &val); if (ret < 0) return ret; return val &...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-highbank.c
static int clk_pll_prepare(struct clk_hw *hwclk) { struct hb_clk *hbclk = to_hb_clk(hwclk); u32 reg; reg = readl(hbclk->reg); reg &= ~HB_PLL_RESET; writel(reg, hbclk->reg); while ((readl(hbclk->reg) & HB_PLL_LOCK) == 0) ; while ((readl(hbclk->reg) & HB_PLL_LOCK_500) == 0) ; return 0; }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-highbank.c
static int clk_pll_enable(struct clk_hw *hwclk) { struct hb_clk *hbclk = to_hb_clk(hwclk); u32 reg; reg = readl(hbclk->reg); reg |= HB_PLL_EXT_ENA; writel(reg, hbclk->reg); return 0; }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-highbank.c
static int clk_periclk_set_rate(struct clk_hw *hwclk, unsigned long rate, unsigned long parent_rate) { struct hb_clk *hbclk = to_hb_clk(hwclk); u32 div; div = parent_rate / rate; if (div & 0x1) return -EINVAL; writel(div >> 1, hbclk->reg); return 0; }
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-highbank.c
static void __init hb_a9bus_init(struct device_node *node) { hb_clk_init(node, &a9bclk_ops, CLK_IS_CRITICAL); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-hsdk-pll.c
static inline u32 hsdk_pll_read(struct hsdk_pll_clk *clk, u32 reg) { return ioread32(clk->regs + reg); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-hsdk-pll.c
static inline void hsdk_pll_set_cfg(struct hsdk_pll_clk *clk, const struct hsdk_pll_cfg *cfg) { u32 val = 0; if (cfg->bypass) { val = hsdk_pll_read(clk, CGU_PLL_CTRL); val |= CGU_PLL_CTRL_BYPASS; } else { val |= cfg->idiv << CGU_PLL_CTRL_IDIV_SHIFT; val |= cfg...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-hsdk-pll.c
static inline bool hsdk_pll_is_err(struct hsdk_pll_clk *clk) { return !!(hsdk_pll_read(clk, CGU_PLL_STATUS) & CGU_PLL_STATUS_ERR); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-hsdk-pll.c
static unsigned long hsdk_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { u32 val; u64 rate; u32 idiv, fbdiv, odiv; struct hsdk_pll_clk *clk = to_hsdk_pll_clk(hw); val = hsdk_pll_read(clk, CGU_PLL_CTRL); dev_dbg(clk->dev, "current configuration: %#...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-hsdk-pll.c
static int hsdk_pll_core_update_rate(struct hsdk_pll_clk *clk, unsigned long rate, const struct hsdk_pll_cfg *cfg) { if (rate > CORE_IF_CLK_THRESHOLD_HZ) iowrite32(CREG_CORE_IF_CLK_DIV_2, clk->spec_regs); hsdk_pll_set_cfg(clk, cfg); ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-hsdk-pll.c
static int hsdk_pll_set_rate(struct clk_hw *hw, unsigned long rate, unsigned long parent_rate) { int i; struct hsdk_pll_clk *clk = to_hsdk_pll_clk(hw); const struct hsdk_pll_cfg *pll_cfg = clk->pll_devdata->pll_cfg; for (i = 0; pll_cfg[i].rate != 0; i++) { if (pll_cfg[i].rate ...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-hsdk-pll.c
static void __init of_hsdk_pll_clk_setup(struct device_node *node) { int ret; const char *parent_name; unsigned int num_parents; struct hsdk_pll_clk *pll_clk; struct clk_init_data init = {}; pll_clk = kzalloc(sizeof(*pll_clk), GFP_KERNEL); if (!pll_clk) return; pll_clk->regs = of_iomap(node, 0); ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-k210.c
static void k210_init_pll(void __iomem *regs, enum k210_pll_id pllid, struct k210_pll *pll) { pll->id = pllid; pll->reg = regs + k210_plls_cfg[pllid].reg; pll->lock = regs + K210_SYSCTL_PLL_LOCK; pll->lock_shift = k210_plls_cfg[pllid].lock_shift; pll->lock_width = k210_plls_cfg[plli...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-k210.c
static void k210_pll_wait_for_lock(struct k210_pll *pll) { u32 reg, mask = GENMASK(pll->lock_shift + pll->lock_width - 1, pll->lock_shift); while (true) { reg = readl(pll->lock); if ((reg & mask) == mask) break; reg |= BIT(pll->lock_shift + K210_PLL_CLEAR_SLIP); writel(reg, pll->lock)...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-k210.c
static int k210_pll_enable(struct clk_hw *hw) { struct k210_pll *pll = to_k210_pll(hw); struct k210_sysclk *ksc = pll->ksc; unsigned long flags; spin_lock_irqsave(&ksc->clk_lock, flags); k210_pll_enable_hw(ksc->regs, pll); spin_unlock_irqrestore(&ksc->clk_lock, flags); return 0; }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-k210.c
static int k210_pll_is_enabled(struct clk_hw *hw) { return k210_pll_hw_is_enabled(to_k210_pll(hw)); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-k210.c
static unsigned long k210_pll_get_rate(struct clk_hw *hw, unsigned long parent_rate) { struct k210_pll *pll = to_k210_pll(hw); u32 reg = readl(pll->reg); u32 r, f, od; if (reg & K210_PLL_BYPASS) return parent_rate; if (!(reg & K210_PLL_PWRD)) return 0; r = ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-k210.c
static u8 k210_clk_get_parent(struct clk_hw *hw) { struct k210_clk *kclk = to_k210_clk(hw); struct k210_sysclk *ksc = kclk->ksc; struct k210_clk_cfg *cfg = &k210_clk_cfgs[kclk->id]; unsigned long flags; u32 reg, idx; spin_lock_irqsave(&ksc->clk_lock, flags); reg = readl(ksc->regs + cfg->mux_reg); idx ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-k210.c
static inline void __init k210_register_pll_child(struct device_node *np, struct k210_sysclk *ksc, int id, enum k210_pll_id pllid, ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-k210.c
static inline void __init k210_register_clk_child(struct device_node *np, struct k210_sysclk *ksc, int id, int parent_id) { const struct clk_parent_data parent_data = { .hw = &ksc->clks[parent_id].hw, }; k2...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-k210.c
static struct clk_hw *k210_clk_hw_onecell_get(struct of_phandle_args *clkspec, void *data) { struct k210_sysclk *ksc = data; unsigned int idx = clkspec->args[0]; if (idx >= K210_NUM_CLKS) return ERR_PTR(-EINVAL); return &ksc->clks[idx].hw; }
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-lan966x.c
static void lan966x_gck_disable(struct clk_hw *hw) { struct lan966x_gck *gck = to_lan966x_gck(hw); u32 val = readl(gck->reg); val &= ~GCK_ENA; writel(val, gck->reg); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-lan966x.c
static int lan966x_gck_determine_rate(struct clk_hw *hw, struct clk_rate_request *req) { struct clk_hw *parent; int i; for (i = 0; i < clk_hw_get_num_parents(hw); ++i) { parent = clk_hw_get_parent_by_index(hw, i); if (!parent) continue; if (clk_hw_get_rate...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-lmk04832.c
static void lmk04832_vco_unprepare(struct clk_hw *hw) { struct lmk04832 *lmk = container_of(hw, struct lmk04832, vco); regmap_update_bits(lmk->regmap, LMK04832_REG_PLL2_PD, LMK04832_BIT_PLL2_PRE_PD | LMK04832_BIT_PLL2_PD, 0xff); regmap_update_bits(lmk->regmap, LMK04832_REG_MAIN_PD, ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-lmk04832.c
static unsigned long lmk04832_vco_recalc_rate(struct clk_hw *hw, unsigned long prate) { struct lmk04832 *lmk = container_of(hw, struct lmk04832, vco); const unsigned int pll2_p[] = {8, 2, 2, 3, 4, 5, 6, 7}; unsigned int pll2_n, p, pll2_r; unsigned int pll2_misc; ...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-lmk04832.c
static long lmk04832_calc_pll2_params(unsigned long prate, unsigned long rate, unsigned int *n, unsigned int *p, unsigned int *r) { unsigned int pll2_n, pll2_p, pll2_r; unsigned long num, div; pll2_p = 2; div = gcd(rate, prate); nu...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-lmk04832.c
static int lmk04832_sclk_is_enabled(struct clk_hw *hw) { struct lmk04832 *lmk = container_of(hw, struct lmk04832, sclk); unsigned int tmp; int ret; ret = regmap_read(lmk->regmap, LMK04832_REG_MAIN_PD, &tmp); if (ret) return ret; return FIELD_GET(LMK04832_BIT_SYSREF_PD, tmp); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-lmk04832.c
static int lmk04832_sclk_prepare(struct clk_hw *hw) { struct lmk04832 *lmk = container_of(hw, struct lmk04832, sclk); return regmap_update_bits(lmk->regmap, LMK04832_REG_MAIN_PD, LMK04832_BIT_SYSREF_PD, 0x00); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-lmk04832.c
static long lmk04832_sclk_round_rate(struct clk_hw *hw, unsigned long rate, unsigned long *prate) { struct lmk04832 *lmk = container_of(hw, struct lmk04832, sclk); unsigned long sclk_rate; unsigned int sysref_div; sysref_div = DIV_ROUND_CLOSEST(*prate, rate); sclk_rate =...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-lmk04832.c
static int lmk04832_clkout_set_parent(struct clk_hw *hw, uint8_t index) { struct lmk_clkout *clkout = container_of(hw, struct lmk_clkout, hw); struct lmk04832 *lmk = clkout->lmk; return regmap_update_bits(lmk->regmap, LMK04832_REG_CLKOUT_SRC_MUX(clkout->id), ...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-lochnagar.c
static int lochnagar_clk_set_parent(struct clk_hw *hw, u8 index) { struct lochnagar_clk *lclk = lochnagar_hw_to_lclk(hw); struct lochnagar_clk_priv *priv = lclk->priv; struct regmap *regmap = priv->regmap; int ret; ret = regmap_update_bits(regmap, lclk->src_reg, lclk->src_mask, index); if (ret < 0) de...
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-lochnagar.c
static int lochnagar_clk_probe(struct platform_device *pdev) { struct clk_init_data clk_init = { .ops = &lochnagar_clk_ops, }; struct device *dev = &pdev->dev; struct lochnagar_clk_priv *priv; const struct of_device_id *of_id; struct lochnagar_clk *lclk; struct lochnagar_config *conf; int ret, i;...
[ 1, 0 ]
Linux Kernel
drivers/clk/clk-max9485.c
static void max9485_clk_unprepare(struct clk_hw *hw) { struct max9485_clk_hw *clk_hw = to_max9485_clk(hw); max9485_update_bits(clk_hw->drvdata, clk_hw->enable_bit, 0); }
[ 0, 0 ]
Linux Kernel
drivers/clk/clk-max9485.c
static unsigned long max9485_clkout_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { struct max9485_clk_hw *clk_hw = to_max9485_clk(hw); struct max9485_driver_data *drvdata = clk_hw->drvdata; u8 val = drvdata->reg_value & MAX9485_FREQ_MASK; const struc...
[ 0, 0 ]