Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: p4wifi and glide dt-schema improvements #102

Closed
wants to merge 220 commits into from

Conversation

okias
Copy link
Contributor

@okias okias commented Oct 22, 2021

Task for Max:
Validate nvidia,tegra-audio-wm8994 node in p4wifi and glide (it's used later in automated make dtbs_check validation).
This helps discover typos and mistakes when DTS are upstreamed + ensures support for this device won't get broken.

Install steps:

  • install dt-schema

  • install yamllint

  • look at Documentation/devicetree/bindings/sound/nvidia,tegra-audio-* (preferably .yaml) also check them in https://github.com/okias/linux/tree/dt_bindings there is at least one I ported (but may need improvements)

  • create Documentation/devicetree/bindings/sound/nvidia,tegra-audio-wm8994.yaml

  • test with yamllint there are no errors

  • adjust glide and p4wifi DTS as described in this pull-request to have additional compatible in 1st place

  • test with make dt_bindings_check (check example inside YAML)
    You'll need crosscompilator for arm and settings something like export ARCH=arm && export CROSS_COMPILE=arm-linux-gnueabihf-

  • test with make dtbs_check (check p4wifi and glide DTS)

Sending to grate/upstream:

  • separate commit for yaml (dt-bindings)
  • separate commits for grate fixup git commit --fixup COMMIT_HASH) for p4wifi and glide (as in this PR are changes done)

@okias okias marked this pull request as draft October 22, 2021 10:55
Add blocking_notifier_call_chain_empty() that returns true if call chain
is empty and false otherwise.

Signed-off-by: Dmitry Osipenko <[email protected]>
Add atomic/blocking_notifier_has_unique_priority() helpers which return
true if given handler has unique priority in the notifier chain.

Signed-off-by: Dmitry Osipenko <[email protected]>
Correct s/implemenations/implementations/ in <reboot.h>.

Signed-off-by: Dmitry Osipenko <[email protected]>
It doesn't make sense to register restart handlers with the same priority,
normally it's a direct sign of a problem. Add sanity check which ensures
that there are no two restart handlers registered with the same priority.

Signed-off-by: Dmitry Osipenko <[email protected]>
Emit warning if unregister_restart_handler() fails since it never should
fail. This will ease further API development by catching dumb mistakes.

Signed-off-by: Dmitry Osipenko <[email protected]>
There is no need to annotate function prototypes with 'extern', it makes
code less readable. Remove unnecessary annotations from <reboot.h>.

Signed-off-by: Dmitry Osipenko <[email protected]>
SoC platforms often have multiple options for performing of system's
power-off and restart operations. Meanwhile today's kernel is limited to
a single option. Add combined power-off+restart handler call chain API,
which is inspired by the restart API. The new API provides both power-off
and restart functionality, it's designed with reliability, simplicity
and extensibility in mind.

The old pm_power_off method will be kept around till all users are
converted to the new API.

Current restart API will be replaced with the new unified API since
new API is its superset. The restart functionality of the power-handler
API is built upon the existing restart-notifier APIs.

In order to ease conversion to the new API, convenient helpers are added
for the common use-cases. They will reduce amount of boilerplate code and
remove global variables. These helpers preserve old behaviour where only
one power-off handler was executed. Users of the new API should explicitly
opt-in to allow power-off chaining by enabling the corresponding flag of
power_handler structure.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use do_kernel_power_off()
that invokes chained power-off handlers. It also invokes legacy
pm_power_off() for now, which will be removed once all drivers will
be converted to the new power-off API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Kernel now supports chained power-off handlers. Use
register_power_off_handler() that registers power-off handlers and
do_kernel_power_off() that invokes chained power-off handlers. Legacy
pm_power_off() will be removed once all drivers will be converted to
the new power-off API.

Normally arch code should adopt only the do_kernel_power_off() at first,
but m68k is a special case because it uses pm_power_off() "inside out",
i.e. it assigns machine_power_off() to pm_power_off, while it's
machine_power_off() that should invoke the pm_power_off(), and thus,
we can't convert platforms to the new API separately. There are only
two platforms changed here, so it's not a big deal.

Signed-off-by: Dmitry Osipenko <[email protected]>
Replace legacy pm_power_off with kernel_can_power_off() helper that
is aware about chained power-off handlers.

