Skip to content

Commit

Permalink
[Intel-SIG] [Meteor Lake] Bluetooth: add support for Intel Misty Peak…
Browse files Browse the repository at this point in the history
… - 8087:0038 (#77)

* Bluetooth: Add support for Intel Misty Peak - 8087:0038

commit a97258d ("Bluetooth: Add support for Intel Misty Peak - 8087:0038") upstream.

Devices from /sys/kernel/debug/usb/devices:

T:  Bus=01 Lev=01 Prnt=01 Port=13 Cnt=02 Dev#=  3 Spd=12   MxCh= 0
D:  Ver= 2.00 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
P:  Vendor=8087 ProdID=0038 Rev= 0.00
C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
I:  If#= 1 Alt= 6 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
E:  Ad=03(O) Atr=01(Isoc) MxPS=  63 Ivl=1ms
E:  Ad=83(I) Atr=01(Isoc) MxPS=  63 Ivl=1ms

deepin-Intel-SIG: commit a97258d ("Bluetooth: Add support for Intel Misty Peak - 8087:0038").

Signed-off-by: Vijay Satija <vijay.satija@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Wei Qiao: amend commit log ]
Signed-off-by: Wei Qiao <wei.qiao@intel.com>

* Bluetooth: btusb: Don't suspend when there are connections

commit 4e0a1d8 ("Bluetooth: btusb: Don't suspend when there are connections") upstream.

This checks if there are connections before suspending since that may
disrupt the connections making it stop receiving any data if remote
wakeup is not enabled.

deepin-Intel-SIG: commit 4e0a1d8 ("Bluetooth: btusb: Don't suspend when there are connections").

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Wei Qiao: amend commit log ]
Signed-off-by: Wei Qiao <wei.qiao@intel.com>

* Bluetooth: btintel: Print firmware SHA1

commit a2e7707 ("Bluetooth: btintel: Print firmware SHA1") upstream.

Intel Read Version event contains a TLV(0x32) having firmware sha1 in
operational image.

deepin-Intel-SIG: commit a2e7707 ("Bluetooth: btintel: Print firmware SHA1").

Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Wei Qiao: amend commit log ]
Signed-off-by: Wei Qiao <wei.qiao@intel.com>

* USB: core: Use device_driver directly in struct usb_driver and usb_device_driver

commit 49a78b0 ("USB: core: Use device_driver directly in struct usb_driver and usb_device_driver") upstream.

There is usbdrv_wrap in struct usb_driver and usb_device_driver, it
contains device_driver and for_devices. for_devices is used to
distinguish between device drivers and interface drivers.

Like the is_usb_device(), it tests the type of the device. We can test
that if the probe of device_driver is equal to usb_probe_device in
is_usb_device_driver(), and then the struct usbdrv_wrap is no longer
needed.

Clean up struct usbdrv_wrap, use device_driver directly in struct
usb_driver and usb_device_driver. This makes the code cleaner.

deepin-Intel-SIG: commit 49a78b0 ("USB: core: Use device_driver directly in struct usb_driver and usb_device_driver").

Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Link: https://lore.kernel.org/r/20240104032822.1896596-1-yajun.deng@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ Wei Qiao: amend commit log ]
Signed-off-by: Wei Qiao <wei.qiao@intel.com>

---------

Signed-off-by: Vijay Satija <vijay.satija@intel.com>
Signed-off-by: Kiran K <kiran.k@intel.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Wei Qiao <wei.qiao@intel.com>
Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Co-authored-by: Vijay Satija <vijay.satija@intel.com>
Co-authored-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Co-authored-by: Kiran K <kiran.k@intel.com>
Co-authored-by: Yajun Deng <yajun.deng@linux.dev>
  • Loading branch information
