| Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
Signed-off-by: Hector Martin <marcan@marcan.st>
|
|
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>
|
|
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>
|
|
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>
|
|
External display only since the EDID provided by integrated panels
holds no useful / correct information.
Signed-off-by: Janne Grunau <j@jannau.net>
|
|
Known uses EDID retrieval and raw I2C access.
Signed-off-by: Janne Grunau <j@jannau.net>
|
|
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>
|
|
This reverts commit fa86f31f64a691eb65a217c66468b3e9e58cc9e1.
Signed-off-by: Janne Grunau <j@jannau.net>
|
|
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>
|
|
Signed-off-by: Asahi Lina <lina@asahilina.net>
|
|
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>
|
|
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>
|
|
Signed-off-by: Sven Peter <sven@svenpeter.dev>
|
|
Signed-off-by: Asahi Lina <lina@asahilina.net>
|
|
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>
|
|
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>
|
|
Signed-off-by: Asahi Lina <lina@asahilina.net>
|
|
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>
|
|
Can be still enabled by adding `apple_dcp.hdmi_audio` the kernel command
line.
Signed-off-by: Janne Grunau <j@jannau.net>
|
|
Reduce log spam while errors are still likely due missing state checks.
|
|
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>
|
|
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>
|
|
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>
|
|
Signed-off-by: Caspar Schutijser <caspar@schutijser.com>
|
|
Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
|
|
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>
|
|
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>
|
|
Those two drivers are closely linked and should always exists together.
Signed-off-by: Janne Grunau <j@jannau.net>
|
|
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>
|
|
This seems to get rid of initialization timeouts / failures.
Signed-off-by: Janne Grunau <j@jannau.net>
|
|
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>
|