Signed-off-by: Dmitry Osipenko <[email protected]>
Switch to power-handler API that replaces legacy pm_power_off callbacks.

Signed-off-by: Dmitry Osipenko <[email protected]>
Use devm_register_power_handler() that replaces global pm_power_off_prepare
variable and allows to register multiple power-off handlers.

Signed-off-by: Dmitry Osipenko <[email protected]>
All pm_power_off_prepare() users were converted to power-handler API.
Remove the obsolete callback.

Signed-off-by: Dmitry Osipenko <[email protected]>
Nexus 7 Android tablet can be turned off using a special bootloader
command which is conveyed to bootloader by putting magic value into
specific scratch register and then rebooting normally. This power-off
method should be invoked if USB cable is connected. Bootloader then will
display battery status and power off the device. This behaviour is
borrowed from downstream kernel and matches user expectations, otherwise
it looks like device got hung during power-off and it may wake up on
USB disconnect.

Switch PMC driver to power-handler API, which provides drivers with
combined power-off+restart call chains functionality, replacing the
restart-only call chain API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Use devm_register_power_handler() that replaces global pm_power_off
variable and allows to register multiple power-off handlers. It also
provides restart-handler support, i.e. all in one API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Use devm_register_power_handler() that replaces global pm_power_off
variable and allows to register multiple power-off handlers. It also
provides restart-handler support, i.e. all in one API.

Signed-off-by: Dmitry Osipenko <[email protected]>
Use devm_register_power_handler() that replaces global pm_power_off
variable and allows to register multiple power-off handlers. It also
provides restart-handler support, i.e. all in one API.

Signed-off-by: Dmitry Osipenko <[email protected]>
digetx and others added 18 commits October 23, 2021 22:53
Enable options needed by Transformers, GalaxyTab, SGH-I927 and SurfaceRT
devices.

Signed-off-by: Dmitry Osipenko <[email protected]>
Supported devices:
- acer-picasso;
- microsoft surface-rt;
- transformers;
- pegatron chagall;
- grouper / tilapia;
- samsung-i927 glide;

Link: grate-driver#69 (comment)
Signed-off-by: Anton Bambura <[email protected]>
besides generic needed options:
- built-in stuff needed for cryptsetup
- anbox support (is broken on armv7, but we hope it will be fixed)
- waydroid support
- nftables
- containers (docker, lxc)
- zram

Link: grate-driver#69 (comment)
Signed-off-by: Anton Bambura <[email protected]>
NVIDIA Tegra30 thermal sensor driver has a hardware-controlled CPU cooling
feature that halves CPU frequency once a specified trip point is breached.
In order to account the hardware state transitions, which are reported by
interrupt, the sensor driver needs to report the cooling state transition
and this is done by thermal_cooling_device_stats_update(). The sensor
driver could be compiled as a loadable driver module, but this API
function isn't exported, hence export it.

Signed-off-by: Dmitry Osipenko <[email protected]>
Expose Tegra30 thermal sensor as a cooling device and enable
hardware-assisted DIV2 CPU frequency throttling. The DIV2 cooling is
activated by hardware while the breach of hot temperature trip is detected
by sensor.

Signed-off-by: Dmitry Osipenko <[email protected]>
Tegra I2C device isn't guaranteed to be suspended after removal of
the driver since driver uses pm_runtime_put() that is asynchronous and
pm_runtime_disable() cancels pending power-change requests. This means
that potentially refcount of the clocks may become unbalanced after
removal of the driver. This a very minor problem which unlikely to
happen in practice and won't cause any visible problems, nevertheless
let's replace pm_runtime_disable() with pm_runtime_force_suspend() and
use pm_runtime_put_sync() which disables RPM of the device and puts it
into suspend before driver is removed.

Signed-off-by: Dmitry Osipenko <[email protected]>
Not all OPP entries fit into a single word. In particular NVIDIA Tegra OPP
tables use multi-word names. Allow OPP entry to have multi-worded name
separated by hyphen. This silences DT checker warnings about wrong naming
scheme.

Reviewed-by: David Heidelberg <[email protected]>
Signed-off-by: Dmitry Osipenko <[email protected]>
Fixed regulator can't change voltage and regulator_sync_voltage()
returns -EINVAL in this case. Make regulator_sync_voltage() to succeed
for regulators that are incapable to change voltage.

On NVIDIA Tegra power management driver needs to sync voltage and we have
one device (Trimslice) that uses fixed regulator which is getting synced.
The syncing error isn't treated as fatal, but produces a noisy error
message. This patch silences that error.

Signed-off-by: Dmitry Osipenko <[email protected]>
The clock-frequency property was never used and is deprecated now.
Remove it from Nexus 7 device-tree.

Signed-off-by: David Heidelberg <[email protected]>
Older device-trees don't specify padctrl interrupt and xhci-tegra driver
now fails to probe with -EINVAL using those device-trees. Check interrupt
presence and disallow runtime PM suspension if it's missing to fix the
trouble.

Fixes: 971ee24 ("usb: xhci: tegra: Enable ELPG for runtime/system PM")
Reported-by: Nicolas Chauvet <[email protected]>
Tested-by: Nicolas Chauvet <[email protected]>
Signed-off-by: Dmitry Osipenko <[email protected]>
The current default is to leave the VDE clock's parent at the default,
which is clk_m. However, that is not a configuration that will allow the
VDE to function. Reparent it to pll_p instead to make sure the hardware
can actually decode video content.

Signed-off-by: Dmitry Osipenko <[email protected]>
Tegra114 and Tegra124 support reference picture marking, which will
cause BSEV to write picture marking data to SDRAM. Make sure there is
a valid destination address for that data to avoid error messages from
the memory controller.

[[email protected]: added BO support and moved secure BO allocation to kernel]
Tested-by: Anton Bambura <[email protected]> # T114 ASUS TF701T
Signed-off-by: Thierry Reding <[email protected]>
Signed-off-by: Dmitry Osipenko <[email protected]>
Entries in the reference picture list are marked as invalid by setting
the frame ID to 0x3f.

Signed-off-by: Thierry Reding <[email protected]>
Signed-off-by: Dmitry Osipenko <[email protected]>
Register misc device in the end of driver's probing since device should
become visible to userspace once driver is fully prepared. Do the opposite
in case of driver removal. This is a minor improvement that doesn't solve
any problem.

Signed-off-by: Dmitry Osipenko <[email protected]>
LQ101R1SX03 is compatible with LQ101R1SX01, document it.

Signed-off-by: Anton Bambura <[email protected]>
LQ101R1SX03 is compatible with LQ101R1SX01, add compatible to the driver.

Signed-off-by: Anton Bambura <[email protected]>
Document Tegra114-based Asus Transformer Pad TF701T (asus-tf701t).

Signed-off-by: Anton Bambura <[email protected]>
Add more labels in order to use label reference in device-specific
dts files.

Signed-off-by: Anton Bambura <[email protected]>
@digetx digetx force-pushed the master branch 2 times, most recently from 9bd5400 to 30800a2 Compare October 23, 2021 20:39
Add device-tree for Tegra114-based Asus Transformer Pad TF701T (K00C)
tablet.

Signed-off-by: Anton Bambura <[email protected]>
Add Video Decoder Engine node to Tegra114 device-tree.

Signed-off-by: Anton Bambura <[email protected]>
@okias okias closed this Oct 24, 2021
@okias okias deleted the p4wifi-audio-model branch October 28, 2021 12:21
digetx pushed a commit that referenced this pull request Jan 16, 2022
…patch-fixes

Cc: Davidlohr Bueso <[email protected]>

WARNING: A patch subject line should describe the change not the tool that found it
#2:
Subject: kernel-sys-only-take-tasklist_lock-for-get-setpriorityprio_pgrp-checkpatch-fixes

WARNING: Commit log lines starting with '#' are dropped by git as comments
#5:
#102: FILE: kernel/sys.c:321:

WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line)
#13:
      mechanically convert to the typical style using --fix or --fix-inplace.

total: 0 errors, 3 warnings, 8 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
      mechanically convert to the typical style using --fix or --fix-inplace.

./patches/kernel-sys-only-take-tasklist_lock-for-get-setpriorityprio_pgrp-checkpatch-fixes.patch has style problems, please review.

NOTE: If any of the errors are false positives, please report
      them to the maintainer, see CHECKPATCH in MAINTAINERS.

Please run checkpatch prior to sending patches

Cc: Davidlohr Bueso <[email protected]>
Cc: Davidlohr Bueso <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Stephen Rothwell <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.