Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Amitkumar Karwar and committed by
Marcel Holtmann
098ea6bc 0378b597

+35 -16
+22
Documentation/devicetree/bindings/btmrvl.txt
··· 1 + btmrvl 2 + ------ 3 + 4 + Required properties: 5 + 6 + - compatible : must be "btmrvl,cfgdata" 7 + 8 + Optional properties: 9 + 10 + - btmrvl,cal-data : Calibration data downloaded to the device during 11 + initialization. This is an array of 28 values(u8). 12 + 13 + Example: 14 + 15 + btmrvl { 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 + };
+13 -16
drivers/bluetooth/btmrvl_main.c
··· 496 496 { 497 497 struct device_node *dt_node; 498 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 499 int ret; 502 500 503 - dt_node = of_find_node_by_name(NULL, name); 504 - if (!dt_node) 505 - return -ENODEV; 501 + for_each_compatible_node(dt_node, NULL, "btmrvl,cfgdata") { 502 + ret = of_property_read_u8_array(dt_node, "btmrvl,cal-data", 503 + cal_data + BT_CAL_HDR_LEN, 504 + BT_CAL_DATA_SIZE); 505 + if (ret) 506 + return ret; 506 507 507 - ret = of_property_read_u8_array(dt_node, property, 508 - cal_data + BT_CAL_HDR_LEN, 509 - BT_CAL_DATA_SIZE); 510 - if (ret) 511 - return ret; 512 - 513 - BT_DBG("Use cal data from device tree"); 514 - ret = btmrvl_download_cal_data(priv, cal_data, BT_CAL_DATA_SIZE); 515 - if (ret) { 516 - BT_ERR("Fail to download calibrate data"); 517 - return ret; 508 + BT_DBG("Use cal data from device tree"); 509 + ret = btmrvl_download_cal_data(priv, cal_data, 510 + BT_CAL_DATA_SIZE); 511 + if (ret) { 512 + BT_ERR("Fail to download calibrate data"); 513 + return ret; 514 + } 518 515 } 519 516 520 517 return 0;