root/drivers/clk/uniphier/clk-uniphier-fixed-factor.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. uniphier_clk_register_fixed_factor

   1 // SPDX-License-Identifier: GPL-2.0-or-later
   2 /*
   3  * Copyright (C) 2016 Socionext Inc.
   4  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
   5  */
   6 
   7 #include <linux/clk-provider.h>
   8 #include <linux/device.h>
   9 
  10 #include "clk-uniphier.h"
  11 
  12 struct clk_hw *uniphier_clk_register_fixed_factor(struct device *dev,
  13                                                   const char *name,
  14                         const struct uniphier_clk_fixed_factor_data *data)
  15 {
  16         struct clk_fixed_factor *fix;
  17         struct clk_init_data init;
  18         int ret;
  19 
  20         fix = devm_kzalloc(dev, sizeof(*fix), GFP_KERNEL);
  21         if (!fix)
  22                 return ERR_PTR(-ENOMEM);
  23 
  24         init.name = name;
  25         init.ops = &clk_fixed_factor_ops;
  26         init.flags = data->parent_name ? CLK_SET_RATE_PARENT : 0;
  27         init.parent_names = data->parent_name ? &data->parent_name : NULL;
  28         init.num_parents = data->parent_name ? 1 : 0;
  29 
  30         fix->mult = data->mult;
  31         fix->div = data->div;
  32         fix->hw.init = &init;
  33 
  34         ret = devm_clk_hw_register(dev, &fix->hw);
  35         if (ret)
  36                 return ERR_PTR(ret);
  37 
  38         return &fix->hw;
  39 }

/* [<][>][^][v][top][bottom][index][help] */