Files
ack-tegra/include/linux/tegra_prod.h
Laxman Dewangan 9cf1f30f0a NVIDIA: SAUCE: platform: tegra: Add tegra prod as built-in driver
BugLink: https://bugs.launchpad.net/bugs/2080908

This is an integration squash change of below commits.

 - [INTG: NV INTERNAL] platform: tegra: Add tegra prod as built-in
 - [INTG: NV INTERNAL] platform: tegra: Add tegra prod framework
 - [INTG: NV INTERNAL] platform: tegra: Add support for mask with 1s
 - [INTG: NV INTERNAL] platform: tegra_prod: Use kmemleak_not_leak for allocated memory
 - [INTG: NV INTERNAL] platform: tegra_prod: Fix prod setting parsing for package/board
 - [INTG: NV INTERNAL] platform: tegra_prod: Use proper variable name
 - [INTG: NV INTERNAL] platform: tegra_prod: Use for_each_available_child_of_node()
 - [INTG: NV INTERNAL] platform: tegra: move struct tegra_prod_list to private
 - [INTG: NV INTERNAL] platform: tegra_prod: Add APIs to managed allocation of prod_list
 - [INTG: NV INTERNAL] platform: tegra_prod: Remove unused APIs from public header
 - [INTG: NV INTERNAL] platform: tegra_prod: Get rid of tegra_prod_release()
 - [INTG: NV INTERNAL] platform: tegra_prod: Add support for nested prod nodes
 - [INTG: NV INTERNAL] platform: tegra_prod: Add devm_tegra_prod_get_from_node()
 - [INTG: NV INTERNAL] platform: tegra_prod: use devm_ for allocation
 - [INTG: NV INTERNAL] platform: tegra_prod: Do not use kmemleak_not_leak()
 - [INTG: NV INTERNAL] platform: tegra: Add support to find prod setting
 - [INTG: NV INTERNAL] platform: tegra: APIs to set prod based on name/index/offset/mask
 - [INTG: NV INTERNAL] prod: Add support for masked write in partially prod config
 - [INTG: NV INTERNAL] platform: tegra_prod: Use strcasecmp() for prod name
 - [INTG: NV INTERNAL] prod: set prod-settings mask to 1-style default
 - [INTG: NV INTERNAL] platform: tegra_prod: add support to avoid multiple configruation
 - soc: tegra: Add prod configuration parser
 - prod: remove package and board specific prod node
 - platform: tegra: Add config for next generation tegra prod
 - tegra-prod: Add legacy and next gen prod based on config
 - tegra-prod: Fix missing last entry
 - tegra-prod: Fix null pointer error
 - tegra-prod: Fix null pointer error
 - tegra: prod: remove new prod settings support

http://nvbugs/4165866
http://nvbugs/200416207
http://nvbugs/1758682
http://nvbugs/1745386
http://nvbugs/1768583
http://nvbugs/200217343
http://nvbugs/200215286
http://nvbugs/1807581
http://nvbugs/1865456
http://nvbugs/4097475
http://nvbugs/3389584
http://nvbugs/4638219
http://nvbugs/4283554
http://nvbugs/4765671
http://nvbugs/4754882

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Petlozu Pravareshwar <petlozup@nvidia.com>
Acked-by: Noah Wager <noah.wager@canonical.com>
Acked-by: Jacob Martin <jacob.martin@canonical.com>
Signed-off-by: Noah Wager <noah.wager@canonical.com>
2025-11-22 02:47:25 +00:00

127 lines
4.6 KiB
C

/*
* Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
* version 2, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _TEGRA_PRODS_H
#define _TEGRA_PRODS_H
struct tegra_prod;
/**
* tegra_prod_set_list(): Set all prods configurations
* @base: List of IO mapped registers.
* @tegra_prod: tegra_prod handle which is allocated by devm_tegra_prod_get()
* or tegra_prod_get_from_node();
*
* Configure all the prod configuration listed on prod-setting nodes.
*
* Returns 0 on success otherwise negive error number for failed case.
*/
int tegra_prod_set_list(void __iomem **base, struct tegra_prod *tegra_prod);
/**
* tegra_prod_set_boot_init(): Set all prods configurations which has boot init
* flag on the prod setting nodes.
* @base: List of IO mapped registers.
* @tegra_prod: tegra_prod handle which is allocated by devm_tegra_prod_get()
* or tegra_prod_get_from_node();
*
* Configure all the prod configuration listed on prod-setting nodes.
*
* Returns 0 on success otherwise negive error number for failed case.
*/
int tegra_prod_set_boot_init(void __iomem **base,
struct tegra_prod *tegra_prod);
/**
* tegra_prod_set_by_name(): Set prod configuration with specific prod name.
* This is used for conditional prod configurations.
* @base: List of IO mapped registers.
* @name: Name of conditional prod which need to be configure.
* @tegra_prod: tegra_prod handle which is allocated by devm_tegra_prod_get()
* or tegra_prod_get_from_node();
*
* Configure prod configuration with specific prod name for conditional
* prod configurations.
*
* Returns 0 on success otherwise negive error number for failed case.
*/
int tegra_prod_set_by_name(void __iomem **base, const char *name,
struct tegra_prod *tegra_prod);
/**
* tegra_prod_set_by_name_partially - Set the prod setting from list partially
* under given prod name. The matching is done
* qith index, offset and mask.
* @base: base address of the register.
* @name: the name of tegra prod need to set.
* @tegra_prod: the list of tegra prods.
* @index: Index of base address.
* @offset: Offset of the register.
* @mask: Mask field on given register.
*
* Find the tegra prod in the list according to the name. Then set
* that tegra prod which has matching of index, offset and mask.
*
* Returns 0 on success.
*/
int tegra_prod_set_by_name_partially(void __iomem **base, const char *name,
struct tegra_prod *tegra_prod, u32 index,
u32 offset, u32 mask);
/**
* tegra_prod_by_name_supported - Tell whether tegra prod will be supported by
* given name or not.
* @tegra_prod: the list of tegra prods.
* @name: the name of tegra prod need to set.
*
* Find the tegra prod in the list according to the name. If it exist then
* return true else false.
*/
bool tegra_prod_by_name_supported(struct tegra_prod *tegra_prod,
const char *name);
/**
* devm_tegra_prod_get(): Get the prod handle from the device.
* @dev: Device handle on which prod setting nodes are available.
*
* Parse the prod-setting node of the dev->of_node and keep all prod
* setting data in prod handle.
* This handle is used for setting prod configurations.
*
* Returns valid prod_list handle on success or pointer to the error
* when it failed.
*/
struct tegra_prod *devm_tegra_prod_get(struct device *dev);
/**
* devm_tegra_prod_get_from_node(): Get the prod handle from the node.
* @dev: Device handle.
* @np: Node pointer on which prod setting nodes are available.
*
* Parse the prod-setting node of the node pointer "np" and keep all prod
* setting data in prod handle.
* This handle is used for setting prod configurations.
*
* Returns valid prod_list handle on success or pointer to the error
* when it failed.
* The allocated resource is released by driver core framework when device
* is unbinded and so no need to call any release APIs for the tegra_prod
* handle.
*/
struct tegra_prod *devm_tegra_prod_get_from_node(struct device *dev,
struct device_node *np);
#endif