Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003  * Definitions and platform data for Analog Devices
0004  * Backlight drivers ADP8860
0005  *
0006  * Copyright 2009-2010 Analog Devices Inc.
0007  */
0008 
0009 #ifndef __LINUX_I2C_ADP8860_H
0010 #define __LINUX_I2C_ADP8860_H
0011 
0012 #include <linux/leds.h>
0013 #include <linux/types.h>
0014 
0015 #define ID_ADP8860      8860
0016 
0017 #define ADP8860_MAX_BRIGHTNESS  0x7F
0018 #define FLAG_OFFT_SHIFT 8
0019 
0020 /*
0021  * LEDs subdevice platform data
0022  */
0023 
0024 #define ADP8860_LED_DIS_BLINK   (0 << FLAG_OFFT_SHIFT)
0025 #define ADP8860_LED_OFFT_600ms  (1 << FLAG_OFFT_SHIFT)
0026 #define ADP8860_LED_OFFT_1200ms (2 << FLAG_OFFT_SHIFT)
0027 #define ADP8860_LED_OFFT_1800ms (3 << FLAG_OFFT_SHIFT)
0028 
0029 #define ADP8860_LED_ONT_200ms   0
0030 #define ADP8860_LED_ONT_600ms   1
0031 #define ADP8860_LED_ONT_800ms   2
0032 #define ADP8860_LED_ONT_1200ms  3
0033 
0034 #define ADP8860_LED_D7      (7)
0035 #define ADP8860_LED_D6      (6)
0036 #define ADP8860_LED_D5      (5)
0037 #define ADP8860_LED_D4      (4)
0038 #define ADP8860_LED_D3      (3)
0039 #define ADP8860_LED_D2      (2)
0040 #define ADP8860_LED_D1      (1)
0041 
0042 /*
0043  * Backlight subdevice platform data
0044  */
0045 
0046 #define ADP8860_BL_D7       (1 << 6)
0047 #define ADP8860_BL_D6       (1 << 5)
0048 #define ADP8860_BL_D5       (1 << 4)
0049 #define ADP8860_BL_D4       (1 << 3)
0050 #define ADP8860_BL_D3       (1 << 2)
0051 #define ADP8860_BL_D2       (1 << 1)
0052 #define ADP8860_BL_D1       (1 << 0)
0053 
0054 #define ADP8860_FADE_T_DIS  0   /* Fade Timer Disabled */
0055 #define ADP8860_FADE_T_300ms    1   /* 0.3 Sec */
0056 #define ADP8860_FADE_T_600ms    2
0057 #define ADP8860_FADE_T_900ms    3
0058 #define ADP8860_FADE_T_1200ms   4
0059 #define ADP8860_FADE_T_1500ms   5
0060 #define ADP8860_FADE_T_1800ms   6
0061 #define ADP8860_FADE_T_2100ms   7
0062 #define ADP8860_FADE_T_2400ms   8
0063 #define ADP8860_FADE_T_2700ms   9
0064 #define ADP8860_FADE_T_3000ms   10
0065 #define ADP8860_FADE_T_3500ms   11
0066 #define ADP8860_FADE_T_4000ms   12
0067 #define ADP8860_FADE_T_4500ms   13
0068 #define ADP8860_FADE_T_5000ms   14
0069 #define ADP8860_FADE_T_5500ms   15  /* 5.5 Sec */
0070 
0071 #define ADP8860_FADE_LAW_LINEAR 0
0072 #define ADP8860_FADE_LAW_SQUARE 1
0073 #define ADP8860_FADE_LAW_CUBIC1 2
0074 #define ADP8860_FADE_LAW_CUBIC2 3
0075 
0076 #define ADP8860_BL_AMBL_FILT_80ms   0   /* Light sensor filter time */
0077 #define ADP8860_BL_AMBL_FILT_160ms  1
0078 #define ADP8860_BL_AMBL_FILT_320ms  2
0079 #define ADP8860_BL_AMBL_FILT_640ms  3
0080 #define ADP8860_BL_AMBL_FILT_1280ms 4
0081 #define ADP8860_BL_AMBL_FILT_2560ms 5
0082 #define ADP8860_BL_AMBL_FILT_5120ms 6
0083 #define ADP8860_BL_AMBL_FILT_10240ms    7   /* 10.24 sec */
0084 
0085 /*
0086  * Blacklight current 0..30mA
0087  */
0088 #define ADP8860_BL_CUR_mA(I)        ((I * 127) / 30)
0089 
0090 /*
0091  * L2 comparator current 0..1106uA
0092  */
0093 #define ADP8860_L2_COMP_CURR_uA(I)  ((I * 255) / 1106)
0094 
0095 /*
0096  * L3 comparator current 0..138uA
0097  */
0098 #define ADP8860_L3_COMP_CURR_uA(I)  ((I * 255) / 138)
0099 
0100 struct adp8860_backlight_platform_data {
0101     u8 bl_led_assign;   /* 1 = Backlight 0 = Individual LED */
0102 
0103     u8 bl_fade_in;      /* Backlight Fade-In Timer */
0104     u8 bl_fade_out;     /* Backlight Fade-Out Timer */
0105     u8 bl_fade_law;     /* fade-on/fade-off transfer characteristic */
0106 
0107     u8 en_ambl_sens;    /* 1 = enable ambient light sensor */
0108     u8 abml_filt;       /* Light sensor filter time */
0109 
0110     u8 l1_daylight_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
0111     u8 l1_daylight_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
0112     u8 l2_office_max;   /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
0113     u8 l2_office_dim;   /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
0114     u8 l3_dark_max;     /* use BL_CUR_mA(I) 0 <= I <= 30 mA */
0115     u8 l3_dark_dim;     /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */
0116 
0117     u8 l2_trip;     /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
0118     u8 l2_hyst;     /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */
0119     u8 l3_trip;     /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
0120     u8 l3_hyst;     /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */
0121 
0122     /**
0123      * Independent Current Sinks / LEDS
0124      * Sinks not assigned to the Backlight can be exposed to
0125      * user space using the LEDS CLASS interface
0126      */
0127 
0128     int num_leds;
0129     struct led_info *leds;
0130     u8 led_fade_in;     /* LED Fade-In Timer */
0131     u8 led_fade_out;    /* LED Fade-Out Timer */
0132     u8 led_fade_law;    /* fade-on/fade-off transfer characteristic */
0133     u8 led_on_time;
0134 
0135     /**
0136      * Gain down disable. Setting this option does not allow the
0137      * charge pump to switch to lower gains. NOT AVAILABLE on ADP8860
0138      * 1 = the charge pump doesn't switch down in gain until all LEDs are 0.
0139      *  The charge pump switches up in gain as needed. This feature is
0140      *  useful if the ADP8863 charge pump is used to drive an external load.
0141      *  This feature must be used when utilizing small fly capacitors
0142      *  (0402 or smaller).
0143      * 0 = the charge pump automatically switches up and down in gain.
0144      *  This provides optimal efficiency, but is not suitable for driving
0145      *  loads that are not connected through the ADP8863 diode drivers.
0146      *  Additionally, the charge pump fly capacitors should be low ESR
0147      * and sized 0603 or greater.
0148      */
0149 
0150     u8 gdwn_dis;
0151 };
0152 
0153 #endif /* __LINUX_I2C_ADP8860_H */