Advertisement
arter97

Untitled

Oct 21st, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.94 KB | None | 0 0
  1. diff --git a/drivers/fih/fpcfingerprint_tee/fpc1020_tee.c b/drivers/fih/fpcfingerprint_tee/fpc1020_tee.c
  2. index bbd99b5..de664b1 100755
  3. --- a/drivers/fih/fpcfingerprint_tee/fpc1020_tee.c
  4. +++ b/drivers/fih/fpcfingerprint_tee/fpc1020_tee.c
  5. @@ -32,11 +32,13 @@
  6.  
  7.  #include <linux/clk.h>
  8.  #include <linux/delay.h>
  9. +#include <linux/fb.h>
  10.  #include <linux/gpio.h>
  11.  #include <linux/interrupt.h>
  12.  #include <linux/kernel.h>
  13.  #include <linux/module.h>
  14.  #include <linux/mutex.h>
  15. +#include <linux/notifier.h>
  16.  #include <linux/of.h>
  17.  #include <linux/of_gpio.h>
  18.  #include <linux/regulator/consumer.h>
  19. @@ -87,6 +89,7 @@ struct fpc1020_data {
  20.     struct clk *iface_clk;
  21.     struct clk *core_clk;
  22.     struct regulator *vreg[ARRAY_SIZE(vreg_conf)];
  23. +   struct notifier_block fb_notif;
  24.  
  25.      struct wake_lock ttw_wl;
  26.     int irq_gpio;
  27. @@ -646,6 +649,33 @@ static const struct attribute_group attribute_group = {
  28.     .attrs = attributes,
  29.  };
  30.  
  31. +static int fb_notifier_callback(struct notifier_block *self, unsigned long event, void *data)
  32. +{
  33. +   struct fpc1020_data *fpc1020 = container_of(self, struct fpc1020_data, fb_notif);
  34. +   struct fb_event *evdata = data;
  35. +
  36. +   if ((event == FB_EVENT_BLANK) && evdata && evdata->data) {
  37. +       int blank = *(int *)evdata->data;
  38. +
  39. +       switch (blank) {
  40. +       case FB_BLANK_POWERDOWN:
  41. +           pr_info("fpc1020: suspending++\n");
  42. +           fpc1020->clocks_suspended = fpc1020->clocks_enabled;
  43. +           set_clks(fpc1020, false);
  44. +           pr_info("fpc1020: suspended --\n");
  45. +           break;
  46. +       case FB_BLANK_UNBLANK:
  47. +           pr_info("fpc1020: resuming++\n");
  48. +           if (fpc1020->clocks_suspended)
  49. +               set_clks(fpc1020, true);
  50. +           pr_info("fpc1020: resumed --\n");
  51. +           break;
  52. +       }
  53. +   }
  54. +
  55. +   return NOTIFY_OK;
  56. +}
  57. +
  58.  static irqreturn_t fpc1020_irq_handler(int irq, void *handle)
  59.  {
  60.     struct fpc1020_data *fpc1020 = handle;
  61. @@ -845,6 +875,13 @@ static int fpc1020_probe(struct spi_device *spi)
  62.         goto exit;
  63.     }
  64.  
  65. +   fpc1020->fb_notif.notifier_call = fb_notifier_callback;
  66. +   rc = fb_register_client(&fpc1020->fb_notif);
  67. +   if (rc) {
  68. +       dev_err(fpc1020->dev, "Unable to register fb_notifier: %d\n", rc);
  69. +       goto exit;
  70. +   }
  71. +
  72.     if (of_property_read_bool(dev->of_node, "fpc,enable-on-boot")) {
  73.         dev_info(dev, "Enabling hardware\n");
  74.         (void)device_prepare(fpc1020, true);
  75. @@ -870,6 +907,7 @@ static int fpc1020_remove(struct spi_device *spi)
  76.     return 0;
  77.  }
  78.  
  79. +#if 0
  80.  static int fpc1020_suspend(struct device *dev)
  81.  {
  82.     struct fpc1020_data *fpc1020 = dev_get_drvdata(dev);
  83. @@ -893,6 +931,7 @@ static const struct dev_pm_ops fpc1020_pm_ops = {
  84.     .suspend = fpc1020_suspend,
  85.     .resume = fpc1020_resume,
  86.  };
  87. +#endif
  88.  
  89.  static struct of_device_id fpc1020_of_match[] = {
  90.     { .compatible = "fpc,fpc1020", },
  91. @@ -905,7 +944,7 @@ static struct spi_driver fpc1020_driver = {
  92.         .name   = "fpc1020",
  93.         .owner  = THIS_MODULE,
  94.         .of_match_table = fpc1020_of_match,
  95. -       .pm = &fpc1020_pm_ops,
  96. +       //.pm = &fpc1020_pm_ops,
  97.     },
  98.     .probe      = fpc1020_probe,
  99.     .remove     = fpc1020_remove,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement