forked from mirrors/linux
		
	 889c2b7ec4
			
		
	
	
		889c2b7ec4
		
	
	
	
	
		
			
			Initially, the meson clock directory only hosted 2 controllers drivers, for meson8 and gxbb. At the time, both used the same set of clock drivers so managing the dependencies was not a big concern. Since this ancient time, entropy did its job, controllers with different requirement and specific clock drivers have been added. Unfortunately, we did not do a great job at managing the dependencies between the controllers and the different clock drivers. Some drivers, such as clk-phase or vid-pll-div, are compiled even if they are useless on the target (meson8). As we are adding new controllers, we need to be able to pick a driver w/o pulling the whole thing. The patch aims to clean things up by: * providing a dedicated CONFIG_ for each clock drivers * allowing clock drivers to be compiled as a modules, if possible * stating explicitly which drivers are required by each controller. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Signed-off-by: Neil Armstrong <narmstrong@baylibre.com> Link: https://lkml.kernel.org/r/20190201125841.26785-5-jbrunet@baylibre.com
		
			
				
	
	
		
			49 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| // SPDX-License-Identifier: (GPL-2.0 OR MIT)
 | |
| /*
 | |
|  * Copyright (c) 2018 BayLibre, SAS.
 | |
|  * Author: Jerome Brunet <jbrunet@baylibre.com>
 | |
|  */
 | |
| 
 | |
| #include <linux/clk.h>
 | |
| #include <linux/clk-provider.h>
 | |
| #include <linux/device.h>
 | |
| #include <linux/module.h>
 | |
| #include "clk-input.h"
 | |
| 
 | |
| static const struct clk_ops meson_clk_no_ops = {};
 | |
| 
 | |
| struct clk_hw *meson_clk_hw_register_input(struct device *dev,
 | |
| 					   const char *of_name,
 | |
| 					   const char *clk_name,
 | |
| 					   unsigned long flags)
 | |
| {
 | |
| 	struct clk *parent_clk = devm_clk_get(dev, of_name);
 | |
| 	struct clk_init_data init;
 | |
| 	const char *parent_name;
 | |
| 	struct clk_hw *hw;
 | |
| 	int ret;
 | |
| 
 | |
| 	if (IS_ERR(parent_clk))
 | |
| 		return (struct clk_hw *)parent_clk;
 | |
| 
 | |
| 	hw = devm_kzalloc(dev, sizeof(*hw), GFP_KERNEL);
 | |
| 	if (!hw)
 | |
| 		return ERR_PTR(-ENOMEM);
 | |
| 
 | |
| 	parent_name = __clk_get_name(parent_clk);
 | |
| 	init.name = clk_name;
 | |
| 	init.ops = &meson_clk_no_ops;
 | |
| 	init.flags = flags;
 | |
| 	init.parent_names = &parent_name;
 | |
| 	init.num_parents = 1;
 | |
| 	hw->init = &init;
 | |
| 
 | |
| 	ret = devm_clk_hw_register(dev, hw);
 | |
| 
 | |
| 	return ret ? ERR_PTR(ret) : hw;
 | |
| }
 | |
| EXPORT_SYMBOL_GPL(meson_clk_hw_register_input);
 | |
| 
 | |
| MODULE_DESCRIPTION("Amlogic clock input helper");
 | |
| MODULE_AUTHOR("Jerome Brunet <jbrunet@baylibre.com>");
 | |
| MODULE_LICENSE("GPL v2");
 |