From: Raghuram Hegde <raghuram.hegde@xxxxxxxxx> Add helper functions to print boot/firmware version information Signed-off-by: Raghuram Hegde <raghuram.hegde@xxxxxxxxx> Signed-off-by: Chethan T N <chethan.tumkur.narayan@xxxxxxxxx> Signed-off-by: Kiran K <kiran.k@xxxxxxxxx> Signed-off-by: Amit K Bag <amit.k.bag@xxxxxxxxx> --- drivers/bluetooth/btintel.c | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index 5fa5be3c5598..0139857f6a2c 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -226,6 +226,53 @@ void btintel_version_info(struct hci_dev *hdev, struct intel_version *ver) } EXPORT_SYMBOL_GPL(btintel_version_info); +void btintel_boot_info(struct hci_dev *hdev, + struct intel_version_tlv *ver) +{ + const char *variant; + + switch (ver->img_type) { + case 0x01: + variant = "Bootloader"; + break; + case 0x03: + variant = "Firmware"; + break; + default: + bt_dev_err(hdev, "Unsupported image type %x", ver->img_type); + return; + } + + bt_dev_info(hdev, "%s timestamp %u.%u buildtype %u build %u", + variant, 2000 + (ver->timestamp >> 8), + ver->timestamp & 0xff, ver->build_type, ver->build_num); +} +EXPORT_SYMBOL_GPL(btintel_boot_info); + +void btintel_boot_info_tlv(struct hci_dev *hdev, + struct intel_version_tlv *ver) +{ + bt_dev_info(hdev, "Device revision is %u", + ver->dev_rev_id); + + bt_dev_info(hdev, "Secure boot is %s", + ver->secure_boot ? "enabled" : "disabled"); + + bt_dev_info(hdev, "OTP lock is %s", + ver->otp_lock ? "enabled" : "disabled"); + + bt_dev_info(hdev, "API lock is %s", + ver->api_lock ? "enabled" : "disabled"); + + bt_dev_info(hdev, "Debug lock is %s", + ver->debug_lock ? "enabled" : "disabled"); + + bt_dev_info(hdev, "Minimum firmware build %u week %u %u", + ver->min_fw_build_nn, ver->min_fw_build_cw, + 2000 + ver->min_fw_build_yy); +} +EXPORT_SYMBOL_GPL(btintel_boot_info_tlv); + int btintel_secure_send(struct hci_dev *hdev, u8 fragment_type, u32 plen, const void *param) { -- 2.17.1