1*80503b23SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 2056d6ff4SWolfram Sang /* 3056d6ff4SWolfram Sang * Definitions and platform data for Analog Devices 4056d6ff4SWolfram Sang * Backlight drivers ADP8870 5056d6ff4SWolfram Sang * 6056d6ff4SWolfram Sang * Copyright 2009-2010 Analog Devices Inc. 7056d6ff4SWolfram Sang */ 8056d6ff4SWolfram Sang 9056d6ff4SWolfram Sang #ifndef __LINUX_I2C_ADP8870_H 10056d6ff4SWolfram Sang #define __LINUX_I2C_ADP8870_H 11056d6ff4SWolfram Sang 12056d6ff4SWolfram Sang #define ID_ADP8870 8870 13056d6ff4SWolfram Sang 14056d6ff4SWolfram Sang #define ADP8870_MAX_BRIGHTNESS 0x7F 15056d6ff4SWolfram Sang #define FLAG_OFFT_SHIFT 8 16056d6ff4SWolfram Sang 17056d6ff4SWolfram Sang /* 18056d6ff4SWolfram Sang * LEDs subdevice platform data 19056d6ff4SWolfram Sang */ 20056d6ff4SWolfram Sang 21056d6ff4SWolfram Sang #define ADP8870_LED_DIS_BLINK (0 << FLAG_OFFT_SHIFT) 22056d6ff4SWolfram Sang #define ADP8870_LED_OFFT_600ms (1 << FLAG_OFFT_SHIFT) 23056d6ff4SWolfram Sang #define ADP8870_LED_OFFT_1200ms (2 << FLAG_OFFT_SHIFT) 24056d6ff4SWolfram Sang #define ADP8870_LED_OFFT_1800ms (3 << FLAG_OFFT_SHIFT) 25056d6ff4SWolfram Sang 26056d6ff4SWolfram Sang #define ADP8870_LED_ONT_200ms 0 27056d6ff4SWolfram Sang #define ADP8870_LED_ONT_600ms 1 28056d6ff4SWolfram Sang #define ADP8870_LED_ONT_800ms 2 29056d6ff4SWolfram Sang #define ADP8870_LED_ONT_1200ms 3 30056d6ff4SWolfram Sang 31056d6ff4SWolfram Sang #define ADP8870_LED_D7 (7) 32056d6ff4SWolfram Sang #define ADP8870_LED_D6 (6) 33056d6ff4SWolfram Sang #define ADP8870_LED_D5 (5) 34056d6ff4SWolfram Sang #define ADP8870_LED_D4 (4) 35056d6ff4SWolfram Sang #define ADP8870_LED_D3 (3) 36056d6ff4SWolfram Sang #define ADP8870_LED_D2 (2) 37056d6ff4SWolfram Sang #define ADP8870_LED_D1 (1) 38056d6ff4SWolfram Sang 39056d6ff4SWolfram Sang /* 40056d6ff4SWolfram Sang * Backlight subdevice platform data 41056d6ff4SWolfram Sang */ 42056d6ff4SWolfram Sang 43056d6ff4SWolfram Sang #define ADP8870_BL_D7 (1 << 6) 44056d6ff4SWolfram Sang #define ADP8870_BL_D6 (1 << 5) 45056d6ff4SWolfram Sang #define ADP8870_BL_D5 (1 << 4) 46056d6ff4SWolfram Sang #define ADP8870_BL_D4 (1 << 3) 47056d6ff4SWolfram Sang #define ADP8870_BL_D3 (1 << 2) 48056d6ff4SWolfram Sang #define ADP8870_BL_D2 (1 << 1) 49056d6ff4SWolfram Sang #define ADP8870_BL_D1 (1 << 0) 50056d6ff4SWolfram Sang 51056d6ff4SWolfram Sang #define ADP8870_FADE_T_DIS 0 /* Fade Timer Disabled */ 52056d6ff4SWolfram Sang #define ADP8870_FADE_T_300ms 1 /* 0.3 Sec */ 53056d6ff4SWolfram Sang #define ADP8870_FADE_T_600ms 2 54056d6ff4SWolfram Sang #define ADP8870_FADE_T_900ms 3 55056d6ff4SWolfram Sang #define ADP8870_FADE_T_1200ms 4 56056d6ff4SWolfram Sang #define ADP8870_FADE_T_1500ms 5 57056d6ff4SWolfram Sang #define ADP8870_FADE_T_1800ms 6 58056d6ff4SWolfram Sang #define ADP8870_FADE_T_2100ms 7 59056d6ff4SWolfram Sang #define ADP8870_FADE_T_2400ms 8 60056d6ff4SWolfram Sang #define ADP8870_FADE_T_2700ms 9 61056d6ff4SWolfram Sang #define ADP8870_FADE_T_3000ms 10 62056d6ff4SWolfram Sang #define ADP8870_FADE_T_3500ms 11 63056d6ff4SWolfram Sang #define ADP8870_FADE_T_4000ms 12 64056d6ff4SWolfram Sang #define ADP8870_FADE_T_4500ms 13 65056d6ff4SWolfram Sang #define ADP8870_FADE_T_5000ms 14 66056d6ff4SWolfram Sang #define ADP8870_FADE_T_5500ms 15 /* 5.5 Sec */ 67056d6ff4SWolfram Sang 68056d6ff4SWolfram Sang #define ADP8870_FADE_LAW_LINEAR 0 69056d6ff4SWolfram Sang #define ADP8870_FADE_LAW_SQUARE 1 70056d6ff4SWolfram Sang #define ADP8870_FADE_LAW_CUBIC1 2 71056d6ff4SWolfram Sang #define ADP8870_FADE_LAW_CUBIC2 3 72056d6ff4SWolfram Sang 73056d6ff4SWolfram Sang #define ADP8870_BL_AMBL_FILT_80ms 0 /* Light sensor filter time */ 74056d6ff4SWolfram Sang #define ADP8870_BL_AMBL_FILT_160ms 1 75056d6ff4SWolfram Sang #define ADP8870_BL_AMBL_FILT_320ms 2 76056d6ff4SWolfram Sang #define ADP8870_BL_AMBL_FILT_640ms 3 77056d6ff4SWolfram Sang #define ADP8870_BL_AMBL_FILT_1280ms 4 78056d6ff4SWolfram Sang #define ADP8870_BL_AMBL_FILT_2560ms 5 79056d6ff4SWolfram Sang #define ADP8870_BL_AMBL_FILT_5120ms 6 80056d6ff4SWolfram Sang #define ADP8870_BL_AMBL_FILT_10240ms 7 /* 10.24 sec */ 81056d6ff4SWolfram Sang 82056d6ff4SWolfram Sang /* 83056d6ff4SWolfram Sang * Blacklight current 0..30mA 84056d6ff4SWolfram Sang */ 85056d6ff4SWolfram Sang #define ADP8870_BL_CUR_mA(I) ((I * 127) / 30) 86056d6ff4SWolfram Sang 87056d6ff4SWolfram Sang /* 88056d6ff4SWolfram Sang * L2 comparator current 0..1106uA 89056d6ff4SWolfram Sang */ 90056d6ff4SWolfram Sang #define ADP8870_L2_COMP_CURR_uA(I) ((I * 255) / 1106) 91056d6ff4SWolfram Sang 92056d6ff4SWolfram Sang /* 93056d6ff4SWolfram Sang * L3 comparator current 0..551uA 94056d6ff4SWolfram Sang */ 95056d6ff4SWolfram Sang #define ADP8870_L3_COMP_CURR_uA(I) ((I * 255) / 551) 96056d6ff4SWolfram Sang 97056d6ff4SWolfram Sang /* 98056d6ff4SWolfram Sang * L4 comparator current 0..275uA 99056d6ff4SWolfram Sang */ 100056d6ff4SWolfram Sang #define ADP8870_L4_COMP_CURR_uA(I) ((I * 255) / 275) 101056d6ff4SWolfram Sang 102056d6ff4SWolfram Sang /* 103056d6ff4SWolfram Sang * L5 comparator current 0..138uA 104056d6ff4SWolfram Sang */ 105056d6ff4SWolfram Sang #define ADP8870_L5_COMP_CURR_uA(I) ((I * 255) / 138) 106056d6ff4SWolfram Sang 107056d6ff4SWolfram Sang struct adp8870_backlight_platform_data { 108056d6ff4SWolfram Sang u8 bl_led_assign; /* 1 = Backlight 0 = Individual LED */ 109056d6ff4SWolfram Sang u8 pwm_assign; /* 1 = Enables PWM mode */ 110056d6ff4SWolfram Sang 111056d6ff4SWolfram Sang u8 bl_fade_in; /* Backlight Fade-In Timer */ 112056d6ff4SWolfram Sang u8 bl_fade_out; /* Backlight Fade-Out Timer */ 113056d6ff4SWolfram Sang u8 bl_fade_law; /* fade-on/fade-off transfer characteristic */ 114056d6ff4SWolfram Sang 115056d6ff4SWolfram Sang u8 en_ambl_sens; /* 1 = enable ambient light sensor */ 116056d6ff4SWolfram Sang u8 abml_filt; /* Light sensor filter time */ 117056d6ff4SWolfram Sang 118056d6ff4SWolfram Sang u8 l1_daylight_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ 119056d6ff4SWolfram Sang u8 l1_daylight_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ 120056d6ff4SWolfram Sang u8 l2_bright_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ 121056d6ff4SWolfram Sang u8 l2_bright_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ 122056d6ff4SWolfram Sang u8 l3_office_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ 123056d6ff4SWolfram Sang u8 l3_office_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ 124056d6ff4SWolfram Sang u8 l4_indoor_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ 125056d6ff4SWolfram Sang u8 l4_indor_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ 126056d6ff4SWolfram Sang u8 l5_dark_max; /* use BL_CUR_mA(I) 0 <= I <= 30 mA */ 127056d6ff4SWolfram Sang u8 l5_dark_dim; /* typ = 0, use BL_CUR_mA(I) 0 <= I <= 30 mA */ 128056d6ff4SWolfram Sang 129056d6ff4SWolfram Sang u8 l2_trip; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */ 130056d6ff4SWolfram Sang u8 l2_hyst; /* use L2_COMP_CURR_uA(I) 0 <= I <= 1106 uA */ 131056d6ff4SWolfram Sang u8 l3_trip; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */ 132056d6ff4SWolfram Sang u8 l3_hyst; /* use L3_COMP_CURR_uA(I) 0 <= I <= 551 uA */ 133056d6ff4SWolfram Sang u8 l4_trip; /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */ 134056d6ff4SWolfram Sang u8 l4_hyst; /* use L4_COMP_CURR_uA(I) 0 <= I <= 275 uA */ 135056d6ff4SWolfram Sang u8 l5_trip; /* use L5_COMP_CURR_uA(I) 0 <= I <= 138 uA */ 136056d6ff4SWolfram Sang u8 l5_hyst; /* use L6_COMP_CURR_uA(I) 0 <= I <= 138 uA */ 137056d6ff4SWolfram Sang 138056d6ff4SWolfram Sang /** 139056d6ff4SWolfram Sang * Independent Current Sinks / LEDS 140056d6ff4SWolfram Sang * Sinks not assigned to the Backlight can be exposed to 141056d6ff4SWolfram Sang * user space using the LEDS CLASS interface 142056d6ff4SWolfram Sang */ 143056d6ff4SWolfram Sang 144056d6ff4SWolfram Sang int num_leds; 145056d6ff4SWolfram Sang struct led_info *leds; 146056d6ff4SWolfram Sang u8 led_fade_in; /* LED Fade-In Timer */ 147056d6ff4SWolfram Sang u8 led_fade_out; /* LED Fade-Out Timer */ 148056d6ff4SWolfram Sang u8 led_fade_law; /* fade-on/fade-off transfer characteristic */ 149056d6ff4SWolfram Sang u8 led_on_time; 150056d6ff4SWolfram Sang }; 151056d6ff4SWolfram Sang 152056d6ff4SWolfram Sang #endif /* __LINUX_I2C_ADP8870_H */ 153