Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
ad525x_dpot.c File Reference
#include <linux/module.h>
#include <linux/device.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include "ad525x_dpot.h"

Go to the source code of this file.

Data Structures

struct  dpot_data
 

Macros

#define DPOT_DEVICE_SHOW(_name, _reg)
 
#define DPOT_DEVICE_SET(_name, _reg)
 
#define DPOT_DEVICE_SHOW_SET(name, reg)
 
#define DPOT_DEVICE_SHOW_ONLY(name, reg)
 
#define DPOT_DEVICE_DO_CMD(_name, _cmd)
 

Functions

 DPOT_DEVICE_SHOW_SET (rdac0, DPOT_ADDR_RDAC|DPOT_RDAC0)
 
 DPOT_DEVICE_SHOW_SET (eeprom0, DPOT_ADDR_EEPROM|DPOT_RDAC0)
 
 DPOT_DEVICE_SHOW_ONLY (tolerance0, DPOT_ADDR_EEPROM|DPOT_TOL_RDAC0)
 
 DPOT_DEVICE_SHOW_SET (otp0, DPOT_ADDR_OTP|DPOT_RDAC0)
 
 DPOT_DEVICE_SHOW_SET (otp0en, DPOT_ADDR_OTP_EN|DPOT_RDAC0)
 
 DPOT_DEVICE_SHOW_SET (rdac1, DPOT_ADDR_RDAC|DPOT_RDAC1)
 
 DPOT_DEVICE_SHOW_SET (eeprom1, DPOT_ADDR_EEPROM|DPOT_RDAC1)
 
 DPOT_DEVICE_SHOW_ONLY (tolerance1, DPOT_ADDR_EEPROM|DPOT_TOL_RDAC1)
 
 DPOT_DEVICE_SHOW_SET (otp1, DPOT_ADDR_OTP|DPOT_RDAC1)
 
 DPOT_DEVICE_SHOW_SET (otp1en, DPOT_ADDR_OTP_EN|DPOT_RDAC1)
 
 DPOT_DEVICE_SHOW_SET (rdac2, DPOT_ADDR_RDAC|DPOT_RDAC2)
 
 DPOT_DEVICE_SHOW_SET (eeprom2, DPOT_ADDR_EEPROM|DPOT_RDAC2)
 
 DPOT_DEVICE_SHOW_ONLY (tolerance2, DPOT_ADDR_EEPROM|DPOT_TOL_RDAC2)
 
 DPOT_DEVICE_SHOW_SET (otp2, DPOT_ADDR_OTP|DPOT_RDAC2)
 
 DPOT_DEVICE_SHOW_SET (otp2en, DPOT_ADDR_OTP_EN|DPOT_RDAC2)
 
 DPOT_DEVICE_SHOW_SET (rdac3, DPOT_ADDR_RDAC|DPOT_RDAC3)
 
 DPOT_DEVICE_SHOW_SET (eeprom3, DPOT_ADDR_EEPROM|DPOT_RDAC3)
 
 DPOT_DEVICE_SHOW_ONLY (tolerance3, DPOT_ADDR_EEPROM|DPOT_TOL_RDAC3)
 
 DPOT_DEVICE_SHOW_SET (otp3, DPOT_ADDR_OTP|DPOT_RDAC3)
 
 DPOT_DEVICE_SHOW_SET (otp3en, DPOT_ADDR_OTP_EN|DPOT_RDAC3)
 
 DPOT_DEVICE_SHOW_SET (rdac4, DPOT_ADDR_RDAC|DPOT_RDAC4)
 
 DPOT_DEVICE_SHOW_SET (eeprom4, DPOT_ADDR_EEPROM|DPOT_RDAC4)
 
 DPOT_DEVICE_SHOW_ONLY (tolerance4, DPOT_ADDR_EEPROM|DPOT_TOL_RDAC4)
 
 DPOT_DEVICE_SHOW_SET (otp4, DPOT_ADDR_OTP|DPOT_RDAC4)
 
 DPOT_DEVICE_SHOW_SET (otp4en, DPOT_ADDR_OTP_EN|DPOT_RDAC4)
 
 DPOT_DEVICE_SHOW_SET (rdac5, DPOT_ADDR_RDAC|DPOT_RDAC5)
 
 DPOT_DEVICE_SHOW_SET (eeprom5, DPOT_ADDR_EEPROM|DPOT_RDAC5)
 
 DPOT_DEVICE_SHOW_ONLY (tolerance5, DPOT_ADDR_EEPROM|DPOT_TOL_RDAC5)
 
 DPOT_DEVICE_SHOW_SET (otp5, DPOT_ADDR_OTP|DPOT_RDAC5)
 
 DPOT_DEVICE_SHOW_SET (otp5en, DPOT_ADDR_OTP_EN|DPOT_RDAC5)
 
 DPOT_DEVICE_DO_CMD (inc_all, DPOT_INC_ALL)
 
 DPOT_DEVICE_DO_CMD (dec_all, DPOT_DEC_ALL)
 
 DPOT_DEVICE_DO_CMD (inc_all_6db, DPOT_INC_ALL_6DB)
 
 DPOT_DEVICE_DO_CMD (dec_all_6db, DPOT_DEC_ALL_6DB)
 
