Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Copyright (C) ST-Ericsson 2010 - 2013
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  * Author: Martin Persson <martin.persson@stericsson.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *         Hongbo Zhang <hongbo.zhang@linaro.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * When the AB8500 thermal warning temperature is reached (threshold cannot
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  * be changed by SW), an interrupt is set, and if no further action is taken
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * within a certain time frame, kernel_power_off will be called.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  * When AB8500 thermal shutdown temperature is reached a hardware shutdown of
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  * the AB8500 will occur.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/hwmon.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/hwmon-sysfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/mfd/abx500.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/mfd/abx500/ab8500-bm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/power/ab8500.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/reboot.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) #include <linux/sysfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) #include <linux/iio/consumer.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) #include "abx500.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) #define DEFAULT_POWER_OFF_DELAY	(HZ * 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define THERMAL_VCC		1800
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define PULL_UP_RESISTOR	47000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define AB8500_SENSOR_AUX1		0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) #define AB8500_SENSOR_AUX2		1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) #define AB8500_SENSOR_BTEMP_BALL	2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) #define AB8500_SENSOR_BAT_CTRL		3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) #define NUM_MONITORED_SENSORS		4
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) struct ab8500_gpadc_cfg {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	const struct abx500_res_to_temp *temp_tbl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	int tbl_sz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	int vcc;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	int r_up;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) struct ab8500_temp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) 	struct iio_channel *aux1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) 	struct iio_channel *aux2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	struct ab8500_btemp *btemp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	struct delayed_work power_off_work;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	struct ab8500_gpadc_cfg cfg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	struct abx500_temp *abx500_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * The hardware connection is like this:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * VCC----[ R_up ]-----[ NTC ]----GND
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  * where R_up is pull-up resistance, and GPADC measures voltage on NTC.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * and res_to_temp table is strictly sorted by falling resistance values.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) static int ab8500_voltage_to_temp(struct ab8500_gpadc_cfg *cfg,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 		int v_ntc, int *temp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	int r_ntc, i = 0, tbl_sz = cfg->tbl_sz;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 	const struct abx500_res_to_temp *tbl = cfg->temp_tbl;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	if (cfg->vcc < 0 || v_ntc >= cfg->vcc)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	r_ntc = v_ntc * cfg->r_up / (cfg->vcc - v_ntc);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	if (r_ntc > tbl[0].resist || r_ntc < tbl[tbl_sz - 1].resist)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	while (!(r_ntc <= tbl[i].resist && r_ntc > tbl[i + 1].resist) &&
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 			i < tbl_sz - 2)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 		i++;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	/* return milli-Celsius */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	*temp = tbl[i].temp * 1000 + ((tbl[i + 1].temp - tbl[i].temp) * 1000 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		(r_ntc - tbl[i].resist)) / (tbl[i + 1].resist - tbl[i].resist);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) static int ab8500_read_sensor(struct abx500_temp *data, u8 sensor, int *temp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 	int voltage, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	struct ab8500_temp *ab8500_data = data->plat_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	if (sensor == AB8500_SENSOR_BTEMP_BALL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 		*temp = ab8500_btemp_get_temp(ab8500_data->btemp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	} else if (sensor == AB8500_SENSOR_BAT_CTRL) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 		*temp = ab8500_btemp_get_batctrl_temp(ab8500_data->btemp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 	} else if (sensor == AB8500_SENSOR_AUX1) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		ret = iio_read_channel_processed(ab8500_data->aux1, &voltage);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 		if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		ret = ab8500_voltage_to_temp(&ab8500_data->cfg, voltage, temp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 		if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	} else if (sensor == AB8500_SENSOR_AUX2) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 		ret = iio_read_channel_processed(ab8500_data->aux2, &voltage);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 		if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		ret = ab8500_voltage_to_temp(&ab8500_data->cfg, voltage, temp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 		if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 			return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) static void ab8500_thermal_power_off(struct work_struct *work)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	struct ab8500_temp *ab8500_data = container_of(work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 				struct ab8500_temp, power_off_work.work);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	struct abx500_temp *abx500_data = ab8500_data->abx500_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	dev_warn(&abx500_data->pdev->dev, "Power off due to critical temp\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	kernel_power_off();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) static ssize_t ab8500_show_name(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 		struct device_attribute *devattr, char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	return sprintf(buf, "ab8500\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) static ssize_t ab8500_show_label(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 		struct device_attribute *devattr, char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	char *label;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	int index = attr->index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	switch (index) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	case 1:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 		label = "ext_adc1";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	case 2:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 		label = "ext_adc2";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	case 3:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 		label = "bat_temp";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	case 4:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		label = "bat_ctrl";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 		break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	return sprintf(buf, "%s\n", label);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) static int ab8500_temp_irq_handler(int irq, struct abx500_temp *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	struct ab8500_temp *ab8500_data = data->plat_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	dev_warn(&data->pdev->dev, "Power off in %d s\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 		 DEFAULT_POWER_OFF_DELAY / HZ);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	schedule_delayed_work(&ab8500_data->power_off_work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 		DEFAULT_POWER_OFF_DELAY);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) int abx500_hwmon_init(struct abx500_temp *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	struct ab8500_temp *ab8500_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	ab8500_data = devm_kzalloc(&data->pdev->dev, sizeof(*ab8500_data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 		GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	if (!ab8500_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	ab8500_data->btemp = ab8500_btemp_get();
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	if (IS_ERR(ab8500_data->btemp))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 		return PTR_ERR(ab8500_data->btemp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	INIT_DELAYED_WORK(&ab8500_data->power_off_work,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 			  ab8500_thermal_power_off);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	ab8500_data->cfg.vcc = THERMAL_VCC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	ab8500_data->cfg.r_up = PULL_UP_RESISTOR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	ab8500_data->cfg.temp_tbl = ab8500_temp_tbl_a_thermistor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	ab8500_data->cfg.tbl_sz = ab8500_temp_tbl_a_size;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	data->plat_data = ab8500_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	ab8500_data->aux1 = devm_iio_channel_get(&data->pdev->dev, "aux1");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	if (IS_ERR(ab8500_data->aux1)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 		if (PTR_ERR(ab8500_data->aux1) == -ENODEV)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 			return -EPROBE_DEFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		dev_err(&data->pdev->dev, "failed to get AUX1 ADC channel\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 		return PTR_ERR(ab8500_data->aux1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	ab8500_data->aux2 = devm_iio_channel_get(&data->pdev->dev, "aux2");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	if (IS_ERR(ab8500_data->aux2)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 		if (PTR_ERR(ab8500_data->aux2) == -ENODEV)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 			return -EPROBE_DEFER;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 		dev_err(&data->pdev->dev, "failed to get AUX2 ADC channel\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		return PTR_ERR(ab8500_data->aux2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	data->gpadc_addr[0] = AB8500_SENSOR_AUX1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	data->gpadc_addr[1] = AB8500_SENSOR_AUX2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	data->gpadc_addr[2] = AB8500_SENSOR_BTEMP_BALL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	data->gpadc_addr[3] = AB8500_SENSOR_BAT_CTRL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 	data->monitored_sensors = NUM_MONITORED_SENSORS;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 	data->ops.read_sensor = ab8500_read_sensor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 	data->ops.irq_handler = ab8500_temp_irq_handler;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	data->ops.show_name = ab8500_show_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	data->ops.show_label = ab8500_show_label;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	data->ops.is_visible = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) EXPORT_SYMBOL(abx500_hwmon_init);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) MODULE_AUTHOR("Hongbo Zhang <hongbo.zhang@linaro.org>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) MODULE_DESCRIPTION("AB8500 temperature driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) MODULE_LICENSE("GPL");