Created
February 16, 2015 03:34
-
-
Save checko/296ad4d53eadd3b52548 to your computer and use it in GitHub Desktop.
rt5625 mic_ctrl sysfs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static ssize_t rt5625_mic_ctrl_show(struct device *dev, | |
struct device_attribute *attr, char *buf) | |
{ | |
struct i2c_client *client = to_i2c_client(dev); | |
struct rt5625_priv *rt5625 = i2c_get_clientdata(client); | |
struct snd_soc_codec *codec = rt5625->codec; | |
int data = snd_soc_read(codec, RT5625_MIC_CTRL); | |
return sprintf(buf, "%x",data); | |
} | |
static ssize_t rt5625_mic_ctrl_store(struct device *dev, | |
struct device_attribute *attr, const char *buf, size_t count) | |
{ | |
struct i2c_client *client = to_i2c_client(dev); | |
struct rt5625_priv *rt5625 = i2c_get_clientdata(client); | |
struct snd_soc_codec *codec = rt5625->codec; | |
long regvalue; | |
int status; | |
status = strict_strtol(buf,16,®value); | |
if (status != 0) { | |
printk("rt5625 invalid parameter format %s\n",buf); | |
return -EINVAL; | |
} | |
snd_soc_write(codec, RT5625_MIC_CTRL, (int)regvalue&0xFFFF); | |
return count; | |
} | |
static DEVICE_ATTR(mic_ctrl, S_IRUGO | S_IWUSR | S_IWGRP, | |
rt5625_mic_ctrl_show, rt5625_mic_ctrl_store); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment