Esempio n. 1
0
/**
 * cg2900_core_probe() - Initialize resources.
 *
 * Function initializes pf_data structure and also adds the cg2900
 * clock source.
 */
static int __devinit cg2900_core_probe(struct platform_device *pdev)
{
	cg2900_clk_lookup = clkdev_alloc(&cg2900_clk, "sys_clk_out",
			"cw1200_wlan");

	if (!cg2900_clk_lookup)
		return -ENOMEM;

	clkdev_add(cg2900_clk_lookup);
	pf_data = dev_get_platdata(&pdev->dev);
	pf_data->dev = &pdev->dev;
	pf_data->read_cb = cg2900_read_cb;

	return 0;
}
Esempio n. 2
0
static int __init migor_init(void)
{
	int ret;

	ret = clk_register(&siumckb_clk);
	if (ret < 0)
		return ret;

	siumckb_lookup = clkdev_alloc(&siumckb_clk, "siumckb_clk", NULL);
	if (!siumckb_lookup) {
		ret = -ENOMEM;
		goto eclkdevalloc;
	}
	clkdev_add(siumckb_lookup);

	/* Port number used on this machine: port B */
	migor_snd_device = platform_device_alloc("soc-audio", 1);
	if (!migor_snd_device) {
		ret = -ENOMEM;
		goto epdevalloc;
	}

	platform_set_drvdata(migor_snd_device, &snd_soc_migor);

	ret = platform_device_add(migor_snd_device);
	if (ret)
		goto epdevadd;

	return 0;

epdevadd:
	platform_device_put(migor_snd_device);
epdevalloc:
	clkdev_drop(siumckb_lookup);
eclkdevalloc:
	clk_unregister(&siumckb_clk);
	return ret;
}
Esempio n. 3
0
static void _add_clkdev(struct omap_device *od, const char *clk_alias,
		       const char *clk_name)
{
	struct clk *r;
	struct clk_lookup *l;

	if (!clk_alias || !clk_name)
		return;

	pr_debug("omap_device: %s: Creating %s -> %s\n",
		 dev_name(&od->pdev.dev), clk_alias, clk_name);

	r = clk_get_sys(dev_name(&od->pdev.dev), clk_alias);
	if (!IS_ERR(r)) {
		pr_warning("omap_device: %s: alias %s already exists\n",
			   dev_name(&od->pdev.dev), clk_alias);
		clk_put(r);
		return;
	}

	r = omap_clk_get_by_name(clk_name);
	if (IS_ERR(r)) {
		pr_err("omap_device: %s: omap_clk_get_by_name for %s failed\n",
		       dev_name(&od->pdev.dev), clk_name);
		return;
	}

	l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev.dev));
	if (!l) {
		pr_err("omap_device: %s: clkdev_alloc for %s failed\n",
		       dev_name(&od->pdev.dev), clk_alias);
		return;
	}

	clkdev_add(l);
}