summaryrefslogtreecommitdiff
authorKuibao Zhang <kuibao.zhang@amlogic.com>2018-04-13 11:53:38 (GMT)
committer yang.xu <yang.xu@amlogic.com>2018-04-20 02:37:20 (GMT)
commit04d333fa26ced6013bb3e91c2bb1c4e3068d8bfa (patch)
treebbc953f484d7e59d9d76cebc2bcba8e08f785ebf
parent34892894cdd0c540fea95cc3e13696bcfc34eb2a (diff)
downloadcommon-04d333fa26ced6013bb3e91c2bb1c4e3068d8bfa.zip
common-04d333fa26ced6013bb3e91c2bb1c4e3068d8bfa.tar.gz
common-04d333fa26ced6013bb3e91c2bb1c4e3068d8bfa.tar.bz2
BT: introduce power_down_disable property in DT
PD#163673: BT: introduce power_down_disable property in DT introduce a power_down_disable property in the DT file, we need to keep power on for the ap62x8 in order to pass the vts test Change-Id: I1984ded1e7f96732630b4e94a97bbb2705a8fbd6 Signed-off-by: Kuibao Zhang <kuibao.zhang@amlogic.com>
Diffstat
-rw-r--r--arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts1
-rw-r--r--arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts1
-rw-r--r--drivers/amlogic/bluetooth/bt_device.c71
-rw-r--r--include/linux/amlogic/bt_device.h1
4 files changed, 43 insertions, 31 deletions
diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts
index c3a6930..bc1dcd7 100644
--- a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts
+++ b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_1g.dts
@@ -603,6 +603,7 @@
compatible = "amlogic, bt-dev";
dev_name = "bt-dev";
status = "okay";
+ power_down_disable = <1>;
gpio_reset = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>;
//gpio_en = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
};
diff --git a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts
index 1cc57e3..da6cc72 100644
--- a/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts
+++ b/arch/arm64/boot/dts/amlogic/txlx_t962x_r311_2g.dts
@@ -612,6 +612,7 @@
compatible = "amlogic, bt-dev";
dev_name = "bt-dev";
status = "okay";
+ power_down_disable = <1>;
gpio_reset = <&gpio_ao GPIOAO_8 GPIO_ACTIVE_HIGH>;
//gpio_en = <&gpio_ao GPIOAO_5 GPIO_ACTIVE_HIGH>;
};
diff --git a/drivers/amlogic/bluetooth/bt_device.c b/drivers/amlogic/bluetooth/bt_device.c
index dde4ee8..394ad8d 100644
--- a/drivers/amlogic/bluetooth/bt_device.c
+++ b/drivers/amlogic/bluetooth/bt_device.c
@@ -85,25 +85,26 @@ static void bt_device_deinit(struct bt_dev_data *pdata)
static void bt_device_on(struct bt_dev_data *pdata)
{
- if (pdata->gpio_reset > 0) {
-
- if ((pdata->power_on_pin_OD) && (pdata->power_low_level)) {
- gpio_direction_input(pdata->gpio_reset);
- } else {
- gpio_direction_output(pdata->gpio_reset,
- pdata->power_low_level);
+ if (pdata->power_down_disable == 0) {
+ if (pdata->gpio_reset > 0) {
+ if ((pdata->power_on_pin_OD)
+ && (pdata->power_low_level)) {
+ gpio_direction_input(pdata->gpio_reset);
+ } else {
+ gpio_direction_output(pdata->gpio_reset,
+ pdata->power_low_level);
+ }
}
- }
- if (pdata->gpio_en > 0) {
-
- if ((pdata->power_on_pin_OD)
- && (pdata->power_low_level)) {
- gpio_direction_input(pdata->gpio_en);
- } else {
- set_usb_bt_power(0);
+ if (pdata->gpio_en > 0) {
+ if ((pdata->power_on_pin_OD)
+ && (pdata->power_low_level)) {
+ gpio_direction_input(pdata->gpio_en);
+ } else {
+ set_usb_bt_power(0);
+ }
}
+ msleep(200);
}
- msleep(200);
if (pdata->gpio_reset > 0) {
if ((pdata->power_on_pin_OD)
@@ -128,25 +129,27 @@ static void bt_device_on(struct bt_dev_data *pdata)
static void bt_device_off(struct bt_dev_data *pdata)
{
- if (pdata->power_off_flag > 0) { /*bt rc wakeup by bcm.set it by dts*/
- if (pdata->gpio_reset > 0) {
- if ((pdata->power_on_pin_OD)
- && (pdata->power_low_level)) {
- gpio_direction_input(pdata->gpio_reset);
- } else {
- gpio_direction_output(pdata->gpio_reset,
+ if (pdata->power_down_disable == 0) {
+ if (pdata->power_off_flag > 0) { /*bt rc wakeup flag for bcm.*/
+ if (pdata->gpio_reset > 0) {
+ if ((pdata->power_on_pin_OD)
+ && (pdata->power_low_level)) {
+ gpio_direction_input(pdata->gpio_reset);
+ } else {
+ gpio_direction_output(pdata->gpio_reset,
pdata->power_low_level);
+ }
}
- }
- if (pdata->gpio_en > 0) {
- if ((pdata->power_on_pin_OD)
- && (pdata->power_low_level)) {
- gpio_direction_input(pdata->gpio_en);
- } else {
- set_usb_bt_power(0);
+ if (pdata->gpio_en > 0) {
+ if ((pdata->power_on_pin_OD)
+ && (pdata->power_low_level)) {
+ gpio_direction_input(pdata->gpio_en);
+ } else {
+ set_usb_bt_power(0);
+ }
}
+ msleep(20);
}
- msleep(20);
}
}
@@ -260,6 +263,12 @@ static int bt_probe(struct platform_device *pdev)
if (ret)
pdata->power_off_flag = 1;/*bt poweroff*/
pr_info("bt: power_off_flag = %d;\n", pdata->power_off_flag);
+
+ ret = of_property_read_u32(pdev->dev.of_node,
+ "power_down_disable", &pdata->power_down_disable);
+ if (ret)
+ pdata->power_down_disable = 0;
+ pr_info("dis power down = %d;\n", pdata->power_down_disable);
} else {
pdata = (struct bt_dev_data *)(pdev->dev.platform_data);
}
diff --git a/include/linux/amlogic/bt_device.h b/include/linux/amlogic/bt_device.h
index 01dfb0a..6865f00 100644
--- a/include/linux/amlogic/bt_device.h
+++ b/include/linux/amlogic/bt_device.h
@@ -25,6 +25,7 @@ struct bt_dev_data {
int power_low_level;
int power_on_pin_OD;
int power_off_flag;
+ int power_down_disable;
};
extern void set_usb_bt_power(int is_power);
#endif