mirror of
https://github.com/revyos/thead-kernel.git
synced 2026-06-21 09:12:26 +02:00
sync: huiwei: 6e3001aa0c625f07407a414e0d5e0e8e10dcded6
merge into 0e30013865202a00d2117a2e7ee4a15eddac6ea6
This commit is contained in:
@@ -9,14 +9,14 @@
|
||||
|
||||
&lightsound {
|
||||
status = "okay";
|
||||
simple-audio-card,dai-link@0 { /* I2S - HDMI*/
|
||||
simple-audio-card,dai-link@0 { /* I2S - AUDIO SYS CODEC 8388*/
|
||||
reg = <0>;
|
||||
format = "i2s";
|
||||
cpu {
|
||||
sound-dai = <&light_i2s 1>;
|
||||
sound-dai = <&i2s1 0>;
|
||||
};
|
||||
codec {
|
||||
sound-dai = <&dummy_codec>;
|
||||
sound-dai = <&es8388_audio_codec>;
|
||||
};
|
||||
};
|
||||
simple-audio-card,dai-link@1 { /* I2S - AUDIO SYS CODEC 7210*/
|
||||
@@ -29,14 +29,14 @@
|
||||
sound-dai = <&es7210_audio_codec>;
|
||||
};
|
||||
};
|
||||
simple-audio-card,dai-link@2 { /* I2S - AUDIO SYS CODEC 8388*/
|
||||
simple-audio-card,dai-link@2 { /* I2S - AUDIO SYS CODEC HDMI*/
|
||||
reg = <2>;
|
||||
format = "i2s";
|
||||
cpu {
|
||||
sound-dai = <&i2s1 0>;
|
||||
sound-dai = <&light_i2s 1>;
|
||||
};
|
||||
codec {
|
||||
sound-dai = <&es8388_audio_codec>;
|
||||
sound-dai = <&dummy_codec>;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -385,7 +385,7 @@
|
||||
|
||||
gpio-keys {
|
||||
compatible = "gpio-keys";
|
||||
pinctrl-0 = <&pinctrl_volume &pinctrl_sleep>;
|
||||
pinctrl-0 = <&pinctrl_volume &pinctrl_pw>;
|
||||
pinctrl-names = "default";
|
||||
key-volumedown {
|
||||
label = "Volume Down Key";
|
||||
@@ -400,12 +400,12 @@
|
||||
gpios = <&gpio2_porta 25 0x1>;
|
||||
};
|
||||
|
||||
key-wake {
|
||||
label = "Wake Key";
|
||||
kkey-pw{
|
||||
label = "power Key";
|
||||
wakeup-source;
|
||||
linux,code = <KEY_WAKEUP>;
|
||||
linux,code = <KEY_POWER>;
|
||||
debounce-interval = <1>;
|
||||
gpios = <&ao_gpio_porta 2 0x1>;
|
||||
gpios = <&ao_gpio_porta 6 0x1>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -877,6 +877,7 @@
|
||||
compatible = "everest,es8388", "everest,es8323";
|
||||
reg = <0x11>;
|
||||
sound-name-prefix = "ES8388";
|
||||
headset-detect = <&rk_headset>;
|
||||
AVDD-supply = <&soc_aud_3v3_en_reg>;
|
||||
DVDD-supply = <&soc_aud_1v8_en_reg>;
|
||||
PVDD-supply = <&soc_aud_1v8_en_reg>;
|
||||
@@ -1451,16 +1452,19 @@
|
||||
thead,pins = < FM_AUDIO_PA30 LIGHT_PIN_FUNC_0 0x000 >;
|
||||
};
|
||||
touchpad_irq_gpio: touchpad-irq-gpio {
|
||||
thead,pins = < FM_CPU_JTG_TDI LIGHT_PIN_FUNC_3 0x20a >;
|
||||
thead,pins = < FM_CPU_JTG_TDI LIGHT_PIN_FUNC_3 0x238 >;
|
||||
};
|
||||
hidkey_irq_gpio: hidkey-irq-gpio {
|
||||
thead,pins = < FM_CPU_JTG_TMS LIGHT_PIN_FUNC_3 0x20a >;
|
||||
thead,pins = < FM_CPU_JTG_TMS LIGHT_PIN_FUNC_3 0x238 >;
|
||||
};
|
||||
pinctrl_audiopa26: audiopa26 {
|
||||
thead,pins = < FM_AOGPIO_15 LIGHT_PIN_FUNC_0 0x000 >;
|
||||
};
|
||||
mh248_irq_gpio: mh248-irq-gpio {
|
||||
thead,pins = < FM_CPU_JTG_TCLK LIGHT_PIN_FUNC_3 0x20a >;
|
||||
thead,pins = < FM_CPU_JTG_TCLK LIGHT_PIN_FUNC_3 0x238 >;
|
||||
};
|
||||
pinctrl_pw: pw{
|
||||
thead,pins = < FM_CPU_JTG_TRST 0x3 0x238>;
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -1669,6 +1673,7 @@
|
||||
reg = <0x15>;
|
||||
hid-descr-addr = <0x20>;
|
||||
hid-support-wakeup;
|
||||
wakeup-source;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1714,6 +1719,7 @@
|
||||
pinctrl-0 = <&touchpad_irq_gpio>;
|
||||
reg = <0x2c>;
|
||||
hid-descr-addr = <0x20>;
|
||||
wakeup-source;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@@ -1175,6 +1175,9 @@ static int i2c_hid_probe(struct i2c_client *client,
|
||||
goto err_mem_free;
|
||||
}
|
||||
|
||||
if (client->dev.of_node && of_property_read_bool(client->dev.of_node, "wakeup-source"))
|
||||
device_init_wakeup(&client->dev, 1);
|
||||
|
||||
return 0;
|
||||
|
||||
err_mem_free:
|
||||
@@ -1198,6 +1201,10 @@ static int i2c_hid_remove(struct i2c_client *client)
|
||||
hid = ihid->hid;
|
||||
hid_destroy_device(hid);
|
||||
|
||||
if (device_may_wakeup(&client->dev))
|
||||
device_init_wakeup(&client->dev, 0);
|
||||
|
||||
|
||||
free_irq(client->irq, ihid);
|
||||
|
||||
if (ihid->bufsize)
|
||||
@@ -1213,6 +1220,9 @@ static void i2c_hid_shutdown(struct i2c_client *client)
|
||||
{
|
||||
struct i2c_hid *ihid = i2c_get_clientdata(client);
|
||||
|
||||
if (device_may_wakeup(&client->dev))
|
||||
device_init_wakeup(&client->dev, 0);
|
||||
|
||||
i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
|
||||
free_irq(client->irq, ihid);
|
||||
|
||||
@@ -1237,7 +1247,7 @@ static int i2c_hid_suspend(struct device *dev)
|
||||
/* Save some power */
|
||||
i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
|
||||
|
||||
disable_irq(client->irq);
|
||||
// disable_irq(client->irq);
|
||||
|
||||
if (device_may_wakeup(&client->dev)) {
|
||||
wake_status = enable_irq_wake(client->irq);
|
||||
@@ -1279,7 +1289,7 @@ static int i2c_hid_resume(struct device *dev)
|
||||
wake_status);
|
||||
}
|
||||
|
||||
enable_irq(client->irq);
|
||||
// enable_irq(client->irq);
|
||||
|
||||
/* Instead of resetting device, simply powers the device on. This
|
||||
* solves "incomplete reports" on Raydium devices 2386:3118 and
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
# hall sensor drivers configuration
|
||||
#
|
||||
|
||||
menuconfig HALL_DEVICE
|
||||
tristate "hall sensor device support"
|
||||
# menuconfig HALL_DEVICE
|
||||
# tristate "hall sensor device support"
|
||||
|
||||
if HALL_DEVICE
|
||||
# if HALL_DEVICE
|
||||
|
||||
config HS_MH248
|
||||
tristate "hall sensor mh248"
|
||||
|
||||
endif
|
||||
# endif
|
||||
|
||||
@@ -70,9 +70,9 @@ static irqreturn_t hall_mh248_interrupt(int irq, void *dev_id)
|
||||
gpio_value = gpio_get_value(mh248->gpio_pin);
|
||||
if ((gpio_value != mh248->active_value) &&
|
||||
(mh248->is_suspend == 0)) {
|
||||
input_report_key(mh248->hall_input, KEY_POWER, 1);
|
||||
input_report_key(mh248->hall_input, KEY_SLEEP, 1);
|
||||
input_sync(mh248->hall_input);
|
||||
input_report_key(mh248->hall_input, KEY_POWER, 0);
|
||||
input_report_key(mh248->hall_input, KEY_SLEEP, 0);
|
||||
input_sync(mh248->hall_input);
|
||||
} else if ((gpio_value == mh248->active_value) &&
|
||||
(mh248->is_suspend == 1)) {
|
||||
@@ -135,7 +135,7 @@ static int hall_mh248_probe(struct platform_device *pdev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
mh248->hall_input->name = "hall wake key";
|
||||
input_set_capability(mh248->hall_input, EV_KEY, KEY_POWER);
|
||||
input_set_capability(mh248->hall_input, EV_KEY, KEY_SLEEP);
|
||||
input_set_capability(mh248->hall_input, EV_KEY, KEY_WAKEUP);
|
||||
|
||||
ret = input_register_device(mh248->hall_input);
|
||||
|
||||
@@ -132,7 +132,7 @@ CONFIG_PNO_SUPPORT = n
|
||||
CONFIG_PNO_SET_DEBUG = n
|
||||
CONFIG_AP_WOWLAN = n
|
||||
######### Notify SDIO Host Keep Power During Syspend ##########
|
||||
CONFIG_RTW_SDIO_PM_KEEP_POWER = y
|
||||
CONFIG_RTW_SDIO_PM_KEEP_POWER = n
|
||||
###################### MP HW TX MODE FOR VHT #######################
|
||||
CONFIG_MP_VHT_HW_TX_MODE = n
|
||||
###################### ROAMING #####################################
|
||||
@@ -1254,11 +1254,11 @@ ifneq ($(CONFIG_WAKEUP_GPIO_IDX), default)
|
||||
EXTRA_CFLAGS += -DWAKEUP_GPIO_IDX=$(CONFIG_WAKEUP_GPIO_IDX)
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RTW_SDIO_PM_KEEP_POWER), y)
|
||||
ifeq ($(CONFIG_SDIO_HCI), y)
|
||||
EXTRA_CFLAGS += -DCONFIG_RTW_SDIO_PM_KEEP_POWER
|
||||
endif
|
||||
endif
|
||||
#ifeq ($(CONFIG_RTW_SDIO_PM_KEEP_POWER), y)
|
||||
#ifeq ($(CONFIG_SDIO_HCI), y)
|
||||
#EXTRA_CFLAGS += -DCONFIG_RTW_SDIO_PM_KEEP_POWER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
ifeq ($(CONFIG_REDUCE_TX_CPU_LOADING), y)
|
||||
EXTRA_CFLAGS += -DCONFIG_REDUCE_TX_CPU_LOADING
|
||||
@@ -1368,6 +1368,7 @@ endif
|
||||
ifeq ($(CONFIG_PLATFORM_I386_PC), y)
|
||||
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
|
||||
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
|
||||
EXTRA_CFLAGS += -DCONFIG_RESUME_IN_WORKQUEUE
|
||||
|
||||
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
|
||||
ARCH ?= $(SUBARCH)
|
||||
|
||||
@@ -199,12 +199,12 @@
|
||||
#endif
|
||||
*/
|
||||
|
||||
#ifdef CONFIG_RESUME_IN_WORKQUEUE /* this can be removed, because there is no case for this... */
|
||||
#if !defined(CONFIG_WAKELOCK) && !defined(CONFIG_ANDROID_POWER)
|
||||
#error "enable CONFIG_RESUME_IN_WORKQUEUE without CONFIG_WAKELOCK or CONFIG_ANDROID_POWER will suffer from the danger of wifi's unfunctionality..."
|
||||
#error "If you still want to enable CONFIG_RESUME_IN_WORKQUEUE in this case, mask this preprossor checking and GOOD LUCK..."
|
||||
#endif
|
||||
#endif
|
||||
//#ifdef CONFIG_RESUME_IN_WORKQUEUE /* this can be removed, because there is no case for this... */
|
||||
// #if !defined(CONFIG_WAKELOCK) && !defined(CONFIG_ANDROID_POWER)
|
||||
// #error "enable CONFIG_RESUME_IN_WORKQUEUE without CONFIG_WAKELOCK or CONFIG_ANDROID_POWER will suffer from the danger of wifi's unfunctionality..."
|
||||
// #error "If you still want to enable CONFIG_RESUME_IN_WORKQUEUE in this case, mask this preprossor checking and GOOD LUCK..."
|
||||
// #endif
|
||||
//#endif
|
||||
|
||||
/* About USB VENDOR REQ */
|
||||
#if defined(CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX)
|
||||
|
||||
18
include/dt-bindings/sensor-dev.h
Normal file
18
include/dt-bindings/sensor-dev.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef __DT_BINDINGS_ROCKCHIP_SENSORDEV_H__
|
||||
#define __DT_BINDINGS_ROCKCHIP_SENSORDEV_H__
|
||||
|
||||
#define SENSOR_TYPE_NULL 0
|
||||
#define SENSOR_TYPE_ANGLE 1
|
||||
#define SENSOR_TYPE_ACCEL 2
|
||||
#define SENSOR_TYPE_COMPASS 3
|
||||
#define SENSOR_TYPE_GYROSCOPE 4
|
||||
#define SENSOR_TYPE_LIGHT 5
|
||||
#define SENSOR_TYPE_PROXIMITY 6
|
||||
#define SENSOR_TYPE_TEMPERATURE 7
|
||||
#define SENSOR_TYPE_PRESSURE 8
|
||||
#define SENSOR_TYPE_HALL 9
|
||||
#define SENSOR_NUM_TYPES 10
|
||||
|
||||
#endif
|
||||
19
include/linux/rk_keys.h
Normal file
19
include/linux/rk_keys.h
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (C) 2016, Fuzhou Rockchip Electronics Co., Ltd
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*/
|
||||
#ifndef _RK_KEYS_H
|
||||
#define _RK_KEYS_H
|
||||
|
||||
#ifdef CONFIG_KEYBOARD_ROCKCHIP
|
||||
void rk_send_power_key(int state);
|
||||
void rk_send_wakeup_key(void);
|
||||
#else
|
||||
static inline void rk_send_power_key(int state) { }
|
||||
static inline void rk_send_wakeup_key(void) { }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
350
include/linux/sensor-dev.h
Normal file
350
include/linux/sensor-dev.h
Normal file
@@ -0,0 +1,350 @@
|
||||
/* include/linux/sensor-dev.h - sensor header file
|
||||
*
|
||||
* Copyright (C) 2012-2015 ROCKCHIP.
|
||||
* Author: luowei <lw@rock-chips.com>
|
||||
*
|
||||
* This software is licensed under the terms of the GNU General Public
|
||||
* License version 2, as published by the Free Software Foundation, and
|
||||
* may be copied, distributed, and modified under those terms.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/miscdevice.h>
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
#include <linux/earlysuspend.h>
|
||||
#endif
|
||||
|
||||
#include <dt-bindings/sensor-dev.h>
|
||||
#include <linux/module.h>
|
||||
|
||||
#define SENSOR_ON 1
|
||||
#define SENSOR_OFF 0
|
||||
#define SENSOR_UNKNOW_DATA -1
|
||||
|
||||
#define GPIO_HIGH 1
|
||||
#define GPIO_LOW 0
|
||||
|
||||
enum sensor_id {
|
||||
ID_INVALID = 0,
|
||||
|
||||
ANGLE_ID_ALL,
|
||||
ANGLE_ID_KXTIK,
|
||||
ANGLE_ID_LIS3DH,
|
||||
|
||||
ACCEL_ID_ALL,
|
||||
ACCEL_ID_LIS331,
|
||||
ACCEL_ID_LSM303DLX,
|
||||
ACCEL_ID_LIS3DH,
|
||||
ACCEL_ID_KXSD9,
|
||||
ACCEL_ID_KXTF9,
|
||||
ACCEL_ID_KXTIK,
|
||||
ACCEL_ID_KXTJ9,
|
||||
ACCEL_ID_BMA150,
|
||||
ACCEL_ID_BMA222,
|
||||
ACCEL_ID_BMA250,
|
||||
ACCEL_ID_ADXL34X,
|
||||
ACCEL_ID_MMA8450,
|
||||
ACCEL_ID_MMA845X,
|
||||
ACCEL_ID_MMA7660,
|
||||
ACCEL_ID_SC7660,
|
||||
ACCEL_ID_SC7A20,
|
||||
ACCEL_ID_SC7A30,
|
||||
ACCEL_ID_MPU6050,
|
||||
ACCEL_ID_MXC6225,
|
||||
ACCEL_ID_MXC6655XA,
|
||||
ACCEL_ID_DMARD10,
|
||||
ACCEL_ID_LSM303D,
|
||||
ACCEL_ID_MC3230,
|
||||
ACCEL_ID_MPU6880,
|
||||
ACCEL_ID_MPU6500,
|
||||
ACCEL_ID_LSM330,
|
||||
ACCEL_ID_BMA2XX,
|
||||
ACCEL_ID_STK8BAXX,
|
||||
ACCEL_ID_MIR3DA,
|
||||
ACCEL_ID_ICM2060X,
|
||||
COMPASS_ID_ALL,
|
||||
COMPASS_ID_AK8975,
|
||||
COMPASS_ID_AK8963,
|
||||
COMPASS_ID_AK09911,
|
||||
COMPASS_ID_AK8972,
|
||||
COMPASS_ID_AMI30X,
|
||||
COMPASS_ID_AMI306,
|
||||
COMPASS_ID_YAS529,
|
||||
COMPASS_ID_YAS530,
|
||||
COMPASS_ID_HMC5883,
|
||||
COMPASS_ID_LSM303DLH,
|
||||
COMPASS_ID_LSM303DLM,
|
||||
COMPASS_ID_MMC314X,
|
||||
COMPASS_ID_HSCDTD002B,
|
||||
COMPASS_ID_HSCDTD004A,
|
||||
COMPASS_ID_AK09918,
|
||||
|
||||
GYRO_ID_ALL,
|
||||
GYRO_ID_L3G4200D,
|
||||
GYRO_ID_L3G20D,
|
||||
GYRO_ID_EWTSA,
|
||||
GYRO_ID_K3G,
|
||||
GYRO_ID_MPU6500,
|
||||
GYRO_ID_MPU6880,
|
||||
GYRO_ID_LSM330,
|
||||
GYRO_ID_ICM2060X,
|
||||
LIGHT_ID_ALL,
|
||||
LIGHT_ID_CM3217,
|
||||
LIGHT_ID_CM3218,
|
||||
LIGHT_ID_CM3232,
|
||||
LIGHT_ID_AL3006,
|
||||
LIGHT_ID_STK3171,
|
||||
LIGHT_ID_ISL29023,
|
||||
LIGHT_ID_AP321XX,
|
||||
LIGHT_ID_PHOTORESISTOR,
|
||||
LIGHT_ID_US5152,
|
||||
LIGHT_ID_STK3410,
|
||||
LIGHT_ID_EM3071X,
|
||||
|
||||
PROXIMITY_ID_ALL,
|
||||
PROXIMITY_ID_AL3006,
|
||||
PROXIMITY_ID_STK3171,
|
||||
PROXIMITY_ID_AP321XX,
|
||||
PROXIMITY_ID_STK3410,
|
||||
PROXIMITY_ID_EM3071X,
|
||||
|
||||
TEMPERATURE_ID_ALL,
|
||||
TEMPERATURE_ID_MS5607,
|
||||
|
||||
PRESSURE_ID_ALL,
|
||||
PRESSURE_ID_BMA085,
|
||||
PRESSURE_ID_MS5607,
|
||||
|
||||
HALL_ID_ALL,
|
||||
HALL_ID_OCH165T,
|
||||
|
||||
SENSOR_NUM_ID,
|
||||
};
|
||||
|
||||
struct sensor_axis {
|
||||
int x;
|
||||
int y;
|
||||
int z;
|
||||
};
|
||||
|
||||
struct sensor_flag {
|
||||
atomic_t a_flag;
|
||||
atomic_t m_flag;
|
||||
atomic_t mv_flag;
|
||||
atomic_t open_flag;
|
||||
atomic_t debug_flag;
|
||||
long long delay;
|
||||
wait_queue_head_t open_wq;
|
||||
};
|
||||
|
||||
|
||||
struct sensor_operate {
|
||||
char *name;
|
||||
int type;
|
||||
int id_i2c;
|
||||
int range[2];
|
||||
int brightness[2];
|
||||
int read_reg;
|
||||
int read_len;
|
||||
int id_reg;
|
||||
int id_data;
|
||||
int precision;
|
||||
int ctrl_reg;
|
||||
int ctrl_data;
|
||||
int int_ctrl_reg;
|
||||
int int_status_reg;
|
||||
int trig;
|
||||
int (*active)(struct i2c_client *client, int enable, int rate);
|
||||
int (*init)(struct i2c_client *client);
|
||||
int (*report)(struct i2c_client *client);
|
||||
int (*suspend)(struct i2c_client *client);
|
||||
int (*resume)(struct i2c_client *client);
|
||||
struct miscdevice *misc_dev;
|
||||
};
|
||||
|
||||
/* Platform data for the sensor */
|
||||
struct sensor_private_data {
|
||||
int type;
|
||||
struct i2c_client *client;
|
||||
struct input_dev *input_dev;
|
||||
int stop_work;
|
||||
struct delayed_work delaywork;
|
||||
struct sensor_axis axis;
|
||||
char sensor_data[40];
|
||||
atomic_t is_factory;
|
||||
wait_queue_head_t is_factory_ok;
|
||||
struct mutex data_mutex;
|
||||
struct mutex operation_mutex;
|
||||
struct mutex sensor_mutex;
|
||||
struct mutex i2c_mutex;
|
||||
int status_cur;
|
||||
int start_count;
|
||||
int devid;
|
||||
struct sensor_flag flags;
|
||||
struct i2c_device_id *i2c_id;
|
||||
struct sensor_platform_data *pdata;
|
||||
struct sensor_operate *ops;
|
||||
struct file_operations fops;
|
||||
struct miscdevice miscdev;
|
||||
#ifdef CONFIG_HAS_EARLYSUSPEND
|
||||
struct early_suspend early_suspend;
|
||||
#endif
|
||||
};
|
||||
|
||||
struct sensor_platform_data {
|
||||
int type;
|
||||
int irq;
|
||||
int irq_pin;
|
||||
int power_pin;
|
||||
int reset_pin;
|
||||
int standby_pin;
|
||||
int irq_enable;
|
||||
int poll_delay_ms;
|
||||
int x_min;
|
||||
int y_min;
|
||||
int z_min;
|
||||
int factory;
|
||||
int layout;
|
||||
unsigned char address;
|
||||
unsigned long irq_flags;
|
||||
signed char orientation[9];
|
||||
short m_layout[4][3][3];
|
||||
int *project_name;
|
||||
int power_off_in_suspend;
|
||||
};
|
||||
|
||||
struct gsensor_platform_data {
|
||||
u16 model;
|
||||
u16 swap_xy;
|
||||
u16 swap_xyz;
|
||||
signed char orientation[9];
|
||||
int (*get_pendown_state)(void);
|
||||
int (*init_platform_hw)(void);
|
||||
int (*gsensor_platform_sleep)(void);
|
||||
int (*gsensor_platform_wakeup)(void);
|
||||
void (*exit_platform_hw)(void);
|
||||
};
|
||||
|
||||
struct akm8975_platform_data {
|
||||
short m_layout[4][3][3];
|
||||
char project_name[64];
|
||||
int gpio_DRDY;
|
||||
};
|
||||
|
||||
struct akm_platform_data {
|
||||
short m_layout[4][3][3];
|
||||
char project_name[64];
|
||||
char layout;
|
||||
char outbit;
|
||||
int gpio_DRDY;
|
||||
int gpio_RST;
|
||||
};
|
||||
|
||||
extern int sensor_register_device(struct i2c_client *client,
|
||||
struct sensor_platform_data *slave_pdata,
|
||||
const struct i2c_device_id *devid,
|
||||
struct sensor_operate *ops);
|
||||
|
||||
|
||||
extern int sensor_unregister_device(struct i2c_client *client,
|
||||
struct sensor_platform_data *slave_pdata,
|
||||
struct sensor_operate *ops);
|
||||
|
||||
extern void sensor_shutdown(struct i2c_client *client);
|
||||
extern const struct dev_pm_ops sensor_pm_ops;
|
||||
|
||||
#define DBG(x...)
|
||||
|
||||
#define GSENSOR_IOCTL_MAGIC 'a'
|
||||
#define GBUFF_SIZE 12 /* Rx buffer size */
|
||||
|
||||
/* IOCTLs for MMA8452 library */
|
||||
#define GSENSOR_IOCTL_INIT _IO(GSENSOR_IOCTL_MAGIC, 0x01)
|
||||
#define GSENSOR_IOCTL_RESET _IO(GSENSOR_IOCTL_MAGIC, 0x04)
|
||||
#define GSENSOR_IOCTL_CLOSE _IO(GSENSOR_IOCTL_MAGIC, 0x02)
|
||||
#define GSENSOR_IOCTL_START _IO(GSENSOR_IOCTL_MAGIC, 0x03)
|
||||
#define GSENSOR_IOCTL_GETDATA _IOR(GSENSOR_IOCTL_MAGIC, 0x08, char[GBUFF_SIZE+1])
|
||||
#define GSENSOR_IOCTL_APP_SET_RATE _IOW(GSENSOR_IOCTL_MAGIC, 0x10, short)
|
||||
#define GSENSOR_IOCTL_GET_CALIBRATION _IOR(GSENSOR_IOCTL_MAGIC, 0x11, int[3])
|
||||
|
||||
|
||||
#define COMPASS_IOCTL_MAGIC 'c'
|
||||
/* IOCTLs for APPs */
|
||||
#define ECS_IOCTL_APP_SET_MODE _IOW(COMPASS_IOCTL_MAGIC, 0x10, short)
|
||||
#define ECS_IOCTL_APP_SET_MFLAG _IOW(COMPASS_IOCTL_MAGIC, 0x11, short)
|
||||
#define ECS_IOCTL_APP_GET_MFLAG _IOW(COMPASS_IOCTL_MAGIC, 0x12, short)
|
||||
#define ECS_IOCTL_APP_SET_AFLAG _IOW(COMPASS_IOCTL_MAGIC, 0x13, short)
|
||||
#define ECS_IOCTL_APP_GET_AFLAG _IOR(COMPASS_IOCTL_MAGIC, 0x14, short)
|
||||
#define ECS_IOCTL_APP_SET_TFLAG _IOR(COMPASS_IOCTL_MAGIC, 0x15, short)/* NOT use */
|
||||
#define ECS_IOCTL_APP_GET_TFLAG _IOR(COMPASS_IOCTL_MAGIC, 0x16, short)/* NOT use */
|
||||
#define ECS_IOCTL_APP_RESET_PEDOMETER _IOW(COMPASS_IOCTL_MAGIC, 0x17) /* NOT use */
|
||||
#define ECS_IOCTL_APP_SET_DELAY _IOW(COMPASS_IOCTL_MAGIC, 0x18, short)
|
||||
#define ECS_IOCTL_APP_SET_MVFLAG _IOW(COMPASS_IOCTL_MAGIC, 0x19, short)
|
||||
#define ECS_IOCTL_APP_GET_MVFLAG _IOR(COMPASS_IOCTL_MAGIC, 0x1A, short)
|
||||
#define ECS_IOCTL_APP_GET_DELAY _IOR(COMPASS_IOCTL_MAGIC, 0x1B, short)
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
#define COMPAT_ECS_IOCTL_APP_SET_MODE _IOW(COMPASS_IOCTL_MAGIC, 0x10, compat_short_t)
|
||||
#define COMPAT_ECS_IOCTL_APP_SET_MFLAG _IOW(COMPASS_IOCTL_MAGIC, 0x11, compat_short_t)
|
||||
#define COMPAT_ECS_IOCTL_APP_GET_MFLAG _IOW(COMPASS_IOCTL_MAGIC, 0x12, compat_short_t)
|
||||
#define COMPAT_ECS_IOCTL_APP_SET_AFLAG _IOW(COMPASS_IOCTL_MAGIC, 0x13, compat_short_t)
|
||||
#define COMPAT_ECS_IOCTL_APP_GET_AFLAG _IOR(COMPASS_IOCTL_MAGIC, 0x14, compat_short_t)
|
||||
#define COMPAT_ECS_IOCTL_APP_SET_TFLAG _IOR(COMPASS_IOCTL_MAGIC, 0x15, compat_short_t)/* NOT use */
|
||||
#define COMPAT_ECS_IOCTL_APP_GET_TFLAG _IOR(COMPASS_IOCTL_MAGIC, 0x16, compat_short_t)/* NOT use */
|
||||
#define COMPAT_ECS_IOCTL_APP_RESET_PEDOMETER _IOW(COMPASS_IOCTL_MAGIC, 0x17) /* NOT use */
|
||||
#define COMPAT_ECS_IOCTL_APP_SET_DELAY _IOW(COMPASS_IOCTL_MAGIC, 0x18, compat_short_t)
|
||||
#define COMPAT_ECS_IOCTL_APP_SET_MVFLAG _IOW(COMPASS_IOCTL_MAGIC, 0x19, compat_short_t)
|
||||
#define COMPAT_ECS_IOCTL_APP_GET_MVFLAG _IOR(COMPASS_IOCTL_MAGIC, 0x1A, compat_short_t)
|
||||
#define COMPAT_ECS_IOCTL_APP_GET_DELAY _IOR(COMPASS_IOCTL_MAGIC, 0x1B, compat_short_t)
|
||||
#endif
|
||||
|
||||
#define LIGHTSENSOR_IOCTL_MAGIC 'l'
|
||||
#define LIGHTSENSOR_IOCTL_GET_ENABLED _IOR(LIGHTSENSOR_IOCTL_MAGIC, 1, int *)
|
||||
#define LIGHTSENSOR_IOCTL_ENABLE _IOW(LIGHTSENSOR_IOCTL_MAGIC, 2, int *)
|
||||
#define LIGHTSENSOR_IOCTL_SET_RATE _IOW(LIGHTSENSOR_IOCTL_MAGIC, 3, short)
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
#define COMPAT_LIGHTSENSOR_IOCTL_GET_ENABLED _IOR(LIGHTSENSOR_IOCTL_MAGIC, 1, compat_uptr_t)
|
||||
#define COMPAT_LIGHTSENSOR_IOCTL_ENABLE _IOW(LIGHTSENSOR_IOCTL_MAGIC, 2, compat_uptr_t)
|
||||
#define COMPAT_LIGHTSENSOR_IOCTL_SET_RATE _IOW(LIGHTSENSOR_IOCTL_MAGIC, 3, compat_short_t)
|
||||
#endif
|
||||
|
||||
#define PSENSOR_IOCTL_MAGIC 'p'
|
||||
#define PSENSOR_IOCTL_GET_ENABLED _IOR(PSENSOR_IOCTL_MAGIC, 1, int *)
|
||||
#define PSENSOR_IOCTL_ENABLE _IOW(PSENSOR_IOCTL_MAGIC, 2, int *)
|
||||
#define PSENSOR_IOCTL_DISABLE _IOW(PSENSOR_IOCTL_MAGIC, 3, int *)
|
||||
|
||||
#ifdef CONFIG_COMPAT
|
||||
#define COMPAT_PSENSOR_IOCTL_GET_ENABLED _IOR(PSENSOR_IOCTL_MAGIC, 1, compat_uptr_t)
|
||||
#define COMPAT_PSENSOR_IOCTL_ENABLE _IOW(PSENSOR_IOCTL_MAGIC, 2, compat_uptr_t)
|
||||
#define COMPAT_PSENSOR_IOCTL_DISABLE _IOW(PSENSOR_IOCTL_MAGIC, 3, compat_uptr_t)
|
||||
#endif
|
||||
|
||||
#define PRESSURE_IOCTL_MAGIC 'r'
|
||||
#define PRESSURE_IOCTL_GET_ENABLED _IOR(PRESSURE_IOCTL_MAGIC, 1, int *)
|
||||
#define PRESSURE_IOCTL_ENABLE _IOW(PRESSURE_IOCTL_MAGIC, 2, int *)
|
||||
#define PRESSURE_IOCTL_DISABLE _IOW(PRESSURE_IOCTL_MAGIC, 3, int *)
|
||||
#define PRESSURE_IOCTL_SET_DELAY _IOW(PRESSURE_IOCTL_MAGIC, 4, int *)
|
||||
|
||||
|
||||
#define TEMPERATURE_IOCTL_MAGIC 't'
|
||||
#define TEMPERATURE_IOCTL_GET_ENABLED _IOR(TEMPERATURE_IOCTL_MAGIC, 1, int *)
|
||||
#define TEMPERATURE_IOCTL_ENABLE _IOW(TEMPERATURE_IOCTL_MAGIC, 2, int *)
|
||||
#define TEMPERATURE_IOCTL_DISABLE _IOW(TEMPERATURE_IOCTL_MAGIC, 3, int *)
|
||||
#define TEMPERATURE_IOCTL_SET_DELAY _IOW(TEMPERATURE_IOCTL_MAGIC, 4, int *)
|
||||
|
||||
|
||||
extern int sensor_rx_data(struct i2c_client *client, char *rxData, int length);
|
||||
extern int sensor_tx_data(struct i2c_client *client, char *txData, int length);
|
||||
extern int sensor_write_reg(struct i2c_client *client, int addr, int value);
|
||||
extern int sensor_read_reg(struct i2c_client *client, int addr);
|
||||
extern int sensor_tx_data_normal(struct i2c_client *client, char *buf, int num);
|
||||
extern int sensor_rx_data_normal(struct i2c_client *client, char *buf, int num);
|
||||
extern int sensor_write_reg_normal(struct i2c_client *client, char value);
|
||||
extern int sensor_read_reg_normal(struct i2c_client *client);
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/of_gpio.h>
|
||||
#include <linux/rk_headset.h>
|
||||
#include <linux/extcon-provider.h>
|
||||
|
||||
#include "es8323.h"
|
||||
|
||||
@@ -60,6 +61,7 @@ extern int es7243_start(void);
|
||||
// #ifdef CONFIG_RK_HEADSET
|
||||
// extern int rk_headset_get_headset(void);
|
||||
// #endif
|
||||
struct es8323_priv *g_es8323 = NULL;
|
||||
|
||||
#define NR_SUPPORTED_MCLK_LRCK_RATIOS 5
|
||||
static const unsigned int supported_mclk_lrck_ratios[NR_SUPPORTED_MCLK_LRCK_RATIOS] = {
|
||||
@@ -151,6 +153,33 @@ static int es8323_codec_ctl_gpio(struct es8323_priv *es8323,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int es8323_headset_switch(struct notifier_block *nb,
|
||||
unsigned long event, void *ptr) {
|
||||
struct extcon_dev *edev = (struct extcon_dev *)ptr;
|
||||
bool hp_in;
|
||||
DBG("enter :%s \n", __func__);
|
||||
if (g_es8323 == NULL || edev == NULL) {
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
hp_in = extcon_get_state(edev, EXTCON_JACK_HEADPHONE);
|
||||
|
||||
if (hp_in) {
|
||||
snd_soc_component_write(g_es8323->component, ES8323_ADCCONTROL2, 0x00);
|
||||
es8323_codec_ctl_gpio(g_es8323, CODEC_SET_SPK, 0);
|
||||
es8323_codec_ctl_gpio(g_es8323, CODEC_SET_HP, 1);
|
||||
} else {
|
||||
snd_soc_component_write(g_es8323->component, ES8323_ADCCONTROL2, 0x50);
|
||||
es8323_codec_ctl_gpio(g_es8323, CODEC_SET_SPK, 1);
|
||||
es8323_codec_ctl_gpio(g_es8323, CODEC_SET_HP, 0);
|
||||
}
|
||||
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static struct notifier_block es8323_headset_nb = {
|
||||
.notifier_call = es8323_headset_switch,
|
||||
};
|
||||
|
||||
/* ----------------------------------------------------------------- */
|
||||
/**
|
||||
* sysfs
|
||||
@@ -744,10 +773,10 @@ static int es8323_pcm_startup(struct snd_pcm_substream *substream,
|
||||
#ifdef CONFIG_RK_HEADSET
|
||||
if(!rk_headset_get_headset()) {
|
||||
DBG("headset out, select lin2\n");
|
||||
snd_soc_component_write(component, ES8323_DACCONTROL16, 0x09);
|
||||
snd_soc_component_write(component, ES8323_ADCCONTROL2, 0x50);
|
||||
} else {
|
||||
DBG("headset out, select lin1\n");
|
||||
snd_soc_component_write(component, ES8323_DACCONTROL16, 0x00);
|
||||
DBG("headset in, select lin1\n");
|
||||
snd_soc_component_write(component, ES8323_ADCCONTROL2, 0x00);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
@@ -1012,6 +1041,25 @@ static int es8323_probe(struct snd_soc_component *component)
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct device_node *headset_det_node = of_parse_phandle(es8323->np, "headset-detect", 0);
|
||||
if (headset_det_node) {
|
||||
struct extcon_dev *extcon = extcon_find_edev_by_node(headset_det_node);
|
||||
of_node_put(headset_det_node);
|
||||
if (!IS_ERR(extcon)) {
|
||||
ret = extcon_register_notifier(extcon, EXTCON_JACK_HEADPHONE,&es8323_headset_nb);
|
||||
if (ret) {
|
||||
dev_err(component->dev, "Failed to register notifier for headset-detection\n");
|
||||
}
|
||||
}else {
|
||||
if (PTR_ERR(extcon) == -EPROBE_DEFER)
|
||||
return -EPROBE_DEFER;
|
||||
dev_err(component->dev, "Failed to get extcon device for headset-detection\n");
|
||||
return PTR_ERR(extcon);
|
||||
}
|
||||
}else {
|
||||
dev_warn(component->dev, "headset-detect phandle not specified in DTS\n");
|
||||
}
|
||||
|
||||
snd_soc_component_write(component, 0x01, 0x60);
|
||||
snd_soc_component_write(component, 0x02, 0xF3);
|
||||
snd_soc_component_write(component, 0x02, 0xF0);
|
||||
@@ -1052,12 +1100,20 @@ static int es8323_probe(struct snd_soc_component *component)
|
||||
snd_soc_component_write(component, 0x04, 0x3C);
|
||||
|
||||
es8323_set_bias_level(component, SND_SOC_BIAS_STANDBY);
|
||||
g_es8323 = es8323;
|
||||
DBG("%s : successfully !\n",__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void es8323_remove(struct snd_soc_component *component)
|
||||
{
|
||||
es8323_set_bias_level(component, SND_SOC_BIAS_OFF);
|
||||
struct extcon_dev *extcon = extcon_get_edev_by_phandle(component->dev, 0);
|
||||
if (!IS_ERR(extcon)) {
|
||||
extcon_unregister_notifier(extcon, EXTCON_JACK_HEADPHONE,
|
||||
&es8323_headset_nb);
|
||||
}
|
||||
g_es8323 = NULL;
|
||||
}
|
||||
|
||||
static const struct snd_soc_component_driver soc_codec_dev_es8323 = {
|
||||
|
||||
Reference in New Issue
Block a user