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-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * An hwmon driver for the Analog Devices AD7414
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright 2006 Stefan Roese <sr at denx.de>, DENX Software Engineering
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Copyright (c) 2008 PIKA Technologies
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *   Sean MacLennan <smaclennan@pikatech.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  * Copyright (c) 2008 Spansion Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11)  *   Frank Edelhaeuser <frank.edelhaeuser at spansion.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12)  *   (converted to "new style" I2C driver model, removed checkpatch.pl warnings)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14)  * Based on ad7418.c
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15)  * Copyright 2006 Tower Technologies, Alessandro Zummo <a.zummo at towertech.it>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/jiffies.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/i2c.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/hwmon.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) #include <linux/hwmon-sysfs.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) #include <linux/err.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) #include <linux/mutex.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/slab.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) /* AD7414 registers */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) #define AD7414_REG_TEMP		0x00
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) #define AD7414_REG_CONF		0x01
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define AD7414_REG_T_HIGH	0x02
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) #define AD7414_REG_T_LOW	0x03
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) static u8 AD7414_REG_LIMIT[] = { AD7414_REG_T_HIGH, AD7414_REG_T_LOW };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) struct ad7414_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) 	struct i2c_client	*client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 	struct mutex		lock;	/* atomic read data updates */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) 	char			valid;	/* !=0 if following fields are valid */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) 	unsigned long		next_update;	/* In jiffies */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	s16			temp_input;	/* Register values */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 	s8			temps[ARRAY_SIZE(AD7414_REG_LIMIT)];
^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) /* REG: (0.25C/bit, two's complement) << 6 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) static inline int ad7414_temp_from_reg(s16 reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	 * use integer division instead of equivalent right shift to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	 * guarantee arithmetic shift and preserve the sign
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	return ((int)reg / 64) * 250;
^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) static inline int ad7414_read(struct i2c_client *client, u8 reg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	if (reg == AD7414_REG_TEMP)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 		return i2c_smbus_read_word_swapped(client, reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 		return i2c_smbus_read_byte_data(client, reg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) static inline int ad7414_write(struct i2c_client *client, u8 reg, u8 value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	return i2c_smbus_write_byte_data(client, reg, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) static struct ad7414_data *ad7414_update_device(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 	struct ad7414_data *data = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 	struct i2c_client *client = data->client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	mutex_lock(&data->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 	if (time_after(jiffies, data->next_update) || !data->valid) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 		int value, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		dev_dbg(&client->dev, "starting ad7414 update\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		value = ad7414_read(client, AD7414_REG_TEMP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		if (value < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 			dev_dbg(&client->dev, "AD7414_REG_TEMP err %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 				value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 		else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 			data->temp_input = value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 		for (i = 0; i < ARRAY_SIZE(AD7414_REG_LIMIT); ++i) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 			value = ad7414_read(client, AD7414_REG_LIMIT[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 			if (value < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 				dev_dbg(&client->dev, "AD7414 reg %d err %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 					AD7414_REG_LIMIT[i], value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 			else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 				data->temps[i] = value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 		}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		data->next_update = jiffies + HZ + HZ / 2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 		data->valid = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	mutex_unlock(&data->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	return data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) static ssize_t temp_input_show(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 			       struct device_attribute *attr, char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	struct ad7414_data *data = ad7414_update_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	return sprintf(buf, "%d\n", ad7414_temp_from_reg(data->temp_input));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) static SENSOR_DEVICE_ATTR_RO(temp1_input, temp_input, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) static ssize_t max_min_show(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 			    char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	int index = to_sensor_dev_attr(attr)->index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	struct ad7414_data *data = ad7414_update_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	return sprintf(buf, "%d\n", data->temps[index] * 1000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) static ssize_t max_min_store(struct device *dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 			     struct device_attribute *attr, const char *buf,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 			     size_t count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	struct ad7414_data *data = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	struct i2c_client *client = data->client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	int index = to_sensor_dev_attr(attr)->index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	u8 reg = AD7414_REG_LIMIT[index];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	long temp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 	int ret = kstrtol(buf, 10, &temp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	temp = clamp_val(temp, -40000, 85000);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	temp = (temp + (temp < 0 ? -500 : 500)) / 1000;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	mutex_lock(&data->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	data->temps[index] = temp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	ad7414_write(client, reg, temp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	mutex_unlock(&data->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	return count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) static SENSOR_DEVICE_ATTR_RW(temp1_max, max_min, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) static SENSOR_DEVICE_ATTR_RW(temp1_min, max_min, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) static ssize_t alarm_show(struct device *dev, struct device_attribute *attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 			  char *buf)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	int bitnr = to_sensor_dev_attr(attr)->index;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 	struct ad7414_data *data = ad7414_update_device(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 	int value = (data->temp_input >> bitnr) & 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	return sprintf(buf, "%d\n", value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) static SENSOR_DEVICE_ATTR_RO(temp1_min_alarm, alarm, 3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) static SENSOR_DEVICE_ATTR_RO(temp1_max_alarm, alarm, 4);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) static struct attribute *ad7414_attrs[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	&sensor_dev_attr_temp1_input.dev_attr.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	&sensor_dev_attr_temp1_max.dev_attr.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	&sensor_dev_attr_temp1_min.dev_attr.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	&sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	&sensor_dev_attr_temp1_min_alarm.dev_attr.attr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 	NULL
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) ATTRIBUTE_GROUPS(ad7414);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) static int ad7414_probe(struct i2c_client *client)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	struct device *dev = &client->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	struct ad7414_data *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	struct device *hwmon_dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	int conf;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 				     I2C_FUNC_SMBUS_READ_WORD_DATA))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 		return -EOPNOTSUPP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	data = devm_kzalloc(dev, sizeof(struct ad7414_data), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	if (!data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	data->client = client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	mutex_init(&data->lock);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	dev_info(&client->dev, "chip found\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	/* Make sure the chip is powered up. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	conf = i2c_smbus_read_byte_data(client, AD7414_REG_CONF);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	if (conf < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		dev_warn(dev, "ad7414_probe unable to read config register.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 		conf &= ~(1 << 7);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		i2c_smbus_write_byte_data(client, AD7414_REG_CONF, conf);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	hwmon_dev = devm_hwmon_device_register_with_groups(dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 							   client->name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 							   data, ad7414_groups);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	return PTR_ERR_OR_ZERO(hwmon_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) static const struct i2c_device_id ad7414_id[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	{ "ad7414", 0 },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) MODULE_DEVICE_TABLE(i2c, ad7414_id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) static const struct of_device_id __maybe_unused ad7414_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	{ .compatible = "ad,ad7414" },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	{ },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) MODULE_DEVICE_TABLE(of, ad7414_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) static struct i2c_driver ad7414_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 		.name	= "ad7414",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		.of_match_table = of_match_ptr(ad7414_of_match),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 	.probe_new = ad7414_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 	.id_table = ad7414_id,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) module_i2c_driver(ad7414_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) MODULE_AUTHOR("Stefan Roese <sr at denx.de>, "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	      "Frank Edelhaeuser <frank.edelhaeuser at spansion.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) MODULE_DESCRIPTION("AD7414 driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) MODULE_LICENSE("GPL");