Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate
Sign In | Create Account

Miscellany
Sunday, April 13th, 2008 at 9:55:51am UTC 

  1. Index: firmware/export/mc13783.h
  2. ===================================================================
  3. --- firmware/export/mc13783.h   (revision 17091)
  4. +++ firmware/export/mc13783.h   (arbetskopia)
  5. @@ -88,6 +88,9 @@
  6.      MC13783_NUM_REGS,
  7.  };
  8.  
  9. +/* INTERRUPT_STATUS0, INTERRUPT_MASK0, INTERRUPT_SENSE0 */
  10. +#define MC13783_CHGDET      (1 << 6)
  11. +
  12.  /* INTERRUPT_STATUS1, INTERRUPT_MASK1, INTERRUPT_SENSE1 */
  13.  #define MC13783_HSL         (1 << 0)
  14.  #define MC13783_ON1B        (1 << 3)
  15. Index: firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c
  16. ===================================================================
  17. --- firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c        (revision 17091)
  18. +++ firmware/target/arm/imx31/gigabeat-s/mc13783-imx31.c        (arbetskopia)
  19. @@ -24,6 +24,7 @@
  20.  #include "debug.h"
  21.  #include "kernel.h"
  22.  
  23. +#include "power-imx31.h"
  24.  #include "button-target.h"
  25.  
  26.  /* This is all based on communicating with the MC13783 PMU which is on
  27. @@ -64,11 +65,15 @@
  28.      gpio_enable_event(MC13783_GPIO_NUM, MC13783_EVENT_ID);
  29.  
  30.      /* Check initial states */
  31. +    value = mc13783_read(MC13783_INTERRUPT_SENSE0);
  32. +    set_charger_inserted(value & MC13783_CHGDET);
  33. +
  34.      value = mc13783_read(MC13783_INTERRUPT_SENSE1);
  35.      button_power_set_state((value & MC13783_ON1B) == 0);
  36.      set_headphones_inserted((value & MC13783_ON2B) == 0);
  37.  
  38.      /* Enable desired PMIC interrupts */
  39. +    mc13783_clear(MC13783_INTERRUPT_MASK0, MC13783_CHGDET);
  40.      mc13783_clear(MC13783_INTERRUPT_MASK1, MC13783_ON1B | MC13783_ON2B);
  41.      
  42.      while (1)
  43. @@ -78,13 +83,20 @@
  44.          mc13783_read_regset(status_regs, pending, 2);
  45.          mc13783_write_regset(status_regs, pending, 2);
  46.  
  47. -#if 0
  48. +
  49.          if (pending[0])
  50.          {
  51.              /* Handle ...PENDING0 */
  52. +            if (pending[0] & MC13783_CHGDET)
  53. +            {
  54. +                value = mc13783_read(MC13783_INTERRUPT_SENSE0);
  55. +
  56. +                if (pending[0] & MC13783_CHGDET)
  57. +                    set_charger_inserted(value & MC13783_CHGDET);
  58. +            }
  59.          }
  60. -#endif
  61.  
  62. +
  63.          if (pending[1])
  64.          {
  65.              /* Handle ...PENDING1 */
  66. Index: firmware/target/arm/imx31/gigabeat-s/power-imx31.c
  67. ===================================================================
  68. --- firmware/target/arm/imx31/gigabeat-s/power-imx31.c  (revision 17091)
  69. +++ firmware/target/arm/imx31/gigabeat-s/power-imx31.c  (arbetskopia)
  70. @@ -26,13 +26,21 @@
  71.  
  72.  #ifndef SIMULATOR
  73.  
  74. +static bool charger_detect = false;
  75. +
  76.  void power_init(void)
  77.  {
  78.  }
  79.  
  80. +/* This is called from the mc13783 interrupt thread */
  81. +void set_charger_inserted(bool inserted)
  82. +{
  83. +    charger_detect = inserted;
  84. +}
  85. +
  86.  bool charger_inserted(void)
  87.  {
  88. -    return false;
  89. +    return charger_detect;
  90.  }
  91.  
  92.  /* Returns true if the unit is charging the batteries. */

Update the Post

Either update this post and resubmit it with changes, or make a new post.

You may also comment on this post.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.

comments powered by Disqus
worth-right
worth-right
worth-right