#include <linux/module.h>
#include <linux/regmap.h>
#include <linux/iio/iio.h>
#include <linux/iio/buffer.h>
#include <linux/iio/trigger.h>
#include <linux/iio/trigger_consumer.h>
#include <linux/iio/triggered_buffer.h>
#include <linux/iio/sysfs.h>
#include <linux/pm_runtime.h>
#define RPR0521_REG_SYSTEM_CTRL 0x40
#define RPR0521_REG_MODE_CTRL 0x41
#define RPR0521_REG_ALS_CTRL 0x42
#define RPR0521_REG_PXS_CTRL 0x43
#define RPR0521_REG_PXS_DATA 0x44
#define RPR0521_REG_ALS_DATA0 0x46
#define RPR0521_REG_ALS_DATA1 0x48
#define RPR0521_REG_INTERRUPT 0x4A
#define RPR0521_REG_PS_OFFSET_LSB 0x53
#define RPR0521_REG_ID 0x92
#define RPR0521_MODE_ALS_MASK BIT(7)
#define RPR0521_MODE_PXS_MASK BIT(6)
#define RPR0521_MODE_MEAS_TIME_MASK GENMASK(3, 0)
#define RPR0521_ALS_DATA0_GAIN_MASK GENMASK(5, 4)
#define RPR0521_ALS_DATA0_GAIN_SHIFT 4
#define RPR0521_ALS_DATA1_GAIN_MASK GENMASK(3, 2)
#define RPR0521_ALS_DATA1_GAIN_SHIFT 2
#define RPR0521_PXS_GAIN_MASK GENMASK(5, 4)
#define RPR0521_PXS_GAIN_SHIFT 4
#define RPR0521_PXS_PERSISTENCE_MASK GENMASK(3, 0)
#define RPR0521_INTERRUPT_INT_TRIG_PS_MASK BIT(0)
#define RPR0521_INTERRUPT_INT_TRIG_ALS_MASK BIT(1)
#define RPR0521_INTERRUPT_INT_REASSERT_MASK BIT(3)
#define RPR0521_INTERRUPT_ALS_INT_STATUS_MASK BIT(6)
#define RPR0521_INTERRUPT_PS_INT_STATUS_MASK BIT(7)
#define RPR0521_MODE_ALS_ENABLE BIT(7)
#define RPR0521_MODE_ALS_DISABLE 0x00
#define RPR0521_MODE_PXS_ENABLE BIT(6)
#define RPR0521_MODE_PXS_DISABLE 0x00
#define RPR0521_PXS_PERSISTENCE_DRDY 0x00
#define RPR0521_INTERRUPT_INT_TRIG_PS_ENABLE BIT(0)