You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
120 lines
3.2 KiB
120 lines
3.2 KiB
3 years ago
|
/*
|
||
|
* Copyright (C) 2012, Samsung Electronics Co. Ltd. All Rights Reserved.
|
||
|
*
|
||
|
* This program is free software; you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU General Public License as published by
|
||
|
* the Free Software Foundation; either version 2 of the License, or
|
||
|
* (at your option) any later version.
|
||
|
*
|
||
|
* This program is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU General Public License for more details.
|
||
|
*
|
||
|
*/
|
||
|
#ifndef __ADSP_SENSOR_H__
|
||
|
#define __ADSP_SENSOR_H__
|
||
|
|
||
|
#include <linux/kernel.h>
|
||
|
#include <linux/module.h>
|
||
|
#include <linux/device.h>
|
||
|
#include <linux/delay.h>
|
||
|
#include <linux/fs.h>
|
||
|
#include <linux/file.h>
|
||
|
#include <linux/fcntl.h>
|
||
|
#include <linux/mm.h>
|
||
|
#include <linux/slab.h>
|
||
|
#include <linux/uaccess.h>
|
||
|
//#include <linux/sensors.h>
|
||
|
#include <linux/adsp/adsp_ft_common.h>
|
||
|
|
||
|
#define TIMEOUT_CNT 200
|
||
|
|
||
|
#define PATH_LEN 50
|
||
|
#define FILE_BUF_LEN 110
|
||
|
#define ID_INDEX_NUMS 2
|
||
|
#define RETRY_MAX 3
|
||
|
#define VERSION_FILE_NAME_LEN 20
|
||
|
|
||
|
enum {
|
||
|
D_FACTOR,
|
||
|
R_COEF,
|
||
|
G_COEF,
|
||
|
B_COEF,
|
||
|
C_COEF,
|
||
|
CT_COEF,
|
||
|
CT_OFFSET,
|
||
|
THD_HIGH,
|
||
|
THD_LOW,
|
||
|
IRIS_PROX_THD,
|
||
|
SUM_CRC,
|
||
|
EFS_SAVE_NUMS,
|
||
|
};
|
||
|
|
||
|
enum {
|
||
|
ID_UTYPE,
|
||
|
ID_BLACK,
|
||
|
ID_WHITE,
|
||
|
ID_GOLD,
|
||
|
ID_SILVER,
|
||
|
ID_GREEN,
|
||
|
ID_BLUE,
|
||
|
ID_PINKGOLD,
|
||
|
ID_MAX,
|
||
|
};
|
||
|
|
||
|
/* Main struct containing all the data */
|
||
|
struct adsp_data {
|
||
|
struct device *adsp;
|
||
|
struct device *sensor_device[MSG_SENSOR_MAX];
|
||
|
struct device_attribute **sensor_attr[MSG_SENSOR_MAX];
|
||
|
struct device *mobeam_device;
|
||
|
struct sock *adsp_skt;
|
||
|
int32_t *msg_buf[MSG_SENSOR_MAX];
|
||
|
unsigned int ready_flag[MSG_TYPE_MAX];
|
||
|
bool sysfs_created[MSG_SENSOR_MAX];
|
||
|
struct mutex prox_factory_mutex;
|
||
|
struct mutex light_factory_mutex;
|
||
|
struct mutex accel_factory_mutex;
|
||
|
struct mutex flip_cover_factory_mutex;
|
||
|
struct mutex remove_sysfs_mutex;
|
||
|
|
||
|
#ifdef CONFIG_SUPPORT_LIGHT_READ_UBID
|
||
|
struct delayed_work light_work;
|
||
|
#endif
|
||
|
};
|
||
|
|
||
|
#ifdef CONFIG_SUPPORT_MOBEAM
|
||
|
void adsp_mobeam_register(struct device_attribute *attributes[]);
|
||
|
void adsp_mobeam_unregister(struct device_attribute *attributes[]);
|
||
|
#endif
|
||
|
#ifdef CONFIG_SEC_FACTORY
|
||
|
int get_mag_raw_data(int32_t *raw_data);
|
||
|
#endif
|
||
|
int get_accel_raw_data(int32_t *raw_data);
|
||
|
int get_prox_raw_data(int *raw_data, int *offset);
|
||
|
int adsp_get_sensor_data(int sensor_type);
|
||
|
int adsp_factory_register(unsigned int type,
|
||
|
struct device_attribute *attributes[]);
|
||
|
int adsp_factory_unregister(unsigned int type);
|
||
|
int adsp_unicast(void *param, int param_size, u16 sensor_type,
|
||
|
u32 portid, u16 msg_type);
|
||
|
int sensors_register(struct device **dev, void *drvdata,
|
||
|
struct device_attribute *attributes[], char *name);
|
||
|
void sensors_unregister(struct device *dev,
|
||
|
struct device_attribute *attributes[]);
|
||
|
void hidden_hole_init_work(void);
|
||
|
void accel_factory_init_work(void);
|
||
|
void prox_factory_init_work(void);
|
||
|
#ifdef CONFIG_SUPPORT_LIGHT_READ_UBID
|
||
|
void light_ub_read_init_work(struct adsp_data *data);
|
||
|
void light_ub_read_work_func(struct work_struct *work);
|
||
|
#endif
|
||
|
#ifdef CONFIG_GP2AP110S_FACTORY
|
||
|
void prox_gp2ap110s_init_settings(struct adsp_data *data);
|
||
|
#endif
|
||
|
#ifdef CONFIG_SUPPORT_PROX_DUALIZATION
|
||
|
void prox_set_name_vendor(int32_t buf);
|
||
|
#endif
|
||
|
#endif
|