touch: pineapple: Add support for Bazel to build touch modules
Add support for touch modules to be built with Bazel for pineapple. Change-Id: Idf7527318a36ea33e60ba95aadb03a107f2e7205 Signed-off-by: Simranjeet Thind <quic_sthind@quicinc.com>
This commit is contained in:
48
BUILD.bazel
Normal file
48
BUILD.bazel
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
load("//build/kernel/kleaf:kernel.bzl", "ddk_headers")
|
||||||
|
|
||||||
|
package(
|
||||||
|
default_visibility = [
|
||||||
|
"//visibility:public"],
|
||||||
|
)
|
||||||
|
|
||||||
|
ddk_headers(
|
||||||
|
name = "goodix_ts_headers",
|
||||||
|
hdrs = glob([
|
||||||
|
"goodix_berlin_driver/*.h",
|
||||||
|
"qts/*.h"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
ddk_headers(
|
||||||
|
name = "nt36xxx_headers",
|
||||||
|
hdrs = glob([
|
||||||
|
"nt36xxx/*.h"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
ddk_headers(
|
||||||
|
name = "atmel_mxt_headers",
|
||||||
|
hdrs = glob([
|
||||||
|
"qts/*.h"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
ddk_headers(
|
||||||
|
name = "config_headers",
|
||||||
|
hdrs = glob([
|
||||||
|
"config/*.h"
|
||||||
|
]
|
||||||
|
),
|
||||||
|
includes = ["config"]
|
||||||
|
)
|
||||||
|
|
||||||
|
ddk_headers(
|
||||||
|
name = "touch_drivers_headers",
|
||||||
|
hdrs = [":goodix_ts_headers", ":nt36xxx_headers", ":atmel_mxt_headers", ":config_headers"]
|
||||||
|
)
|
||||||
|
|
||||||
|
load(":target.bzl", "define_pineapple")
|
||||||
|
define_pineapple()
|
23
target.bzl
Normal file
23
target.bzl
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
load(":touch_modules.bzl", "touch_driver_modules")
|
||||||
|
load(":touch_modules_build.bzl", "define_consolidate_gki_modules")
|
||||||
|
|
||||||
|
def define_pineapple():
|
||||||
|
define_consolidate_gki_modules(
|
||||||
|
target = "pineapple",
|
||||||
|
registry = touch_driver_modules,
|
||||||
|
modules = [
|
||||||
|
"nt36xxx-i2c",
|
||||||
|
"atmel_mxt_ts",
|
||||||
|
"dummy_ts",
|
||||||
|
"goodix_ts"
|
||||||
|
],
|
||||||
|
config_options = [
|
||||||
|
"TOUCH_DLKM_ENABLE",
|
||||||
|
"CONFIG_ARCH_PINEAPPLE",
|
||||||
|
"CONFIG_MSM_TOUCH",
|
||||||
|
"CONFIG_TOUCHSCREEN_GOODIX_BRL",
|
||||||
|
"CONFIG_TOUCHSCREEN_NT36XXX_I2C",
|
||||||
|
"CONFIG_TOUCHSCREEN_ATMEL_MXT",
|
||||||
|
"CONFIG_TOUCHSCREEN_DUMMY"
|
||||||
|
],
|
||||||
|
)
|
60
touch_modules.bzl
Normal file
60
touch_modules.bzl
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
# Importing to touch module entry api from touch_modules_build.bzl to define module entried for touch drivers
|
||||||
|
load(":touch_modules_build.bzl", "touch_module_entry")
|
||||||
|
|
||||||
|
# Importing the touch driver headers defined in BUILD.bazel
|
||||||
|
touch_driver_modules = touch_module_entry([":touch_drivers_headers"])
|
||||||
|
|
||||||
|
#Including the headers in the modules to be declared
|
||||||
|
module_entry = touch_driver_modules.register
|
||||||
|
|
||||||
|
#--------------- TOUCH-DRIVERS MODULES ------------------
|
||||||
|
|
||||||
|
#define ddk_module() for goodix_ts
|
||||||
|
module_entry(
|
||||||
|
name = "goodix_ts",
|
||||||
|
config_option = "CONFIG_TOUCHSCREEN_GOODIX_BRL",
|
||||||
|
srcs = [
|
||||||
|
"goodix_berlin_driver/goodix_brl_fwupdate.c",
|
||||||
|
"goodix_berlin_driver/goodix_brl_hw.c",
|
||||||
|
"goodix_berlin_driver/goodix_brl_i2c.c",
|
||||||
|
"goodix_berlin_driver/goodix_brl_spi.c",
|
||||||
|
"goodix_berlin_driver/goodix_cfg_bin.c",
|
||||||
|
"goodix_berlin_driver/goodix_ts_core.c",
|
||||||
|
"goodix_berlin_driver/goodix_ts_gesture.c",
|
||||||
|
"goodix_berlin_driver/goodix_ts_inspect.c",
|
||||||
|
"goodix_berlin_driver/goodix_ts_tools.c",
|
||||||
|
"goodix_berlin_driver/goodix_ts_utils.c",
|
||||||
|
"qts/qts_core.c"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
#define ddk_module() for nt36xxx
|
||||||
|
module_entry(
|
||||||
|
name = "nt36xxx-i2c",
|
||||||
|
config_option = "CONFIG_TOUCHSCREEN_NT36XXX_I2C",
|
||||||
|
srcs = [
|
||||||
|
"nt36xxx/nt36xxx_ext_proc.c",
|
||||||
|
"nt36xxx/nt36xxx_fw_update.c",
|
||||||
|
"nt36xxx/nt36xxx_mp_ctrlram.c",
|
||||||
|
"nt36xxx/nt36xxx.c"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
#define ddk_module() for atmel_mxt_ts
|
||||||
|
module_entry(
|
||||||
|
name = "atmel_mxt_ts",
|
||||||
|
config_option = "CONFIG_TOUCHSCREEN_ATMEL_MXT",
|
||||||
|
srcs = [
|
||||||
|
"atmel_mxt/atmel_mxt_ts.c",
|
||||||
|
"qts/qts_core.c"
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
#define ddk_module() for dummy_ts
|
||||||
|
module_entry(
|
||||||
|
name = "dummy_ts",
|
||||||
|
config_option = "CONFIG_TOUCHSCREEN_DUMMY",
|
||||||
|
srcs = [
|
||||||
|
"dummy_touch/dummy_touch.c"
|
||||||
|
]
|
||||||
|
)
|
86
touch_modules_build.bzl
Normal file
86
touch_modules_build.bzl
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
load("//build/kernel/kleaf:kernel.bzl", "ddk_module","ddk_submodule")
|
||||||
|
load("//build/bazel_common_rules/dist:dist.bzl", "copy_to_dist_dir")
|
||||||
|
|
||||||
|
def _register_module_to_map(module_map, name, path, config_option, srcs):
|
||||||
|
module = struct(
|
||||||
|
name = name,
|
||||||
|
path = path,
|
||||||
|
srcs = srcs,
|
||||||
|
config_option = config_option
|
||||||
|
)
|
||||||
|
|
||||||
|
module_map[name] = module
|
||||||
|
|
||||||
|
def _get_config_choices(map, options):
|
||||||
|
choices = []
|
||||||
|
for option in map:
|
||||||
|
choices.extend(map[option].get(option in options,[]))
|
||||||
|
return choices
|
||||||
|
|
||||||
|
def _get_kernel_build_options(modules, config_options):
|
||||||
|
all_options = {option: True for option in config_options}
|
||||||
|
all_options = all_options | {module.config_option: True for module in modules if module.config_option}
|
||||||
|
return all_options
|
||||||
|
|
||||||
|
def _get_kernel_build_module_srcs(module, options, formatter):
|
||||||
|
srcs = module.srcs
|
||||||
|
print("-",module.name,",",module.config_option,",srcs =",srcs)
|
||||||
|
module_path = "{}/".format(module.path) if module.path else ""
|
||||||
|
return ["{}{}".format(module_path, formatter(src)) for src in srcs]
|
||||||
|
|
||||||
|
def touch_module_entry(hdrs = []):
|
||||||
|
module_map = {}
|
||||||
|
|
||||||
|
def register(name, path = None, config_option = [], srcs = [], config_srcs = None, deps = None):
|
||||||
|
_register_module_to_map(module_map, name, path, config_option, srcs)
|
||||||
|
return struct(
|
||||||
|
register = register,
|
||||||
|
get = module_map.get,
|
||||||
|
hdrs = hdrs
|
||||||
|
)
|
||||||
|
|
||||||
|
def define_target_variant_modules(target, variant, registry, modules, config_options = []):
|
||||||
|
kernel_build = "{}_{}".format(target, variant)
|
||||||
|
kernel_build_label = "//msm-kernel:{}".format(kernel_build)
|
||||||
|
modules = [registry.get(module_name) for module_name in modules]
|
||||||
|
options = _get_kernel_build_options(modules, config_options)
|
||||||
|
build_print = lambda message : print("{}: {}".format(kernel_build, message))
|
||||||
|
formatter = lambda s : s.replace("%b", kernel_build).replace("%t", target)
|
||||||
|
headers = ["//msm-kernel:all_headers"] + registry.hdrs
|
||||||
|
all_module_rules = []
|
||||||
|
|
||||||
|
for module in modules:
|
||||||
|
rule_name = "{}_{}".format(kernel_build, module.name)
|
||||||
|
module_srcs = _get_kernel_build_module_srcs(module, options, formatter)
|
||||||
|
|
||||||
|
if not module_srcs:
|
||||||
|
continue
|
||||||
|
|
||||||
|
ddk_submodule(
|
||||||
|
name = rule_name,
|
||||||
|
srcs = module_srcs,
|
||||||
|
out = "{}.ko".format(module.name),
|
||||||
|
deps = headers,
|
||||||
|
local_defines = options.keys(),
|
||||||
|
)
|
||||||
|
all_module_rules.append(rule_name)
|
||||||
|
|
||||||
|
ddk_module(
|
||||||
|
name = "{}_touch_drivers".format(kernel_build),
|
||||||
|
kernel_build = kernel_build_label,
|
||||||
|
deps = all_module_rules,
|
||||||
|
)
|
||||||
|
copy_to_dist_dir(
|
||||||
|
name = "{}_touch_drivers_dist".format(kernel_build),
|
||||||
|
data = [":{}_touch_drivers".format(kernel_build)],
|
||||||
|
dist_dir = "out/target/product/{}/dlkm/lib/modules".format(target),
|
||||||
|
flat = True,
|
||||||
|
wipe_dist_dir = False,
|
||||||
|
allow_duplicate_filenames = False,
|
||||||
|
mode_overrides = {"**/*": "644"},
|
||||||
|
log = "info",
|
||||||
|
)
|
||||||
|
|
||||||
|
def define_consolidate_gki_modules(target, registry, modules, config_options = []):
|
||||||
|
define_target_variant_modules(target, "gki", registry, modules, config_options)
|
||||||
|
define_target_variant_modules(target, "consolidate", registry, modules, config_options)
|
Reference in New Issue
Block a user