Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Copyright 2017 Advanced Micro Devices, Inc.
0003  *
0004  * Permission is hereby granted, free of charge, to any person obtaining a
0005  * copy of this software and associated documentation files (the "Software"),
0006  * to deal in the Software without restriction, including without limitation
0007  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
0008  * and/or sell copies of the Software, and to permit persons to whom the
0009  * Software is furnished to do so, subject to the following conditions:
0010  *
0011  * The above copyright notice and this permission notice shall be included in
0012  * all copies or substantial portions of the Software.
0013  *
0014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
0015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
0016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
0017  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
0018  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
0019  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0020  * OTHER DEALINGS IN THE SOFTWARE.
0021  *
0022  */
0023 /*
0024  * panel_cntl.h
0025  *
0026  *  Created on: Oct 6, 2015
0027  *      Author: yonsun
0028  */
0029 
0030 #ifndef DC_PANEL_CNTL_H_
0031 #define DC_PANEL_CNTL_H_
0032 
0033 #include "dc_types.h"
0034 
0035 #define MAX_BACKLIGHT_LEVEL 0xFFFF
0036 
0037 struct panel_cntl_backlight_registers {
0038     unsigned int BL_PWM_CNTL;
0039     unsigned int BL_PWM_CNTL2;
0040     unsigned int BL_PWM_PERIOD_CNTL;
0041     unsigned int LVTMA_PWRSEQ_REF_DIV_BL_PWM_REF_DIV;
0042     unsigned int PANEL_PWRSEQ_REF_DIV2;
0043 };
0044 
0045 struct panel_cntl_funcs {
0046     void (*destroy)(struct panel_cntl **panel_cntl);
0047     uint32_t (*hw_init)(struct panel_cntl *panel_cntl);
0048     bool (*is_panel_backlight_on)(struct panel_cntl *panel_cntl);
0049     bool (*is_panel_powered_on)(struct panel_cntl *panel_cntl);
0050     void (*store_backlight_level)(struct panel_cntl *panel_cntl);
0051     void (*driver_set_backlight)(struct panel_cntl *panel_cntl,
0052             uint32_t backlight_pwm_u16_16);
0053     uint32_t (*get_current_backlight)(struct panel_cntl *panel_cntl);
0054 };
0055 
0056 struct panel_cntl_init_data {
0057     struct dc_context *ctx;
0058     uint32_t inst;
0059 };
0060 
0061 struct panel_cntl {
0062     const struct panel_cntl_funcs *funcs;
0063     struct dc_context *ctx;
0064     uint32_t inst;
0065     /* registers setting needs to be saved and restored at InitBacklight */
0066     struct panel_cntl_backlight_registers stored_backlight_registers;
0067 };
0068 
0069 #endif /* DC_PANEL_CNTL_H_ */