diff options
author | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2017-02-23 14:36:24 +0100 |
---|---|---|
committer | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2017-02-23 14:36:24 +0100 |
commit | ac7b0739841a9810ebd8c3f3d0780fff84a67426 (patch) | |
tree | efc679f9ae0dc5fc185a5112afa3826872bf9457 /drivers/sensorhub/atmel/light_cm36651.c | |
parent | 5647bb1dce2ce09622e03f87cc78491b14e0d835 (diff) | |
download | kernel_samsung_smdk4412-ac7b0739841a9810ebd8c3f3d0780fff84a67426.zip kernel_samsung_smdk4412-ac7b0739841a9810ebd8c3f3d0780fff84a67426.tar.gz kernel_samsung_smdk4412-ac7b0739841a9810ebd8c3f3d0780fff84a67426.tar.bz2 |
drivers/sensorhub: update from GT-N7100_KK_Opensource_Update1 source drop
The import already includes the build fixes from this commit:
commit 7055ffb
Author: Dheeraj CVR <cvr.dheeraj@gmail.com>
Date: 2014-12-22 12:55:48 +0530
drivers: sensorhub: fix compile
Change-Id: Ice06c873e4f2fe50ccb1a4cac5ac761e4a872bd3
Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'drivers/sensorhub/atmel/light_cm36651.c')
-rwxr-xr-x | drivers/sensorhub/atmel/light_cm36651.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/drivers/sensorhub/atmel/light_cm36651.c b/drivers/sensorhub/atmel/light_cm36651.c new file mode 100755 index 0000000..68081e4 --- /dev/null +++ b/drivers/sensorhub/atmel/light_cm36651.c @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2012, Samsung Electronics Co. Ltd. All Rights Reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + */ +#include "ssp.h" + +#define VENDOR "CAPELLA" +#define CHIP_ID "CM36651" + +/*************************************************************************/ +/* factory Sysfs */ +/*************************************************************************/ + +static ssize_t light_vendor_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%s\n", VENDOR); +} + +static ssize_t light_name_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + return sprintf(buf, "%s\n", CHIP_ID); +} + +static ssize_t light_lux_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct ssp_data *data = dev_get_drvdata(dev); + + return sprintf(buf, "%u,%u,%u,%u\n", + data->buf[LIGHT_SENSOR].r, data->buf[LIGHT_SENSOR].g, + data->buf[LIGHT_SENSOR].b, data->buf[LIGHT_SENSOR].w); +} + +static ssize_t light_data_show(struct device *dev, + struct device_attribute *attr, char *buf) +{ + struct ssp_data *data = dev_get_drvdata(dev); + + return sprintf(buf, "%u,%u,%u,%u\n", + data->buf[LIGHT_SENSOR].r, data->buf[LIGHT_SENSOR].g, + data->buf[LIGHT_SENSOR].b, data->buf[LIGHT_SENSOR].w); +} + +static DEVICE_ATTR(vendor, S_IRUGO, light_vendor_show, NULL); +static DEVICE_ATTR(name, S_IRUGO, light_name_show, NULL); +static DEVICE_ATTR(lux, S_IRUGO, light_lux_show, NULL); +static DEVICE_ATTR(raw_data, S_IRUGO, light_data_show, NULL); + +static struct device_attribute *light_attrs[] = { + &dev_attr_vendor, + &dev_attr_name, + &dev_attr_lux, + &dev_attr_raw_data, + NULL, +}; + +void initialize_light_factorytest(struct ssp_data *data) +{ + sensors_register(data->light_device, data, light_attrs, "light_sensor"); +} + +void remove_light_factorytest(struct ssp_data *data) +{ + sensors_unregister(data->light_device, light_attrs); +} |