How to read temperature in linux
Hi all for learning purpose i have created a driver under driver/thermal ( xyz_thermal.c) which can read temperature ( just passing dummies value). But now how can i read this vlue from userspace. i tried /sys/class/thermal/ but i didn't see thermal zone which i created. Can any one help me on this?
Changes what i have done.
xyz_thermal.c
*/
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/nvmem-consumer.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <linux/thermal.h>
#include <linux/reset.h>
#include <linux/types.h>
struct xyz_therm_info {
struct device *dev;
struct thermal_zone_device *tz_device;
int irq_tj1;
int irq_tj2;
int irq_tj3;
};
static int xyz_read_temp(void *data, int *temperature)
{
struct mtk_thermal *mt = data;
temperature = 100;
return 0;
}
static const struct thermal_zone_of_device_ops xyz_thermal_ops = {
.get_temp = xyz_read_temp,
};
static int xyz_thermal_probe(struct platform_device *pdev)
{
}
static struct platform_device_id xyz_thermal_devtype[] = {
{ .name = "xyz-thermal", },
{},
};
MODULE_DEVICE_TABLE(platform, xyz_thermal_devtype);
static struct platform_driver xyz_thermal_driver = {
.driver = {
.name = "xyz-thermal",
},
.probe = xyz_thermal_probe,
.id_table = xyz_thermal_devtype,
};
module_platform_driver(xyz_thermal_driver);
also did changes in kconfig and make file and enable it on .config file
i want to know what i am missing here or is i am doing it correctly?
|