* aaudio: fix wrong latency assignment
Due to (likely) copy-pasted code between input and output stream initialisation, the input stream latency was assigned to the output stream structure.
Input and output latency values are actually different, for example on my machine:
```
Latencies for device Digital Mic: in=40 out=42
Latencies for device Codec Output: in=6 out=41
Latencies for device Speaker: in=8 out=19
Latencies for device Bridge Loopback: in=13 out=30
Latencies for device Codec Input: in=47 out=0
```
This may or may not also fix the following, previously common error message: (e.g.) `aaudio aaudio: invalid position: , pos = 53211761056, buffer size = 16640, period size = 1`. At least, it hasn't appeared since I applied this change.
Also corrects typos in macro names and an error message.
* aaudio: apply typo corrections of 8d8e0f7 to audio.h
- Fix hub_status_data() bitmap: port N is stored in bit N via set_bit(),
so copy the bitmask directly instead of shifting by 1. The previous
shift mapped port status changes to incorrect bit positions.
- Handle >15 ports by returning a 3rd byte when needed.
- Use pr_info_ratelimited() for event 0x12 logging to avoid potential
log spam.
Signed-off-by: Craig de Stigter <craig@destigter.nz>
The T2 chip sends event 0x12 on the system event queue when a port's
status changes (e.g. a device finishes initializing). The driver was
silently ignoring this event, and hub_status_data() was hardcoded to
return 0 ("no changes"). Together, these meant that any T2 USB device
not ready during the initial hub scan was never discovered.
This caused intermittent failures where devices such as the FaceTime
camera, Touch Bar, and iBridge network interface would not appear after
boot or resume from suspend/hibernate — depending on a race between the
T2's device initialization and the initial USB hub scan.
Fix this by:
- Adding a port_change_pending bitmask to struct bce_vhci
- Handling event 0x12 in handle_system_event() to flag the affected
port and call usb_hcd_poll_rh_status() to wake the USB framework
- Implementing hub_status_data() properly to report pending port
changes via the standard USB hub status bitmap
Tested on MacBookPro15,1 (2018 15" MBP) with kernel 6.18.4-1-t2-plucky.
All 7 VHCI devices now appear reliably at boot and survive
suspend/resume cycles.
Signed-off-by: Craig de Stigter <craig@destigter.nz>
The following error was shown if compiled on kernel versions < 6.8
```
make -C /lib/modules/5.15.0-131-generic/build M=/var/lib/dkms/apple-bce/0.2/build modules
make[1]: Entering directory '/usr/src/linux-headers-5.15.0-131-generic'
CC [M] /var/lib/dkms/apple-bce/0.2/build/apple_bce.o
CC [M] /var/lib/dkms/apple-bce/0.2/build/mailbox.o
CC [M] /var/lib/dkms/apple-bce/0.2/build/queue.o
CC [M] /var/lib/dkms/apple-bce/0.2/build/queue_dma.o
CC [M] /var/lib/dkms/apple-bce/0.2/build/vhci/vhci.o
CC [M] /var/lib/dkms/apple-bce/0.2/build/vhci/queue.o
CC [M] /var/lib/dkms/apple-bce/0.2/build/vhci/transfer.o
CC [M] /var/lib/dkms/apple-bce/0.2/build/audio/audio.o
CC [M] /var/lib/dkms/apple-bce/0.2/build/audio/protocol.o
CC [M] /var/lib/dkms/apple-bce/0.2/build/audio/protocol_bce.o
CC [M] /var/lib/dkms/apple-bce/0.2/build/audio/pcm.o
/var/lib/dkms/apple-bce/0.2/build/vhci/vhci.c:717:27: error: initialization of ‘int ()(struct usb_hcd, struct usb_device )’ from incompatible pointer type ‘int ()(struct usb_hcd , struct usb_device, unsigned int)’ [-Werror=incompatible-pointer-types]
717 | .address_device = bce_vhci_address_device,
| ^~~~~~~
/var/lib/dkms/apple-bce/0.2/build/vhci/vhci.c:717:27: note: (near initialization for ‘bce_vhci_driver.address_device’)
cc1: some warnings being treated as errors
make[2]: [scripts/Makefile.build:297: /var/lib/dkms/apple-bce/0.2/build/vhci/vhci.o] Error 1
make[2]: Waiting for unfinished jobs....
make[1]: [Makefile:1910: /var/lib/dkms/apple-bce/0.2/build] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.15.0-131-generic'
make: [Makefile:22: all] Error 2
```
aaudio: set the card driver name to AppleT2x{channel count} instead of AppleT2 so that audio configuration files of Macs with different channel counts can coexist together