mirror of
https://gitlab.com/manzerbredes/ina260-sysfs-driver.git
synced 2025-04-19 04:09:45 +00:00
Minor changes
This commit is contained in:
parent
3ed60f4537
commit
4acb4daa59
1 changed files with 9 additions and 21 deletions
30
ina260.c
30
ina260.c
|
@ -17,14 +17,14 @@
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
|
||||||
// INA260 registers
|
// INA260 registers
|
||||||
#define INA260_REG_CONFIGURATION 0x00
|
#define INA260_REG_CONFIGURATION 0x00
|
||||||
#define INA260_REG_CURRENT 0x01
|
#define INA260_REG_CURRENT 0x01
|
||||||
#define INA260_REG_VOLTAGE 0x02
|
#define INA260_REG_VOLTAGE 0x02
|
||||||
#define INA260_REG_POWER 0x03
|
#define INA260_REG_POWER 0x03
|
||||||
#define INA260_REG_MASKENABLE 0x06
|
#define INA260_REG_MASKENABLE 0x06
|
||||||
#define INA260_REG_ALERTLIMIT 0x07
|
#define INA260_REG_ALERTLIMIT 0x07
|
||||||
#define INA260_REG_MANUFACTURER 0xFE
|
#define INA260_REG_MANUFACTURER 0xFE
|
||||||
#define INA260_REG_DIE 0xFF
|
#define INA260_REG_DIE 0xFF
|
||||||
|
|
||||||
static struct regmap_config ina260_regmap_config = {
|
static struct regmap_config ina260_regmap_config = {
|
||||||
.max_register = INA260_REG_DIE,
|
.max_register = INA260_REG_DIE,
|
||||||
|
@ -41,7 +41,7 @@ static ssize_t _attr##_show(struct device *dev, struct device_attribute *attr, c
|
||||||
err = regmap_read(cdata->regmap, (_reg), &rvalue); \
|
err = regmap_read(cdata->regmap, (_reg), &rvalue); \
|
||||||
if(err>0) \
|
if(err>0) \
|
||||||
return err; \
|
return err; \
|
||||||
return sprintf(buf, "%x\n", rvalue); \
|
return sprintf(buf, "0x%x\n", rvalue); \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INA260_REG_STORE(_attr,_reg) \
|
#define INA260_REG_STORE(_attr,_reg) \
|
||||||
|
@ -57,18 +57,6 @@ static ssize_t _attr##_store(struct device *dev, struct device_attribute *attr,
|
||||||
return count; \
|
return count; \
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief This macro is not available on old kernel especially the one
|
|
||||||
* used by Beaglebones Single Board Computers
|
|
||||||
*/
|
|
||||||
#define HWMON_CHANNEL_INFO(stype, ...) \
|
|
||||||
(&(struct hwmon_channel_info) { \
|
|
||||||
.type = hwmon_##stype, \
|
|
||||||
.config = (u32 []) { \
|
|
||||||
__VA_ARGS__, 0 \
|
|
||||||
} \
|
|
||||||
})
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Embedded user data
|
* @brief Embedded user data
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue