add adauinit to sysfs

This commit is contained in:
wangzijiao 2018-08-13 18:35:22 +08:00
parent ac957d3e5f
commit 7550320002
1 changed files with 10 additions and 0 deletions

View File

@ -8,6 +8,7 @@ static struct kset *netease_keyset = NULL;
static struct kobject cpld_ko;
extern int cx20810_set_mode(int mode, int index);
extern void netease_cpld_reset(void);
extern void netease_adau1761_init(void);
enum {
CX20810_NORMAL_MODE = 0,
@ -25,6 +26,7 @@ static ssize_t gen_attr_show(struct kobject *kobj, struct attribute *attr,
count += sprintf(buf + count, "adc rst and config:echo 1 > cpld_init\n");
count += sprintf(buf + count, "adc rst:echo 2 > cpld_init\n");
count += sprintf(buf + count, "adc config:echo 3 > cpld_init\n");
count += sprintf(buf + count, "adau1761 init:echo 4 > cpld_init\n");
return count;
}
@ -41,15 +43,23 @@ static ssize_t gen_attr_store(struct kobject *kobj, struct attribute *attr,
cx20810_set_mode(CX20810_NORMAL_MODE, 0);
cx20810_set_mode(CX20810_NORMAL_MODE, 1);
break;
case 2:
printk("Adc rst\n");
netease_cpld_reset();
break;
case 3:
printk("Adc config\n");
cx20810_set_mode(CX20810_NORMAL_MODE, 0);
cx20810_set_mode(CX20810_NORMAL_MODE, 1);
break;
case 4:
printk("Init adau1761!\n");
netease_adau1761_init();
break;
default:
printk("Can not read your input cmd, need help? type cat cpld_init.");
}