Skip to content

Commit

Permalink
Provide separate datapipes for raw and filtered ALS data
Browse files Browse the repository at this point in the history
By default the ALS data is median filtered, which makes it too slow
reacting to be used for things like substitute for proximity sensor
and only the filtered state can be subscribed to.

Make it possible for mce logic to subscribe to also raw als data
by providing a separate data pipe for it.

[mce] Provide separate datapipes for raw and filtered ALS data. Contributes to JB#29011
  • Loading branch information
spiiroin committed Jun 11, 2015
1 parent 956275d commit 15ce15b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions datapipe.c
Expand Up @@ -103,6 +103,9 @@ datapipe_struct proximity_sensor_pipe;
/** Ambient light sensor; read only */
datapipe_struct ambient_light_sensor_pipe;

/** Filtered ambient light level; read only */
datapipe_struct ambient_light_level_pipe;

/** Orientation sensor; read only */
datapipe_struct orientation_sensor_pipe;

Expand Down Expand Up @@ -853,6 +856,8 @@ void mce_datapipe_init(void)
0, GINT_TO_POINTER(COVER_OPEN));
setup_datapipe(&ambient_light_sensor_pipe, READ_ONLY, DONT_FREE_CACHE,
0, GINT_TO_POINTER(400));
setup_datapipe(&ambient_light_level_pipe, READ_ONLY, DONT_FREE_CACHE,
0, GINT_TO_POINTER(400));
setup_datapipe(&orientation_sensor_pipe, READ_ONLY, DONT_FREE_CACHE,
0, GINT_TO_POINTER(MCE_ORIENTATION_UNDEFINED));
setup_datapipe(&tk_lock_pipe, READ_ONLY, DONT_FREE_CACHE,
Expand Down Expand Up @@ -929,6 +934,7 @@ void mce_datapipe_quit(void)
free_datapipe(&tk_lock_pipe);
free_datapipe(&proximity_sensor_pipe);
free_datapipe(&ambient_light_sensor_pipe);
free_datapipe(&ambient_light_level_pipe);
free_datapipe(&orientation_sensor_pipe);
free_datapipe(&lens_cover_pipe);
free_datapipe(&lid_cover_sensor_pipe);
Expand Down
1 change: 1 addition & 0 deletions datapipe.h
Expand Up @@ -113,6 +113,7 @@ extern datapipe_struct lid_cover_policy_pipe;
extern datapipe_struct lens_cover_pipe;
extern datapipe_struct proximity_sensor_pipe;
extern datapipe_struct ambient_light_sensor_pipe;
extern datapipe_struct ambient_light_level_pipe;
extern datapipe_struct orientation_sensor_pipe;
extern datapipe_struct alarm_ui_state_pipe;
extern datapipe_struct system_state_pipe;
Expand Down
6 changes: 5 additions & 1 deletion modules/filter-brightness-als.c
Expand Up @@ -661,7 +661,7 @@ static void inputflt_sampling_output(int lux)

run_datapipes();

execute_datapipe(&ambient_light_sensor_pipe,
execute_datapipe(&ambient_light_level_pipe,
GINT_TO_POINTER(als_lux_latest),
USE_INDATA, CACHE_INDATA);
EXIT:
Expand Down Expand Up @@ -795,6 +795,10 @@ static void als_lux_changed(unsigned lux_)
}

inputflt_sampling_input(als_lux_cached);

execute_datapipe(&ambient_light_sensor_pipe,
GINT_TO_POINTER(als_lux_cached),
USE_INDATA, CACHE_INDATA);
}

/** Check if ALS sensor should be enabled or disabled
Expand Down

0 comments on commit 15ce15b

Please sign in to comment.