UDM-power.txt 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. The U-Boot Driver Model Project
  2. ===============================
  3. POWER analysis
  4. ==============
  5. Viktor Krivak <viktor.krivak@gmail.com>
  6. 2012-03-09
  7. I) Overview
  8. -----------
  9. 1) Actual state
  10. ---------------
  11. At this moment power doesn't contain API. There are many methods for
  12. initialization of some board specific functions but only few does what is
  13. expected. Basically only one file contains something meaningful for this
  14. driver.
  15. 2) Current implementation
  16. -------------------------
  17. In file twl6030.c are methods twl6030_stop_usb_charging() and
  18. twl6030_start_usb_charging() for start and stop charging from USB. There are
  19. also methods to get information about battery state and initialization of
  20. battery charging. Only these methods are used in converted API.
  21. II) Approach
  22. ------------
  23. 1) New API
  24. ----------
  25. New API implements only functions specific for managing power. All board
  26. specific init methods are moved to other files. Name of methods are
  27. self-explanatory.
  28. struct ops {
  29. void (*start_usb_charging)(struct instance *i);
  30. void (*stop_usb_charging)(struct instance *i);
  31. int (*get_battery_current)(struct instance *i);
  32. int (*get_battery_voltage)(struct instance *i);
  33. void (*init_battery_charging)(struct instance *i);
  34. }
  35. 2) Conversions of other methods
  36. -------------------------------
  37. Methods that can't be converted to new API are moved to board file or to
  38. special file for board hacks.
  39. III) Analysis of in-tree drivers
  40. --------------------------------
  41. 1) ftpmu010.c
  42. -------------
  43. All methods of this file are moved to another location.
  44. void ftpmu010_32768osc_enable(void): Move to boards hacks
  45. void ftpmu010_mfpsr_select_dev(unsigned int dev): Move to board file
  46. arch/nds32/lib/board.c
  47. void ftpmu010_mfpsr_diselect_dev(unsigned int dev): Dead code
  48. void ftpmu010_dlldis_disable(void): Dead code
  49. void ftpmu010_sdram_clk_disable(unsigned int cr0): Move to board file
  50. arch/nds32/lib/board.c
  51. void ftpmu010_sdramhtc_set(unsigned int val): Move to board file
  52. arch/nds32/lib/board.c
  53. 2) twl4030.c
  54. ------------
  55. All methods of this file are moved to another location.
  56. void twl4030_power_reset_init(void): Move to board hacks
  57. void twl4030_pmrecv_vsel_cfg(u8 vsel_reg, u8 vsel_val, u8 dev_grp,
  58. u8 dev_grp_sel): Move to board hacks
  59. void twl4030_power_init(void): Move to board hacks
  60. void twl4030_power_mmc_init(void): Move to board hacks
  61. 3) twl6030.c
  62. ------------
  63. Some methods are converted to new API and rest are moved to another location.
  64. void twl6030_stop_usb_charging(void): Convert to new API
  65. void twl6030_start_usb_charging(void): Convert to new API
  66. int twl6030_get_battery_current(void): Convert to new API
  67. int twl6030_get_battery_voltage(void): Convert to new API
  68. void twl6030_init_battery_charging(void): Convert to new API
  69. void twl6030_power_mmc_init(): Move to board file
  70. drivers/mmc/omap_hsmmc.c
  71. void twl6030_usb_device_settings(): Move to board file
  72. drivers/usb/musb/omap3.c