diff options
| author | Mohsan Habibi <mohsan@motorola.com> | 2014-05-16 11:29:52 -0400 | 
|---|---|---|
| committer | Mohsan Habibi <mohsan@motorola.com> | 2014-05-20 07:22:38 +0000 | 
| commit | 50191c76ff3e89362ff1a28507dc8a66de8affa9 (patch) | |
| tree | 349fc94851815ffb4b11984cce8e54172e10388c /drivers | |
| parent | 7cb6941f44acdf142aed3c0feb7e28a9b712ac91 (diff) | |
| download | olio-linux-3.10-50191c76ff3e89362ff1a28507dc8a66de8affa9.tar.xz olio-linux-3.10-50191c76ff3e89362ff1a28507dc8a66de8affa9.zip  | |
IKXCLOCK-1129 misc: c55_ctrl: add file to track fw verification
Change-Id: Id9e0d8d05ccecae5543a2507ad11d26103f469dd
Signed-off-by: Mohsan Habibi <mohsan@motorola.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/misc/c55_ctrl.c | 42 | 
1 files changed, 42 insertions, 0 deletions
diff --git a/drivers/misc/c55_ctrl.c b/drivers/misc/c55_ctrl.c index 507732514cb..ab934a94dff 100644 --- a/drivers/misc/c55_ctrl.c +++ b/drivers/misc/c55_ctrl.c @@ -42,6 +42,7 @@ struct c55_ctrl_data {  	struct pinctrl_state *states[C55_MODE_MAX];  	int c55_mode;  	struct mutex ctrl_mutex;	/* mutex to handle critical area */ +	int fw_verified;  };  const char *c55_pin_state_labels[C55_MODE_MAX] = { @@ -216,6 +217,38 @@ static ssize_t c55_ctrl_enable(struct device *dev,  static DEVICE_ATTR(enable, S_IWUSR | S_IWGRP, NULL, c55_ctrl_enable); +static ssize_t c55_fw_verified_write(struct device *dev, +	struct device_attribute *attr, const char *buf, size_t count) +{ +	struct c55_ctrl_data *cdata = dev_get_drvdata(dev); +	int verified = 0; + +	if (kstrtoint(buf, 10, &verified) < 0) +		return -EINVAL; + +	mutex_lock(&cdata->ctrl_mutex); +	cdata->fw_verified = verified; +	mutex_unlock(&cdata->ctrl_mutex); + +	return count; +} + +static ssize_t c55_fw_verified_read(struct device *dev, +	struct device_attribute *attr, char *buf) +{ +	struct c55_ctrl_data *cdata = dev_get_drvdata(dev); +	int ret; + +	mutex_lock(&cdata->ctrl_mutex); +	ret = sprintf(buf, "%d\n", cdata->fw_verified); +	mutex_unlock(&cdata->ctrl_mutex); + +	return ret; +} + +static DEVICE_ATTR(fw_verified, S_IRUSR | S_IRGRP | S_IWUSR | S_IWGRP, +	c55_fw_verified_read, c55_fw_verified_write); +  static int c55_ctrl_pin_setup(struct device *dev, struct c55_ctrl_data *cdata)  {  	int i, ret = 0; @@ -303,6 +336,15 @@ static int c55_ctrl_probe(struct platform_device *pdev)  		return ret;  	} +	cdata->fw_verified = 0; + +	ret = device_create_file(&pdev->dev, &dev_attr_fw_verified); +	if (ret) { +		dev_err(&pdev->dev, "%s: c55_ctrl creating fw_verified failed.\n", +			__func__); +		return ret; +	} +  	wake_lock_init(&cdata->wake_lock, WAKE_LOCK_SUSPEND, "c55_ctrl");  	platform_set_drvdata(pdev, cdata);  |