bt_modules.bzl 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. PWR_PATH = "pwr"
  2. SLIMBUS_PATH = "slimbus"
  3. FMRTC_PATH = "rtc6226"
  4. BTFMCODEC_PATH = "btfmcodec"
  5. # This dictionary holds all the BT modules included in the bt-kernel
  6. bt_modules = {}
  7. def register_bt_modules(name, path = None, config_opt = None, srcs = [], config_srcs = {}, deps = [], config_deps = {}):
  8. """
  9. Register modules
  10. Args:
  11. name: Name of the module (which will be used to generate the name of the .ko file)
  12. path: Path in which the source files can be found
  13. config_opt: Config name used in Kconfig (not needed currently)
  14. srcs: source files and local headers
  15. config_srcs: source files and local headers that depend on a config define being enabled.
  16. deps: a list of dependent targets
  17. config_deps: a list of dependent targets that depend on a config define being enabled.
  18. """
  19. processed_config_srcs = {}
  20. processed_config_deps = {}
  21. for config_src_name in config_srcs:
  22. config_src = config_srcs[config_src_name]
  23. if type(config_src) == "list":
  24. processed_config_srcs[config_src_name] = {True: config_src}
  25. else:
  26. processed_config_srcs[config_src_name] = config_src
  27. for config_deps_name in config_deps:
  28. config_dep = config_deps[config_deps_name]
  29. if type(config_dep) == "list":
  30. processed_config_deps[config_deps_name] = {True: config_dep}
  31. else:
  32. processed_config_deps[config_deps_name] = config_dep
  33. module = struct(
  34. name = name,
  35. path = path,
  36. srcs = srcs,
  37. config_srcs = processed_config_srcs,
  38. config_opt = config_opt,
  39. deps = deps,
  40. config_deps = processed_config_deps,
  41. )
  42. bt_modules[name] = module
  43. # --- BT Modules ---
  44. register_bt_modules(
  45. name = "btpower",
  46. path = PWR_PATH,
  47. config_opt = "CONFIG_MSM_BT_POWER",
  48. srcs = ["btpower.c"],
  49. config_deps = {
  50. "CONFIG_BT_HW_SECURE_DISABLE": [
  51. "//vendor/qcom/opensource/securemsm-kernel:%b_smcinvoke_dlkm",
  52. ]
  53. },
  54. )
  55. register_bt_modules(
  56. name = "bt_fm_slim",
  57. path = SLIMBUS_PATH,
  58. # config_opt = "CONFIG_BTFM_SLIM",
  59. srcs = [
  60. "btfm_slim.c",
  61. "btfm_slim.h",
  62. "btfm_slim_slave.c",
  63. "btfm_slim_slave.h",
  64. "btfm_slim_codec.c",
  65. ],
  66. deps = [":%b_btpower"],
  67. )
  68. register_bt_modules(
  69. name = "btfm_slim_codec",
  70. path = SLIMBUS_PATH,
  71. config_opt = "CONFIG_SLIM_BTFM_CODEC",
  72. srcs = [
  73. "btfm_slim.c",
  74. "btfm_slim.h",
  75. "btfm_slim_slave.c",
  76. "btfm_slim_slave.h",
  77. "btfm_slim_hw_interface.c",
  78. "btfm_slim_hw_interface.h",
  79. ],
  80. deps = [":%b_btpower", ":%b_btfmcodec", ":btfmcodec_headers"],
  81. )
  82. register_bt_modules(
  83. name = "btfmcodec",
  84. path = BTFMCODEC_PATH,
  85. config_opt = "CONFIG_BTFM_CODEC",
  86. srcs = [
  87. "btfm_codec.c",
  88. "btfm_codec_btadv_interface.c",
  89. "btfm_codec_hw_interface.c",
  90. "btfm_codec_interface.c",
  91. ],
  92. deps = [":btfmcodec_headers"],
  93. )
  94. register_bt_modules(
  95. name = "radio-i2c-rtc6226-qca",
  96. path = FMRTC_PATH,
  97. config_opt = "CONFIG_I2C_RTC6226_QCA",
  98. srcs = [
  99. "radio-rtc6226-common.c",
  100. "radio-rtc6226-i2c.c",
  101. "radio-rtc6226.h",
  102. ],
  103. )