drivers/misc: driver for bh1770glc / sfh7770 ALS and proximity sensor
This is a driver for ROHM BH1770GLC and OSRAM SFH7770 combined ALS and proximity sensor. Interface is sysfs based. The driver uses interrupts to provide new data. The driver supports pm_runtime and regulator frameworks. See Documentation/misc-devices/bh1770glc.txt for details Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4b068de9ab
commit
190420ab34
@ -315,6 +315,16 @@ config SENSORS_BH1780
|
||||
This driver can also be built as a module. If so, the module
|
||||
will be called bh1780gli.
|
||||
|
||||
config SENSORS_BH1770
|
||||
tristate "BH1770GLC / SFH7770 combined ALS - Proximity sensor"
|
||||
depends on I2C
|
||||
---help---
|
||||
Say Y here if you want to build a driver for BH1770GLC (ROHM) or
|
||||
SFH7770 (Osram) combined ambient light and proximity sensor chip.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called bh1770glc. If unsure, say N here.
|
||||
|
||||
config HMC6352
|
||||
tristate "Honeywell HMC6352 compass"
|
||||
depends on I2C
|
||||
|
@ -16,6 +16,7 @@ obj-$(CONFIG_TIFM_CORE) += tifm_core.o
|
||||
obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o
|
||||
obj-$(CONFIG_PHANTOM) += phantom.o
|
||||
obj-$(CONFIG_SENSORS_BH1780) += bh1780gli.o
|
||||
obj-$(CONFIG_SENSORS_BH1770) += bh1770glc.o
|
||||
obj-$(CONFIG_SGI_IOC4) += ioc4.o
|
||||
obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
|
||||
obj-$(CONFIG_KGDB_TESTS) += kgdbts.o
|
||||
|
1413
drivers/misc/bh1770glc.c
Normal file
1413
drivers/misc/bh1770glc.c
Normal file
File diff suppressed because it is too large
Load Diff
53
include/linux/i2c/bh1770glc.h
Normal file
53
include/linux/i2c/bh1770glc.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This file is part of the ROHM BH1770GLC / OSRAM SFH7770 sensor driver.
|
||||
* Chip is combined proximity and ambient light sensor.
|
||||
*
|
||||
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
||||
*
|
||||
* Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __BH1770_H__
|
||||
#define __BH1770_H__
|
||||
|
||||
/**
|
||||
* struct bh1770_platform_data - platform data for bh1770glc driver
|
||||
* @led_def_curr: IR led driving current.
|
||||
* @glass_attenuation: Attenuation factor for covering window.
|
||||
* @setup_resources: Call back for interrupt line setup function
|
||||
* @release_resources: Call back for interrupte line release function
|
||||
*
|
||||
* Example of glass attenuation: 16384 * 385 / 100 means attenuation factor
|
||||
* of 3.85. i.e. light_above_sensor = light_above_cover_window / 3.85
|
||||
*/
|
||||
|
||||
struct bh1770_platform_data {
|
||||
#define BH1770_LED_5mA 0
|
||||
#define BH1770_LED_10mA 1
|
||||
#define BH1770_LED_20mA 2
|
||||
#define BH1770_LED_50mA 3
|
||||
#define BH1770_LED_100mA 4
|
||||
#define BH1770_LED_150mA 5
|
||||
#define BH1770_LED_200mA 6
|
||||
__u8 led_def_curr;
|
||||
#define BH1770_NEUTRAL_GA 16384 /* 16384 / 16384 = 1 */
|
||||
__u32 glass_attenuation;
|
||||
int (*setup_resources)(void);
|
||||
int (*release_resources)(void);
|
||||
};
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user