From patchwork Thu Dec 14 15:33:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 121980 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp6961182qgn; Thu, 14 Dec 2017 07:35:01 -0800 (PST) X-Google-Smtp-Source: ACJfBotBjlbt3dxeETlP4AaDVRaZ68cg/W4jhRkYdL3lwO7yk5dGcW97WDh5Jzgdd9rwOPEIaRq/ X-Received: by 10.159.195.12 with SMTP id bd12mr10097945plb.14.1513265701035; Thu, 14 Dec 2017 07:35:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513265701; cv=none; d=google.com; s=arc-20160816; b=CbKlrsXOmGqBF0+282VF/KiJD1k6jwEow0+fb26o1we1UXLzm2erX9es+ni8mum9Ra Pd4KnKtsg9Nrp5VvCaoIQoyfIw2T3zl22B/HHzCbMM5LbKvvs0iaX5p9AeLoWvfLVv/1 hHUWDjFKMlrDllZEZ+KG/LrVml0M2Yh3IAELjN/pu+9acnXwAh2I2Aj4vKoS38pRYFHb axWjnrUiaTNOFbR1hJvWLSFhCvGwpQatzVzwz4iDh3IPSOyAEks9DrD5r5Qp16WdOevg QcrklA6wYbSfi0xtvNSN5hdgXkHBPy30QdTK97mzqcSllgFjSZei/lTDWJrSOl99rAtv cMJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=api11LEndXJusHFPvHzUNPAysLOMa4YH5yakyeuJ+c0=; b=wMINzgK7/4GwZi1B4IIdm+vm/TZ9FeIWKRoG6o3GV1u6Z0omwFYN37K0lwlsZ9iDcx zln6+EtMWgTJ8hS5iCOg3g1ygm3ycO2+ZwD3VF4Qd2Cm68CTwUDsKpeg1w67rwnEgIH5 AH1biFqXlxrY4Tb0zZGoEynkSzRTYCN96ftlySsip43ampd7L1apoL0uskFqLbM49S8q X60ZhJ4iKUzVYN7+2Gm/FDQN0PZn/a88lc0tDWW0Zap5736DtL/9gWtOtcsRfhGDGtpx IXlSTeTXfM4/vjyaKMELL0LLtjx/p1N94zQ9TEtMLgGtUzmOj8FDReL1BzQX4iUCM3t1 5rrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i8uuwGK8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c26si3412776pfh.105.2017.12.14.07.35.00; Thu, 14 Dec 2017 07:35:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=i8uuwGK8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753532AbdLNPeo (ORCPT + 19 others); Thu, 14 Dec 2017 10:34:44 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:43373 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753249AbdLNPe2 (ORCPT ); Thu, 14 Dec 2017 10:34:28 -0500 Received: by mail-pg0-f66.google.com with SMTP id b18so3621260pgv.10 for ; Thu, 14 Dec 2017 07:34:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=api11LEndXJusHFPvHzUNPAysLOMa4YH5yakyeuJ+c0=; b=i8uuwGK8/7YyIG7MOlPIzZEGoySM01O92fmsykZ3H7TLG8+rHE/GJlZUF7K2YfZ94a 3UwmRR4Idcnnv7Piu+x8Bl/vbDS/b8oh4Yijf5qqITu8dIVm88Kx9awFIlqL9OuJYjc9 QWHnFuiLWC02ZH9NII+ccKx9TiVS+UGKtJy+o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=api11LEndXJusHFPvHzUNPAysLOMa4YH5yakyeuJ+c0=; b=LdpXs1zpn4xM8nNOtZI/9YENQ0cPszxWFxq6qpoJrJfvsOQnaOIBAdMfi8iNM7rqZ6 1T+AGnbPBD/Jei/SKPg5Q5KSX2CLWEOmK7FLmKT/vJPKp/SOtodsGzQlJdgAt4qLRNrs GztCwjHL4E12QgYA3quN0gmZDvhRZ1dSU4vH/z/AnXnRAaJDjnI5FwbOhBmTSO/HFHV3 Lf2Mvc7oSYMcMNm2/kG4rt6QLER+8JE2qysAZWODH/8V0BrpqOq7s2gjY9IZXqa/fAen oaH+Cs/OYgPYOhXVBwNrCyZQhPTT4TqKc4GIvN1AqkDDOUFggKDffLTz4svYFvXYGm95 +/Gg== X-Gm-Message-State: AKGB3mKOSLYQHegzypyHzeMEKywTvqaeDBAytMFBa//aC885+bv/9fjD ar4iKRv3ddrOAiNORczDaVZVZQ== X-Received: by 10.99.177.75 with SMTP id g11mr8981330pgp.268.1513265667911; Thu, 14 Dec 2017 07:34:27 -0800 (PST) Received: from localhost ([122.172.99.7]) by smtp.gmail.com with ESMTPSA id e2sm7190342pgv.34.2017.12.14.07.34.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Dec 2017 07:34:27 -0800 (PST) From: Viresh Kumar To: Greg Kroah-Hartman Cc: Viresh Kumar , Vincent Guittot , Stephen Boyd , Rajendra Nayak , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, robdclark@gmail.com, s.hauer@pengutronix.de, l.stach@pengutronix.de, shawnguo@kernel.org, fabio.estevam@nxp.com, nm@ti.com, xuwei5@hisilicon.com, robh+dt@kernel.org Subject: [PATCH V5 13/13] boot_constraint: Add documentation Date: Thu, 14 Dec 2017 21:03:20 +0530 Message-Id: X-Mailer: git-send-email 2.15.0.194.g9af6a3dea062 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This adds boot constraint documentation. Signed-off-by: Viresh Kumar --- .../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 -- 2.15.0.194.g9af6a3dea062 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:: + +========================= +Boot Constraint Subsystem +========================= + +:Copyright: |copy| 2017 Viresh Kumar , 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