Misc fixes as passed to us
This commit is contained in:
parent
75cc2c36d7
commit
929d1854e9
9 changed files with 169 additions and 9 deletions
|
@ -100,6 +100,9 @@ TARGET_PROVIDES_CAMERA_HAL :=
|
|||
# Build lights
|
||||
TARGET_PROVIDES_LIBLIGHT := true
|
||||
|
||||
# vibrator
|
||||
BOARD_HAS_VIBRATOR_IMPLEMENTATION := ../../device/samsung/klte/vibrator/tspdrv.c
|
||||
|
||||
# Time services
|
||||
BOARD_USES_QC_TIME_SERVICES := true
|
||||
|
||||
|
|
|
@ -156,8 +156,6 @@
|
|||
<ctl name="ES705 TX1 Enable" value="ZERO" />
|
||||
<ctl name="ES705 RX1 Enable" value="ZERO" />
|
||||
<ctl name="ES705 RX2 Enable" value="ZERO" />
|
||||
<ctl name="ES325 RX1 Enable" value="ZERO" />
|
||||
<ctl name="ES325 RX2 Enable" value="ZERO" />
|
||||
<ctl name="ES705-AP Tx Channels" value="One" />
|
||||
<ctl name="ES705 Voice Wakeup Enable" value="ZERO" />
|
||||
<ctl name="ES705 Voice LPM Enable" value="ZERO" />
|
||||
|
@ -712,14 +710,14 @@
|
|||
<path name="rcv" />
|
||||
<ctl name="EAR PA Gain" value="POS_6_DB" />
|
||||
<ctl name="RX1 Digital Volume" value="84" />
|
||||
<ctl name="ES325 RX1 Enable" value="1" />
|
||||
<ctl name="ES705 RX1 Enable" value="1" />
|
||||
</path>
|
||||
|
||||
<path name="voice-call-handset-extra-vol">
|
||||
<path name="rcv" />
|
||||
<ctl name="EAR PA Gain" value="POS_6_DB" />
|
||||
<ctl name="RX1 Digital Volume" value="84" />
|
||||
<ctl name="ES325 RX1 Enable" value="1" />
|
||||
<ctl name="ES705 RX1 Enable" value="1" />
|
||||
<ctl name="VEQ Enable" value="ZERO" />
|
||||
</path>
|
||||
|
||||
|
@ -727,7 +725,7 @@
|
|||
<path name="rcv" />
|
||||
<ctl name="EAR PA Gain" value="POS_6_DB" />
|
||||
<ctl name="RX1 Digital Volume" value="84" />
|
||||
<ctl name="ES325 RX1 Enable" value="1" />
|
||||
<ctl name="ES705 RX1 Enable" value="1" />
|
||||
</path>
|
||||
|
||||
<path name="voice-call-speaker">
|
||||
|
@ -752,7 +750,7 @@
|
|||
</path>
|
||||
|
||||
<path name="voice-call-dock">
|
||||
<ctl name="ES325 RX1 Enable" value="1" />
|
||||
<ctl name="ES705 RX1 Enable" value="1" />
|
||||
<path name="lineout" />
|
||||
<ctl name="SLIM_0_RX Channels" value="Two" />
|
||||
<ctl name="LINEOUT1 Volume" value="19" />
|
||||
|
@ -760,7 +758,7 @@
|
|||
</path>
|
||||
|
||||
<path name="voice-call-handset-emergency">
|
||||
<ctl name="ES325 RX1 Enable" value="1" />
|
||||
<ctl name="ES705 RX1 Enable" value="1" />
|
||||
<path name="rcv" />
|
||||
<ctl name="EAR PA Gain" value="POS_6_DB" />
|
||||
<ctl name="RX1 Digital Volume" value="84" />
|
||||
|
|
|
@ -632,8 +632,6 @@ on boot
|
|||
mkdir /data/misc/radio/hatp 0775 radio system
|
||||
|
||||
# Vibetonz
|
||||
chmod 0660 /dev/tspdrv
|
||||
chown root shell /dev/tspdrv
|
||||
chown system system /sys/class/timed_output/vibrator/pwm_value
|
||||
chmod 0660 /sys/class/timed_output/vibrator/pwm_value
|
||||
chown system system /sys/class/timed_output/vibrator/pwm_max
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
# the DIAG device node is not world writable/readable.
|
||||
/dev/diag 0660 system qcom_diag
|
||||
|
||||
# vibrator
|
||||
/dev/tspdrv 0660 system system
|
||||
|
||||
/dev/genlock 0666 system system
|
||||
/dev/kgsl 0666 system system
|
||||
/dev/kgsl-3d0 0666 system system
|
||||
|
|
2
sepolicy/device.te
Normal file
2
sepolicy/device.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
# vibrator
|
||||
type tspdrv_device, dev_type;
|
1
sepolicy/file_contexts
Normal file
1
sepolicy/file_contexts
Normal file
|
@ -0,0 +1 @@
|
|||
/dev/tspdrv u:object_r:tspdrv_device:s0
|
2
sepolicy/system.te
Normal file
2
sepolicy/system.te
Normal file
|
@ -0,0 +1,2 @@
|
|||
# vibrator access to system apps
|
||||
allow system tspdrv_device:chr_file rw_file_perms;
|
123
vibrator/tspdrv.c
Normal file
123
vibrator/tspdrv.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
* Copyright (C) 2011 CyanogenMod Project
|
||||
* Copyright (C) 2011 Daniel Hillenbrand
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
||||
#define LOG_NDEBUG 0
|
||||
#define LOG_TAG "tspdrv"
|
||||
#include <log/log.h>
|
||||
|
||||
#include "tspdrv.h"
|
||||
|
||||
int vibrator_exists()
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = open(THE_DEVICE, O_RDWR);
|
||||
if(fd < 0) {
|
||||
ALOGE("%s is not available.", THE_DEVICE);
|
||||
return 0;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
fd = open(TSPDRV_DEVICE, O_RDWR);
|
||||
if(fd < 0) {
|
||||
ALOGE("%s is not available.", TSPDRV_DEVICE);
|
||||
return 0;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int write_value(const char *devname, int timeout_ms)
|
||||
{
|
||||
int nwr, fd, ret;
|
||||
char value[20];
|
||||
|
||||
fd = open(devname, O_RDWR);
|
||||
if(fd < 0)
|
||||
return errno;
|
||||
|
||||
nwr = sprintf(value, "%d\n", timeout_ms);
|
||||
ret = write(fd, value, nwr);
|
||||
|
||||
close(fd);
|
||||
return (ret == nwr) ? 0 : -1;
|
||||
}
|
||||
|
||||
static void tsp_set_timeout(int tspd, int timeout_ms, int actuators)
|
||||
{
|
||||
int tspret;
|
||||
|
||||
if(timeout_ms == 0) {
|
||||
/* stop tspdrv kernel timer */
|
||||
tspret = ioctl(tspd, TSPDRV_STOP_KERNEL_TIMER);
|
||||
if(tspret != 0) {
|
||||
ALOGE("TSPDRV_STOP_KERNEL_TIMER error: %d\n", tspret);
|
||||
}
|
||||
|
||||
/* disable tspdrv amp */
|
||||
if(actuators >= 1) {
|
||||
tspret = ioctl(tspd, TSPDRV_DISABLE_AMP, actuators);
|
||||
if(tspret != 0) {
|
||||
ALOGE("TSPDRV_DISABLE_AMP error: %d\n", tspret);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(timeout_ms > 0) {
|
||||
/* enable tspdrv amp */
|
||||
tspret = ioctl(tspd, TSPDRV_ENABLE_AMP, actuators);
|
||||
if(tspret != 0) {
|
||||
ALOGE("TSPDRV_ENABLE_AMP error: %d\n", tspret);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int sendit(int timeout_ms)
|
||||
{
|
||||
int tspd, tspret, actuators;
|
||||
|
||||
tspd = open(TSPDRV_DEVICE, O_RDWR);
|
||||
if(tspd < 0) {
|
||||
ALOGE("failed on opening /dev/tspdrv\n");
|
||||
return errno;
|
||||
}
|
||||
|
||||
/* send tspdrv magic number */
|
||||
tspret = ioctl(tspd, TSPDRV_MAGIC_NUMBER);
|
||||
if(tspret != 0) {
|
||||
ALOGE("TSPDRV_MAGIC_NUMBER error: %d\n", tspret);
|
||||
}
|
||||
|
||||
/* get number of actuators */
|
||||
actuators = ioctl(tspd, TSPDRV_GET_NUM_ACTUATORS);
|
||||
if(actuators < 1) {
|
||||
ALOGE("TSPDRV_GET_NUM_ACTUATORS error, no actuators available\n");
|
||||
close(tspd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsp_set_timeout(tspd, timeout_ms, actuators);
|
||||
close(tspd);
|
||||
|
||||
return write_value(THE_DEVICE, timeout_ms);
|
||||
}
|
30
vibrator/tspdrv.h
Normal file
30
vibrator/tspdrv.h
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2011 CyanogenMod Project
|
||||
* Copyright (C) 2011 Daniel Hillenbrand
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __TSPDRV_H
|
||||
#define __TSPDRV_H __FILE__
|
||||
|
||||
#define THE_DEVICE "/sys/class/timed_output/vibrator/enable"
|
||||
#define TSPDRV_DEVICE "/dev/tspdrv"
|
||||
|
||||
#define TSPDRV_MAGIC_NUMBER 0x494D4D52
|
||||
#define TSPDRV_STOP_KERNEL_TIMER _IO(TSPDRV_MAGIC_NUMBER & 0xFF, 1)
|
||||
#define TSPDRV_ENABLE_AMP _IO(TSPDRV_MAGIC_NUMBER & 0xFF, 3)
|
||||
#define TSPDRV_DISABLE_AMP _IO(TSPDRV_MAGIC_NUMBER & 0xFF, 4)
|
||||
#define TSPDRV_GET_NUM_ACTUATORS _IO(TSPDRV_MAGIC_NUMBER & 0xFF, 5)
|
||||
|
||||
#endif /* __TSPDRV_H */
|
Loading…
Reference in a new issue