mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 17:24:17 +08:00
firmware: raspberrypi: Register hwmon driver
Since the raspberrypi-hwmon driver is tied to the VC4 firmware instead of particular hardware its registration should be in the firmware driver. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Signed-off-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
parent
74d1e00791
commit
70eea1bbb5
@ -21,6 +21,8 @@
|
|||||||
#define MBOX_DATA28(msg) ((msg) & ~0xf)
|
#define MBOX_DATA28(msg) ((msg) & ~0xf)
|
||||||
#define MBOX_CHAN_PROPERTY 8
|
#define MBOX_CHAN_PROPERTY 8
|
||||||
|
|
||||||
|
static struct platform_device *rpi_hwmon;
|
||||||
|
|
||||||
struct rpi_firmware {
|
struct rpi_firmware {
|
||||||
struct mbox_client cl;
|
struct mbox_client cl;
|
||||||
struct mbox_chan *chan; /* The property channel. */
|
struct mbox_chan *chan; /* The property channel. */
|
||||||
@ -183,6 +185,20 @@ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
rpi_register_hwmon_driver(struct device *dev, struct rpi_firmware *fw)
|
||||||
|
{
|
||||||
|
u32 packet;
|
||||||
|
int ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_THROTTLED,
|
||||||
|
&packet, sizeof(packet));
|
||||||
|
|
||||||
|
if (ret)
|
||||||
|
return;
|
||||||
|
|
||||||
|
rpi_hwmon = platform_device_register_data(dev, "raspberrypi-hwmon",
|
||||||
|
-1, NULL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
static int rpi_firmware_probe(struct platform_device *pdev)
|
static int rpi_firmware_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
@ -209,6 +225,7 @@ static int rpi_firmware_probe(struct platform_device *pdev)
|
|||||||
platform_set_drvdata(pdev, fw);
|
platform_set_drvdata(pdev, fw);
|
||||||
|
|
||||||
rpi_firmware_print_firmware_revision(fw);
|
rpi_firmware_print_firmware_revision(fw);
|
||||||
|
rpi_register_hwmon_driver(dev, fw);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -217,6 +234,8 @@ static int rpi_firmware_remove(struct platform_device *pdev)
|
|||||||
{
|
{
|
||||||
struct rpi_firmware *fw = platform_get_drvdata(pdev);
|
struct rpi_firmware *fw = platform_get_drvdata(pdev);
|
||||||
|
|
||||||
|
platform_device_unregister(rpi_hwmon);
|
||||||
|
rpi_hwmon = NULL;
|
||||||
mbox_free_channel(fw->chan);
|
mbox_free_channel(fw->chan);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user