#ifndef __REGULATOR_JZ_DEBUG__
#define __REGULATOR_JZ_DEBUG__
#endif
#define INFO_PRINTF(seq, sw, fmt, arg...) \
do { \
if (seq) \
seq_printf(seq, fmt, ##arg); \
else if (sw) \
printk(KERN_ERR fmt, ##arg); \
} while(0)
static int _rdev_state_error(struct regulator_dev *rdev)
{
}
void regulator_consumer_info(struct seq_file *m, bool sw, struct regulator_dev *rdev, int print_supply)
{
struct regulator *dev = NULL;
if(rdev == NULL)
{
INFO_PRINTF(m, sw, "Error:The regulator is NULL!\n");
return -1;
}
//INFO_PRINTF(m, sw, "HELLO WORLD!\n");
mutex_lock(&rdev->mutex);
/*if(strcmp(rdev_get_name(rdev), "RICOH619_LDO10") == 0)
{
_regulator_disable(rdev, &rdev->supply);
}
if(strcmp(rdev_get_name(rdev), "RICOH619_LDO3") == 0)
{
_regulator_disable(rdev, &rdev->supply);
}
if(strcmp(rdev_get_name(rdev), "RICOH619_LDO4") == 0)
{
_regulator_disable(rdev, &rdev->supply);
}
if(strcmp(rdev_get_name(rdev), "RICOH619_LDO6") == 0)
{
_regulator_disable(rdev, &rdev->supply);
}
if(strcmp(rdev_get_name(rdev), "RICOH619_LDO9") == 0)
{
_regulator_disable(rdev, &rdev->supply);
}
if(strcmp(rdev_get_name(rdev), "RICOH619_DC5") == 0)
{
_regulator_disable(rdev, &rdev->supply);
}*/
INFO_PRINTF(m, sw, "%-15s->suspend::%-15suse_count::%-10dis_enabled:%-10dvoltage::%-15d\n", rdev_get_name(rdev), rdev->supply ? rdev_get_name(rdev->supply) : "NULL", rdev->use_count, _regulator_is_enabled(rdev), _regulator_get_voltage(rdev));
mutex_unlock(&rdev->mutex);
}
static int regulator_seq_show(struct seq_file *m, void *p)
{
struct regulator_dev *rdev = list_entry(p, struct regulator_dev, list);
regulator_consumer_info(m, 0, rdev, 0);
return 0;
}
static void * regulator_map_seq_start (struct seq_file *m, loff_t *pos) {
mutex_lock(®ulator_list_mutex);
return seq_list_start( ®ulator_list, *pos);
}
static void *regulator_map_seq_next(struct seq_file *m, void *p, loff_t *pos)
{
return seq_list_next(p, ®ulator_list, pos);
}
static void regulator_map_seq_stop(struct seq_file *m, void *p)
{
mutex_unlock(®ulator_list_mutex);
}
struct seq_operations regulator_map_seq_ops = {
.show = regulator_seq_show,
.start = regulator_map_seq_start,
.next = regulator_map_seq_next,
.stop = regulator_map_seq_stop
};
static int regulator_seq_open(struct inode *inode, struct file *file)
{
return seq_open(file, ®ulator_map_seq_ops);
}
struct file_operations regulator_map_file_ops = {
.owner = THIS_MODULE,
.open = regulator_seq_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release
};
int regulator_core_suspend(void)
{
struct regulator_dev *rdev = NULL;
printk(KERN_ERR "%s:\n", __func__);
list_for_each_entry(rdev, ®ulator_list, list) {
regulator_consumer_info(NULL, 1, rdev, 0);
}
return 0;
}
struct syscore_ops regulator_core_ops = {
.suspend = ®ulator_core_suspend,
};
seq_file实例
最新推荐文章于 2024-01-02 19:27:42 发布