diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2014-11-19 04:28:32 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-11-19 10:22:41 -0500 |
commit | 098ea6bc4cb5890d09b1b79154fa11182e0f71e0 (patch) | |
tree | 0d66eef2ccb830153e2a645e9a8de5ad84519f3e /drivers/bluetooth/btmrvl_main.c | |
parent | 0378b59770130a994272b176a2a4346dc27361e9 (diff) |
Bluetooth: btmrvl: add DT bindings documentation
Calibration data can be downloaded through device tree method. This
patch adds the documentation. Also, instead of searching device tree
node by name using of_find_node_by_name() API, let's use
for_each_compatible_node().
Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Cathy Luo <cluo@marvell.com>
Signed-off-by: Avinash Patil <patila@marvell.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'drivers/bluetooth/btmrvl_main.c')
-rw-r--r-- | drivers/bluetooth/btmrvl_main.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/bluetooth/btmrvl_main.c b/drivers/bluetooth/btmrvl_main.c index 1d7db2064889..2909bca6b8b6 100644 --- a/drivers/bluetooth/btmrvl_main.c +++ b/drivers/bluetooth/btmrvl_main.c | |||
@@ -496,25 +496,22 @@ static int btmrvl_cal_data_dt(struct btmrvl_private *priv) | |||
496 | { | 496 | { |
497 | struct device_node *dt_node; | 497 | struct device_node *dt_node; |
498 | u8 cal_data[BT_CAL_HDR_LEN + BT_CAL_DATA_SIZE]; | 498 | u8 cal_data[BT_CAL_HDR_LEN + BT_CAL_DATA_SIZE]; |
499 | const char name[] = "btmrvl_caldata"; | ||
500 | const char property[] = "btmrvl,caldata"; | ||
501 | int ret; | 499 | int ret; |
502 | 500 | ||
503 | dt_node = of_find_node_by_name(NULL, name); | 501 | for_each_compatible_node(dt_node, NULL, "btmrvl,cfgdata") { |
504 | if (!dt_node) | 502 | ret = of_property_read_u8_array(dt_node, "btmrvl,cal-data", |
505 | return -ENODEV; | 503 | cal_data + BT_CAL_HDR_LEN, |
506 | 504 | BT_CAL_DATA_SIZE); | |
507 | ret = of_property_read_u8_array(dt_node, property, | 505 | if (ret) |
508 | cal_data + BT_CAL_HDR_LEN, | 506 | return ret; |
509 | BT_CAL_DATA_SIZE); | 507 | |
510 | if (ret) | 508 | BT_DBG("Use cal data from device tree"); |
511 | return ret; | 509 | ret = btmrvl_download_cal_data(priv, cal_data, |
512 | 510 | BT_CAL_DATA_SIZE); | |
513 | BT_DBG("Use cal data from device tree"); | 511 | if (ret) { |
514 | ret = btmrvl_download_cal_data(priv, cal_data, BT_CAL_DATA_SIZE); | 512 | BT_ERR("Fail to download calibrate data"); |
515 | if (ret) { | 513 | return ret; |
516 | BT_ERR("Fail to download calibrate data"); | 514 | } |
517 | return ret; | ||
518 | } | 515 | } |
519 | 516 | ||
520 | return 0; | 517 | return 0; |