mfd:rk616:support power down in suspend,add config to enable/disable debug message
[firefly-linux-kernel-4.4.55.git] / drivers / mfd / rk616-core.c
old mode 100644 (file)
new mode 100755 (executable)
index 40b8d02..97d1b66
@@ -1,4 +1,3 @@
-
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/delay.h>
@@ -129,7 +128,6 @@ static ssize_t rk616_reg_write (struct file *file, const char __user *buf, size_
        if (copy_from_user(kbuf, buf, count))
                return -EFAULT;
        sscanf(kbuf, "%x%x", &reg,&val);
-       dev_dbg(rk616->dev,"%s:reg:0x%04x val:0x%08x\n",__func__,reg,val);
        rk616->write_dev(rk616,reg,&val);
        return count;
 }
@@ -244,7 +242,7 @@ static  int  rk616_pll_wait_lock(struct mfd_rk616 *rk616,int id)
                ret = rk616->read_dev(rk616,CRU_PLL0_CON1 + offset,&val);
                if (val&PLL0_LOCK)
                {
-                       dev_info(rk616->dev,"PLL%d locked\n",id);
+                       rk616_dbg(rk616->dev,"PLL%d locked\n",id);
                        break;
                }
                msleep(1);
@@ -252,7 +250,7 @@ static  int  rk616_pll_wait_lock(struct mfd_rk616 *rk616,int id)
        }
        if (delay == 0)
        {
-               printk(KERN_ALERT "rk616 wait PLL%d lock time out!\n",id);
+               dev_err(rk616->dev,"rk616 wait PLL%d lock time out!\n",id);
        }
 
        return 0;
@@ -385,7 +383,17 @@ static int rk616_clk_common_init(struct mfd_rk616 *rk616)
        return 0;
 }
 
+static int rk616_core_suspend(struct device *dev, pm_message_t state)
+{
+       return 0;       
+}
 
+static int rk616_core_resume(struct device* dev)
+{
+       struct mfd_rk616 *rk616 = dev_get_drvdata(dev);
+       rk616_clk_common_init(rk616);
+       return 0;
+}
 static int rk616_i2c_probe(struct i2c_client *client,const struct i2c_device_id *id)
 {
        int ret;
@@ -456,7 +464,6 @@ static int rk616_i2c_probe(struct i2c_client *client,const struct i2c_device_id
        ret = mfd_add_devices(rk616->dev, -1,
                                      rk616_devs, ARRAY_SIZE(rk616_devs),
                                      NULL, rk616->irq_base);
-       
        dev_info(&client->dev,"rk616 core probe success!\n");
        return 0;
 }
@@ -483,6 +490,8 @@ static struct i2c_driver rk616_i2c_driver  = {
        .driver = {
                .name  = "rk616",
                .owner = THIS_MODULE,
+               .suspend        = &rk616_core_suspend,
+               .resume         = &rk616_core_resume,
        },
        .probe          = &rk616_i2c_probe,
        .remove         = &rk616_i2c_remove,