__devinit int ad_dpot_add_files (struct device *dev, unsigned features, unsigned rdac)
 
void ad_dpot_remove_files (struct device *dev, unsigned features, unsigned rdac)
 
int __devinit ad_dpot_probe (struct device *dev, struct ad_dpot_bus_data *bdata, unsigned long devid, const char *name)
 
 EXPORT_SYMBOL (ad_dpot_probe)
 
int ad_dpot_remove (struct device *dev)
 
 EXPORT_SYMBOL (ad_dpot_remove)
 
 MODULE_AUTHOR ("Chris Verges <[email protected]>, ""Michael Hennerich <[email protected]>")
 
 MODULE_DESCRIPTION ("Digital potentiometer driver")
 
 MODULE_LICENSE ("GPL")
 

Macro Definition Documentation

#define DPOT_DEVICE_DO_CMD (   _name,
  _cmd 
)
Value:
static ssize_t \
set_##_name(struct device *dev, \
const char *buf, size_t count) \
{ \
return sysfs_do_cmd(dev, attr, buf, count, _cmd); \
} \
static DEVICE_ATTR(_name, S_IWUSR | S_IRUGO, NULL, set_##_name);

Definition at line 618 of file ad525x_dpot.c.

#define DPOT_DEVICE_SET (   _name,
  _reg 
)
Value:
static ssize_t \
set_##_name(struct device *dev, \
const char *buf, size_t count) \
{ \
return sysfs_set_reg(dev, attr, buf, count, _reg); \
}

Definition at line 513 of file ad525x_dpot.c.

#define DPOT_DEVICE_SHOW (   _name,
  _reg 
)
Value:
static ssize_t \
show_##_name(struct device *dev, \
struct device_attribute *attr, char *buf) \
{ \
return sysfs_show_reg(dev, attr, buf, _reg); \
}

Definition at line 506 of file ad525x_dpot.c.

#define DPOT_DEVICE_SHOW_ONLY (   name,
  reg 
)
Value:

Definition at line 526 of file ad525x_dpot.c.

