Gopikrishnaiah Anandan | e0e5e0c | 2016-05-25 11:05:33 -0700 | [diff] [blame] | 1 | /* Copyright (c) 2016-2017, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef _SDE_COLOR_PROCESSING_H |
| 15 | #define _SDE_COLOR_PROCESSING_H |
| 16 | #include <drm/drm_crtc.h> |
| 17 | |
Gopikrishnaiah Anandan | 5154c71 | 2017-02-27 17:48:24 -0800 | [diff] [blame] | 18 | struct sde_irq_callback; |
| 19 | |
Benet Clark | d009b1d | 2016-06-27 14:45:59 -0700 | [diff] [blame] | 20 | /* |
| 21 | * PA MEMORY COLOR types |
| 22 | * @MEMCOLOR_SKIN Skin memory color type |
| 23 | * @MEMCOLOR_SKY Sky memory color type |
| 24 | * @MEMCOLOR_FOLIAGE Foliage memory color type |
| 25 | */ |
| 26 | enum sde_memcolor_type { |
| 27 | MEMCOLOR_SKIN = 0, |
| 28 | MEMCOLOR_SKY, |
| 29 | MEMCOLOR_FOLIAGE |
| 30 | }; |
| 31 | |
Xu Yang | 056d39b | 2017-07-11 16:34:13 +0800 | [diff] [blame] | 32 | /* |
| 33 | * PA HISTOGRAM modes |
| 34 | * @HIST_DISABLED Histogram disabled |
| 35 | * @HIST_ENABLED Histogram enabled |
| 36 | */ |
| 37 | enum sde_hist_modes { |
| 38 | HIST_DISABLED, |
| 39 | HIST_ENABLED |
| 40 | }; |
| 41 | |
| 42 | /** |
| 43 | * struct drm_prop_enum_list - drm structure for creating enum property and |
| 44 | * enumerating values |
| 45 | */ |
| 46 | static const struct drm_prop_enum_list sde_hist_modes[] = { |
| 47 | {HIST_DISABLED, "hist_off"}, |
| 48 | {HIST_ENABLED, "hist_on"}, |
| 49 | }; |
| 50 | |
Gopikrishnaiah Anandan | e0e5e0c | 2016-05-25 11:05:33 -0700 | [diff] [blame] | 51 | /** |
| 52 | * sde_cp_crtc_init(): Initialize color processing lists for a crtc. |
| 53 | * Should be called during crtc initialization. |
| 54 | * @crtc: Pointer to sde_crtc. |
| 55 | */ |
| 56 | void sde_cp_crtc_init(struct drm_crtc *crtc); |
| 57 | |
| 58 | /** |
| 59 | * sde_cp_crtc_install_properties(): Installs the color processing |
| 60 | * properties for a crtc. |
| 61 | * Should be called during crtc initialization. |
| 62 | * @crtc: Pointer to crtc. |
| 63 | */ |
| 64 | void sde_cp_crtc_install_properties(struct drm_crtc *crtc); |
| 65 | |
| 66 | /** |
| 67 | * sde_cp_crtc_destroy_properties: Destroys color processing |
| 68 | * properties for a crtc. |
| 69 | * should be called during crtc de-initialization. |
| 70 | * @crtc: Pointer to crtc. |
| 71 | */ |
| 72 | void sde_cp_crtc_destroy_properties(struct drm_crtc *crtc); |
| 73 | |
| 74 | /** |
| 75 | * sde_cp_crtc_set_property: Set a color processing property |
| 76 | * for a crtc. |
| 77 | * Should be during atomic set property. |
| 78 | * @crtc: Pointer to crtc. |
| 79 | * @property: Property that needs to enabled/disabled. |
| 80 | * @val: Value of property. |
| 81 | */ |
| 82 | int sde_cp_crtc_set_property(struct drm_crtc *crtc, |
| 83 | struct drm_property *property, uint64_t val); |
| 84 | |
| 85 | /** |
| 86 | * sde_cp_crtc_apply_properties: Enable/disable properties |
| 87 | * for a crtc. |
| 88 | * Should be called during atomic commit call. |
| 89 | * @crtc: Pointer to crtc. |
| 90 | */ |
| 91 | void sde_cp_crtc_apply_properties(struct drm_crtc *crtc); |
| 92 | |
| 93 | /** |
| 94 | * sde_cp_crtc_get_property: Get value of color processing property |
| 95 | * for a crtc. |
| 96 | * Should be during atomic get property. |
| 97 | * @crtc: Pointer to crtc. |
| 98 | * @property: Property that needs to enabled/disabled. |
| 99 | * @val: Value of property. |
| 100 | * |
| 101 | */ |
| 102 | int sde_cp_crtc_get_property(struct drm_crtc *crtc, |
| 103 | struct drm_property *property, uint64_t *val); |
Gopikrishnaiah Anandan | 7f6ef94 | 2016-06-20 15:50:00 -0700 | [diff] [blame] | 104 | |
| 105 | /** |
| 106 | * sde_cp_crtc_suspend: Suspend the crtc features |
| 107 | * @crtc: Pointer to crtc. |
| 108 | */ |
| 109 | void sde_cp_crtc_suspend(struct drm_crtc *crtc); |
| 110 | |
| 111 | /** |
| 112 | * sde_cp_crtc_resume: Resume the crtc features |
| 113 | * @crtc: Pointer to crtc. |
| 114 | */ |
| 115 | void sde_cp_crtc_resume(struct drm_crtc *crtc); |
Gopikrishnaiah Anandan | 5154c71 | 2017-02-27 17:48:24 -0800 | [diff] [blame] | 116 | |
| 117 | /** |
| 118 | * sde_cp_ad_interrupt: Api to enable/disable ad interrupt |
| 119 | * @crtc: Pointer to crtc. |
| 120 | * @en: Variable to enable/disable interrupt. |
| 121 | * @irq: Pointer to irq callback |
| 122 | */ |
| 123 | int sde_cp_ad_interrupt(struct drm_crtc *crtc, bool en, |
| 124 | struct sde_irq_callback *irq); |
Ping Li | e505f3b | 2017-06-19 14:19:08 -0700 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * sde_cp_crtc_pre_ipc: Handle color processing features |
| 128 | * before entering IPC |
| 129 | * @crtc: Pointer to crtc. |
| 130 | */ |
| 131 | void sde_cp_crtc_pre_ipc(struct drm_crtc *crtc); |
| 132 | |
| 133 | /** |
| 134 | * sde_cp_crtc_post_ipc: Handle color processing features |
| 135 | * after exiting IPC |
| 136 | * @crtc: Pointer to crtc. |
| 137 | */ |
| 138 | void sde_cp_crtc_post_ipc(struct drm_crtc *crtc); |
Xu Yang | 5e53c2e | 2017-07-11 16:46:28 +0800 | [diff] [blame] | 139 | |
| 140 | /** |
| 141 | * sde_cp_hist_interrupt: Api to enable/disable histogram interrupt |
| 142 | * @crtc: Pointer to crtc. |
| 143 | * @en: Variable to enable/disable interrupt. |
| 144 | * @irq: Pointer to irq callback |
| 145 | */ |
| 146 | int sde_cp_hist_interrupt(struct drm_crtc *crtc_drm, bool en, |
| 147 | struct sde_irq_callback *hist_irq); |
Gopikrishnaiah Anandan | e0e5e0c | 2016-05-25 11:05:33 -0700 | [diff] [blame] | 148 | #endif /*_SDE_COLOR_PROCESSING_H */ |