Commit 26ea2292 authored by Nícolas F. R. A. Prado's avatar Nícolas F. R. A. Prado
Browse files

HACK: Add spmi registers write through debugfs

Format is 'address,mask,value', all in hex. It uses the same file as the
parent b56594d5
......@@ -271,9 +271,30 @@ ssize_t debugfs_spmi_regs_read(struct file *file, char __user *buf, size_t size,
return simple_read_from_buffer(buf, size, ppos, my_buf, total);
ssize_t debugfs_spmi_regs_write(struct file *file, const char __user *buf,
size_t size, loff_t *ppos)
const int SIZE = 20;
char my_buf[SIZE];
ssize_t len = simple_write_to_buffer(my_buf, PAGE_SIZE, ppos, buf, size);
unsigned int addr, mask, val;
int rc;
rc = sscanf(my_buf, "%x,%x,%x", &addr, &mask, &val);
if (rc < 3)
return -EINVAL;
qcom_flash_masked_write(debugfs_leds_dev, addr, mask, val);
return len;
static struct dentry *debugfs_dir;
const struct file_operations debugfs_spmi_regs_fops = {
.read = debugfs_spmi_regs_read,
.write = debugfs_spmi_regs_write,
static u8 qcom_flash_duration_to_reg(u32 us)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment