Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Power HAL: Remove sampling rate change
Sampling rate change causes stutter while playing music.
Stutter appears randomly, but has a higher chance of appearing
when the screen goes from off to on.

Change-Id: I9b23212165203c7ff7ef65021be09fd366e55770
  • Loading branch information
pawitp committed Sep 30, 2012
1 parent 5bff9ac commit 76a153a
Showing 1 changed file with 2 additions and 33 deletions.
35 changes: 2 additions & 33 deletions exynos3/s5pc110/power/power.c
Expand Up @@ -28,40 +28,14 @@
#include <hardware/power.h>

#define BOOSTPULSE_PATH "/sys/devices/system/cpu/cpufreq/ondemand/boostpulse"
#define SAMPLING_RATE_ONDEMAND "/sys/devices/system/cpu/cpufreq/ondemand/sampling_rate"
#define SAMPLING_RATE_SCREEN_ON "40000"
#define SAMPLING_RATE_SCREEN_OFF "400000"

struct s5pc110_power_module {
struct power_module base;
pthread_mutex_t lock;
int boostpulse_fd;
int boostpulse_warned;
char sampling_rate_screen_on[PROPERTY_VALUE_MAX];
char sampling_rate_screen_off[PROPERTY_VALUE_MAX];
};

static void sysfs_write(char *path, char *s)
{
char buf[80];
int len;
int fd = open(path, O_WRONLY);

if (fd < 0) {
strerror_r(errno, buf, sizeof(buf));
ALOGE("Error opening %s: %s\n", path, buf);
return;
}

len = write(fd, s, strlen(s));
if (len < 0) {
strerror_r(errno, buf, sizeof(buf));
ALOGE("Error writing to %s: %s\n", path, buf);
}

close(fd);
}

static int boostpulse_open(struct s5pc110_power_module *s5pc110)
{
char buf[80];
Expand Down Expand Up @@ -119,17 +93,12 @@ static void s5pc110_power_hint(struct power_module *module, power_hint_t hint,

static void s5pc110_power_set_interactive(struct power_module *module, int on)
{
struct s5pc110_power_module *s5pc110 = (struct s5pc110_power_module *) module;
sysfs_write(SAMPLING_RATE_ONDEMAND,
on ? s5pc110->sampling_rate_screen_on : s5pc110->sampling_rate_screen_off);
return;
}

static void s5pc110_power_init(struct power_module *module)
{
struct s5pc110_power_module *s5pc110 = (struct s5pc110_power_module *) module;
property_get("ro.sys.sampling_rate_on", s5pc110->sampling_rate_screen_on, SAMPLING_RATE_SCREEN_ON);
property_get("ro.sys.sampling_rate_off", s5pc110->sampling_rate_screen_off, SAMPLING_RATE_SCREEN_OFF);
sysfs_write(SAMPLING_RATE_ONDEMAND, s5pc110->sampling_rate_screen_on);
return;
}

static struct hw_module_methods_t power_module_methods = {
Expand Down

0 comments on commit 76a153a

Please sign in to comment.