[PATCH] GTA02 power manager for bluetooth

Werner Almesberger werner at openmoko.org
Thu Jan 17 23:52:25 CET 2008

[ Sent again. Addresses were wrong on the first and second try. ]

Willie wrote:
> I modify some power initial code for bluetooth. Thanks.

Thanks ! I've added the patch as gat02-bt-fixes.patch in r3875.
I made several changes:

- mutually exclusive configuration:

  The kernel is supposed to run on GTA01 and GTA02, without requiring
  reconfiguration. So constructs like

  #ifndef CONFIG_MACH_NEO1973_GTA02
        case MACH_TYPE_NEO1973_GTA01:
        case MACH_TYPE_NEO1973_GTA02:

  aren't correct. I think what you wanted to do was to omit calls to
  PCF50633-related functions if the GTA02 isn't enabled (similar to
  how this is done in gta02-core.patch. I've changed the patch

  This introduces a lot of the #ifdefs, so the driver wants further
  cleanup in the future.

  This also required some cleanup of pcf50606.h and pcf50633.h, which
  I've done in a separate patch, pcf506xx.patch

- bt_write

  There was a lot of redundancy between the "on" and the "!on" branch,
  so I merged them into one.

- pcf50633_ldo4ena_set and pcf50633_ldo5ena_set:

  It seems that   pcf50633_ldo4ena_set(pcf, X)
  is identical to pcf50633_ena_voltage(pcf, PCF50633_REGULATOR_LDO4, X)
  and             pcf50633_ldo5ena_set(pcf, X)
  is identical to pcf50633_ena_voltage(pcf, PCF50633_REGULATOR_LDO5, X)

  Furthermore, nothing it using pcf50633_ldo4ena_set and pcf50633_ldo5ena_set.
  So I removed them.

- pcf50633_ena_voltage sanity checking:

  The "switch" statement isn't necessary. A much simpler test will do.

- pcf50633_ena_voltage return value:

  This function didn't return a value on success. Didn't this produce a
  compiler warning ?

- pcf50633_ena_voltage register use:

  This clears all the other bits in the respective xxxENA register,
  i.e., dependency on GPIO print or the activation phase. I don't
  think this is correct. I've changed it accordingly.

One question: don't we have to set GTA02_GPIO_BT_EN in gta01_bt_probe ?

I've tested that the kernel builds with defconfig-2.6.24-rc7 and that
it boots on my GTA02v3. I didn't check BT (don't have the hardware
installed), so please make sure that I didn't break anything.

- Werner

More information about the openmoko-kernel mailing list