mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
drivers/input/sensors/lsensor: remove unused ls_photoresistor driver
Change-Id: Id49ba18a182add9cd1b2e53539b6fff0255c8cd8 Signed-off-by: Tao Huang <huangtao@rock-chips.com>
This commit is contained in:
parent
a305d96ee3
commit
96ab43200d
|
|
@ -36,10 +36,6 @@ config LS_AP321XX
|
|||
bool "light sensor ap321xx"
|
||||
default n
|
||||
|
||||
config LS_PHOTORESISTOR
|
||||
bool "light sensor photoresistor"
|
||||
default n
|
||||
|
||||
config LS_US5152
|
||||
bool "light sensor us5152"
|
||||
default n
|
||||
|
|
|
|||
|
|
@ -8,6 +8,5 @@ obj-$(CONFIG_LS_AL3006) += ls_al3006.o
|
|||
obj-$(CONFIG_LS_STK3171) += ls_stk3171.o
|
||||
obj-$(CONFIG_LS_ISL29023) += isl29023.o
|
||||
obj-$(CONFIG_LS_AP321XX) += ls_ap321xx.o
|
||||
obj-$(CONFIG_LS_PHOTORESISTOR) += ls_photoresistor.o
|
||||
obj-$(CONFIG_LS_US5152) += ls_us5152.o
|
||||
obj-$(CONFIG_LS_STK3410) += ls_stk3410.o
|
||||
|
|
|
|||
|
|
@ -1,186 +0,0 @@
|
|||
/* drivers/input/sensors/lsensor/ls_photoresistor.c
|
||||
*
|
||||
* Copyright (C) 2012-2015 ROCKCHIP.
|
||||
* Author: ?<?@rock-chips.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* 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 <linux/interrupt.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/irq.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <asm/atomic.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/input.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/freezer.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/board.h>
|
||||
#include <linux/adc.h>
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
#include <linux/sensor-dev.h>
|
||||
|
||||
struct lsp_base_data {
|
||||
|
||||
int adcvalue ;
|
||||
int oldadcvalue ;
|
||||
struct adc_client *adc_client ;
|
||||
};
|
||||
struct lsp_base_data glspdata ;
|
||||
|
||||
//{1000,900,700,400,200,100,40,0};
|
||||
static int LighSensorValue[8]={800,700,500,400,200,100,40,0};
|
||||
static int LighSensorLevel_TAB[8]={0,1,2,3,4,5,6,7};
|
||||
|
||||
/****************operate according to sensor chip:start************/
|
||||
|
||||
static int sensor_active(struct i2c_client *client, int enable, int rate)
|
||||
{
|
||||
//int ret = 0;
|
||||
|
||||
//printk("light_photoresisto: sensor active is %s \n",( (enable)?"on":"off" ) );
|
||||
|
||||
if( enable ){//ture on
|
||||
|
||||
}else{//ture off
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void lsp_adc_callback(struct adc_client *client, void *callback_param, int result)
|
||||
{
|
||||
glspdata.adcvalue = result;
|
||||
//printk("light_photoresisto: adc callback value is %d \n",glspdata.adcvalue);
|
||||
}
|
||||
|
||||
static int valuetoindex( int data)
|
||||
{
|
||||
unsigned char index = 0;
|
||||
|
||||
for( index = 0 ; index < ARRAY_SIZE(LighSensorLevel_TAB) ; index ++ )
|
||||
{
|
||||
if(data > LighSensorValue[index])
|
||||
break;
|
||||
}
|
||||
|
||||
return index;
|
||||
}
|
||||
|
||||
static int sensor_report_value(struct i2c_client *client)
|
||||
{
|
||||
int ret = 0 ;
|
||||
struct sensor_private_data *sensor =
|
||||
(struct sensor_private_data *) i2c_get_clientdata(client);
|
||||
|
||||
if(glspdata.adc_client)
|
||||
adc_async_read(glspdata.adc_client);
|
||||
|
||||
if(glspdata.adcvalue==0||glspdata.adcvalue==1){//
|
||||
printk("light_photoresisto: adc value is (%d) invalid \n",glspdata.adcvalue);
|
||||
return ret ;
|
||||
}
|
||||
|
||||
if(glspdata.adcvalue != glspdata.oldadcvalue)
|
||||
{
|
||||
DBG("light_photoresisto: input report value is %d \n",glspdata.adcvalue);
|
||||
input_report_abs(sensor->input_dev, ABS_MISC,
|
||||
valuetoindex(glspdata.adcvalue) );
|
||||
input_sync(sensor->input_dev);
|
||||
|
||||
glspdata.oldadcvalue = glspdata.adcvalue;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sensor_init(struct i2c_client *client)
|
||||
{
|
||||
int error = 0 ;
|
||||
struct sensor_private_data *sensor = (struct sensor_private_data *) i2c_get_clientdata(client);
|
||||
DBG("enter %s\n",__func__);
|
||||
|
||||
//adc register
|
||||
if( (sensor->pdata->address >= 0) && (sensor->pdata->address <=3) ){
|
||||
glspdata.adc_client = adc_register(sensor->pdata->address, lsp_adc_callback, "lsp_adc");
|
||||
if( !glspdata.adc_client ) {
|
||||
printk("%s : light_photoresisto adc_register faile !\n",__func__);
|
||||
error = -EINVAL;
|
||||
goto fail1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0 ;
|
||||
|
||||
fail1:
|
||||
adc_unregister(glspdata.adc_client);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
struct sensor_operate light_photoresistor_ops = {
|
||||
.name = "light_photoresistor",
|
||||
.type = SENSOR_TYPE_LIGHT, //sensor type and it should be correct
|
||||
.id_i2c = LIGHT_ID_PHOTORESISTOR, //i2c id number
|
||||
|
||||
.range = {0,10}, //range
|
||||
.brightness ={1,255}, // brightness
|
||||
.active = sensor_active,
|
||||
.init = sensor_init,
|
||||
.report = sensor_report_value,
|
||||
|
||||
/*--------- INVALID ----------*/
|
||||
.read_reg = SENSOR_UNKNOW_DATA, //read data INVALID
|
||||
.read_len = SENSOR_UNKNOW_DATA, //data length INVALID
|
||||
.id_reg = SENSOR_UNKNOW_DATA, //read device id from this register INVALID
|
||||
.id_data = SENSOR_UNKNOW_DATA, //device id INVALID
|
||||
.precision = SENSOR_UNKNOW_DATA, //8 bits INVALID
|
||||
.ctrl_reg = SENSOR_UNKNOW_DATA, //enable or disable INVALID
|
||||
.int_status_reg = SENSOR_UNKNOW_DATA, //intterupt status register INVALID
|
||||
.trig = SENSOR_UNKNOW_DATA,
|
||||
/*--------- INVALID end-------*/
|
||||
};
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *light_get_ops(void)
|
||||
{
|
||||
return &light_photoresistor_ops;
|
||||
}
|
||||
|
||||
|
||||
static int __init lsp_init(void)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, light_get_ops);
|
||||
return result;
|
||||
}
|
||||
|
||||
static void __exit lsp_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, light_get_ops);
|
||||
if(glspdata.adc_client)
|
||||
adc_unregister(glspdata.adc_client);
|
||||
}
|
||||
|
||||
module_init(lsp_init);
|
||||
module_exit(lsp_exit);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user