raspberrypi.c (2a267e7c41aa88215de2b542de797d03d16ecdfd) raspberrypi.c (91f2cf4a6b2131016b1ae9c9500245f0572112c7)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Defines interfaces for interacting wtih the Raspberry Pi firmware's
4 * property channel.
5 *
6 * Copyright © 2015 Broadcom
7 */
8

--- 6 unchanged lines hidden (view full) ---

15#include <soc/bcm2835/raspberrypi-firmware.h>
16
17#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf))
18#define MBOX_CHAN(msg) ((msg) & 0xf)
19#define MBOX_DATA28(msg) ((msg) & ~0xf)
20#define MBOX_CHAN_PROPERTY 8
21
22static struct platform_device *rpi_hwmon;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Defines interfaces for interacting wtih the Raspberry Pi firmware's
4 * property channel.
5 *
6 * Copyright © 2015 Broadcom
7 */
8

--- 6 unchanged lines hidden (view full) ---

15#include <soc/bcm2835/raspberrypi-firmware.h>
16
17#define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf))
18#define MBOX_CHAN(msg) ((msg) & 0xf)
19#define MBOX_DATA28(msg) ((msg) & ~0xf)
20#define MBOX_CHAN_PROPERTY 8
21
22static struct platform_device *rpi_hwmon;
23static struct platform_device *rpi_clk;
23
24struct rpi_firmware {
25 struct mbox_client cl;
26 struct mbox_chan *chan; /* The property channel. */
27 struct completion c;
28 u32 enabled;
29};
30

--- 171 unchanged lines hidden (view full) ---

202
203 if (ret)
204 return;
205
206 rpi_hwmon = platform_device_register_data(dev, "raspberrypi-hwmon",
207 -1, NULL, 0);
208}
209
24
25struct rpi_firmware {
26 struct mbox_client cl;
27 struct mbox_chan *chan; /* The property channel. */
28 struct completion c;
29 u32 enabled;
30};
31

--- 171 unchanged lines hidden (view full) ---

203
204 if (ret)
205 return;
206
207 rpi_hwmon = platform_device_register_data(dev, "raspberrypi-hwmon",
208 -1, NULL, 0);
209}
210
211static void rpi_register_clk_driver(struct device *dev)
212{
213 rpi_clk = platform_device_register_data(dev, "raspberrypi-clk",
214 -1, NULL, 0);
215}
216
210static int rpi_firmware_probe(struct platform_device *pdev)
211{
212 struct device *dev = &pdev->dev;
213 struct rpi_firmware *fw;
214
215 fw = devm_kzalloc(dev, sizeof(*fw), GFP_KERNEL);
216 if (!fw)
217 return -ENOMEM;

--- 11 unchanged lines hidden (view full) ---

229 }
230
231 init_completion(&fw->c);
232
233 platform_set_drvdata(pdev, fw);
234
235 rpi_firmware_print_firmware_revision(fw);
236 rpi_register_hwmon_driver(dev, fw);
217static int rpi_firmware_probe(struct platform_device *pdev)
218{
219 struct device *dev = &pdev->dev;
220 struct rpi_firmware *fw;
221
222 fw = devm_kzalloc(dev, sizeof(*fw), GFP_KERNEL);
223 if (!fw)
224 return -ENOMEM;

--- 11 unchanged lines hidden (view full) ---

236 }
237
238 init_completion(&fw->c);
239
240 platform_set_drvdata(pdev, fw);
241
242 rpi_firmware_print_firmware_revision(fw);
243 rpi_register_hwmon_driver(dev, fw);
244 rpi_register_clk_driver(dev);
237
238 return 0;
239}
240
241static void rpi_firmware_shutdown(struct platform_device *pdev)
242{
243 struct rpi_firmware *fw = platform_get_drvdata(pdev);
244

--- 4 unchanged lines hidden (view full) ---

249}
250
251static int rpi_firmware_remove(struct platform_device *pdev)
252{
253 struct rpi_firmware *fw = platform_get_drvdata(pdev);
254
255 platform_device_unregister(rpi_hwmon);
256 rpi_hwmon = NULL;
245
246 return 0;
247}
248
249static void rpi_firmware_shutdown(struct platform_device *pdev)
250{
251 struct rpi_firmware *fw = platform_get_drvdata(pdev);
252

--- 4 unchanged lines hidden (view full) ---

257}
258
259static int rpi_firmware_remove(struct platform_device *pdev)
260{
261 struct rpi_firmware *fw = platform_get_drvdata(pdev);
262
263 platform_device_unregister(rpi_hwmon);
264 rpi_hwmon = NULL;
265 platform_device_unregister(rpi_clk);
266 rpi_clk = NULL;
257 mbox_free_channel(fw->chan);
258
259 return 0;
260}
261
262/**
263 * rpi_firmware_get - Get pointer to rpi_firmware structure.
264 * @firmware_node: Pointer to the firmware Device Tree node.

--- 34 unchanged lines hidden ---
267 mbox_free_channel(fw->chan);
268
269 return 0;
270}
271
272/**
273 * rpi_firmware_get - Get pointer to rpi_firmware structure.
274 * @firmware_node: Pointer to the firmware Device Tree node.

--- 34 unchanged lines hidden ---