aboutsummaryrefslogtreecommitdiff
path: root/sound/sh (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-09-16power: supply: macsmc_power: Add more propertiesHector Martin1-0/+57
Report more voltages from the battery, and also fudge energy numbers from charge numbers. This way userspace doesn't try to convert on its own (and gets it very wrong). Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Report available charge_behavioursThomas Weißschuh1-0/+3
The generic handling if charge_behaviours in the power_supply core requires power_supply_desc.charge_behaviours to be set. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2024-09-16power: supply: macsmc_power: Add CHWA charge thresholdsHector Martin1-4/+63
This is a hardcoded charge threshold feature present in firmware 13.0 or newer. Userspace settings are rounded to one of the two possible behaviors. Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Log power data on button pressesHector Martin1-27/+37
This helps catch s2idle power stats, since we get early data when the system resumes due to a power button press. Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16macsmc: Fix race between backend and core on notificationsHector Martin3-17/+14
The core enables notifications (NTAP) before returning from the probe function, before the backend has a chance to set smc->core. This leads to a race if a notification arrives early. We already rely on the core setting the drvdata to itself, so move that ahead of NTAP=1 and drop smc->core entirely. That way it's safe for the backend notification callback to fire before the core probe function returns. Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Add a debug mode to print power usageHector Martin1-1/+80
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16platform/apple: smc: Add apple_smc_read_f32_scaledHector Martin2-0/+50
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Add critical level shutdown & misc eventsHector Martin1-0/+123
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16Input: macsmc-hid: Support the power button on desktopsHector Martin1-1/+3
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16gpio: macsmc: Add IRQ supportHector Martin1-0/+150
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16Input: macsmc-hid: Support button/lid wakeupsHector Martin1-2/+39
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16Input: macsmc-hid: New driver to handle the Apple Mac SMC buttons/lidHector Martin3-0/+170
This driver implements power button and lid switch support for Apple Mac devices using SMC controllers driven by the macsmc driver. In addition to basic input support, this also responds to the final shutdown warning (when the power button is held down long enough) by doing an emergency kernel poweroff. This allows the NVMe controller to be cleanly shut down, which prevents data loss for in-cache data. Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16rtc: Add new rtc-macsmc driver for Apple Silicon MacsHector Martin3-0/+144
Apple Silicon Macs (M1, etc.) have an RTC that is part of the PMU IC, but most of the PMU functionality is abstracted out by the SMC. On T600x machines, the RTC counter must be accessed via the SMC to get full functionality, and it seems likely that future machines will move towards making SMC handle all RTC functionality. The SMC RTC counter access is implemented on all current machines as of the time of this writing, on firmware 12.x. However, the RTC offset (needed to set the time) is still only accessible via direct PMU access. To handle this, we expose the RTC offset as an NVMEM cell from the SPMI PMU device node, and this driver consumes that cell and uses it to compute/set the current time. Alarm functionality is not yet implemented. This would also go via the PMU today, but could change in the future. Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: reset: macsmc-reboot: Add driver for rebooting via Apple SMCHector Martin3-0/+347
This driver implements the reboot/shutdown support exposed by the SMC on Apple Silicon machines, such as Apple M1 Macs. Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Add AC power supplyHector Martin1-7/+65
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Turn off OBC flags if macOS left them onHector Martin1-0/+4
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Use BUIC instead of BRSC for chargeHector Martin1-2/+2
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Add more props, rework othersHector Martin1-21/+202
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Add present propHector Martin1-0/+4
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Add cycle count and health propsHector Martin1-0/+11
Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16power: supply: macsmc_power: Driver for Apple SMC power/battery statsHector Martin3-0/+263
This driver implements support for battery stats on top of the macsmc framework, to support Apple M1 Mac machines. Co-authored-by: Joey Gouly <joey.gouly@arm.com> Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16gpio: Add new gpio-macsmc driver for Apple MacsHector Martin3-0/+250
This driver implements the GPIO service on top of the SMC framework on Apple Mac machines. In particular, these are the GPIOs present in the PMU IC which are used to control power to certain on-board devices. Although the underlying hardware supports various pin config settings (input/output, open drain, etc.), this driver does not implement that functionality and leaves it up to the firmware to configure things properly. We also don't yet support interrupts/events. This is sufficient for device power control, which is the only thing we need to support at this point. More features will be implemented when needed. To our knowledge, only Apple Silicon Macs implement this SMC feature. Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16platform/apple: Add new Apple Mac SMC driverHector Martin8-0/+880
This driver implements support for the SMC (System Management Controller) in Apple Macs. In contrast to the existing applesmc driver, it uses pluggable backends that allow it to support different SMC implementations, and uses the MFD subsystem to expose the core SMC functionality so that specific features (gpio, hwmon, battery, etc.) can be implemented by separate drivers in their respective downstream subsystems. The initial RTKit backend adds support for Apple Silicon Macs (M1 et al). We hope a backend for T2 Macs will be written in the future (since those are not supported by applesmc), and eventually an x86 backend would allow us to fully deprecate applesmc in favor of this driver. Signed-off-by: Hector Martin <marcan@marcan.st>
2024-09-16drm: apple: iomfb: Provide the EDID as connector propertyJanne Grunau3-0/+25
External display only since the EDID provided by integrated panels holds no useful / correct information. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: Add dcpav-service-epJanne Grunau9-1/+296
Known uses EDID retrieval and raw I2C access. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: afk: Optionally match against EPICNameJanne Grunau2-1/+7
The dpavserv endpoint uses various EPICProviderClass depending on the connected display. Observed values: - "AppleDCPAgileCDIDPDisplay" (j134c, dcp, panel) - "AppleDCPMCDP29XX" (j274, dcp, hdmi) - "AppleDCPPS190" (j474s, dcpext0, hdmi) - "DCPDPService" (j474s, dcpext1, typec) So match against against EPICName which is consistent in all cases. This also allows the distinction between 'dcpav-service-epic' and 'dcpdp-service-epic'. Not sure what the second EPIC service is used for. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16Revert "drm: apple: HACK: Do not delete piodma platform device"Janne Grunau1-4/+1
This reverts commit fa86f31f64a691eb65a217c66468b3e9e58cc9e1. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: iomfb: Align buffer size on unmap/free as wellJanne Grunau1-4/+7
Fixes failure to unmap buffers in dcpep_cb_unmap_piodma() due to the unaligned size. Further along this causes kernel log splat when DCP tries to map the buffers again since thye IOVA is still in use. This causes no apparent issue although map_piodma callback signals an errror and returns 0 (unmapped as DVA). It's not clear why this presents only randomly. Possibly some build or uninitialized memory triggers this unmap/free and immediate allocate/map cycle in the DCP firmware. I never notices this with a clang-built kernel on j314c. It showed with gcc build with the Fedora config at least on 6.8.8 based kernels. This did not reproduce on j375d. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm/apple: Fix missing mode init (feel free to squash)Asahi Lina1-0/+1
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-09-16drm: apple: dptxport: get_max_lane_count: Retrieve lane count from phyJanne Grunau1-0/+14
This unfortunately doesn't work relieably with typec-altmode-displayport since the oob hotplug notification arrives before atc-phy is configured to the appropiate DP mode. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: dptx: Fix get_drive_settings retcodeJanne Grunau1-2/+6
This appears to be lane count as "2" is observed for USB-C DP alt mode in shared DP/USB3 mode. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: Add oob hotplug eventSven Peter3-0/+39
Signed-off-by: Sven Peter <sven@svenpeter.dev>
2024-09-16drm/apple: audio: Fix hotplug notificationsAsahi Lina2-2/+17
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-09-16drm/apple: audio: Defer DMA channel acquisition to device openAsahi Lina1-48/+57
Allow the DMA device driver to probe late, and still create the sound device upfront. Instead try to request the DMA channel on first PCM open. This should be safe as long as we bail early and don't allow the process to continue to configuring buffers (since that requires the DMA to be configured). Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-09-16drm/apple: audio: Create a device link to the DMA deviceAsahi Lina1-36/+31
This works even before the DMA device probes. Might help deal with runtime-pm ordering, though it doesn't solve the deferred ordering problem (since we're creating the link while already probing)... Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-09-16drm/apple: Explicitly stop AFK endpoints on shutdownAsahi Lina3-1/+44
Signed-off-by: Asahi Lina <lina@asahilina.net>
2024-09-16drm: apple: Override drm_vblank's page flip event handling [HACK]Janne Grunau3-1/+93
Since we don't init/uses drm's vblank support our page flip timestamps are CLOCK_MONOTONIC timestamps during the event generation. Since compositors use the timestamp to schedule their next kms commit this is timing sensitive sop move it under the drivers control. Take the timestamp directly in the swap_complete callback. Framebuffer swaps are unfortunately not fast with DCP. Measured time from swap_submit to swap_complete is ~1.5 ms for dcp and ~2.3 ms for dcpext. This warrants further investigation. Presentation timestamps might help if delay on dcp firmware side occurs after the actual swap. In the meantime doctor the time stamps and move the page flip completion up to 1 ms earler. This fixes half rate refresh on external displays displays using dcpext. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: disable HDMI audio by defaultJanne Grunau2-4/+9
Can be still enabled by adding `apple_dcp.hdmi_audio` the kernel command line. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: av: Warn only once about failed callsJanne Grunau1-4/+11
Reduce log spam while errors are still likely due missing state checks.
2024-09-16drm: apple: Reduce log spam about busy command channelJanne Grunau2-1/+8
The most likely cause for this is an unexpected callback form which the current driver doesn't recover. Warn only once about it. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: Fix broken MemDescRelay::release_descriptor callback numberJanne Grunau1-1/+1
Two callbacks for IOMFB::MemDescRelay seems to be dropped between 12.3 and 13.5 DCP firmware. This results in the renumbering of MemDescRelay::release_descriptor from D456 to D454. Noticed while when switching the display refresh rate to 50 Hz with a 14.5 system firmware on a M1 Max Macbook Pro. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: Switch back to drm_atomic_helper_commit_tail_rpm()Janne Grunau1-21/+1
The custom commit_tail implementation stopped making after "drm/apple: Disable fake vblank IRQ machinery" which stopped calling drm_vblank_init(). Revert back to the standard helper implementation. Avoids or at least significantly reduces page flips taking approximately one frame time in kwin_wayland 6. Fixes: ("drm/apple: Switch to nonblocking commit handling") Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: backlight: release lock in error pathCaspar Schutijser1-2/+4
Signed-off-by: Caspar Schutijser <caspar@schutijser.com>
2024-09-16drm/apple: fix double words in commentsJonathan Gray2-3/+3
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
2024-09-16drm: apple: audio: Avoid probe errorsJanne Grunau1-42/+105
Now that the DP audio driver is a component of the display sub-system probe errors will bring down the whole display initialization. To prevent that the audio driver must not fail. Allow delayed sound card initialization if the DMA controller is not ready, for example because the apple-sio module is missing (at all or just in the initeramfs). In the case apple-sio is available later provide as sysfs file "probe_snd_card" to trigger initialization. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: audio: Make the DP/HDMI audio driver a full driverJanne Grunau4-99/+155
The main advantage is that it allows runtime PM which would have been manually implemented with the ad-hoc instantiated platform driver. This also probes the devices as component of the DRM driver which allows to simplify the the interface between the av endpoint and the audio driver. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: audio: move the audio driver into the DCP moduleJanne Grunau4-11/+35
Those two drivers are closely linked and should always exists together. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: av: Use a workqueueJanne Grunau1-27/+36
Functionally a revert of "drm: apple: av: Do not open AV service from afk receive handler" with more workqueues. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: audio: init AV endpoint laterJanne Grunau1-8/+9
This seems to get rid of initialization timeouts / failures. Signed-off-by: Janne Grunau <j@jannau.net>
2024-09-16drm: apple: dptx: Remove DPTX disconnect/connect on initJanne Grunau1-4/+12
This was only necessary for dcp0 on M2* devices presumably because the reset in m1n1 doesn't work as intended. Signed-off-by: Janne Grunau <j@jannau.net>