input: sensor: sensor supports modularity
The sensor-dev framework and device drivers depend on each other, causing sensor initialization to fail. eg: [ 2.907011] i2c i2c-4: sensor_probe: mpu6500_acc,000000006539f8ba [ 2.907626] sensors 4-0068: sensor_chip_init:ops is null,sensor name is mpu6500_acc [ 2.908318] i2c i2c-4: sensor_probe failed -1 Signed-off-by: Wang Jie <dave.wang@rock-chips.com> Change-Id: Ic1f320a7c40bde0c4e3db3dc43542302d9270f42
This commit is contained in:
parent
4869b05bb7
commit
c8ebec26c7
59 changed files with 1378 additions and 1164 deletions
|
|
@ -11,5 +11,5 @@ obj-$(CONFIG_PRESSURE_DEVICE) += pressure/
|
|||
obj-$(CONFIG_HALL_DEVICE) += hall/
|
||||
|
||||
|
||||
obj-$(CONFIG_SENSOR_DEVICE) += sensor-i2c.o
|
||||
obj-$(CONFIG_SENSOR_DEVICE) += sensor-dev.o
|
||||
obj-$(CONFIG_SENSOR_DEVICE) += sensor_dev.o
|
||||
sensor_dev-y = sensor-i2c.o sensor-dev.o
|
||||
|
|
|
|||
|
|
@ -12,130 +12,130 @@ menuconfig GSENSOR_DEVICE
|
|||
|
||||
if GSENSOR_DEVICE
|
||||
config GS_MMA8452
|
||||
bool "gsensor mma8451/mma8452/mma8453/mma8653"
|
||||
tristate "gsensor mma8451/mma8452/mma8453/mma8653"
|
||||
default n
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config STK8BAXX_ACC
|
||||
bool "gsensor STK8BAXX"
|
||||
tristate "gsensor STK8BAXX"
|
||||
default n
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config MPU6880_ACC
|
||||
bool "Sensor mpu6880_acc"
|
||||
tristate "Sensor mpu6880_acc"
|
||||
default n
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config MPU6500_ACC
|
||||
bool "Sensor mpu6500_acc"
|
||||
tristate "Sensor mpu6500_acc"
|
||||
default n
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config GS_KXTIK
|
||||
bool "gsensor kxtik"
|
||||
tristate "gsensor kxtik"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config GS_KXTJ9
|
||||
bool "gsensor kxtj9"
|
||||
tristate "gsensor kxtj9"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config GS_LIS3DH
|
||||
bool "gsensor lis3dh"
|
||||
tristate "gsensor lis3dh"
|
||||
default n
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config GS_MMA7660
|
||||
bool "gsensor mma7660"
|
||||
tristate "gsensor mma7660"
|
||||
default n
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config GS_MC3230
|
||||
bool "gsensor mc3230"
|
||||
tristate "gsensor mc3230"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config GS_SC7660
|
||||
bool "gsensor sc7660"
|
||||
tristate "gsensor sc7660"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config GS_SC7A20
|
||||
bool "gsensor sc7a20"
|
||||
tristate "gsensor sc7a20"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config GS_SC7A30
|
||||
bool "gsensor sc7a30"
|
||||
tristate "gsensor sc7a30"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config GS_MXC6225
|
||||
bool "gsensor mxc6225"
|
||||
tristate "gsensor mxc6225"
|
||||
help
|
||||
To have support for your sepcific gsensor you will have to
|
||||
select het proper drivers which depend on this option.
|
||||
|
||||
config GS_MXC6655XA
|
||||
bool "gsensor mxc6655xa"
|
||||
tristate "gsensor mxc6655xa"
|
||||
help
|
||||
To have support for your sepcific gsensor you will have to
|
||||
select het proper drivers which depend on this option.
|
||||
|
||||
config GS_DMT10
|
||||
bool "gsensor dmard10"
|
||||
tristate "gsensor dmard10"
|
||||
help
|
||||
To have support for your sepcific gsensor you will have to
|
||||
select het proper drivers which depend on this option.
|
||||
|
||||
config GS_LSM303D
|
||||
bool "gsensor lsm303d"
|
||||
tristate "gsensor lsm303d"
|
||||
default n
|
||||
help
|
||||
To have support for your sepcific gsensor you will have to
|
||||
select het proper drivers which depend on this option.
|
||||
|
||||
config GS_BMA023
|
||||
bool "gsensor bma023"
|
||||
tristate "gsensor bma023"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config LSM330_ACC
|
||||
bool "gsensor lsm330"
|
||||
tristate "gsensor lsm330"
|
||||
default n
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config BMA2XX_ACC
|
||||
bool "Sensor bma2xx_acc"
|
||||
tristate "Sensor bma2xx_acc"
|
||||
default n
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config GS_DA223
|
||||
bool "gsensor da223"
|
||||
tristate "gsensor da223"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
|
|
|||
|
|
@ -18,4 +18,4 @@ obj-$(CONFIG_LSM330_ACC) += lsm330_acc.o
|
|||
obj-$(CONFIG_BMA2XX_ACC) += bma2xx.o
|
||||
obj-$(CONFIG_STK8BAXX_ACC) += stk8baxx.o
|
||||
obj-$(CONFIG_GS_DA223) += da223.o
|
||||
da223-objs := da223_cust.o da223_core.o
|
||||
da223-y := da223_cust.o da223_core.o
|
||||
|
|
|
|||
|
|
@ -2232,29 +2232,37 @@ struct sensor_operate gsensor_bma2x2_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
/*function name should not be changed*/
|
||||
static struct sensor_operate *bma2x2_get_ops(void)
|
||||
static int gsensor_bma2x2_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_bma2x2_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_bma2x2_ops);
|
||||
}
|
||||
|
||||
static int __init gsensor_bma2x2_init(void)
|
||||
static int gsensor_bma2x2_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = bma2x2_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
|
||||
result = sensor_register_slave(type, NULL, NULL, bma2x2_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_bma2x2_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_bma2x2_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = bma2x2_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gsensor_bma2x2_id[] = {
|
||||
{"bma2xx_acc", ACCEL_ID_BMA2XX},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, bma2x2_get_ops);
|
||||
}
|
||||
static struct i2c_driver gsensor_bma2x2_driver = {
|
||||
.probe = gsensor_bma2x2_probe,
|
||||
.remove = gsensor_bma2x2_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_bma2x2_id,
|
||||
.driver = {
|
||||
.name = "gsensor_bma2x2",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_bma2x2_init);
|
||||
module_exit(gsensor_bma2x2_exit);
|
||||
module_i2c_driver(gsensor_bma2x2_driver);
|
||||
|
||||
MODULE_AUTHOR("Bin Yang <yangbin@rock - chips.com>");
|
||||
MODULE_DESCRIPTION("bma2x2 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -793,98 +793,106 @@ static int sensor_report_value(struct i2c_client *client)
|
|||
/******************************************************************************/
|
||||
static int sensor_suspend(struct i2c_client *client)
|
||||
{
|
||||
int result = 0;
|
||||
int result = 0;
|
||||
|
||||
MI_FUN;
|
||||
|
||||
mdelay(10);
|
||||
|
||||
result = mir3da_set_enable(client, false);
|
||||
if(result){
|
||||
MI_ERR("sensor_suspend disable fail!!\n");
|
||||
return result;
|
||||
}
|
||||
MI_FUN;
|
||||
|
||||
mdelay(10);
|
||||
|
||||
return result;
|
||||
result = mir3da_set_enable(client, false);
|
||||
if (result) {
|
||||
MI_ERR("sensor_suspend disable fail!!\n");
|
||||
return result;
|
||||
}
|
||||
|
||||
mdelay(10);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
static int sensor_resume(struct i2c_client *client)
|
||||
{
|
||||
int result = 0;
|
||||
int result = 0;
|
||||
|
||||
MI_FUN;
|
||||
MI_FUN;
|
||||
|
||||
mdelay(10);
|
||||
mdelay(10);
|
||||
|
||||
/*
|
||||
result = mir3da_chip_resume(client);
|
||||
if(result) {
|
||||
MI_ERR("sensor_resume chip resume fail!!\n");
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
result = mir3da_set_enable(client, true);
|
||||
if(result){
|
||||
/*
|
||||
* result = mir3da_chip_resume(client);
|
||||
* if(result) {
|
||||
* MI_ERR("sensor_resume chip resume fail!!\n");
|
||||
* return result;
|
||||
* }
|
||||
*/
|
||||
result = mir3da_set_enable(client, true);
|
||||
if (result) {
|
||||
MI_ERR("sensor_resume enable fail!!\n");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
mdelay(10);
|
||||
mdelay(10);
|
||||
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
struct sensor_operate gsensor_ops = {
|
||||
.name = MIR3DA_DRV_NAME,
|
||||
.type = SENSOR_TYPE_ACCEL,
|
||||
.id_i2c = ACCEL_ID_MIR3DA,
|
||||
.read_reg =-1,
|
||||
.read_len = 0,
|
||||
.id_reg = -1,
|
||||
.id_data = 0,
|
||||
.precision = MIR3DA_PRECISION,
|
||||
.ctrl_reg = -1,
|
||||
.int_status_reg = 0x00,
|
||||
.range = {-MIR3DA_RANGE,MIR3DA_RANGE},
|
||||
.trig = IRQF_TRIGGER_LOW|IRQF_ONESHOT,
|
||||
.active = sensor_active,
|
||||
.init = sensor_init,
|
||||
.report = sensor_report_value,
|
||||
.suspend =sensor_suspend,
|
||||
.resume =sensor_resume,
|
||||
.name = MIR3DA_DRV_NAME,
|
||||
.type = SENSOR_TYPE_ACCEL,
|
||||
.id_i2c = ACCEL_ID_MIR3DA,
|
||||
.read_reg = -1,
|
||||
.read_len = 0,
|
||||
.id_reg = -1,
|
||||
.id_data = 0,
|
||||
.precision = MIR3DA_PRECISION,
|
||||
.ctrl_reg = -1,
|
||||
.int_status_reg = 0x00,
|
||||
.range = {-MIR3DA_RANGE, MIR3DA_RANGE},
|
||||
.trig = IRQF_TRIGGER_LOW | IRQF_ONESHOT,
|
||||
.active = sensor_active,
|
||||
.init = sensor_init,
|
||||
.report = sensor_report_value,
|
||||
.suspend = sensor_suspend,
|
||||
.resume = sensor_resume,
|
||||
};
|
||||
|
||||
/******************************************************************************/
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_mir3da_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_ops;
|
||||
MI_FUN;
|
||||
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_ops);
|
||||
}
|
||||
/******************************************************************************/
|
||||
static int __init mir3da_init(void)
|
||||
static int gsensor_mir3da_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
MI_FUN;
|
||||
|
||||
MI_FUN;
|
||||
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_ops);
|
||||
}
|
||||
/******************************************************************************/
|
||||
static void __exit mir3da_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gsensor_mir3da_id[] = {
|
||||
{"gs_da223", ACCEL_ID_MIR3DA},
|
||||
{}
|
||||
};
|
||||
|
||||
MI_FUN;
|
||||
static struct i2c_driver gsensor_mir3da_driver = {
|
||||
.probe = gsensor_mir3da_probe,
|
||||
.remove = gsensor_mir3da_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_mir3da_id,
|
||||
.driver = {
|
||||
.name = "gsensor_mir3da",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
/******************************************************************************/
|
||||
module_i2c_driver(gsensor_mir3da_driver);
|
||||
|
||||
module_init(mir3da_init);
|
||||
module_exit(mir3da_exit);
|
||||
MODULE_DESCRIPTION("mir3da 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -181,9 +181,6 @@ struct sensor_axis_average {
|
|||
|
||||
static struct sensor_axis_average axis_average;
|
||||
int gsensor_reset(struct i2c_client *client){
|
||||
struct sensor_private_data *sensor =
|
||||
(struct sensor_private_data *) i2c_get_clientdata(client);
|
||||
|
||||
char buffer[7], buffer2[2];
|
||||
/* 1. check D10 , VALUE_STADR = 0x55 , VALUE_STAINT = 0xAA */
|
||||
buffer[0] = REG_STADR;
|
||||
|
|
@ -422,33 +419,38 @@ struct sensor_operate gsensor_dmard10_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_dmard10_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_dmard10_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_dmard10_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gsensor_dmard10_init(void)
|
||||
static int gsensor_dmard10_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_dmard10_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_dmard10_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id gsensor_dmard10_id[] = {
|
||||
{"gs_dmard10", ACCEL_ID_DMARD10},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gsensor_dmard10_driver = {
|
||||
.probe = gsensor_dmard10_probe,
|
||||
.remove = gsensor_dmard10_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_dmard10_id,
|
||||
.driver = {
|
||||
.name = "gsensor_dmard10",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_dmard10_init);
|
||||
module_exit(gsensor_dmard10_exit);
|
||||
|
||||
module_i2c_driver(gsensor_dmard10_driver);
|
||||
|
||||
MODULE_AUTHOR("guoyi <gy@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("dmard10 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
|
|
|||
|
|
@ -323,31 +323,37 @@ struct sensor_operate gsensor_kxtik_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_kxtik_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_kxtik_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_kxtik_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gsensor_kxtik_init(void)
|
||||
static int gsensor_kxtik_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_kxtik_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_kxtik_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id gsensor_kxtik_id[] = {
|
||||
{"gs_kxtik", ACCEL_ID_KXTIK},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gsensor_kxtik_driver = {
|
||||
.probe = gsensor_kxtik_probe,
|
||||
.remove = gsensor_kxtik_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_kxtik_id,
|
||||
.driver = {
|
||||
.name = "gsensor_kxtik",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_kxtik_init);
|
||||
module_exit(gsensor_kxtik_exit);
|
||||
module_i2c_driver(gsensor_kxtik_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("kxtik 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -296,31 +296,37 @@ struct sensor_operate gsensor_kxtj9_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_kxtj9_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_kxtj9_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_kxtj9_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gsensor_kxtj9_init(void)
|
||||
static int gsensor_kxtj9_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_kxtj9_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_kxtj9_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id gsensor_kxtj9_id[] = {
|
||||
{"gs_kxtj9", ACCEL_ID_KXTJ9},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gsensor_kxtj9_driver = {
|
||||
.probe = gsensor_kxtj9_probe,
|
||||
.remove = gsensor_kxtj9_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_kxtj9_id,
|
||||
.driver = {
|
||||
.name = "gsensor_kxtj9",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_kxtj9_init);
|
||||
module_exit(gsensor_kxtj9_exit);
|
||||
module_i2c_driver(gsensor_kxtj9_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("kxtj9 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -267,26 +267,37 @@ struct sensor_operate gsensor_lis3dh_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_lis3dh_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_lis3dh_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_lis3dh_ops);
|
||||
}
|
||||
|
||||
static int __init gsensor_lis3dh_init(void)
|
||||
static int gsensor_lis3dh_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
|
||||
return sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return sensor_unregister_device(client, NULL, &gsensor_lis3dh_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_lis3dh_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gsensor_lis3dh_id[] = {
|
||||
{"gs_lis3dh", ACCEL_ID_LIS3DH},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static struct i2c_driver gsensor_lis3dh_driver = {
|
||||
.probe = gsensor_lis3dh_probe,
|
||||
.remove = gsensor_lis3dh_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_lis3dh_id,
|
||||
.driver = {
|
||||
.name = "gsensor_lis3dh",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_lis3dh_init);
|
||||
module_exit(gsensor_lis3dh_exit);
|
||||
module_i2c_driver(gsensor_lis3dh_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("lis3dh 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -326,34 +326,37 @@ struct sensor_operate gsensor_lsm303d_ops = {
|
|||
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_lsm303d_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_lsm303d_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_lsm303d_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gsensor_lis3dh_init(void)
|
||||
static int gsensor_lsm303d_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_lsm303d_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_lis3dh_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
|
||||
|
||||
module_init(gsensor_lis3dh_init);
|
||||
module_exit(gsensor_lis3dh_exit);
|
||||
|
||||
static const struct i2c_device_id gsensor_lsm303d_id[] = {
|
||||
{"gs_lsm303d", ACCEL_ID_LSM303D},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gsensor_lsm303d_driver = {
|
||||
.probe = gsensor_lsm303d_probe,
|
||||
.remove = gsensor_lsm303d_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_lsm303d_id,
|
||||
.driver = {
|
||||
.name = "gsensor_lsm303d",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(gsensor_lsm303d_driver);
|
||||
|
||||
MODULE_AUTHOR("xwj <xwj@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("lsm303d 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -242,29 +242,37 @@ struct sensor_operate gsensor_lsm330_ops = {
|
|||
.report = sensor_report_value,
|
||||
};
|
||||
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_lsm330_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_lsm330_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_lsm330_ops);
|
||||
}
|
||||
|
||||
static int __init gsensor_lsm330_init(void)
|
||||
static int gsensor_lsm330_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_lsm330_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_lsm330_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gsensor_lsm330_id[] = {
|
||||
{"lsm330_acc", ACCEL_ID_LSM330},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static struct i2c_driver gsensor_lsm330_driver = {
|
||||
.probe = gsensor_lsm330_probe,
|
||||
.remove = gsensor_lsm330_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_lsm330_id,
|
||||
.driver = {
|
||||
.name = "gsensor_lsm330",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_lsm330_init);
|
||||
module_exit(gsensor_lsm330_exit);
|
||||
module_i2c_driver(gsensor_lsm330_driver);
|
||||
|
||||
MODULE_AUTHOR("Bin Yang <yangbin@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("lsm330_acc 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -1297,31 +1297,36 @@ static struct sensor_operate gsensor_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
/* function name should not be changed */
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_mc3230_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_ops);
|
||||
}
|
||||
|
||||
static int __init gsensor_init(void)
|
||||
static int gsensor_mc3230_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
GSE_LOG(" %s\n", __func__);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gsensor_mc3230_id[] = {
|
||||
{"gs_mc3230", ACCEL_ID_MC3230},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static struct i2c_driver gsensor_mc3230_driver = {
|
||||
.probe = gsensor_mc3230_probe,
|
||||
.remove = gsensor_mc3230_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_mc3230_id,
|
||||
.driver = {
|
||||
.name = "gsensor_mc3230",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_init);
|
||||
module_exit(gsensor_exit);
|
||||
module_i2c_driver(gsensor_mc3230_driver);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("mc3230 3-Axis accelerometer driver");
|
||||
|
|
|
|||
|
|
@ -222,28 +222,37 @@ struct sensor_operate gsensor_mma7660_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_mma7660_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_mma7660_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_mma7660_ops);
|
||||
}
|
||||
|
||||
static int __init gsensor_mma7660_init(void)
|
||||
static int gsensor_mma7660_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
|
||||
return sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return sensor_unregister_device(client, NULL, &gsensor_mma7660_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_mma7660_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gsensor_mma7660_id[] = {
|
||||
{"gs_mma7660", ACCEL_ID_MMA7660},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static struct i2c_driver gsensor_mma7660_driver = {
|
||||
.probe = gsensor_mma7660_probe,
|
||||
.remove = gsensor_mma7660_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_mma7660_id,
|
||||
.driver = {
|
||||
.name = "gsensor_mma7660",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_mma7660_init);
|
||||
module_exit(gsensor_mma7660_exit);
|
||||
module_i2c_driver(gsensor_mma7660_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("mma7660 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -388,33 +388,37 @@ struct sensor_operate gsensor_mma8452_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_mma8452_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_mma8452_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_mma8452_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gsensor_mma8452_init(void)
|
||||
static int gsensor_mma8452_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_mma8452_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_mma8452_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
|
||||
|
||||
module_init(gsensor_mma8452_init);
|
||||
module_exit(gsensor_mma8452_exit);
|
||||
static const struct i2c_device_id gsensor_mma8452_id[] = {
|
||||
{"gs_mma8452", ACCEL_ID_MMA845X},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gsensor_mma8452_driver = {
|
||||
.probe = gsensor_mma8452_probe,
|
||||
.remove = gsensor_mma8452_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_mma8452_id,
|
||||
.driver = {
|
||||
.name = "gsensor_mma8452",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(gsensor_mma8452_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("mma8452 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -257,34 +257,44 @@ struct sensor_operate gsensor_mpu6500_ops = {
|
|||
.ctrl_reg = MPU6500_PWR_MGMT_2,
|
||||
.int_status_reg = MPU6500_INT_STATUS,
|
||||
.range = {-32768, 32768},
|
||||
.trig = IRQF_TRIGGER_HIGH |IRQF_ONESHOT,
|
||||
.trig = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
|
||||
.active = sensor_active,
|
||||
.init = sensor_init,
|
||||
.report = sensor_report_value,
|
||||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_mpu6500_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_mpu6500_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_mpu6500_ops);
|
||||
}
|
||||
|
||||
static int __init gsensor_mpu6500_init(void)
|
||||
static int gsensor_mpu6500_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
|
||||
return sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return sensor_unregister_device(client, NULL, &gsensor_mpu6500_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_mpu6500_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gsensor_mpu6500_id[] = {
|
||||
{"mpu6500_acc", ACCEL_ID_MPU6500},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static struct i2c_driver gsensor_mpu6500_driver = {
|
||||
.probe = gsensor_mpu6500_probe,
|
||||
.remove = gsensor_mpu6500_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_mpu6500_id,
|
||||
.driver = {
|
||||
.name = "gsensor_mpu6500",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_mpu6500_init);
|
||||
module_exit(gsensor_mpu6500_exit);
|
||||
module_i2c_driver(gsensor_mpu6500_driver);
|
||||
|
||||
MODULE_AUTHOR("oeh <oeh@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("mpu6500_acc 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -260,26 +260,37 @@ struct sensor_operate gsensor_mpu6880_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_mpu6880_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_mpu6880_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_mpu6880_ops);
|
||||
}
|
||||
|
||||
static int __init gsensor_mpu6880_init(void)
|
||||
static int gsensor_mpu6880_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
|
||||
return sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return sensor_unregister_device(client, NULL, &gsensor_mpu6880_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_mpu6880_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gsensor_mpu6880_id[] = {
|
||||
{"mpu6880_acc", ACCEL_ID_MPU6880},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static struct i2c_driver gsensor_mpu6880_driver = {
|
||||
.probe = gsensor_mpu6880_probe,
|
||||
.remove = gsensor_mpu6880_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_mpu6880_id,
|
||||
.driver = {
|
||||
.name = "gsensor_mpu6880",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_mpu6880_init);
|
||||
module_exit(gsensor_mpu6880_exit);
|
||||
module_i2c_driver(gsensor_mpu6880_driver);
|
||||
|
||||
MODULE_AUTHOR("oeh <oeh@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("mpu6880 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -248,34 +248,37 @@ struct sensor_operate gsensor_mxc6225_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_mxc6225_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_mxc6225_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_mxc6225_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gsensor_mxc6225_init(void)
|
||||
static int gsensor_mxc6225_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_mxc6225_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_mxc6225_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
|
||||
|
||||
module_init(gsensor_mxc6225_init);
|
||||
module_exit(gsensor_mxc6225_exit);
|
||||
static const struct i2c_device_id gsensor_mxc6225_id[] = {
|
||||
{"gs_mxc6225", ACCEL_ID_MXC6225},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gsensor_mxc6225_driver = {
|
||||
.probe = gsensor_mxc6225_probe,
|
||||
.remove = gsensor_mxc6225_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_mxc6225_id,
|
||||
.driver = {
|
||||
.name = "gsensor_mxc6225",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(gsensor_mxc6225_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("mxc6225 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
* kernel/drivers/input/sensors/accel/mxc6655xa.c
|
||||
*
|
||||
* Copyright (C) 2020 Rockchip Co.,Ltd.
|
||||
* Author: Jie Wang <dave.wang@rock-chips.com>
|
||||
* Author: Wang Jie <dave.wang@rock-chips.com>
|
||||
*/
|
||||
|
||||
#include <linux/interrupt.h>
|
||||
|
|
@ -226,30 +226,37 @@ static struct sensor_operate gsensor_mxc6655_ops = {
|
|||
.report = sensor_report_value,
|
||||
};
|
||||
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_mxc6655_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_mxc6655_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_mxc6655_ops);
|
||||
}
|
||||
|
||||
static int __init gsensor_mxc6655_init(void)
|
||||
static int gsensor_mxc6655_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_mxc6655_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_mxc6655_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gsensor_mxc6655_id[] = {
|
||||
{"gs_mxc6655xa", ACCEL_ID_MXC6655XA},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static struct i2c_driver gsensor_mxc6655_driver = {
|
||||
.probe = gsensor_mxc6655_probe,
|
||||
.remove = gsensor_mxc6655_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_mxc6655_id,
|
||||
.driver = {
|
||||
.name = "gsensor_mxc6655",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gsensor_mxc6655_init);
|
||||
module_exit(gsensor_mxc6655_exit);
|
||||
module_i2c_driver(gsensor_mxc6655_driver);
|
||||
|
||||
MODULE_AUTHOR("Wang Jie <dave.wang@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("mxc6655 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -1619,33 +1619,37 @@ static struct sensor_operate gsensor_sc7660_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_sc7660_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_sc7660_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_sc7660_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gsensor_sc7660_init(void)
|
||||
static int gsensor_sc7660_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_sc7660_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_sc7660_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
|
||||
|
||||
module_init(gsensor_sc7660_init);
|
||||
module_exit(gsensor_sc7660_exit);
|
||||
static const struct i2c_device_id gsensor_sc7660_id[] = {
|
||||
{"gs_sc7660", ACCEL_ID_SC7660},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gsensor_sc7660_driver = {
|
||||
.probe = gsensor_sc7660_probe,
|
||||
.remove = gsensor_sc7660_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_sc7660_id,
|
||||
.driver = {
|
||||
.name = "gsensor_sc7660",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(gsensor_sc7660_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("sc7660 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -1732,33 +1732,37 @@ static struct sensor_operate gsensor_sc7a20_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_sc7a20_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_sc7a20_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_sc7a20_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gsensor_sc7a20_init(void)
|
||||
static int gsensor_sc7a20_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_sc7a20_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_sc7a20_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
|
||||
|
||||
module_init(gsensor_sc7a20_init);
|
||||
module_exit(gsensor_sc7a20_exit);
|
||||
static const struct i2c_device_id gsensor_sc7a20_id[] = {
|
||||
{"gs_sc7a20", ACCEL_ID_SC7A20},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gsensor_sc7a20_driver = {
|
||||
.probe = gsensor_sc7a20_probe,
|
||||
.remove = gsensor_sc7a20_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_sc7a20_id,
|
||||
.driver = {
|
||||
.name = "gsensor_sc7a20",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(gsensor_sc7a20_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("sc7a20 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -1179,28 +1179,37 @@ struct sensor_operate gsensor_sc7a30_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gsensor_get_ops(void)
|
||||
static int gsensor_sc7a30_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_sc7a30_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_sc7a30_ops);
|
||||
}
|
||||
|
||||
static int __init gsensor_sc7a30_init(void)
|
||||
static int gsensor_sc7a30_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gsensor_sc7a30_ops);
|
||||
}
|
||||
|
||||
static void __exit gsensor_sc7a30_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gsensor_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gsensor_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id gsensor_sc7a30_id[] = {
|
||||
{"gs_sc7a30", ACCEL_ID_SC7A30},
|
||||
{}
|
||||
};
|
||||
|
||||
module_init(gsensor_sc7a30_init);
|
||||
module_exit(gsensor_sc7a30_exit);
|
||||
static struct i2c_driver gsensor_sc7a30_driver = {
|
||||
.probe = gsensor_sc7a30_probe,
|
||||
.remove = gsensor_sc7a30_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_sc7a30_id,
|
||||
.driver = {
|
||||
.name = "gsensor_sc7a30",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(gsensor_sc7a30_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("sc7a30 3-Axis accelerometer driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -920,29 +920,36 @@ struct sensor_operate gsensor_stk8baxx_ops = {
|
|||
.report = sensor_report_value,
|
||||
};
|
||||
|
||||
static struct sensor_operate *stk8baxx_get_ops(void)
|
||||
static int gsensor_stk8baxx_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gsensor_stk8baxx_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gsensor_stk8baxx_ops);
|
||||
}
|
||||
|
||||
static int __init stk8baxx_init(void)
|
||||
static int gsensor_stk8baxx_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = stk8baxx_get_ops();
|
||||
int type = ops->type;
|
||||
|
||||
return sensor_register_slave(type, NULL, NULL, stk8baxx_get_ops);
|
||||
return sensor_unregister_device(client, NULL, &gsensor_stk8baxx_ops);
|
||||
}
|
||||
|
||||
static void __exit stk8baxx_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = stk8baxx_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gsensor_stk8baxx_id[] = {
|
||||
{"gs_stk8baxx", ACCEL_ID_STK8BAXX},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, stk8baxx_get_ops);
|
||||
}
|
||||
static struct i2c_driver gsensor_stk8baxx_driver = {
|
||||
.probe = gsensor_stk8baxx_probe,
|
||||
.remove = gsensor_stk8baxx_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gsensor_stk8baxx_id,
|
||||
.driver = {
|
||||
.name = "gsensor_stk8baxx",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(stk8baxx_init);
|
||||
module_exit(stk8baxx_exit);
|
||||
module_i2c_driver(gsensor_stk8baxx_driver);
|
||||
|
||||
MODULE_AUTHOR("Lex Hsieh, Sensortek");
|
||||
MODULE_DESCRIPTION("stk8baxx 3-Axis accelerometer driver");
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#
|
||||
|
||||
menuconfig ANGLE_DEVICE
|
||||
bool "angle device support"
|
||||
tristate "angle device support"
|
||||
help
|
||||
Enable this to be able to choose the drivers for controlling the
|
||||
g_sensor on some platforms, for example on PDAs.
|
||||
|
|
@ -12,16 +12,16 @@ menuconfig ANGLE_DEVICE
|
|||
if ANGLE_DEVICE
|
||||
|
||||
config ANGLE_KXTIK
|
||||
bool "angle kxtik"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
tristate "angle kxtik"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
config ANGLE_LIS3DH
|
||||
bool "angle lis3dh"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
tristate "angle lis3dh"
|
||||
help
|
||||
To have support for your specific gsesnor you will have to
|
||||
select the proper drivers which depend on this option.
|
||||
|
||||
endif
|
||||
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ static int sensor_convert_data(struct i2c_client *client, char high_byte, char l
|
|||
s64 result;
|
||||
struct sensor_private_data *sensor =
|
||||
(struct sensor_private_data *) i2c_get_clientdata(client);
|
||||
//int precision = sensor->ops->precision;
|
||||
/* int precision = sensor->ops->precision; */
|
||||
switch (sensor->devid) {
|
||||
case KXTIK_DEVID_1004:
|
||||
case KXTIK_DEVID_1013:
|
||||
|
|
@ -255,10 +255,10 @@ static int sensor_convert_data(struct i2c_client *client, char high_byte, char l
|
|||
case KXTIK_DEVID_J2_1009:
|
||||
result = (((int)high_byte << 8) | ((int)low_byte ))>>4;
|
||||
if (result < KXTIK_BOUNDARY)
|
||||
result = result* KXTIK_GRAVITY_STEP;
|
||||
else
|
||||
result = ~( ((~result & (0x7fff>>(16-KXTIK_PRECISION)) ) + 1)
|
||||
* KXTIK_GRAVITY_STEP) + 1;
|
||||
result = result * KXTIK_GRAVITY_STEP;
|
||||
else
|
||||
result = ~(((~result & (0x7fff >> (16 - KXTIK_PRECISION))) + 1)
|
||||
* KXTIK_GRAVITY_STEP) + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -362,32 +362,37 @@ struct sensor_operate angle_kxtik_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *angle_get_ops(void)
|
||||
static int angle_kxtik_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &angle_kxtik_ops;
|
||||
return sensor_register_device(client, NULL, devid, &angle_kxtik_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init angle_kxtik_init(void)
|
||||
static int angle_kxtik_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = angle_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, angle_get_ops);
|
||||
printk("%s\n",__func__);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &angle_kxtik_ops);
|
||||
}
|
||||
|
||||
static void __exit angle_kxtik_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = angle_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, angle_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id angle_kxtik_id[] = {
|
||||
{"angle_kxtik", ANGLE_ID_KXTIK},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver angle_kxtik_driver = {
|
||||
.probe = angle_kxtik_probe,
|
||||
.remove = angle_kxtik_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = angle_kxtik_id,
|
||||
.driver = {
|
||||
.name = "angle_kxtik",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(angle_kxtik_init);
|
||||
module_exit(angle_kxtik_exit);
|
||||
module_i2c_driver(angle_kxtik_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("kxtik angle driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -183,15 +183,15 @@ static int sensor_convert_data(struct i2c_client *client, char high_byte, char l
|
|||
s64 result;
|
||||
struct sensor_private_data *sensor =
|
||||
(struct sensor_private_data *) i2c_get_clientdata(client);
|
||||
//int precision = sensor->ops->precision;
|
||||
/* int precision = sensor->ops->precision; */
|
||||
switch (sensor->devid) {
|
||||
case LIS3DH_DEVID:
|
||||
result = ((int)high_byte << 8) | (int)low_byte;
|
||||
if (result < LIS3DH_BOUNDARY)
|
||||
result = result* LIS3DH_GRAVITY_STEP;
|
||||
else
|
||||
result = ~( ((~result & (0x7fff>>(16-LIS3DH_PRECISION)) ) + 1)
|
||||
* LIS3DH_GRAVITY_STEP) + 1;
|
||||
result = result * LIS3DH_GRAVITY_STEP;
|
||||
else
|
||||
result = ~(((~result & (0x7fff >> (16 - LIS3DH_PRECISION))) + 1)
|
||||
* LIS3DH_GRAVITY_STEP) + 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -304,32 +304,39 @@ struct sensor_operate angle_lis3dh_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *angle_get_ops(void)
|
||||
static int angle_lis3dh_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &angle_lis3dh_ops;
|
||||
return sensor_register_device(client, NULL, devid, &angle_lis3dh_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init angle_lis3dh_init(void)
|
||||
static int angle_lis3dh_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = angle_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, angle_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &angle_lis3dh_ops);
|
||||
}
|
||||
|
||||
static void __exit angle_lis3dh_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = angle_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, angle_get_ops);
|
||||
}
|
||||
|
||||
|
||||
module_init(angle_lis3dh_init);
|
||||
module_exit(angle_lis3dh_exit);
|
||||
static const struct i2c_device_id angle_lis3dh_id[] = {
|
||||
{"angle_lis3dh", ANGLE_ID_LIS3DH},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver angle_lis3dh_driver = {
|
||||
.probe = angle_lis3dh_probe,
|
||||
.remove = angle_lis3dh_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = angle_lis3dh_id,
|
||||
.driver = {
|
||||
.name = "angle_lis3dh",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(angle_lis3dh_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("lis3dh angle driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -631,29 +631,37 @@ struct sensor_operate compass_akm09911_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
static struct sensor_operate *compass_get_ops(void)
|
||||
static int compass_akm09911_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &compass_akm09911_ops;
|
||||
return sensor_register_device(client, NULL, devid, &compass_akm09911_ops);
|
||||
}
|
||||
|
||||
static int __init compass_akm09911_init(void)
|
||||
static int compass_akm09911_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = compass_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
|
||||
result = sensor_register_slave(type, NULL, NULL, compass_get_ops);
|
||||
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &compass_akm09911_ops);
|
||||
}
|
||||
|
||||
static void __exit compass_akm09911_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = compass_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id compass_akm09911_id[] = {
|
||||
{"ak09911", COMPASS_ID_AK09911},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, compass_get_ops);
|
||||
}
|
||||
static struct i2c_driver compass_akm09911_driver = {
|
||||
.probe = compass_akm09911_probe,
|
||||
.remove = compass_akm09911_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = compass_akm09911_id,
|
||||
.driver = {
|
||||
.name = "compass_akm09911",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(compass_akm09911_init);
|
||||
module_exit(compass_akm09911_exit);
|
||||
module_i2c_driver(compass_akm09911_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("akm09911 3-Axis compasss driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -678,30 +678,37 @@ struct sensor_operate compass_akm8963_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
static struct sensor_operate *compass_get_ops(void)
|
||||
static int compass_akm8963_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &compass_akm8963_ops;
|
||||
return sensor_register_device(client, NULL, devid, &compass_akm8963_ops);
|
||||
}
|
||||
|
||||
static int __init compass_akm8963_init(void)
|
||||
static int compass_akm8963_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = compass_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
|
||||
result = sensor_register_slave(type, NULL, NULL, compass_get_ops);
|
||||
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &compass_akm8963_ops);
|
||||
}
|
||||
|
||||
static void __exit compass_akm8963_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = compass_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id compass_akm8963_id[] = {
|
||||
{"ak8963", COMPASS_ID_AK8963},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, compass_get_ops);
|
||||
}
|
||||
static struct i2c_driver compass_akm8963_driver = {
|
||||
.probe = compass_akm8963_probe,
|
||||
.remove = compass_akm8963_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = compass_akm8963_id,
|
||||
.driver = {
|
||||
.name = "compass_akm8963",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(compass_akm8963_init);
|
||||
module_exit(compass_akm8963_exit);
|
||||
module_i2c_driver(compass_akm8963_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("akm8963 3-Axis compasss driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -612,33 +612,39 @@ struct sensor_operate compass_akm8975_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *compass_get_ops(void)
|
||||
static int compass_akm8975_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &compass_akm8975_ops;
|
||||
return sensor_register_device(client, NULL, devid, &compass_akm8975_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init compass_akm8975_init(void)
|
||||
static int compass_akm8975_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = compass_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, compass_get_ops);
|
||||
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &compass_akm8975_ops);
|
||||
}
|
||||
|
||||
static void __exit compass_akm8975_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = compass_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, compass_get_ops);
|
||||
}
|
||||
|
||||
|
||||
module_init(compass_akm8975_init);
|
||||
module_exit(compass_akm8975_exit);
|
||||
static const struct i2c_device_id compass_akm8975_id[] = {
|
||||
{"ak8975", COMPASS_ID_AK8975},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver compass_akm8975_driver = {
|
||||
.probe = compass_akm8975_probe,
|
||||
.remove = compass_akm8975_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = compass_akm8975_id,
|
||||
.driver = {
|
||||
.name = "compass_akm8975",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(compass_akm8975_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("akm8975 3-Axis compasss driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,36 +4,36 @@
|
|||
#
|
||||
|
||||
menuconfig GYROSCOPE_DEVICE
|
||||
bool "gyroscope device support"
|
||||
tristate "gyroscope device support"
|
||||
default n
|
||||
|
||||
if GYROSCOPE_DEVICE
|
||||
|
||||
config GYRO_L3G4200D
|
||||
bool "gyroscope l3g4200d"
|
||||
tristate "gyroscope l3g4200d"
|
||||
default n
|
||||
|
||||
config GYRO_K3G
|
||||
bool "gyroscope k3g"
|
||||
tristate "gyroscope k3g"
|
||||
default n
|
||||
|
||||
config GYRO_L3G20D
|
||||
bool "gyroscope l3g20d"
|
||||
tristate "gyroscope l3g20d"
|
||||
default n
|
||||
|
||||
config GYRO_EWTSA
|
||||
bool "gyroscope ewtsa"
|
||||
tristate "gyroscope ewtsa"
|
||||
default n
|
||||
|
||||
config GYRO_MPU6500
|
||||
bool "gyroscope mpu6500_gyro"
|
||||
tristate "gyroscope mpu6500_gyro"
|
||||
default n
|
||||
|
||||
config GYRO_MPU6880
|
||||
bool "gyroscope mpu6880_gyro"
|
||||
tristate "gyroscope mpu6880_gyro"
|
||||
default n
|
||||
|
||||
config GYRO_LSM330
|
||||
bool "gyroscope lsm330_gyro"
|
||||
tristate "gyroscope lsm330_gyro"
|
||||
default n
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# SPDX-License-Identifier: GPL-2.0
|
||||
# gyroscope drivers
|
||||
|
||||
obj-$(CONFIG_GYRO_SENSOR_K3G) += k3g.o
|
||||
#obj-$(CONFIG_GYRO_SENSOR_K3G) += k3g.o
|
||||
obj-$(CONFIG_GYRO_L3G4200D) += l3g4200d.o
|
||||
obj-$(CONFIG_GYRO_L3G20D) += l3g20d.o
|
||||
obj-$(CONFIG_GYRO_EWTSA) += ewtsa.o
|
||||
|
|
|
|||
|
|
@ -425,32 +425,37 @@ struct sensor_operate gyro_ewtsa_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gyro_get_ops(void)
|
||||
static int gyro_ewtsa_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gyro_ewtsa_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gyro_ewtsa_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gyro_ewtsa_init(void)
|
||||
static int gyro_ewtsa_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gyro_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gyro_ewtsa_ops);
|
||||
}
|
||||
|
||||
static void __exit gyro_ewtsa_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gyro_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id gyro_ewtsa_id[] = {
|
||||
{"ewtsa_gyro", GYRO_ID_EWTSA},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gyro_ewtsa_driver = {
|
||||
.probe = gyro_ewtsa_probe,
|
||||
.remove = gyro_ewtsa_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gyro_ewtsa_id,
|
||||
.driver = {
|
||||
.name = "gyro_ewtsa",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gyro_ewtsa_init);
|
||||
module_exit(gyro_ewtsa_exit);
|
||||
|
||||
module_i2c_driver(gyro_ewtsa_driver);
|
||||
|
||||
MODULE_AUTHOR("zhangaihui <zah@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("ewtsa 3-Axis Gyroscope driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -221,32 +221,37 @@ static struct sensor_operate gyro_l3g20d_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gyro_get_ops(void)
|
||||
static int gyro_l3g20d_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gyro_l3g20d_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gyro_l3g20d_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gyro_l3g20d_init(void)
|
||||
static int gyro_l3g20d_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gyro_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gyro_l3g20d_ops);
|
||||
}
|
||||
|
||||
static void __exit gyro_l3g20d_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gyro_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id gyro_l3g20d_id[] = {
|
||||
{"l3g20d_gyro", GYRO_ID_L3G20D},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gyro_l3g20d_driver = {
|
||||
.probe = gyro_l3g20d_probe,
|
||||
.remove = gyro_l3g20d_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gyro_l3g20d_id,
|
||||
.driver = {
|
||||
.name = "gyro_l3g20d",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gyro_l3g20d_init);
|
||||
module_exit(gyro_l3g20d_exit);
|
||||
|
||||
module_i2c_driver(gyro_l3g20d_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("l3g20d 3-Axis Gyroscope driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -221,32 +221,37 @@ struct sensor_operate gyro_l3g4200d_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *gyro_get_ops(void)
|
||||
static int gyro_l3g4200d_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gyro_l3g4200d_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gyro_l3g4200d_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init gyro_l3g4200d_init(void)
|
||||
static int gyro_l3g4200d_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, gyro_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gyro_l3g4200d_ops);
|
||||
}
|
||||
|
||||
static void __exit gyro_l3g4200d_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, gyro_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id gyro_l3g4200d_id[] = {
|
||||
{"l3g4200d_gyro", GYRO_ID_L3G4200D},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gyro_l3g4200d_driver = {
|
||||
.probe = gyro_l3g4200d_probe,
|
||||
.remove = gyro_l3g4200d_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gyro_l3g4200d_id,
|
||||
.driver = {
|
||||
.name = "gyro_l3g4200d",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gyro_l3g4200d_init);
|
||||
module_exit(gyro_l3g4200d_exit);
|
||||
|
||||
module_i2c_driver(gyro_l3g4200d_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("l3g4200d 3-Axis Gyroscope driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -226,29 +226,37 @@ struct sensor_operate gyro_lsm330_ops = {
|
|||
.report = sensor_report_value,
|
||||
};
|
||||
|
||||
static struct sensor_operate *gyro_get_ops(void)
|
||||
static int gyro_lsm330_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gyro_lsm330_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gyro_lsm330_ops);
|
||||
}
|
||||
|
||||
static int __init gyro_lsm330_init(void)
|
||||
static int gyro_lsm330_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
|
||||
result = sensor_register_slave(type, NULL, NULL, gyro_get_ops);
|
||||
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &gyro_lsm330_ops);
|
||||
}
|
||||
|
||||
static void __exit gyro_lsm330_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id gyro_lsm330_id[] = {
|
||||
{"lsm330_gyro", GYRO_ID_LSM330},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gyro_get_ops);
|
||||
}
|
||||
static struct i2c_driver gyro_lsm330_driver = {
|
||||
.probe = gyro_lsm330_probe,
|
||||
.remove = gyro_lsm330_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gyro_lsm330_id,
|
||||
.driver = {
|
||||
.name = "gyro_lsm330",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(gyro_lsm330_init);
|
||||
module_exit(gyro_lsm330_exit);
|
||||
module_i2c_driver(gyro_lsm330_driver);
|
||||
|
||||
MODULE_AUTHOR("Bin Yang <yangbin@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("lsm330 3-Axis Gyroscope driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -161,35 +161,56 @@ struct sensor_operate gyro_mpu6500_ops = {
|
|||
.ctrl_reg = MPU6500_PWR_MGMT_2,
|
||||
.int_status_reg = MPU6500_INT_STATUS,
|
||||
.range = {-32768, 32768},
|
||||
.trig = IRQF_TRIGGER_HIGH |IRQF_ONESHOT,
|
||||
.trig = IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
|
||||
.active = sensor_active,
|
||||
.init = sensor_init,
|
||||
.report = sensor_report_value,
|
||||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
static struct sensor_operate *gyro_get_ops(void)
|
||||
static int gyro_mpu6500_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gyro_mpu6500_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gyro_mpu6500_ops);
|
||||
}
|
||||
|
||||
static int gyro_mpu6500_remove(struct i2c_client *client)
|
||||
{
|
||||
return sensor_unregister_device(client, NULL, &gyro_mpu6500_ops);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id gyro_mpu6500_id[] = {
|
||||
{"mpu6500_gyro", GYRO_ID_MPU6500},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gyro_mpu6500_driver = {
|
||||
.probe = gyro_mpu6500_probe,
|
||||
.remove = gyro_mpu6500_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gyro_mpu6500_id,
|
||||
.driver = {
|
||||
.name = "gyro_mpu6500",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
static int __init gyro_mpu6500_init(void)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int type = ops->type;
|
||||
|
||||
return sensor_register_slave(type, NULL, NULL, gyro_get_ops);
|
||||
return i2c_add_driver(&gyro_mpu6500_driver);
|
||||
}
|
||||
|
||||
static void __exit gyro_mpu6500_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int type = ops->type;
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gyro_get_ops);
|
||||
i2c_del_driver(&gyro_mpu6500_driver);
|
||||
}
|
||||
|
||||
/* must register after mpu6500_acc */
|
||||
device_initcall_sync(gyro_mpu6500_init);
|
||||
module_exit(gyro_mpu6500_exit);
|
||||
|
||||
MODULE_AUTHOR("ouenhui <oeh@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("mpu6500_gyro 3-Axis Gyroscope driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -168,32 +168,49 @@ struct sensor_operate gyro_mpu6880_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
static struct sensor_operate *gyro_get_ops(void)
|
||||
static int gyro_mpu6880_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &gyro_mpu6880_ops;
|
||||
return sensor_register_device(client, NULL, devid, &gyro_mpu6880_ops);
|
||||
}
|
||||
|
||||
static int gyro_mpu6880_remove(struct i2c_client *client)
|
||||
{
|
||||
return sensor_unregister_device(client, NULL, &gyro_mpu6880_ops);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id gyro_mpu6880_id[] = {
|
||||
{"mpu6880_gyro", GYRO_ID_MPU6880},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver gyro_mpu6880_driver = {
|
||||
.probe = gyro_mpu6880_probe,
|
||||
.remove = gyro_mpu6880_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = gyro_mpu6880_id,
|
||||
.driver = {
|
||||
.name = "gyro_mpu6880",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
static int __init gyro_mpu6880_init(void)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int type = ops->type;
|
||||
|
||||
return sensor_register_slave(type, NULL, NULL, gyro_get_ops);
|
||||
return i2c_add_driver(&gyro_mpu6880_driver);
|
||||
}
|
||||
|
||||
static void __exit gyro_mpu6880_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = gyro_get_ops();
|
||||
int type = ops->type;
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, gyro_get_ops);
|
||||
i2c_del_driver(&gyro_mpu6880_driver);
|
||||
}
|
||||
|
||||
/* must register after mpu6880_acc */
|
||||
device_initcall_sync(gyro_mpu6880_init);
|
||||
module_exit(gyro_mpu6880_exit);
|
||||
|
||||
|
||||
|
||||
MODULE_AUTHOR("ouenhui <oeh@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("mpu6880_gyro 3-Axis Gyroscope driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@
|
|||
#
|
||||
|
||||
menuconfig HALL_DEVICE
|
||||
bool "hall sensor device support"
|
||||
tristate "hall sensor device support"
|
||||
|
||||
if HALL_DEVICE
|
||||
config HS_OCH165T
|
||||
bool "hall sensor och165t"
|
||||
tristate "hall sensor och165t"
|
||||
|
||||
config HS_MH248
|
||||
bool "hall sensor mh248"
|
||||
tristate "hall sensor mh248"
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -123,32 +123,37 @@ struct sensor_operate hall_och165t_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *hall_get_ops(void)
|
||||
static int hall_och165t_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &hall_och165t_ops;
|
||||
return sensor_register_device(client, NULL, devid, &hall_och165t_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init hall_och165t_init(void)
|
||||
static int hall_och165t_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = hall_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, hall_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &hall_och165t_ops);
|
||||
}
|
||||
|
||||
static void __exit hall_och165t_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = hall_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, hall_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id hall_och165t_id[] = {
|
||||
{"hall_och165t", HALL_ID_OCH165T},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver hall_och165t_driver = {
|
||||
.probe = hall_och165t_probe,
|
||||
.remove = hall_och165t_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = hall_och165t_id,
|
||||
.driver = {
|
||||
.name = "hall_och165t",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(hall_och165t_init);
|
||||
module_exit(hall_och165t_exit);
|
||||
|
||||
module_i2c_driver(hall_och165t_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("och165t hall driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -4,44 +4,44 @@
|
|||
#
|
||||
|
||||
menuconfig LIGHT_DEVICE
|
||||
bool "light sensor device support"
|
||||
tristate "light sensor device support"
|
||||
default n
|
||||
|
||||
if LIGHT_DEVICE
|
||||
config LS_CM3217
|
||||
bool "light sensor cm3217"
|
||||
tristate "light sensor cm3217"
|
||||
default n
|
||||
|
||||
config LS_CM3218
|
||||
bool "light sensor cm3218"
|
||||
tristate "light sensor cm3218"
|
||||
default n
|
||||
|
||||
config LS_CM3232
|
||||
bool "light sensor cm3232"
|
||||
tristate "light sensor cm3232"
|
||||
default n
|
||||
|
||||
config LS_AL3006
|
||||
bool "light sensor al3006"
|
||||
tristate "light sensor al3006"
|
||||
default n
|
||||
|
||||
config LS_STK3171
|
||||
bool "light sensor stk3171"
|
||||
tristate "light sensor stk3171"
|
||||
default n
|
||||
|
||||
config LS_ISL29023
|
||||
bool "light sensor isl29023"
|
||||
tristate "light sensor isl29023"
|
||||
default n
|
||||
|
||||
config LS_AP321XX
|
||||
bool "light sensor ap321xx"
|
||||
tristate "light sensor ap321xx"
|
||||
default n
|
||||
|
||||
config LS_US5152
|
||||
bool "light sensor us5152"
|
||||
tristate "light sensor us5152"
|
||||
default n
|
||||
|
||||
config LS_STK3410
|
||||
bool "light sensor stk3410"
|
||||
tristate "light sensor stk3410"
|
||||
default n
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -202,32 +202,36 @@ struct sensor_operate light_cm3217_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *light_get_ops(void)
|
||||
static int light_cm3217_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &light_cm3217_ops;
|
||||
return sensor_register_device(client, NULL, devid, &light_cm3217_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init light_cm3217_init(void)
|
||||
static int light_cm3217_remove(struct i2c_client *client)
|
||||
{
|
||||
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;
|
||||
return sensor_unregister_device(client, NULL, &light_cm3217_ops);
|
||||
}
|
||||
|
||||
static void __exit light_cm3217_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, light_get_ops);
|
||||
}
|
||||
|
||||
|
||||
module_init(light_cm3217_init);
|
||||
module_exit(light_cm3217_exit);
|
||||
static const struct i2c_device_id light_cm3217_id[] = {
|
||||
{"light_cm3217", LIGHT_ID_CM3217},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver light_cm3217_driver = {
|
||||
.probe = light_cm3217_probe,
|
||||
.remove = light_cm3217_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = light_cm3217_id,
|
||||
.driver = {
|
||||
.name = "light_cm3217",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(light_cm3217_driver);
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("cm3217 light driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -379,31 +379,37 @@ struct sensor_operate light_cm3218_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
/* function name should not be changed */
|
||||
static struct sensor_operate *light_get_ops(void)
|
||||
static int light_cm3218_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &light_cm3218_ops;
|
||||
return sensor_register_device(client, NULL, devid, &light_cm3218_ops);
|
||||
}
|
||||
|
||||
static int __init light_cm3218_init(void)
|
||||
static int light_cm3218_remove(struct i2c_client *client)
|
||||
{
|
||||
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;
|
||||
return sensor_unregister_device(client, NULL, &light_cm3218_ops);
|
||||
}
|
||||
|
||||
static void __exit light_cm3218_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id light_cm3218_id[] = {
|
||||
{"light_cm3218", LIGHT_ID_CM3218},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, light_get_ops);
|
||||
}
|
||||
static struct i2c_driver light_cm3218_driver = {
|
||||
.probe = light_cm3218_probe,
|
||||
.remove = light_cm3218_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = light_cm3218_id,
|
||||
.driver = {
|
||||
.name = "light_cm3218",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(light_cm3218_init);
|
||||
module_exit(light_cm3218_exit);
|
||||
module_i2c_driver(light_cm3218_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("cm3218 light driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -209,32 +209,37 @@ struct sensor_operate light_cm3232_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *light_get_ops(void)
|
||||
static int light_cm3232_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &light_cm3232_ops;
|
||||
return sensor_register_device(client, NULL, devid, &light_cm3232_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init light_cm3232_init(void)
|
||||
static int light_cm3232_remove(struct i2c_client *client)
|
||||
{
|
||||
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;
|
||||
return sensor_unregister_device(client, NULL, &light_cm3232_ops);
|
||||
}
|
||||
|
||||
static void __exit light_cm3232_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, light_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id light_cm3232_id[] = {
|
||||
{"light_cm3232", LIGHT_ID_CM3232},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver light_cm3232_driver = {
|
||||
.probe = light_cm3232_probe,
|
||||
.remove = light_cm3232_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = light_cm3232_id,
|
||||
.driver = {
|
||||
.name = "light_cm3232",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(light_cm3232_init);
|
||||
module_exit(light_cm3232_exit);
|
||||
|
||||
module_i2c_driver(light_cm3232_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("cm3232 light driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -237,32 +237,37 @@ struct sensor_operate light_isl29023_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *light_get_ops(void)
|
||||
static int light_isl29023_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &light_isl29023_ops;
|
||||
return sensor_register_device(client, NULL, devid, &light_isl29023_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init light_isl29023_init(void)
|
||||
static int light_isl29023_remove(struct i2c_client *client)
|
||||
{
|
||||
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;
|
||||
return sensor_unregister_device(client, NULL, &light_isl29023_ops);
|
||||
}
|
||||
|
||||
static void __exit light_isl29023_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, light_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id light_isl29023_id[] = {
|
||||
{"ls_isl29023", LIGHT_ID_ISL29023},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver light_isl29023_driver = {
|
||||
.probe = light_isl29023_probe,
|
||||
.remove = light_isl29023_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = light_isl29023_id,
|
||||
.driver = {
|
||||
.name = "light_isl29023",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(light_isl29023_init);
|
||||
module_exit(light_isl29023_exit);
|
||||
|
||||
module_i2c_driver(light_isl29023_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("isl29023 light driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -264,32 +264,38 @@ struct sensor_operate light_al3006_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *light_get_ops(void)
|
||||
static int light_al3006_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &light_al3006_ops;
|
||||
return sensor_register_device(client, NULL, devid, &light_al3006_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init light_al3006_init(void)
|
||||
static int light_al3006_remove(struct i2c_client *client)
|
||||
{
|
||||
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;
|
||||
return sensor_unregister_device(client, NULL, &light_al3006_ops);
|
||||
}
|
||||
|
||||
static void __exit light_al3006_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, light_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id light_al3006_id[] = {
|
||||
{"light_al3006", LIGHT_ID_AL3006},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver light_al3006_driver = {
|
||||
.probe = light_al3006_probe,
|
||||
.remove = light_al3006_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = light_al3006_id,
|
||||
.driver = {
|
||||
.name = "light_al3006",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(light_al3006_init);
|
||||
module_exit(light_al3006_exit);
|
||||
module_i2c_driver(light_al3006_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("al3006 light driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
#include <linux/input.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/freezer.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/board.h>
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
|
|
@ -385,25 +383,45 @@ static struct sensor_operate *light_get_ops(void)
|
|||
return &light_ap321xx_ops;
|
||||
}
|
||||
|
||||
|
||||
static int __init light_ap321xx_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 light_ap321xx_exit(void)
|
||||
static int light_ap321xx_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, light_get_ops);
|
||||
|
||||
return sensor_register_device(type, client, NULL, devid, light_get_ops);
|
||||
}
|
||||
|
||||
static int light_ap321xx_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
|
||||
module_init(light_ap321xx_init);
|
||||
module_exit(light_ap321xx_exit);
|
||||
return sensor_unregister_device(type, client, NULL, light_get_ops);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id light_ap321xx_id[] = {
|
||||
{"ls_ap321xx", LIGHT_ID_AP321XX},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver light_ap321xx_driver = {
|
||||
.probe = light_ap321xx_probe,
|
||||
.remove = light_ap321xx_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = light_ap321xx_id,
|
||||
.driver = {
|
||||
.name = "light_ap321xx",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(light_ap321xx_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("ap321xx light driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -283,32 +283,39 @@ struct sensor_operate light_stk3171_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *light_get_ops(void)
|
||||
static int light_stk3171_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &light_stk3171_ops;
|
||||
return sensor_register_device(client, NULL, devid, &light_stk3171_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init light_stk3171_init(void)
|
||||
static int light_stk3171_remove(struct i2c_client *client)
|
||||
{
|
||||
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;
|
||||
return sensor_unregister_device(client, NULL, &light_stk3171_ops);
|
||||
}
|
||||
|
||||
static void __exit light_stk3171_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, light_get_ops);
|
||||
}
|
||||
|
||||
|
||||
module_init(light_stk3171_init);
|
||||
module_exit(light_stk3171_exit);
|
||||
static const struct i2c_device_id light_stk3171_id[] = {
|
||||
{"ls_stk3171", LIGHT_ID_STK3171},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver light_stk3171_driver = {
|
||||
.probe = light_stk3171_probe,
|
||||
.remove = light_stk3171_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = light_stk3171_id,
|
||||
.driver = {
|
||||
.name = "light_stk3171",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_i2c_driver(light_stk3171_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("stk3171 light driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -338,29 +338,37 @@ struct sensor_operate light_stk3410_ops = {
|
|||
.report = sensor_report_value,
|
||||
};
|
||||
|
||||
static struct sensor_operate *light_get_ops(void)
|
||||
static int light_stk3410_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &light_stk3410_ops;
|
||||
return sensor_register_device(client, NULL, devid, &light_stk3410_ops);
|
||||
}
|
||||
|
||||
static int __init light_stk3410_init(void)
|
||||
static int light_stk3410_remove(struct i2c_client *client)
|
||||
{
|
||||
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;
|
||||
return sensor_unregister_device(client, NULL, &light_stk3410_ops);
|
||||
}
|
||||
|
||||
static void __exit light_stk3410_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id light_stk3410_id[] = {
|
||||
{"ls_stk3410", LIGHT_ID_STK3410},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, light_get_ops);
|
||||
}
|
||||
static struct i2c_driver light_stk3410_driver = {
|
||||
.probe = light_stk3410_probe,
|
||||
.remove = light_stk3410_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = light_stk3410_id,
|
||||
.driver = {
|
||||
.name = "light_stk3410",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(light_stk3410_init);
|
||||
module_exit(light_stk3410_exit);
|
||||
module_i2c_driver(light_stk3410_driver);
|
||||
|
||||
MODULE_AUTHOR("Bin Yang <yangbin@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("stk3410 light driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -11,8 +11,6 @@
|
|||
#include <linux/input.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/freezer.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/board.h>
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
|
|
@ -404,36 +402,39 @@ struct sensor_operate light_us5152_ops = {
|
|||
.report = sensor_report_value,
|
||||
};
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *light_get_ops(void)
|
||||
static int light_us5152_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &light_us5152_ops;
|
||||
return sensor_register_device(client, NULL, devid, &light_us5152_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init us5152_init(void)
|
||||
static int light_us5152_remove(struct i2c_client *client)
|
||||
{
|
||||
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;
|
||||
return sensor_unregister_device(client, NULL, &light_us5152_ops);
|
||||
}
|
||||
|
||||
static void __exit us5152_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = light_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, light_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id light_us5152_id[] = {
|
||||
{"ls_us5152", LIGHT_ID_US5152},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver light_us5152_driver = {
|
||||
.probe = light_us5152_probe,
|
||||
.remove = light_us5152_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = light_us5152_id,
|
||||
.driver = {
|
||||
.name = "light_us5152",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
module_i2c_driver(light_us5152_driver);
|
||||
|
||||
MODULE_AUTHOR("Finley Huang finley_huang@upi-semi.com");
|
||||
MODULE_DESCRIPTION("us5152 ambient light sensor driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_VERSION(DRIVER_VERSION);
|
||||
|
||||
module_init(us5152_init);
|
||||
module_exit(us5152_exit);
|
||||
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
#
|
||||
|
||||
menuconfig PRESSURE_DEVICE
|
||||
bool "pressure sensor device support"
|
||||
tristate "pressure sensor device support"
|
||||
default n
|
||||
|
||||
if PRESSURE_DEVICE
|
||||
config PR_MS5607
|
||||
bool "pressure sensor ms5607"
|
||||
default n
|
||||
tristate "pressure sensor ms5607"
|
||||
default n
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -262,31 +262,36 @@ struct sensor_operate pressure_ms5607_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *pressure_get_ops(void)
|
||||
static int pressure_ms5607_probe(struct i2c_client *client, const struct i2c_device_id *devid)
|
||||
{
|
||||
return &pressure_ms5607_ops;
|
||||
return sensor_register_device(client, NULL, devid, &pressure_ms5607_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init pressure_ms5607_init(void)
|
||||
static int pressure_ms5607_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = pressure_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, pressure_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &pressure_ms5607_ops);
|
||||
}
|
||||
|
||||
static void __exit pressure_ms5607_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = pressure_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, pressure_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id pressure_ms5607_id[] = {
|
||||
{"pr_ms5607", PRESSURE_ID_MS5607},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver pressure_ms5607_driver = {
|
||||
.probe = pressure_ms5607_probe,
|
||||
.remove = pressure_ms5607_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = pressure_ms5607_id,
|
||||
.driver = {
|
||||
.name = "pressure_ms5607",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(pressure_ms5607_init);
|
||||
module_exit(pressure_ms5607_exit);
|
||||
module_i2c_driver(pressure_ms5607_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("ms5607 pressure driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -4,25 +4,25 @@
|
|||
#
|
||||
|
||||
menuconfig PROXIMITY_DEVICE
|
||||
bool "proximity sensor device support"
|
||||
tristate "proximity sensor device support"
|
||||
default n
|
||||
|
||||
if PROXIMITY_DEVICE
|
||||
|
||||
config PS_AL3006
|
||||
bool "psensor al3006"
|
||||
tristate "psensor al3006"
|
||||
default n
|
||||
|
||||
config PS_STK3171
|
||||
bool "psensor stk3171"
|
||||
tristate "psensor stk3171"
|
||||
default n
|
||||
|
||||
config PS_AP321XX
|
||||
bool "psensor ap321xx"
|
||||
tristate "psensor ap321xx"
|
||||
default n
|
||||
|
||||
config PS_STK3410
|
||||
bool "proximity sensor stk3410"
|
||||
tristate "proximity sensor stk3410"
|
||||
default n
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -225,32 +225,37 @@ struct sensor_operate proximity_al3006_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *proximity_get_ops(void)
|
||||
static int proximity_al3006_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &proximity_al3006_ops;
|
||||
return sensor_register_device(client, NULL, devid, &proximity_al3006_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init proximity_al3006_init(void)
|
||||
static int proximity_al3006_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = proximity_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, proximity_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &proximity_al3006_ops);
|
||||
}
|
||||
|
||||
static void __exit proximity_al3006_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = proximity_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, proximity_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id proximity_al3006_id[] = {
|
||||
{"proximity_al3006", PROXIMITY_ID_AL3006},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver proximity_al3006_driver = {
|
||||
.probe = proximity_al3006_probe,
|
||||
.remove = proximity_al3006_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = proximity_al3006_id,
|
||||
.driver = {
|
||||
.name = "proximity_al3006",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(proximity_al3006_init);
|
||||
module_exit(proximity_al3006_exit);
|
||||
|
||||
module_i2c_driver(proximity_al3006_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("al3006 proximity driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@
|
|||
#include <linux/input.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/freezer.h>
|
||||
#include <mach/gpio.h>
|
||||
#include <mach/board.h>
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
|
|
@ -291,32 +289,37 @@ struct sensor_operate proximity_ap321xx_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *proximity_get_ops(void)
|
||||
static int proximity_ap321xx_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &proximity_ap321xx_ops;
|
||||
return sensor_register_device(client, NULL, devid, &proximity_ap321xx_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init proximity_ap321xx_init(void)
|
||||
static int proximity_ap321xx_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = proximity_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, proximity_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &proximity_ap321xx_ops);
|
||||
}
|
||||
|
||||
static void __exit proximity_ap321xx_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = proximity_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, proximity_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id proximity_ap321xx_id[] = {
|
||||
{"ps_ap321xx", PROXIMITY_ID_AP321XX},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver proximity_ap321xx_driver = {
|
||||
.probe = proximity_ap321xx_probe,
|
||||
.remove = proximity_ap321xx_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = proximity_ap321xx_id,
|
||||
.driver = {
|
||||
.name = "proximity_ap321xx",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(proximity_ap321xx_init);
|
||||
module_exit(proximity_ap321xx_exit);
|
||||
|
||||
module_i2c_driver(proximity_ap321xx_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("ps_ap321xx proximity driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -232,31 +232,37 @@ struct sensor_operate proximity_stk3171_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *proximity_get_ops(void)
|
||||
static int proximity_stk3171_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &proximity_stk3171_ops;
|
||||
return sensor_register_device(client, NULL, devid, &proximity_stk3171_ops);
|
||||
}
|
||||
|
||||
static int __init proximity_stk3171_init(void)
|
||||
static int proximity_stk3171_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = proximity_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, proximity_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &proximity_stk3171_ops);
|
||||
}
|
||||
|
||||
static void __exit proximity_stk3171_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = proximity_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, proximity_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id proximity_stk3171_id[] = {
|
||||
{"ps_stk3171", PROXIMITY_ID_STK3171},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver proximity_stk3171_driver = {
|
||||
.probe = proximity_stk3171_probe,
|
||||
.remove = proximity_stk3171_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = proximity_stk3171_id,
|
||||
.driver = {
|
||||
.name = "proximity_stk3171",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(proximity_stk3171_init);
|
||||
module_exit(proximity_stk3171_exit);
|
||||
|
||||
module_i2c_driver(proximity_stk3171_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("ps_stk3171 proximity driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -341,29 +341,37 @@ struct sensor_operate psensor_stk3410_ops = {
|
|||
.report = sensor_report_value,
|
||||
};
|
||||
|
||||
static struct sensor_operate *psensor_get_ops(void)
|
||||
static int proximity_stk3410_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *devid)
|
||||
{
|
||||
return &psensor_stk3410_ops;
|
||||
return sensor_register_device(client, NULL, devid, &psensor_stk3410_ops);
|
||||
}
|
||||
|
||||
static int __init psensor_stk3410_init(void)
|
||||
static int proximity_stk3410_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = psensor_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
|
||||
result = sensor_register_slave(type, NULL, NULL, psensor_get_ops);
|
||||
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &psensor_stk3410_ops);
|
||||
}
|
||||
|
||||
static void __exit psensor_stk3410_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = psensor_get_ops();
|
||||
int type = ops->type;
|
||||
static const struct i2c_device_id proximity_stk3410_id[] = {
|
||||
{"ps_stk3410", PROXIMITY_ID_STK3410},
|
||||
{}
|
||||
};
|
||||
|
||||
sensor_unregister_slave(type, NULL, NULL, psensor_get_ops);
|
||||
}
|
||||
static struct i2c_driver proximity_stk3410_driver = {
|
||||
.probe = proximity_stk3410_probe,
|
||||
.remove = proximity_stk3410_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = proximity_stk3410_id,
|
||||
.driver = {
|
||||
.name = "proximity_stk3410",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(psensor_stk3410_init);
|
||||
module_exit(psensor_stk3410_exit);
|
||||
module_i2c_driver(proximity_stk3410_driver);
|
||||
|
||||
MODULE_AUTHOR("Bin Yang <yangbin@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("stk3410 proximity driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -590,6 +590,18 @@ error:
|
|||
return result;
|
||||
}
|
||||
|
||||
void sensor_shutdown(struct i2c_client *client)
|
||||
{
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
struct sensor_private_data *sensor =
|
||||
(struct sensor_private_data *) i2c_get_clientdata(client);
|
||||
|
||||
if ((sensor->ops->suspend) && (sensor->ops->resume))
|
||||
unregister_early_suspend(&sensor->early_suspend);
|
||||
#endif
|
||||
}
|
||||
EXPORT_SYMBOL(sensor_shutdown);
|
||||
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
static void sensor_suspend(struct early_suspend *h)
|
||||
{
|
||||
|
|
@ -633,9 +645,10 @@ static int __maybe_unused sensor_of_resume(struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops sensor_pm_ops = {
|
||||
const struct dev_pm_ops sensor_pm_ops = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(sensor_of_suspend, sensor_of_resume)
|
||||
};
|
||||
EXPORT_SYMBOL(sensor_pm_ops);
|
||||
|
||||
#define SENSOR_PM_OPS (&sensor_pm_ops)
|
||||
#else
|
||||
|
|
@ -1559,42 +1572,6 @@ error:
|
|||
return result;
|
||||
}
|
||||
|
||||
int sensor_register_slave(int type, struct i2c_client *client,
|
||||
struct sensor_platform_data *slave_pdata,
|
||||
struct sensor_operate *(*get_sensor_ops)(void))
|
||||
{
|
||||
int result = 0;
|
||||
struct sensor_operate *ops = get_sensor_ops();
|
||||
|
||||
if ((ops->id_i2c >= SENSOR_NUM_ID) || (ops->id_i2c <= ID_INVALID)) {
|
||||
printk(KERN_ERR "%s:%s id is error %d\n", __func__, ops->name, ops->id_i2c);
|
||||
return -1;
|
||||
}
|
||||
sensor_ops[ops->id_i2c] = ops;
|
||||
sensor_probe_times[ops->id_i2c] = 0;
|
||||
|
||||
printk(KERN_INFO "%s:%s,id=%d\n", __func__, sensor_ops[ops->id_i2c]->name, ops->id_i2c);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
int sensor_unregister_slave(int type, struct i2c_client *client,
|
||||
struct sensor_platform_data *slave_pdata,
|
||||
struct sensor_operate *(*get_sensor_ops)(void))
|
||||
{
|
||||
int result = 0;
|
||||
struct sensor_operate *ops = get_sensor_ops();
|
||||
|
||||
if ((ops->id_i2c >= SENSOR_NUM_ID) || (ops->id_i2c <= ID_INVALID)) {
|
||||
printk(KERN_ERR "%s:%s id is error %d\n", __func__, ops->name, ops->id_i2c);
|
||||
return -1;
|
||||
}
|
||||
printk(KERN_INFO "%s:%s,id=%d\n", __func__, sensor_ops[ops->id_i2c]->name, ops->id_i2c);
|
||||
sensor_ops[ops->id_i2c] = NULL;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int sensor_probe(struct i2c_client *client, const struct i2c_device_id *devid)
|
||||
{
|
||||
struct sensor_private_data *sensor;
|
||||
|
|
@ -1971,17 +1948,6 @@ out_no_free:
|
|||
return result;
|
||||
}
|
||||
|
||||
static void sensor_shut_down(struct i2c_client *client)
|
||||
{
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
struct sensor_private_data *sensor =
|
||||
(struct sensor_private_data *) i2c_get_clientdata(client);
|
||||
|
||||
if ((sensor->ops->suspend) && (sensor->ops->resume))
|
||||
unregister_early_suspend(&sensor->early_suspend);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int sensor_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_private_data *sensor =
|
||||
|
|
@ -1998,149 +1964,77 @@ static int sensor_remove(struct i2c_client *client)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct i2c_device_id sensor_id[] = {
|
||||
/*angle*/
|
||||
{"angle_kxtik", ANGLE_ID_KXTIK},
|
||||
{"angle_lis3dh", ANGLE_ID_LIS3DH},
|
||||
/*gsensor*/
|
||||
{"gsensor", ACCEL_ID_ALL},
|
||||
{"gs_mma8452", ACCEL_ID_MMA845X},
|
||||
{"gs_kxtik", ACCEL_ID_KXTIK},
|
||||
{"gs_kxtj9", ACCEL_ID_KXTJ9},
|
||||
{"gs_lis3dh", ACCEL_ID_LIS3DH},
|
||||
{"gs_mma7660", ACCEL_ID_MMA7660},
|
||||
{"gs_mxc6225", ACCEL_ID_MXC6225},
|
||||
{"gs_mxc6655xa", ACCEL_ID_MXC6655XA},
|
||||
{"gs_dmard10", ACCEL_ID_DMARD10},
|
||||
{"gs_lsm303d", ACCEL_ID_LSM303D},
|
||||
{"gs_sc7660", ACCEL_ID_SC7660},
|
||||
{"gs_sc7a20", ACCEL_ID_SC7A20},
|
||||
{"gs_sc7a30",ACCEL_ID_SC7A30},
|
||||
{"gs_mc3230", ACCEL_ID_MC3230},
|
||||
{"mpu6880_acc", ACCEL_ID_MPU6880},
|
||||
{"mpu6500_acc", ACCEL_ID_MPU6500},
|
||||
{"lsm330_acc", ACCEL_ID_LSM330},
|
||||
{"bma2xx_acc", ACCEL_ID_BMA2XX},
|
||||
{"gs_stk8baxx", ACCEL_ID_STK8BAXX},
|
||||
{"gs_da223", ACCEL_ID_MIR3DA},
|
||||
/*compass*/
|
||||
{"compass", COMPASS_ID_ALL},
|
||||
{"ak8975", COMPASS_ID_AK8975},
|
||||
{"ak8963", COMPASS_ID_AK8963},
|
||||
{"ak09911", COMPASS_ID_AK09911},
|
||||
{"mmc314x", COMPASS_ID_MMC314X},
|
||||
/*gyroscope*/
|
||||
{"gyro", GYRO_ID_ALL},
|
||||
{"l3g4200d_gyro", GYRO_ID_L3G4200D},
|
||||
{"l3g20d_gyro", GYRO_ID_L3G20D},
|
||||
{"ewtsa_gyro", GYRO_ID_EWTSA},
|
||||
{"k3g", GYRO_ID_K3G},
|
||||
{"mpu6500_gyro", GYRO_ID_MPU6500},
|
||||
{"mpu6880_gyro", GYRO_ID_MPU6880},
|
||||
{"lsm330_gyro", GYRO_ID_LSM330},
|
||||
/*light sensor*/
|
||||
{"lightsensor", LIGHT_ID_ALL},
|
||||
{"light_cm3217", LIGHT_ID_CM3217},
|
||||
{"light_cm3218", LIGHT_ID_CM3218},
|
||||
{"light_cm3232", LIGHT_ID_CM3232},
|
||||
{"light_al3006", LIGHT_ID_AL3006},
|
||||
{"ls_stk3171", LIGHT_ID_STK3171},
|
||||
{"ls_isl29023", LIGHT_ID_ISL29023},
|
||||
{"ls_ap321xx", LIGHT_ID_AP321XX},
|
||||
{"ls_photoresistor", LIGHT_ID_PHOTORESISTOR},
|
||||
{"ls_us5152", LIGHT_ID_US5152},
|
||||
{"ls_stk3410", LIGHT_ID_STK3410},
|
||||
/*proximity sensor*/
|
||||
{"psensor", PROXIMITY_ID_ALL},
|
||||
{"proximity_al3006", PROXIMITY_ID_AL3006},
|
||||
{"ps_stk3171", PROXIMITY_ID_STK3171},
|
||||
{"ps_ap321xx", PROXIMITY_ID_AP321XX},
|
||||
{"ps_stk3410", PROXIMITY_ID_STK3410},
|
||||
/*temperature*/
|
||||
{"temperature", TEMPERATURE_ID_ALL},
|
||||
{"tmp_ms5607", TEMPERATURE_ID_MS5607},
|
||||
int sensor_register_device(struct i2c_client *client,
|
||||
struct sensor_platform_data *slave_pdata,
|
||||
const struct i2c_device_id *devid,
|
||||
struct sensor_operate *ops)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
/*pressure*/
|
||||
{"pressure", PRESSURE_ID_ALL},
|
||||
{"pr_ms5607", PRESSURE_ID_MS5607},
|
||||
if (!client || !ops) {
|
||||
dev_err(&client->dev, "%s: no device or ops.\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
{},
|
||||
};
|
||||
if ((ops->id_i2c >= SENSOR_NUM_ID) || (ops->id_i2c <= ID_INVALID) ||
|
||||
(((int)devid->driver_data) != ops->id_i2c)) {
|
||||
dev_err(&client->dev, "%s: %s id is error %d\n",
|
||||
__func__, ops->name, ops->id_i2c);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static struct of_device_id sensor_dt_ids[] = {
|
||||
/*gsensor*/
|
||||
{ .compatible = "gs_mma8452" },
|
||||
{ .compatible = "gs_lis3dh" },
|
||||
{ .compatible = "gs_lsm303d" },
|
||||
{ .compatible = "gs_mma7660" },
|
||||
{ .compatible = "gs_mxc6225" },
|
||||
{ .compatible = "gs_mc3230" },
|
||||
{ .compatible = "gs_sc7a30" },
|
||||
{ .compatible = "lsm330_acc" },
|
||||
{ .compatible = "bma2xx_acc" },
|
||||
{ .compatible = "gs_stk8baxx" },
|
||||
{ .compatible = "gs_mxc6655xa"},
|
||||
sensor_ops[ops->id_i2c] = ops;
|
||||
dev_info(&client->dev, "%s: %s, id = %d\n",
|
||||
__func__, sensor_ops[ops->id_i2c]->name, ops->id_i2c);
|
||||
|
||||
/*compass*/
|
||||
{ .compatible = "ak8975" },
|
||||
{ .compatible = "ak8963" },
|
||||
{ .compatible = "ak09911" },
|
||||
{ .compatible = "mmc314x" },
|
||||
sensor_probe(client, devid);
|
||||
|
||||
/* gyroscop*/
|
||||
{ .compatible = "l3g4200d_gyro" },
|
||||
{ .compatible = "l3g20d_gyro" },
|
||||
{ .compatible = "ewtsa_gyro" },
|
||||
{ .compatible = "k3g" },
|
||||
{ .compatible = "lsm330_gyro" },
|
||||
return result;
|
||||
}
|
||||
EXPORT_SYMBOL(sensor_register_device);
|
||||
|
||||
/*light sensor*/
|
||||
{ .compatible = "light_cm3217" },
|
||||
{ .compatible = "light_cm3232" },
|
||||
{ .compatible = "light_al3006" },
|
||||
{ .compatible = "ls_stk3171" },
|
||||
{ .compatible = "ls_ap321xx" },
|
||||
int sensor_unregister_device(struct i2c_client *client,
|
||||
struct sensor_platform_data *slave_pdata,
|
||||
struct sensor_operate *ops)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
{ .compatible = "ls_photoresistor" },
|
||||
{ .compatible = "ls_us5152" },
|
||||
{ .compatible = "ls_stk3410" },
|
||||
{ .compatible = "ps_stk3410" },
|
||||
if (!client || !ops) {
|
||||
dev_err(&client->dev, "%s: no device or ops.\n", __func__);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/*temperature sensor*/
|
||||
{ .compatible = "tmp_ms5607" },
|
||||
if ((ops->id_i2c >= SENSOR_NUM_ID) || (ops->id_i2c <= ID_INVALID)) {
|
||||
dev_err(&client->dev, "%s: %s id is error %d\n",
|
||||
__func__, ops->name, ops->id_i2c);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*pressure sensor*/
|
||||
{ .compatible = "pr_ms5607" },
|
||||
sensor_remove(client);
|
||||
|
||||
/*hall sensor*/
|
||||
{ .compatible = "hall_och165t" },
|
||||
{ }
|
||||
};
|
||||
dev_info(&client->dev, "%s: %s, id = %d\n",
|
||||
__func__, sensor_ops[ops->id_i2c]->name, ops->id_i2c);
|
||||
sensor_ops[ops->id_i2c] = NULL;
|
||||
|
||||
static struct i2c_driver sensor_driver = {
|
||||
.probe = sensor_probe,
|
||||
.remove = sensor_remove,
|
||||
.shutdown = sensor_shut_down,
|
||||
.id_table = sensor_id,
|
||||
.driver = {
|
||||
.name = "sensors",
|
||||
.of_match_table = of_match_ptr(sensor_dt_ids),
|
||||
.pm = SENSOR_PM_OPS,
|
||||
},
|
||||
};
|
||||
return result;
|
||||
}
|
||||
EXPORT_SYMBOL(sensor_unregister_device);
|
||||
|
||||
static int __init sensor_init(void)
|
||||
{
|
||||
sensor_class_init();
|
||||
return i2c_add_driver(&sensor_driver);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit sensor_exit(void)
|
||||
{
|
||||
i2c_del_driver(&sensor_driver);
|
||||
class_remove_file(sensor_class, &class_attr_gyro_calibration);
|
||||
class_remove_file(sensor_class, &class_attr_accel_calibration);
|
||||
class_destroy(sensor_class);
|
||||
}
|
||||
|
||||
late_initcall(sensor_init);
|
||||
module_init(sensor_init);
|
||||
module_exit(sensor_exit);
|
||||
|
||||
MODULE_AUTHOR("ROCKCHIP Corporation:lw@rock-chips.com");
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
#
|
||||
|
||||
menuconfig TEMPERATURE_DEVICE
|
||||
bool "temperature sensor device support"
|
||||
tristate "temperature sensor device support"
|
||||
default n
|
||||
|
||||
if TEMPERATURE_DEVICE
|
||||
config TMP_MS5607
|
||||
bool "temperature sensor ms5607"
|
||||
default n
|
||||
tristate"temperature sensor ms5607"
|
||||
default n
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -279,31 +279,36 @@ struct sensor_operate temperature_ms5607_ops = {
|
|||
};
|
||||
|
||||
/****************operate according to sensor chip:end************/
|
||||
|
||||
//function name should not be changed
|
||||
static struct sensor_operate *temperature_get_ops(void)
|
||||
static int temperature_ms5607_probe(struct i2c_client *client, const struct i2c_device_id *devid)
|
||||
{
|
||||
return &temperature_ms5607_ops;
|
||||
return sensor_register_device(client, NULL, devid, &temperature_ms5607_ops);
|
||||
}
|
||||
|
||||
|
||||
static int __init temperature_ms5607_init(void)
|
||||
static int temperature_ms5607_remove(struct i2c_client *client)
|
||||
{
|
||||
struct sensor_operate *ops = temperature_get_ops();
|
||||
int result = 0;
|
||||
int type = ops->type;
|
||||
result = sensor_register_slave(type, NULL, NULL, temperature_get_ops);
|
||||
return result;
|
||||
return sensor_unregister_device(client, NULL, &temperature_ms5607_ops);
|
||||
}
|
||||
|
||||
static void __exit temperature_ms5607_exit(void)
|
||||
{
|
||||
struct sensor_operate *ops = temperature_get_ops();
|
||||
int type = ops->type;
|
||||
sensor_unregister_slave(type, NULL, NULL, temperature_get_ops);
|
||||
}
|
||||
static const struct i2c_device_id temperature_ms5607_id[] = {
|
||||
{"tmp_ms5607", TEMPERATURE_ID_MS5607},
|
||||
{}
|
||||
};
|
||||
|
||||
static struct i2c_driver temperature_ms5607_driver = {
|
||||
.probe = temperature_ms5607_probe,
|
||||
.remove = temperature_ms5607_remove,
|
||||
.shutdown = sensor_shutdown,
|
||||
.id_table = temperature_ms5607_id,
|
||||
.driver = {
|
||||
.name = "temperature_ms5607",
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &sensor_pm_ops,
|
||||
#endif
|
||||
},
|
||||
};
|
||||
|
||||
module_init(temperature_ms5607_init);
|
||||
module_exit(temperature_ms5607_exit);
|
||||
module_i2c_driver(temperature_ms5607_driver);
|
||||
|
||||
MODULE_AUTHOR("luowei <lw@rock-chips.com>");
|
||||
MODULE_DESCRIPTION("ms5607 temperature driver");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -240,14 +240,18 @@ struct akm_platform_data {
|
|||
int gpio_RST;
|
||||
};
|
||||
|
||||
extern int sensor_register_slave(int type, struct i2c_client *client,
|
||||
extern int sensor_register_device(struct i2c_client *client,
|
||||
struct sensor_platform_data *slave_pdata,
|
||||
struct sensor_operate *(*get_sensor_ops)(void));
|
||||
const struct i2c_device_id *devid,
|
||||
struct sensor_operate *ops);
|
||||
|
||||
|
||||
extern int sensor_unregister_slave(int type, struct i2c_client *client,
|
||||
extern int sensor_unregister_device(struct i2c_client *client,
|
||||
struct sensor_platform_data *slave_pdata,
|
||||
struct sensor_operate *(*get_sensor_ops)(void));
|
||||
struct sensor_operate *ops);
|
||||
|
||||
extern void sensor_shutdown(struct i2c_client *client);
|
||||
extern const struct dev_pm_ops sensor_pm_ops;
|
||||
|
||||
#define DBG(x...)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue