Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * This file is part of the APDS990x sensor driver.
0004  * Chip is combined proximity and ambient light sensor.
0005  *
0006  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
0007  *
0008  * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
0009  */
0010 
0011 #ifndef __APDS990X_H__
0012 #define __APDS990X_H__
0013 
0014 
0015 #define APDS_IRLED_CURR_12mA    0x3
0016 #define APDS_IRLED_CURR_25mA    0x2
0017 #define APDS_IRLED_CURR_50mA    0x1
0018 #define APDS_IRLED_CURR_100mA   0x0
0019 
0020 /**
0021  * struct apds990x_chip_factors - defines effect of the cover window
0022  * @ga: Total glass attenuation
0023  * @cf1: clear channel factor 1 for raw to lux conversion
0024  * @irf1: IR channel factor 1 for raw to lux conversion
0025  * @cf2: clear channel factor 2 for raw to lux conversion
0026  * @irf2: IR channel factor 2 for raw to lux conversion
0027  * @df: device factor for conversion formulas
0028  *
0029  * Structure for tuning ALS calculation to match with environment.
0030  * Values depend on the material above the sensor and the sensor
0031  * itself. If the GA is zero, driver will use uncovered sensor default values
0032  * format: decimal value * APDS_PARAM_SCALE except df which is plain integer.
0033  */
0034 #define APDS_PARAM_SCALE 4096
0035 struct apds990x_chip_factors {
0036     int ga;
0037     int cf1;
0038     int irf1;
0039     int cf2;
0040     int irf2;
0041     int df;
0042 };
0043 
0044 /**
0045  * struct apds990x_platform_data - platform data for apsd990x.c driver
0046  * @cf: chip factor data
0047  * @pddrive: IR-led driving current
0048  * @ppcount: number of IR pulses used for proximity estimation
0049  * @setup_resources: interrupt line setup call back function
0050  * @release_resources: interrupt line release call back function
0051  *
0052  * Proximity detection result depends heavily on correct ppcount, pdrive
0053  * and cover window.
0054  *
0055  */
0056 
0057 struct apds990x_platform_data {
0058     struct apds990x_chip_factors cf;
0059     u8     pdrive;
0060     u8     ppcount;
0061     int    (*setup_resources)(void);
0062     int    (*release_resources)(void);
0063 };
0064 
0065 #endif