5 people authored Feb 19, 2024
1 parent 7488551 commit 7d3f571
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 69 deletions.
5 changes: 5 additions & 0 deletions drivers/bluetooth/btintel.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@ static int btintel_version_info_tlv(struct hci_dev *hdev,
bt_dev_info(hdev, "%s timestamp %u.%u buildtype %u build %u", variant,
2000 + (version->timestamp >> 8), version->timestamp & 0xff,
version->build_type, version->build_num);
if (version->img_type == 0x03)
bt_dev_info(hdev, "Firmware SHA1: 0x%8.8x", version->git_sha1);

return 0;
}
Expand Down Expand Up @@ -630,6 +632,9 @@ static int btintel_parse_version_tlv(struct hci_dev *hdev,
memcpy(&version->otp_bd_addr, tlv->val,
sizeof(bdaddr_t));
break;
case INTEL_TLV_GIT_SHA1:
version->git_sha1 = get_unaligned_le32(tlv->val);
break;
default:
/* Ignore rest of information */
break;
Expand Down
4 changes: 3 additions & 1 deletion drivers/bluetooth/btintel.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ enum {
INTEL_TLV_LIMITED_CCE,
INTEL_TLV_SBE_TYPE,
INTEL_TLV_OTP_BDADDR,
INTEL_TLV_UNLOCKED_STATE
INTEL_TLV_UNLOCKED_STATE,
INTEL_TLV_GIT_SHA1
};

struct intel_tlv {
Expand Down Expand Up @@ -69,6 +70,7 @@ struct intel_version_tlv {
u8 min_fw_build_yy;
u8 limited_cce;
u8 sbe_type;
u32 git_sha1;
bdaddr_t otp_bd_addr;
};

Expand Down
11 changes: 7 additions & 4 deletions drivers/bluetooth/btusb.c
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ static const struct usb_device_id quirks_table[] = {
{ USB_DEVICE(0x8087, 0x0033), .driver_info = BTUSB_INTEL_COMBINED },
{ USB_DEVICE(0x8087, 0x0035), .driver_info = BTUSB_INTEL_COMBINED },
{ USB_DEVICE(0x8087, 0x0036), .driver_info = BTUSB_INTEL_COMBINED },
{ USB_DEVICE(0x8087, 0x0038), .driver_info = BTUSB_INTEL_COMBINED },
{ USB_DEVICE(0x8087, 0x07da), .driver_info = BTUSB_CSR },
{ USB_DEVICE(0x8087, 0x07dc), .driver_info = BTUSB_INTEL_COMBINED |
BTUSB_INTEL_NO_WBS_SUPPORT |
Expand Down Expand Up @@ -4625,6 +4626,10 @@ static int btusb_suspend(struct usb_interface *intf, pm_message_t message)

BT_DBG("intf %p", intf);

/* Don't suspend if there are connections */
if (hci_conn_count(data->hdev))
return -EBUSY;

if (data->suspend_count++)
return 0;

Expand Down Expand Up @@ -4786,10 +4791,8 @@ static struct usb_driver btusb_driver = {
.disable_hub_initiated_lpm = 1,

#ifdef CONFIG_DEV_COREDUMP
.drvwrap = {
.driver = {
.coredump = btusb_coredump,
},
.driver = {
.coredump = btusb_coredump,
},
#endif
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/can/usb/peak_usb/pcan_usb_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1143,7 +1143,7 @@ static void __exit peak_usb_exit(void)
int err;

/* last chance do send any synchronous commands here */
err = driver_for_each_device(&peak_usb_driver.drvwrap.driver, NULL,
err = driver_for_each_device(&peak_usb_driver.driver, NULL,
NULL, peak_usb_do_device_exit);
if (err)
pr_err("%s: failed to stop all can devices (err %d)\n",
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,7 @@ static int brcmf_usb_reset_device(struct device *dev, void *notused)

void brcmf_usb_exit(void)
{
struct device_driver *drv = &brcmf_usbdrvr.drvwrap.driver;
struct device_driver *drv = &brcmf_usbdrvr.driver;
int ret;

brcmf_dbg(USB, "Enter\n");
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/marvell/mwifiex/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ static struct usb_driver mwifiex_usb_driver = {
.suspend = mwifiex_usb_suspend,
.resume = mwifiex_usb_resume,
.soft_unbind = 1,
.drvwrap.driver = {
.driver = {
.coredump = mwifiex_usb_coredump,
},
};
Expand Down
59 changes: 31 additions & 28 deletions drivers/usb/core/driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ static int usb_create_newid_files(struct usb_driver *usb_drv)
goto exit;

if (usb_drv->probe != NULL) {
error = driver_create_file(&usb_drv->drvwrap.driver,
error = driver_create_file(&usb_drv->driver,
&driver_attr_new_id);
if (error == 0) {
error = driver_create_file(&usb_drv->drvwrap.driver,
error = driver_create_file(&usb_drv->driver,
&driver_attr_remove_id);
if (error)
driver_remove_file(&usb_drv->drvwrap.driver,
driver_remove_file(&usb_drv->driver,
&driver_attr_new_id);
}
}
Expand All @@ -209,9 +209,9 @@ static void usb_remove_newid_files(struct usb_driver *usb_drv)
return;

if (usb_drv->probe != NULL) {
driver_remove_file(&usb_drv->drvwrap.driver,
driver_remove_file(&usb_drv->driver,
&driver_attr_remove_id);
driver_remove_file(&usb_drv->drvwrap.driver,
driver_remove_file(&usb_drv->driver,
&driver_attr_new_id);
}
}
Expand Down Expand Up @@ -549,7 +549,7 @@ int usb_driver_claim_interface(struct usb_driver *driver,
if (!iface->authorized)
return -ENODEV;

dev->driver = &driver->drvwrap.driver;
dev->driver = &driver->driver;
usb_set_intfdata(iface, data);
iface->needs_binding = 0;

Expand Down Expand Up @@ -612,7 +612,7 @@ void usb_driver_release_interface(struct usb_driver *driver,
struct device *dev = &iface->dev;

/* this should never happen, don't release something that's not ours */
if (!dev->driver || dev->driver != &driver->drvwrap.driver)
if (!dev->driver || dev->driver != &driver->driver)
return;

/* don't release from within disconnect() */
Expand Down Expand Up @@ -947,7 +947,7 @@ static int __usb_bus_reprobe_drivers(struct device *dev, void *data)
int ret;

/* Don't reprobe if current driver isn't usb_generic_driver */
if (dev->driver != &usb_generic_driver.drvwrap.driver)
if (dev->driver != &usb_generic_driver.driver)
return 0;

udev = to_usb_device(dev);
Expand All @@ -961,6 +961,11 @@ static int __usb_bus_reprobe_drivers(struct device *dev, void *data)
return 0;
}

bool is_usb_device_driver(const struct device_driver *drv)
{
return drv->probe == usb_probe_device;
}

/**
* usb_register_device_driver - register a USB device (not interface) driver
* @new_udriver: USB operations for the device driver
Expand All @@ -980,15 +985,14 @@ int usb_register_device_driver(struct usb_device_driver *new_udriver,
if (usb_disabled())
return -ENODEV;

new_udriver->drvwrap.for_devices = 1;
new_udriver->drvwrap.driver.name = new_udriver->name;
new_udriver->drvwrap.driver.bus = &usb_bus_type;
new_udriver->drvwrap.driver.probe = usb_probe_device;
new_udriver->drvwrap.driver.remove = usb_unbind_device;
new_udriver->drvwrap.driver.owner = owner;
new_udriver->drvwrap.driver.dev_groups = new_udriver->dev_groups;
new_udriver->driver.name = new_udriver->name;
new_udriver->driver.bus = &usb_bus_type;
new_udriver->driver.probe = usb_probe_device;
new_udriver->driver.remove = usb_unbind_device;
new_udriver->driver.owner = owner;
new_udriver->driver.dev_groups = new_udriver->dev_groups;

retval = driver_register(&new_udriver->drvwrap.driver);
retval = driver_register(&new_udriver->driver);

if (!retval) {
pr_info("%s: registered new device driver %s\n",
Expand Down Expand Up @@ -1020,7 +1024,7 @@ void usb_deregister_device_driver(struct usb_device_driver *udriver)
pr_info("%s: deregistering device driver %s\n",
usbcore_name, udriver->name);

driver_unregister(&udriver->drvwrap.driver);
driver_unregister(&udriver->driver);
}
EXPORT_SYMBOL_GPL(usb_deregister_device_driver);

Expand Down Expand Up @@ -1048,18 +1052,17 @@ int usb_register_driver(struct usb_driver *new_driver, struct module *owner,
if (usb_disabled())
return -ENODEV;

new_driver->drvwrap.for_devices = 0;
new_driver->drvwrap.driver.name = new_driver->name;
new_driver->drvwrap.driver.bus = &usb_bus_type;
new_driver->drvwrap.driver.probe = usb_probe_interface;
new_driver->drvwrap.driver.remove = usb_unbind_interface;
new_driver->drvwrap.driver.owner = owner;
new_driver->drvwrap.driver.mod_name = mod_name;
new_driver->drvwrap.driver.dev_groups = new_driver->dev_groups;
new_driver->driver.name = new_driver->name;
new_driver->driver.bus = &usb_bus_type;
new_driver->driver.probe = usb_probe_interface;
new_driver->driver.remove = usb_unbind_interface;
new_driver->driver.owner = owner;
new_driver->driver.mod_name = mod_name;
new_driver->driver.dev_groups = new_driver->dev_groups;
spin_lock_init(&new_driver->dynids.lock);
INIT_LIST_HEAD(&new_driver->dynids.list);

retval = driver_register(&new_driver->drvwrap.driver);
retval = driver_register(&new_driver->driver);
if (retval)
goto out;

Expand All @@ -1074,7 +1077,7 @@ int usb_register_driver(struct usb_driver *new_driver, struct module *owner,
return retval;

out_newid:
driver_unregister(&new_driver->drvwrap.driver);
driver_unregister(&new_driver->driver);

pr_err("%s: error %d registering interface driver %s\n",
usbcore_name, retval, new_driver->name);
Expand All @@ -1099,7 +1102,7 @@ void usb_deregister(struct usb_driver *driver)
usbcore_name, driver->name);

usb_remove_newid_files(driver);
driver_unregister(&driver->drvwrap.driver);
driver_unregister(&driver->driver);
usb_free_dynids(driver);
}
EXPORT_SYMBOL_GPL(usb_deregister);
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/core/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor)
struct device *dev;

argb.minor = minor;
argb.drv = &drv->drvwrap.driver;
argb.drv = &drv->driver;

dev = bus_find_device(&usb_bus_type, NULL, &argb, __find_interface);

Expand Down
8 changes: 1 addition & 7 deletions drivers/usb/core/usb.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,7 @@ static inline int is_root_hub(struct usb_device *udev)
return (udev->parent == NULL);
}

/* Do the same for device drivers and interface drivers. */

static inline int is_usb_device_driver(struct device_driver *drv)
{
return container_of(drv, struct usbdrv_wrap, driver)->
for_devices;
}
extern bool is_usb_device_driver(const struct device_driver *drv);

/* for labeling diagnostics */
extern const char *usbcore_name;
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/misc/onboard_usb_hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ static void onboard_hub_attach_usb_driver(struct work_struct *work)
{
int err;

err = driver_attach(&onboard_hub_usbdev_driver.drvwrap.driver);
err = driver_attach(&onboard_hub_usbdev_driver.driver);
if (err)
pr_err("Failed to attach USB driver: %d\n", err);
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/serial/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static ssize_t new_id_store(struct device_driver *driver,
if (retval >= 0 && usb_drv->usb_driver != NULL)
retval = usb_store_new_id(&usb_drv->usb_driver->dynids,
usb_drv->usb_driver->id_table,
&usb_drv->usb_driver->drvwrap.driver,
&usb_drv->usb_driver->driver,
buf, count);
return retval;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/serial/usb-serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ int usb_serial_register_drivers(struct usb_serial_driver *const serial_drivers[]

/* Now set udriver's id_table and look for matches */
udriver->id_table = id_table;
rc = driver_attach(&udriver->drvwrap.driver);
rc = driver_attach(&udriver->driver);
return 0;

err_deregister_drivers:
Expand Down
2 changes: 1 addition & 1 deletion drivers/usb/storage/uas.c
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ static struct usb_driver uas_driver = {
.suspend = uas_suspend,
.resume = uas_resume,
.reset_resume = uas_reset_resume,
.drvwrap.driver.shutdown = uas_shutdown,
.driver.shutdown = uas_shutdown,
.id_table = uas_usb_ids,
};

Expand Down
8 changes: 4 additions & 4 deletions drivers/usb/usbip/stub_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,14 @@ static int __init usbip_host_init(void)
goto err_usb_register;
}

ret = driver_create_file(&stub_driver.drvwrap.driver,
ret = driver_create_file(&stub_driver.driver,
&driver_attr_match_busid);
if (ret) {
pr_err("driver_create_file failed\n");
goto err_create_file;
}

ret = driver_create_file(&stub_driver.drvwrap.driver,
ret = driver_create_file(&stub_driver.driver,
&driver_attr_rebind);
if (ret) {
pr_err("driver_create_file failed\n");
Expand All @@ -402,10 +402,10 @@ static int __init usbip_host_init(void)

static void __exit usbip_host_exit(void)
{
driver_remove_file(&stub_driver.drvwrap.driver,
driver_remove_file(&stub_driver.driver,
&driver_attr_match_busid);

driver_remove_file(&stub_driver.drvwrap.driver,
driver_remove_file(&stub_driver.driver,
&driver_attr_rebind);

/*
Expand Down
Loading

0 comments on commit 7d3f571

Please sign in to comment.