Jump to content

How to add bluetooth reset gpio control to rfkill?


Yihui

Recommended Posts

Try to use a DTS file to add  bluetooth reset gpio control to rfkill, but `rfkill list` doesn't show "sunxi-bt".

/dts-v1/;
/plugin/;

/ {
    compatible = "allwinner,sun8i-h3";

    fragment@0 {
        target = <&pio>;
        __overlay__ {
            bt_pwr_pin: bt_pwr_pin@0 {
                pins = "PG13";
                function = "gpio_out";
            };
        };
    };

    fragment@1 {
        target-path = "/";
        __overlay__ {
            rfkill_bt {
                compatible = "rfkill-gpio";
                pinctrl-names = "default";
                pinctrl-0 = <&bt_pwr_pin>;
                reset-gpios = <&pio 6 13 1>;
                clocks = <&osc32k>;
                clock-frequency = <32768>;
                rfkill-name = "sunxi-bt";
                rfkill-type = "bluetooth";
            };
        };
    };
};

 

Background:

Try to enable bluetooth on Nanopi Neo Air. After a lot of search, get bluetooth work finally. A few details are:

 

1. enable UART3 and its CTS & DTS. In /boot/armbianEnv.txt, add something like:

 


param_uart3_rtscts=1
overlays=uart3

 

2. control bluetooth reset pin PG13

3. enable RTC LOSC output

 

I use a script to test:

#!/bin/sh

# sudo apt install sunxi-tools devmem2

echo 'Enable 32K RTC LOSC output'
devmem2 0x1f00060 b 1 
echo 'reset bt'
sunxi-pio -m PG13=0 
sleep 1
sunxi-pio -m PG13=1
sleep 1
echo 'attach'
hciattach /dev/ttyS3 bcm43xx 1500000 flow bdaddr 11:22:33:44:55:66
echo 'config'
#hciconfig hci0 up

 

To setup RTC LOSC and PG13, we can also use the above DTS file.

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines