Files
OpenCellular/include/als.h
Bill Richardson 43806f07e3 samus: Add scale factor to account for ALS attenuation
This adds a sensor-specific attentuation factor, which will be
applied to the ALS raw sensor readings on the EC. This is to
account for the attenutation due to glass, tinting, etc.

BUG=chrome-os-partner:34590
BRANCH=ToT,Samus
TEST=manual

In a root shell, run this:

  cd /sys/bus/acpi/drivers/acpi_als/ACPI0008:00/iio:device1
  while true; do cat in_illuminance_raw; sleep 1 ;done

Shine a flashlight on the ALS. Note that the readings are 5X
higher than they were before this CL.

Change-Id: I2a53872ecb5fab62e5f443d43588a26d3d7e697f
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/241191
Reviewed-by: Bryan Freed <bfreed@chromium.org>
2015-01-21 05:05:47 +00:00

34 lines
651 B
C

/* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef __CROS_EC_ALS_H
#define __CROS_EC_ALS_H
#include "common.h"
/* Defined in board.h */
enum als_id;
/* Initialized in board.c */
struct als_t {
const char const *name;
int (*read)(int *lux, int af);
int attenuation_factor;
};
extern struct als_t als[];
/**
* Read an ALS
*
* @param id Which one?
* @param lux Put value here
*
* @return EC_SUCCESS, or non-zero if error.
*/
int als_read(enum als_id id, int *lux);
#endif /* __CROS_EC_ALS_H */