1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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);
}
|