1919
2020#include <net/bluetooth/bluetooth.h>
2121#include <net/bluetooth/hci_core.h>
22+ #include <net/bluetooth/hci_drv.h>
2223
2324#include "btintel.h"
2425#include "btintel_pcie.h"
@@ -2360,6 +2361,63 @@ static bool btintel_pcie_wakeup(struct hci_dev *hdev)
23602361 return device_may_wakeup (& data -> pdev -> dev );
23612362}
23622363
2364+ static const struct {
2365+ u16 opcode ;
2366+ const char * desc ;
2367+ } btintel_pcie_hci_drv_supported_commands [] = {
2368+ /* Common commands */
2369+ { HCI_DRV_OP_READ_INFO , "Read Info" },
2370+ };
2371+
2372+ static int btintel_pcie_hci_drv_read_info (struct hci_dev * hdev , void * data ,
2373+ u16 data_len )
2374+ {
2375+ struct hci_drv_rp_read_info * rp ;
2376+ size_t rp_size ;
2377+ int err , i ;
2378+ u16 opcode , num_supported_commands =
2379+ ARRAY_SIZE (btintel_pcie_hci_drv_supported_commands );
2380+
2381+ rp_size = sizeof (* rp ) + num_supported_commands * 2 ;
2382+
2383+ rp = kmalloc (rp_size , GFP_KERNEL );
2384+ if (!rp )
2385+ return - ENOMEM ;
2386+
2387+ strscpy_pad (rp -> driver_name , KBUILD_MODNAME );
2388+
2389+ rp -> num_supported_commands = cpu_to_le16 (num_supported_commands );
2390+ for (i = 0 ; i < num_supported_commands ; i ++ ) {
2391+ opcode = btintel_pcie_hci_drv_supported_commands [i ].opcode ;
2392+ bt_dev_dbg (hdev ,
2393+ "Supported HCI Drv command (0x%02x|0x%04x): %s" ,
2394+ hci_opcode_ogf (opcode ),
2395+ hci_opcode_ocf (opcode ),
2396+ btintel_pcie_hci_drv_supported_commands [i ].desc );
2397+ rp -> supported_commands [i ] = cpu_to_le16 (opcode );
2398+ }
2399+
2400+ err = hci_drv_cmd_complete (hdev , HCI_DRV_OP_READ_INFO ,
2401+ HCI_DRV_STATUS_SUCCESS ,
2402+ rp , rp_size );
2403+
2404+ kfree (rp );
2405+ return err ;
2406+ }
2407+
2408+ static const struct hci_drv_handler btintel_pcie_hci_drv_common_handlers [] = {
2409+ { btintel_pcie_hci_drv_read_info , HCI_DRV_READ_INFO_SIZE },
2410+ };
2411+
2412+ static const struct hci_drv_handler btintel_pcie_hci_drv_specific_handlers [] = {};
2413+
2414+ static struct hci_drv btintel_pcie_hci_drv = {
2415+ .common_handler_count = ARRAY_SIZE (btintel_pcie_hci_drv_common_handlers ),
2416+ .common_handlers = btintel_pcie_hci_drv_common_handlers ,
2417+ .specific_handler_count = ARRAY_SIZE (btintel_pcie_hci_drv_specific_handlers ),
2418+ .specific_handlers = btintel_pcie_hci_drv_specific_handlers ,
2419+ };
2420+
23632421static int btintel_pcie_setup_hdev (struct btintel_pcie_data * data )
23642422{
23652423 int err ;
@@ -2386,6 +2444,7 @@ static int btintel_pcie_setup_hdev(struct btintel_pcie_data *data)
23862444 hdev -> set_bdaddr = btintel_set_bdaddr ;
23872445 hdev -> reset = btintel_pcie_reset ;
23882446 hdev -> wakeup = btintel_pcie_wakeup ;
2447+ hdev -> hci_drv = & btintel_pcie_hci_drv ;
23892448
23902449 err = hci_register_dev (hdev );
23912450 if (err < 0 ) {
0 commit comments