aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmitkumar Karwar <akarwar@marvell.com>2014-11-19 04:28:32 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-11-19 10:22:41 -0500
commit098ea6bc4cb5890d09b1b79154fa11182e0f71e0 (patch)
tree0d66eef2ccb830153e2a645e9a8de5ad84519f3e
parent0378b59770130a994272b176a2a4346dc27361e9 (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>
-rw-r--r--Documentation/devicetree/bindings/btmrvl.txt22
-rw-r--r--drivers/bluetooth/btmrvl_main.c31
2 files changed, 36 insertions, 17 deletions
diff --git a/Documentation/devicetree/bindings/btmrvl.txt b/Documentation/devicetree/bindings/btmrvl.txt
new file mode 100644
index 000000000000..cdd57680a749
--- /dev/null
+++ b/Documentation/devicetree/bindings/btmrvl.txt
@@ -0,0 +1,22 @@
1btmrvl
2------
3
4Required properties:
5
6 - compatible : must be "btmrvl,cfgdata"
7
8Optional properties:
9
10 - btmrvl,cal-data : Calibration data downloaded to the device during
11 initialization. This is an array of 28 values(u8).
12
13Example:
14
15btmrvl {
16 compatible = "btmrvl,cfgdata";
17
18 btmrvl,cal-data = /bits/ 8 <
19 0x37 0x01 0x1c 0x00 0xff 0xff 0xff 0xff 0x01 0x7f 0x04 0x02
20 0x00 0x00 0xba 0xce 0xc0 0xc6 0x2d 0x00 0x00 0x00 0x00 0x00
21 0x00 0x00 0xf0 0x00>;
22};
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;