1/*
2 * Copyright (C) 2009 Lemote Inc.
3 * Author: Wu Zhangjin, wuzhangjin@gmail.com
4 *         Xiang Yu, xiangy@lemote.com
5 *         Chen Huacai, chenhc@lemote.com
6 *
7 * This program is free software; you can redistribute  it and/or modify it
8 * under  the terms of  the GNU General  Public License as published by the
9 * Free Software Foundation;  either version 2 of the  License, or (at your
10 * option) any later version.
11 */
12
13#include <linux/err.h>
14#include <linux/slab.h>
15#include <linux/platform_device.h>
16#include <asm/bootinfo.h>
17#include <boot_param.h>
18#include <loongson_hwmon.h>
19#include <workarounds.h>
20
21static int __init loongson3_platform_init(void)
22{
23	int i;
24	struct platform_device *pdev;
25
26	if (loongson_sysconf.ecname[0] != '\0')
27		platform_device_register_simple(loongson_sysconf.ecname, -1, NULL, 0);
28
29	for (i = 0; i < loongson_sysconf.nr_sensors; i++) {
30		if (loongson_sysconf.sensors[i].type > SENSOR_FAN)
31			continue;
32
33		pdev = kzalloc(sizeof(struct platform_device), GFP_KERNEL);
34		pdev->name = loongson_sysconf.sensors[i].name;
35		pdev->id = loongson_sysconf.sensors[i].id;
36		pdev->dev.platform_data = &loongson_sysconf.sensors[i];
37		platform_device_register(pdev);
38	}
39
40	return 0;
41}
42
43arch_initcall(loongson3_platform_init);
44