1 /* 2 * Copyright (C) 2019 Allwinnertech Co.Ltd 3 * Authors: zhengwanyu 4 * 5 * This program is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License as published by the 7 * Free Software Foundation; either version 2 of the License, or (at your 8 * option) any later version. 9 * 10 */ 11 12 #ifndef _SUNXI_DRM_ENCODER_H_ 13 #define _SUNXI_DRM_ENCODER_H_ 14 15 #include <drm/drm_crtc.h> 16 #include <drm/drm_encoder.h> 17 #include "sunxi_drm_connector.h" 18 #include "sunxi_device/sunxi_tcon.h" 19 20 struct sunxi_drm_encoder { 21 struct drm_encoder encoder; 22 unsigned int encoder_id; 23 24 bool use_irq; 25 unsigned int irq_no; 26 27 struct sunxi_tcon_funcs *hw_funcs; 28 29 /* There are common funcs that all kinds of encoders must implement. 30 * 31 * These funcs can be called by sunxi_drm_plane/crtc/encoder/connector. 32 * 33 * But these funcs can NOT be called by DRM CORE 34 * and sunxi hw layer, like sunxi_tv/lcd/hdmi. 35 */ 36 bool (*is_in_use)(struct sunxi_drm_encoder *senc); 37 void (*sw_enable)(struct sunxi_drm_encoder *senc); 38 bool (*conn_is_supported)(struct sunxi_drm_encoder *senc, 39 struct sunxi_drm_connector *sconn); 40 }; 41 42 #define to_sunxi_encoder(x) (container_of(x, struct sunxi_drm_encoder, encoder)) 43 44 unsigned int sunxi_drm_encoder_get_count(void); 45 ssize_t sunxi_drm_encoder_show(char *buf, struct drm_device *dev); 46 47 int sunxi_drm_encoder_init(struct drm_device *dev); 48 void sunxi_drm_encoder_exit(struct drm_device *dev); 49 #endif 50