Commit 025a60a7 authored by Amitkumar Karwar's avatar Amitkumar Karwar Committed by Marcel Holtmann

Bluetooth: btmrvl: add DT-bindings for gpio-gap

This can be used to have GPIO host wakeup method suitable for the
platform and configurable GAP for host sleep handshake.
Signed-off-by: default avatarAmitkumar Karwar <akarwar@marvell.com>
Signed-off-by: default avatarCathy Luo <cluo@marvell.com>
Signed-off-by: default avatarAvinash Patil <patila@marvell.com>
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
parent 098ea6bc
...@@ -10,8 +10,14 @@ Optional properties: ...@@ -10,8 +10,14 @@ Optional properties:
- btmrvl,cal-data : Calibration data downloaded to the device during - btmrvl,cal-data : Calibration data downloaded to the device during
initialization. This is an array of 28 values(u8). initialization. This is an array of 28 values(u8).
- btmrvl,gpio-gap : gpio and gap (in msecs) combination to be
configured.
Example: Example:
GPIO pin 13 is configured as a wakeup source and GAP is set to 100 msecs
in below example.
btmrvl { btmrvl {
compatible = "btmrvl,cfgdata"; compatible = "btmrvl,cfgdata";
...@@ -19,4 +25,5 @@ btmrvl { ...@@ -19,4 +25,5 @@ btmrvl {
0x37 0x01 0x1c 0x00 0xff 0xff 0xff 0xff 0x01 0x7f 0x04 0x02 0x37 0x01 0x1c 0x00 0xff 0xff 0xff 0xff 0x01 0x7f 0x04 0x02
0x00 0x00 0xba 0xce 0xc0 0xc6 0x2d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0xba 0xce 0xc0 0xc6 0x2d 0x00 0x00 0x00 0x00 0x00
0x00 0x00 0xf0 0x00>; 0x00 0x00 0xf0 0x00>;
btmrvl,gpio-gap = <0x0d64>;
}; };
...@@ -492,13 +492,18 @@ static int btmrvl_download_cal_data(struct btmrvl_private *priv, ...@@ -492,13 +492,18 @@ static int btmrvl_download_cal_data(struct btmrvl_private *priv,
return 0; return 0;
} }
static int btmrvl_cal_data_dt(struct btmrvl_private *priv) static int btmrvl_check_device_tree(struct btmrvl_private *priv)
{ {
struct device_node *dt_node; struct device_node *dt_node;
u8 cal_data[BT_CAL_HDR_LEN + BT_CAL_DATA_SIZE]; u8 cal_data[BT_CAL_HDR_LEN + BT_CAL_DATA_SIZE];
int ret; int ret;
u32 val;
for_each_compatible_node(dt_node, NULL, "btmrvl,cfgdata") { for_each_compatible_node(dt_node, NULL, "btmrvl,cfgdata") {
ret = of_property_read_u32(dt_node, "btmrvl,gpio-gap", &val);
if (!ret)
priv->btmrvl_dev.gpio_gap = val;
ret = of_property_read_u8_array(dt_node, "btmrvl,cal-data", ret = of_property_read_u8_array(dt_node, "btmrvl,cal-data",
cal_data + BT_CAL_HDR_LEN, cal_data + BT_CAL_HDR_LEN,
BT_CAL_DATA_SIZE); BT_CAL_DATA_SIZE);
...@@ -523,14 +528,15 @@ static int btmrvl_setup(struct hci_dev *hdev) ...@@ -523,14 +528,15 @@ static int btmrvl_setup(struct hci_dev *hdev)
btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ); btmrvl_send_module_cfg_cmd(priv, MODULE_BRINGUP_REQ);
btmrvl_cal_data_dt(priv); priv->btmrvl_dev.gpio_gap = 0xffff;
btmrvl_check_device_tree(priv);
btmrvl_pscan_window_reporting(priv, 0x01); btmrvl_pscan_window_reporting(priv, 0x01);
priv->btmrvl_dev.psmode = 1; priv->btmrvl_dev.psmode = 1;
btmrvl_enable_ps(priv); btmrvl_enable_ps(priv);
priv->btmrvl_dev.gpio_gap = 0xffff;
btmrvl_send_hscfg_cmd(priv); btmrvl_send_hscfg_cmd(priv);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment