linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: viresh.kumar@linaro.org (Viresh Kumar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V5 13/13] boot_constraint: Add documentation
Date: Thu, 14 Dec 2017 21:03:20 +0530	[thread overview]
Message-ID: <c0baa3f040d6a165b5e6ddc4748a73ecbf42b54c.1513264961.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1513264961.git.viresh.kumar@linaro.org>

This adds boot constraint documentation.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 .../driver-api/boot-constraint/constraints.rst     | 98 ++++++++++++++++++++++
 Documentation/driver-api/boot-constraint/index.rst |  4 +
 Documentation/driver-api/index.rst                 |  1 +
 3 files changed, 103 insertions(+)
 create mode 100644 Documentation/driver-api/boot-constraint/constraints.rst
 create mode 100644 Documentation/driver-api/boot-constraint/index.rst

diff --git a/Documentation/driver-api/boot-constraint/constraints.rst b/Documentation/driver-api/boot-constraint/constraints.rst
new file mode 100644
index 000000000000..036bb77a26f9
--- /dev/null
+++ b/Documentation/driver-api/boot-constraint/constraints.rst
@@ -0,0 +1,98 @@
+.. include:: <isonum.txt>
+
+=========================
+Boot Constraint Subsystem
+=========================
+
+:Copyright: |copy| 2017 Viresh Kumar <vireshk@kernel.org>, Linaro Ltd.
+
+Introduction
+============
+
+A lot of devices are configured and powered ON by the bootloader before passing
+on control to the operating system, Linux in our case.  It is important for some
+of them to keep working until the time a Linux device driver probes the device
+and reconfigure it.
+
+A typical example of that can be the LCD controller, which is used by the
+bootloaders to show image(s) while the platform boots Linux.  The LCD controller
+can be using resources like clk, regulators, etc, that are shared with other
+devices. These shared resources should be configured in such a way that they
+satisfy need of all the user devices.  If another device's (X) driver gets
+probed before the LCD controller driver, then it may end up disabling or
+reconfiguring these resources to ranges satisfying only the current user (device
+X) and that may make the LCD screen unstable and present a bad user experience.
+
+Another case can be a debug serial port (earlycon) enabled from the bootloader,
+which may be used to debug early kernel oops.
+
+There are also cases where the resources may not be shared, but the kernel will
+disable them forcefully as no users may have appeared until a certain point in
+the kernel boot.
+
+Of course we can have more complex cases where the same resource is getting used
+by multiple devices while the kernel boots and the order in which the devices
+get probed wouldn't matter as the other devices may break because of the chosen
+configuration of the first probed device.
+
+Adding boot constraints
+=======================
+
+A boot constraint defines a configuration requirement set for the device by the
+boot loader. For example, if a clock is enabled for a device by the bootloader
+and we want the device to be working as is until the time the device is probed
+by its driver, then keeping this clock enabled is one of the boot constraint.
+
+Following are the different type of boot constraints supported currently by the
+core:
+
+.. kernel-doc:: include/linux/boot_constraint.h
+   :functions: dev_boot_constraint_type
+
+
+A single boot constraint can be added using the following helper:
+
+.. kernel-doc:: drivers/boot_constraint/core.c
+   :functions: dev_boot_constraint_add
+
+
+The second parameter to this routine describes the constraint to add and is
+represented by following structures:
+
+.. kernel-doc:: include/linux/boot_constraint.h
+   :functions: dev_boot_constraint dev_boot_constraint_info
+
+The power domain boot constraint doesn't need any data, while the clock and
+power supply boot constraint specific data is represented by following
+structures:
+
+.. kernel-doc:: include/linux/boot_constraint.h
+   :functions: dev_boot_constraint_supply_info dev_boot_constraint_clk_info
+
+
+In order to simplify adding multiple boot constraints for a platform, the boot
+constraints core supplies another helper which can be used to add all
+constraints for the platform.
+
+.. kernel-doc:: drivers/boot_constraint/deferrable_dev.c
+   :functions: dev_boot_constraint_add_deferrable_of
+
+
+The argument of this routine is described by following structure:
+
+.. kernel-doc:: include/linux/boot_constraint.h
+   :functions: dev_boot_constraint_of
+
+
+Removing boot constraints
+=========================
+
+Once the boot constraints are added, they will be honored by the boot constraint
+core until the time a driver tries to probe the device. The constraints are
+removed by the driver core if either the driver successfully probed the device
+or failed with an error value other than -EPROBE_DEFER. The constraints are kept
+as is for deferred probe. The driver core removes the constraints using the
+following helper, which must not be called directly by the platforms:
+
+.. kernel-doc:: drivers/boot_constraint/core.c
+   :functions: dev_boot_constraints_remove
diff --git a/Documentation/driver-api/boot-constraint/index.rst b/Documentation/driver-api/boot-constraint/index.rst
new file mode 100644
index 000000000000..d6fce17626a2
--- /dev/null
+++ b/Documentation/driver-api/boot-constraint/index.rst
@@ -0,0 +1,4 @@
+.. toctree::
+   :maxdepth: 1
+
+   constraints
diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst
index d17a9876b473..e591c172b5b5 100644
--- a/Documentation/driver-api/index.rst
+++ b/Documentation/driver-api/index.rst
@@ -47,6 +47,7 @@ available subsections can be seen below.
    gpio
    misc_devices
    dmaengine/index
+   boot-constraint/index
 
 .. only::  subproject and html
 
-- 
2.15.0.194.g9af6a3dea062

  parent reply	other threads:[~2017-12-14 15:33 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-14 15:33 [PATCH V5 00/13] drivers: Boot Constraint core Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 01/13] of: platform: Add of_find_any_device_by_node() Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 02/13] of: platform: Make of_platform_bus_create() global Viresh Kumar
2017-12-15  3:58   ` [PATCH V6 " Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 03/13] drivers: Add boot constraints core Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 04/13] boot_constraint: Add support for supply constraints Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 05/13] boot_constraint: Add support for clk constraints Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 06/13] boot_constraint: Add support for PM constraints Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 07/13] boot_constraint: Add debugfs support Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 08/13] boot_constraint: Manage deferrable constraints Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 09/13] boot_constraint: Add support for Hisilicon platforms Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 10/13] boot_constraint: Add support for IMX platform Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 11/13] boot_constraint: Add Qualcomm display controller constraints Viresh Kumar
2017-12-14 15:33 ` [PATCH V5 12/13] boot_constraint: Update MAINTAINERS Viresh Kumar
2017-12-14 15:33 ` Viresh Kumar [this message]
2018-01-09 18:47 ` [PATCH V5 00/13] drivers: Boot Constraint core Greg Kroah-Hartman
2018-01-10  3:44   ` Viresh Kumar
2018-01-10  8:08     ` Greg Kroah-Hartman
2018-01-10  8:42       ` Viresh Kumar
2018-01-10 18:19         ` Rob Herring
2018-01-10 18:54 ` Olof Johansson
2018-01-11  9:51   ` Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c0baa3f040d6a165b5e6ddc4748a73ecbf42b54c.1513264961.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).