Example #1
0
/**
 * sr_class1p5_driver_init() - register class 1p5 as default
 *
 * board files call this function to use class 1p5, we register with the
 * smartreflex subsystem
 */
static int __init sr_class1p5_driver_init(void)
{
	int r;

	/* Enable this class only for OMAP3630 and OMAP4 */
	if (!(cpu_is_omap3630() || cpu_is_omap44xx()))
		return -EINVAL;

	r = sr_register_class(&class1p5_data);
	if (r) {
		pr_err("SmartReflex class 1.5 driver: "
		       "failed to register with %d\n", r);
	} else {
#if CONFIG_OMAP_SR_CLASS1P5_RECALIBRATION_DELAY
		INIT_DELAYED_WORK_DEFERRABLE(&recal_work,
					     sr_class1p5_recal_work);
		schedule_delayed_work(&recal_work,
			      msecs_to_jiffies
			      (CONFIG_OMAP_SR_CLASS1P5_RECALIBRATION_DELAY));
#endif
		pr_info("SmartReflex class 1.5 driver: initialized (%dms)\n",
			CONFIG_OMAP_SR_CLASS1P5_RECALIBRATION_DELAY);
	}
	return r;
}
/* Smartreflex Class3 init API to be called from board file */
static int __init sr_class3_init(void)
{
	/* Enable this class only for OMAP343x and OMAP443x */
	if (!cpu_is_omap343x() && !cpu_is_omap443x())
		return -EINVAL;

	pr_info("SmartReflex Class3 initialized\n");
	return sr_register_class(&class3_data);
}
static int __init sr_classp5_driver_init(void)
{
	int ret = -EINVAL;
	char *name = "1.5";

	/* Enable this class only for OMAP3630 and OMAP4, OMAP5 */
	if (!(cpu_is_omap3630() || cpu_is_omap44xx() || cpu_is_omap54xx()))
		return -EINVAL;

	ret = sr_register_class(&classp5_data);
	if (ret) {
		pr_err("SmartReflex Class %s:"
		       "failed to register with %d\n", name, ret);
	} else {
		sr_classp5_recal_init();
		pr_info("SmartReflex Class %s initialized\n", name);
	}
	return ret;
}
/* Smartreflex Class3 init API to be called from board file */
static int __init sr_class3_init(void)
{
	pr_info("SmartReflex Class3 initialized\n");
	return sr_register_class(&class3_data);
}