dataOperationOfSprayterminal.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * twl-common.c
  3. *
  4. * Copyright (C) 2011 Texas Instruments, Inc..
  5. * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * version 2 as published by the Free Software Foundation.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  19. * 02110-1301 USA
  20. *
  21. */
  22. #include <linux/i2c.h>
  23. #include <linux/i2c/twl.h>
  24. #include <linux/gpio.h>
  25. #include <linux/regulator/machine.h>
  26. #include <linux/regulator/fixed.h>
  27. #include "soc.h"
  28. #include "twl-common.h"
  29. #include "pm.h"
  30. #include "voltage.h"
  31. #include "mux.h"
  32. static struct i2c_board_info __initdata pmic_i2c_board_info = {
  33. .addr = 0x48,
  34. .flags = I2C_CLIENT_WAKE,
  35. };
  36. #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
  37. static int twl_set_voltage(void *data, int target_uV)
  38. {
  39. struct voltagedomain *voltdm = (struct voltagedomain *)data;
  40. return voltdm_scale(voltdm, target_uV);
  41. }
  42. static int twl_get_voltage(void *data)
  43. {
  44. struct voltagedomain *voltdm = (struct voltagedomain *)data;
  45. return voltdm_get_voltage(voltdm);
  46. }
  47. #endif
  48. void __init omap_pmic_init(int bus, u32 clkrate,
  49. const char *pmic_type, int pmic_irq,
  50. struct twl4030_platform_data *pmic_data)
  51. {
  52. omap_mux_init_signal("sys_nirq", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
  53. strncpy(pmic_i2c_board_info.type, pmic_type,
  54. sizeof(pmic_i2c_board_info.type));
  55. pmic_i2c_board_info.irq = pmic_irq;
  56. pmic_i2c_board_info.platform_data = pmic_data;
  57. omap_register_i2c_bus(bus, clkrate, &pmic_i2c_board_info, 1);
  58. }
  59. void __init omap4_pmic_init(const char *pmic_type,
  60. struct twl4030_platform_data *pmic_data,
  61. struct i2c_board_info *devices, int nr_devices)
  62. {
  63. /* PMIC part*/
  64. omap_mux_init_signal("sys_nirq1", OMAP_PIN_INPUT_PULLUP | OMAP_PIN_OFF_WAKEUPENABLE);
  65. omap_mux_init_signal("fref_clk0_out.sys_drm_msecure", OMAP_PIN_OUTPUT);
  66. omap_pmic_init(1, 400, pmic_type, 7 + OMAP44XX_IRQ_GIC_START, pmic_data);
  67. /* Register additional devices on i2c1 bus if needed */
  68. if (devices)
  69. i2c_register_board_info(1, devices, nr_devices);
  70. }
  71. void __init omap_pmic_late_init(void)
  72. {
  73. /* Init the OMAP TWL parameters (if PMIC has been registerd) */
  74. if (!pmic_i2c_board_info.irq)
  75. return;
  76. omap3_twl_init();
  77. omap4_twl_init();
  78. }
  79. #if defined(CONFIG_ARCH_OMAP3)
  80. static struct twl4030_usb_data omap3_usb_pdata = {
  81. .usb_mode = T2_USB_MODE_ULPI,
  82. };
  83. static int omap3_batt_table[] = {
  84. /* 0 C */
  85. 30800, 29500, 28300, 27100,
  86. 26000, 24900, 23900, 22900, 22000, 21100, 20300, 19400, 18700, 17900,
  87. 17200, 16500, 15900, 15300, 14700, 14100, 13600, 13100, 12600, 12100,
  88. 11600, 11200, 10800, 10400, 10000, 9630, 9280, 8950, 8620, 8310,
  89. 8020, 7730, 7460, 7200, 6950, 6710, 6470, 6250, 6040, 5830,
  90. 5640, 5450, 5260, 5090, 4920, 4760, 4600, 4450, 4310, 4170,
  91. 4040, 3910, 3790, 3670, 3550