Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

firmware: tegra: bpmp: Add tegra_bpmp_get_with_id() function

Some device tree bindings need to specify a parameter along with a BPMP
phandle reference to designate the ID associated with a given controller
that needs to interoperate with BPMP. Typically this is specified as an
extra cell in the nvidia,bpmp property, so add a helper to parse this ID
while resolving the phandle reference.

Signed-off-by: Thierry Reding <treding@nvidia.com>

+42
+34
drivers/firmware/tegra/bpmp.c
··· 32 32 return bpmp->soc->ops; 33 33 } 34 34 35 + struct tegra_bpmp *tegra_bpmp_get_with_id(struct device *dev, unsigned int *id) 36 + { 37 + struct platform_device *pdev; 38 + struct of_phandle_args args; 39 + struct tegra_bpmp *bpmp; 40 + int err; 41 + 42 + err = __of_parse_phandle_with_args(dev->of_node, "nvidia,bpmp", NULL, 43 + 1, 0, &args); 44 + if (err < 0) 45 + return ERR_PTR(err); 46 + 47 + pdev = of_find_device_by_node(args.np); 48 + if (!pdev) { 49 + bpmp = ERR_PTR(-ENODEV); 50 + goto put; 51 + } 52 + 53 + bpmp = platform_get_drvdata(pdev); 54 + if (!bpmp) { 55 + bpmp = ERR_PTR(-EPROBE_DEFER); 56 + put_device(&pdev->dev); 57 + goto put; 58 + } 59 + 60 + if (id) 61 + *id = args.args[0]; 62 + 63 + put: 64 + of_node_put(args.np); 65 + return bpmp; 66 + } 67 + EXPORT_SYMBOL_GPL(tegra_bpmp_get_with_id); 68 + 35 69 struct tegra_bpmp *tegra_bpmp_get(struct device *dev) 36 70 { 37 71 struct platform_device *pdev;
+8
include/soc/tegra/bpmp.h
··· 127 127 128 128 #if IS_ENABLED(CONFIG_TEGRA_BPMP) 129 129 struct tegra_bpmp *tegra_bpmp_get(struct device *dev); 130 + struct tegra_bpmp *tegra_bpmp_get_with_id(struct device *dev, unsigned int *id); 130 131 void tegra_bpmp_put(struct tegra_bpmp *bpmp); 131 132 int tegra_bpmp_transfer_atomic(struct tegra_bpmp *bpmp, 132 133 struct tegra_bpmp_message *msg); ··· 146 145 { 147 146 return ERR_PTR(-ENOTSUPP); 148 147 } 148 + 149 + static inline struct tegra_bpmp *tegra_bpmp_get_with_id(struct device *dev, 150 + unsigned int *id) 151 + { 152 + return ERR_PTR(-ENODEV); 153 + } 154 + 149 155 static inline void tegra_bpmp_put(struct tegra_bpmp *bpmp) 150 156 { 151 157 }