#define DPOT_DEVICE_SHOW_SET (   name,
  reg 
)
Value:
DPOT_DEVICE_SET(name, reg) \
static DEVICE_ATTR(name, S_IWUSR | S_IRUGO, show_##name, set_##name);

Definition at line 521 of file ad525x_dpot.c.

Function Documentation

__devinit int ad_dpot_add_files ( struct device dev,
unsigned  features,
unsigned  rdac 
)

Definition at line 644 of file ad525x_dpot.c.

int __devinit ad_dpot_probe ( struct device dev,
struct ad_dpot_bus_data bdata,
unsigned long  devid,
const char name 
)

Definition at line 688 of file ad525x_dpot.c.

int ad_dpot_remove ( struct device dev)

Definition at line 752 of file ad525x_dpot.c.

void ad_dpot_remove_files ( struct device dev,
unsigned  features,
unsigned  rdac 
)
inline

Definition at line 669 of file ad525x_dpot.c.

DPOT_DEVICE_DO_CMD ( inc_all  ,
DPOT_INC_ALL   
)
DPOT_DEVICE_DO_CMD ( dec_all  ,
DPOT_DEC_ALL   
)
DPOT_DEVICE_DO_CMD ( inc_all_6db  ,
DPOT_INC_ALL_6DB   
)
DPOT_DEVICE_DO_CMD ( dec_all_6db  ,
DPOT_DEC_ALL_6DB   
)
DPOT_DEVICE_SHOW_ONLY ( tolerance0  ,
DPOT_ADDR_EEPROM DPOT_TOL_RDAC0 
)
DPOT_DEVICE_SHOW_ONLY ( tolerance1  ,
DPOT_ADDR_EEPROM DPOT_TOL_RDAC1 
)
DPOT_DEVICE_SHOW_ONLY ( tolerance2  ,
DPOT_ADDR_EEPROM DPOT_TOL_RDAC2 
)
DPOT_DEVICE_SHOW_ONLY ( tolerance3  ,
DPOT_ADDR_EEPROM DPOT_TOL_RDAC3 
)
DPOT_DEVICE_SHOW_ONLY ( tolerance4  ,
DPOT_ADDR_EEPROM DPOT_TOL_RDAC4 
)
DPOT_DEVICE_SHOW_ONLY ( tolerance5  ,
DPOT_ADDR_EEPROM DPOT_TOL_RDAC5 
)
DPOT_DEVICE_SHOW_SET ( rdac0  ,
DPOT_ADDR_RDAC DPOT_RDAC0 
)
DPOT_DEVICE_SHOW_SET ( eeprom0  ,
DPOT_ADDR_EEPROM DPOT_RDAC0 
)
DPOT_DEVICE_SHOW_SET ( otp0  ,
DPOT_ADDR_OTP DPOT_RDAC0 
)
DPOT_DEVICE_SHOW_SET ( otp0en  ,
DPOT_ADDR_OTP_EN DPOT_RDAC0 
)
DPOT_DEVICE_SHOW_SET ( rdac1  ,
DPOT_ADDR_RDAC DPOT_RDAC1 
)
DPOT_DEVICE_SHOW_SET ( eeprom1  ,
DPOT_ADDR_EEPROM DPOT_RDAC1 
)
DPOT_DEVICE_SHOW_SET ( otp1  ,
DPOT_ADDR_OTP DPOT_RDAC1 
)
DPOT_DEVICE_SHOW_SET ( otp1en  ,
DPOT_ADDR_OTP_EN DPOT_RDAC1 
)
DPOT_DEVICE_SHOW_SET ( rdac2  ,
DPOT_ADDR_RDAC DPOT_RDAC2 
)
DPOT_DEVICE_SHOW_SET ( eeprom2  ,
DPOT_ADDR_EEPROM DPOT_RDAC2 
)
DPOT_DEVICE_SHOW_SET ( otp2  ,
DPOT_ADDR_OTP DPOT_RDAC2 
)
DPOT_DEVICE_SHOW_SET ( otp2en  ,
DPOT_ADDR_OTP_EN DPOT_RDAC2 
)
DPOT_DEVICE_SHOW_SET ( rdac3  ,
DPOT_ADDR_RDAC DPOT_RDAC3 
)
DPOT_DEVICE_SHOW_SET ( eeprom3  ,
DPOT_ADDR_EEPROM DPOT_RDAC3 
)
DPOT_DEVICE_SHOW_SET ( otp3  ,
DPOT_ADDR_OTP DPOT_RDAC3 
)
DPOT_DEVICE_SHOW_SET ( otp3en  ,
DPOT_ADDR_OTP_EN DPOT_RDAC3 
)
DPOT_DEVICE_SHOW_SET ( rdac4  ,
DPOT_ADDR_RDAC DPOT_RDAC4 
)
DPOT_DEVICE_SHOW_SET ( eeprom4  ,
DPOT_ADDR_EEPROM DPOT_RDAC4 
)
DPOT_DEVICE_SHOW_SET ( otp4  ,
DPOT_ADDR_OTP DPOT_RDAC4 
)
DPOT_DEVICE_SHOW_SET ( otp4en  ,
DPOT_ADDR_OTP_EN DPOT_RDAC4 
)
DPOT_DEVICE_SHOW_SET ( rdac5  ,
DPOT_ADDR_RDAC DPOT_RDAC5 
)
DPOT_DEVICE_SHOW_SET ( eeprom5  ,
DPOT_ADDR_EEPROM DPOT_RDAC5 
)
DPOT_DEVICE_SHOW_SET ( otp5  ,
DPOT_ADDR_OTP DPOT_RDAC5 
)
DPOT_DEVICE_SHOW_SET ( otp5en  ,
DPOT_ADDR_OTP_EN DPOT_RDAC5 
)
EXPORT_SYMBOL ( ad_dpot_probe  )
EXPORT_SYMBOL ( ad_dpot_remove  )
MODULE_AUTHOR ( "Chris Verges <[email protected] ,
""Michael Hennerich< hennerich @blackfin.uclinux.org >"   
)
MODULE_DESCRIPTION ( "Digital potentiometer driver )
MODULE_LICENSE ( "GPL"  )