mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 20:32:04 +09:00
Revert "regulator: rk29-pwm: fix sleep in atomic"
This reverts commit 045e8a7d9e.
The patch isn't the right way to fix this problem.
This commit is contained in:
@@ -1,49 +1,48 @@
|
||||
/* drivers/regulator/rk29-pwm-regulator.c
|
||||
*
|
||||
* Copyright (C) 2010 ROCKCHIP, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
/*******************************************************************/
|
||||
/* COPYRIGHT (C) ROCK-CHIPS FUZHOU . ALL RIGHTS RESERVED. */
|
||||
/*******************************************************************
|
||||
*
|
||||
* Copyright (C) 2010 ROCKCHIP, Inc.
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
/*******************************************************************/
|
||||
/* COPYRIGHT (C) ROCK-CHIPS FUZHOU . ALL RIGHTS RESERVED. */
|
||||
/*******************************************************************
|
||||
FILE : rk29-pwm-regulator.c
|
||||
DESC : rk29 pwm regulator driver
|
||||
AUTHOR : hxy
|
||||
DATE : 2010-12-20
|
||||
NOTES :
|
||||
$LOG: GPIO.C,V $
|
||||
REVISION 0.01
|
||||
********************************************************************/
|
||||
|
||||
|
||||
#include <linux/bug.h>
|
||||
NOTES :
|
||||
$LOG: GPIO.C,V $
|
||||
REVISION 0.01
|
||||
********************************************************************/
|
||||
|
||||
|
||||
#include <linux/bug.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/clk.h>
|
||||
#include <asm/io.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/regulator/driver.h>
|
||||
#include <linux/regulator/driver.h>
|
||||
#include <linux/regulator/rk29-pwm-regulator.h>
|
||||
#include <mach/iomux.h>
|
||||
#include <linux/gpio.h>
|
||||
|
||||
|
||||
#if 0
|
||||
#define DBG(x...) printk(KERN_INFO x)
|
||||
#else
|
||||
#define DBG(x...)
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
#define DBG(x...) printk(KERN_INFO x)
|
||||
#else
|
||||
#define DBG(x...)
|
||||
#endif
|
||||
|
||||
|
||||
#define PWM_VCORE_120 40
|
||||
@@ -102,10 +101,7 @@ static int pwm_set_rate(struct pwm_platform_data *pdata,int nHz,u32 rate)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (in_atomic() || irqs_disabled())
|
||||
mdelay(10);
|
||||
else
|
||||
usleep_range(10*1000, 10*1000);
|
||||
usleep_range(10*1000, 10*1000);
|
||||
|
||||
|
||||
return (0);
|
||||
@@ -124,20 +120,20 @@ static int pwm_regulator_is_enabled(struct regulator_dev *dev)
|
||||
{
|
||||
DBG("Enter %s\n",__FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int pwm_regulator_enable(struct regulator_dev *dev)
|
||||
{
|
||||
DBG("Enter %s\n",__FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int pwm_regulator_disable(struct regulator_dev *dev)
|
||||
{
|
||||
DBG("Enter %s\n",__FUNCTION__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int pwm_regulator_get_voltage(struct regulator_dev *dev)
|
||||
{
|
||||
struct pwm_platform_data *pdata = rdev_get_drvdata(dev);
|
||||
@@ -145,8 +141,8 @@ static int pwm_regulator_get_voltage(struct regulator_dev *dev)
|
||||
DBG("Enter %s\n",__FUNCTION__);
|
||||
|
||||
return (pdata->pwm_voltage*1000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int pwm_regulator_set_voltage(struct regulator_dev *dev,
|
||||
int min_uV, int max_uV)
|
||||
{
|
||||
@@ -161,14 +157,14 @@ static int pwm_regulator_set_voltage(struct regulator_dev *dev,
|
||||
DBG("%s: min_uV = %d, max_uV = %d\n",__FUNCTION__, min_uV,max_uV);
|
||||
|
||||
if (min_mV < voltage_map[0] ||max_mA > voltage_map[size-1])
|
||||
return -EINVAL;
|
||||
|
||||
return -EINVAL;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
{
|
||||
if (voltage_map[i] >= min_mV)
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
vol = voltage_map[i];
|
||||
|
||||
@@ -183,8 +179,8 @@ static int pwm_regulator_set_voltage(struct regulator_dev *dev,
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static struct regulator_ops pwm_voltage_ops = {
|
||||
.list_voltage = pwm_regulator_list_voltage,
|
||||
.set_voltage =pwm_regulator_set_voltage,
|
||||
@@ -193,30 +189,30 @@ static struct regulator_ops pwm_voltage_ops = {
|
||||
.disable = pwm_regulator_disable,
|
||||
.is_enabled = pwm_regulator_is_enabled,
|
||||
};
|
||||
|
||||
|
||||
static struct regulator_desc pwm_regulator= {
|
||||
.name = "pwm-regulator",
|
||||
.ops = &pwm_voltage_ops,
|
||||
.type = REGULATOR_VOLTAGE,
|
||||
};
|
||||
|
||||
|
||||
static int __devinit pwm_regulator_probe(struct platform_device *pdev)
|
||||
{
|
||||
|
||||
struct pwm_platform_data *pdata = pdev->dev.platform_data;
|
||||
struct regulator_dev *rdev;
|
||||
int ret ;
|
||||
|
||||
if (!pdata)
|
||||
return -ENODEV;
|
||||
|
||||
if (!pdata->pwm_voltage)
|
||||
pdata->pwm_voltage = 1200; // default 1.2v
|
||||
|
||||
|
||||
if (!pdata)
|
||||
return -ENODEV;
|
||||
|
||||
if (!pdata->pwm_voltage)
|
||||
pdata->pwm_voltage = 1200; // default 1.2v
|
||||
|
||||
rdev = regulator_register(&pwm_regulator, &pdev->dev,
|
||||
pdata->init_data, pdata);
|
||||
if (IS_ERR(rdev)) {
|
||||
dev_dbg(&pdev->dev, "couldn't register regulator\n");
|
||||
dev_dbg(&pdev->dev, "couldn't register regulator\n");
|
||||
return PTR_ERR(rdev);
|
||||
}
|
||||
|
||||
@@ -243,7 +239,7 @@ err_gpio:
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
}
|
||||
static int __devexit pwm_regulator_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct pwm_platform_data *pdata = pdev->dev.platform_data;
|
||||
@@ -261,23 +257,23 @@ static struct platform_driver pwm_regulator_driver = {
|
||||
},
|
||||
.remove = __devexit_p(pwm_regulator_remove),
|
||||
};
|
||||
|
||||
|
||||
|
||||
static int __init pwm_regulator_module_init(void)
|
||||
{
|
||||
{
|
||||
return platform_driver_probe(&pwm_regulator_driver, pwm_regulator_probe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void __exit pwm_regulator_module_exit(void)
|
||||
{
|
||||
{
|
||||
platform_driver_unregister(&pwm_regulator_driver);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
subsys_initcall(pwm_regulator_module_init);
|
||||
|
||||
module_exit(pwm_regulator_module_exit);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_AUTHOR("hxy <hxy@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("k29 pwm change driver");
|
||||
|
||||
Reference in New Issue
Block a user