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

tea5767 detection
Tuesday, November 2nd, 2010 at 6:57:56pm UTC 

  1. Index: firmware/export/tea5767.h
  2. ===================================================================
  3. --- firmware/export/tea5767.h   (revision 28449)
  4. +++ firmware/export/tea5767.h   (working copy)
  5. @@ -32,6 +32,7 @@
  6.      unsigned char write_regs[5];
  7.  };
  8.  
  9. +void tea5767_init(void);
  10.  int tea5767_set(int setting, int value);
  11.  int tea5767_get(int setting);
  12.  void tea5767_dbg_info(struct tea5767_dbg_info *info);
  13. Index: firmware/drivers/tuner/tea5767.c
  14. ===================================================================
  15. --- firmware/drivers/tuner/tea5767.c    (revision 28449)
  16. +++ firmware/drivers/tuner/tea5767.c    (working copy)
  17. @@ -34,6 +34,7 @@
  18.  #define I2C_ADR 0xC0
  19.  #endif
  20.  
  21. +static bool tuner_present = false;
  22.  static unsigned char write_bytes[5] = { 0x00, 0x00, 0x00, 0x00, 0x00 };
  23.  
  24.  static void tea5767_set_clear(int byte, unsigned char bits, int set)
  25. @@ -116,7 +117,7 @@
  26.      switch(setting)
  27.      {
  28.          case RADIO_PRESENT:
  29. -            val = 1; /* true */
  30. +            val = tuner_present ? 1 : 0;
  31.              break;
  32.  
  33.          case RADIO_TUNED:
  34. @@ -136,6 +137,24 @@
  35.      return val;
  36.  }
  37.  
  38. +void tea5767_init(void)
  39. +{
  40. +    unsigned char buf[5];
  41. +    unsigned char chipid;
  42. +
  43. +    /* read all registers */
  44. +    if (fmradio_i2c_read(I2C_ADR, buf, sizeof(buf)) < 0) {
  45. +        /* no i2c device detected */
  46. +        return;
  47. +    }
  48. +   
  49. +    /* check device id */
  50. +    chipid = (buf[3] >> 1) & 7;
  51. +    if (chipid == 0) {
  52. +        tuner_present = true;
  53. +    }
  54. +}
  55. +
  56.  void tea5767_dbg_info(struct tea5767_dbg_info *info)
  57.  {
  58.      fmradio_i2c_read(I2C_ADR, info->read_regs, 5);
  59. Index: firmware/tuner.c
  60. ===================================================================
  61. --- firmware/tuner.c    (revision 28449)
  62. +++ firmware/tuner.c    (working copy)
  63. @@ -74,7 +74,8 @@
  64.      #if (CONFIG_TUNER & TEA5767)
  65.          TUNER_TYPE_CASE(TEA5767,
  66.                          tea5767_set,
  67. -                        tea5767_get)
  68. +                        tea5767_get,
  69. +                        tea5767_init())
  70.      #endif
  71.      #if (CONFIG_TUNER & S1A0903X01)
  72.          TUNER_TYPE_CASE(S1A0903X01,

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
worth-right