apds990x.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * This file is part of the APDS990x sensor driver.
  4. * Chip is combined proximity and ambient light sensor.
  5. *
  6. * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
  7. *
  8. * Contact: Samu Onkalo <[email protected]>
  9. */
  10. #ifndef __APDS990X_H__
  11. #define __APDS990X_H__
  12. #define APDS_IRLED_CURR_12mA 0x3
  13. #define APDS_IRLED_CURR_25mA 0x2
  14. #define APDS_IRLED_CURR_50mA 0x1
  15. #define APDS_IRLED_CURR_100mA 0x0
  16. /**
  17. * struct apds990x_chip_factors - defines effect of the cover window
  18. * @ga: Total glass attenuation
  19. * @cf1: clear channel factor 1 for raw to lux conversion
  20. * @irf1: IR channel factor 1 for raw to lux conversion
  21. * @cf2: clear channel factor 2 for raw to lux conversion
  22. * @irf2: IR channel factor 2 for raw to lux conversion
  23. * @df: device factor for conversion formulas
  24. *
  25. * Structure for tuning ALS calculation to match with environment.
  26. * Values depend on the material above the sensor and the sensor
  27. * itself. If the GA is zero, driver will use uncovered sensor default values
  28. * format: decimal value * APDS_PARAM_SCALE except df which is plain integer.
  29. */
  30. #define APDS_PARAM_SCALE 4096
  31. struct apds990x_chip_factors {
  32. int ga;
  33. int cf1;
  34. int irf1;
  35. int cf2;
  36. int irf2;
  37. int df;
  38. };
  39. /**
  40. * struct apds990x_platform_data - platform data for apsd990x.c driver
  41. * @cf: chip factor data
  42. * @pddrive: IR-led driving current
  43. * @ppcount: number of IR pulses used for proximity estimation
  44. * @setup_resources: interrupt line setup call back function
  45. * @release_resources: interrupt line release call back function
  46. *
  47. * Proximity detection result depends heavily on correct ppcount, pdrive
  48. * and cover window.
  49. *
  50. */
  51. struct apds990x_platform_data {
  52. struct apds990x_chip_factors cf;
  53. u8 pdrive;
  54. u8 ppcount;
  55. int (*setup_resources)(void);
  56. int (*release_resources)(void);
  57. };
  58. #endif