1*9f09e317SLiu Ying /* SPDX-License-Identifier: GPL-2.0+ */ 2*9f09e317SLiu Ying /* 3*9f09e317SLiu Ying * Copyright 2024 NXP 4*9f09e317SLiu Ying */ 5*9f09e317SLiu Ying 6*9f09e317SLiu Ying #ifndef __DC_DRV_H__ 7*9f09e317SLiu Ying #define __DC_DRV_H__ 8*9f09e317SLiu Ying 9*9f09e317SLiu Ying #include <linux/ioport.h> 10*9f09e317SLiu Ying #include <linux/platform_device.h> 11*9f09e317SLiu Ying #include <linux/types.h> 12*9f09e317SLiu Ying 13*9f09e317SLiu Ying #include <drm/drm_device.h> 14*9f09e317SLiu Ying 15*9f09e317SLiu Ying #include "dc-de.h" 16*9f09e317SLiu Ying 17*9f09e317SLiu Ying /** 18*9f09e317SLiu Ying * struct dc_drm_device - DC specific drm_device 19*9f09e317SLiu Ying */ 20*9f09e317SLiu Ying struct dc_drm_device { 21*9f09e317SLiu Ying /** @base: base drm_device structure */ 22*9f09e317SLiu Ying struct drm_device base; 23*9f09e317SLiu Ying /** @de: display engine list */ 24*9f09e317SLiu Ying struct dc_de *de[DC_DISPLAYS]; 25*9f09e317SLiu Ying /** @fg: framegen list */ 26*9f09e317SLiu Ying struct dc_fg *fg[DC_DISPLAYS]; 27*9f09e317SLiu Ying /** @tc: tcon list */ 28*9f09e317SLiu Ying struct dc_tc *tc[DC_DISPLAYS]; 29*9f09e317SLiu Ying }; 30*9f09e317SLiu Ying 31*9f09e317SLiu Ying struct dc_subdev_info { 32*9f09e317SLiu Ying resource_size_t reg_start; 33*9f09e317SLiu Ying int id; 34*9f09e317SLiu Ying }; 35*9f09e317SLiu Ying 36*9f09e317SLiu Ying extern struct platform_driver dc_de_driver; 37*9f09e317SLiu Ying extern struct platform_driver dc_fg_driver; 38*9f09e317SLiu Ying extern struct platform_driver dc_tc_driver; 39*9f09e317SLiu Ying 40*9f09e317SLiu Ying static inline int dc_subdev_get_id(const struct dc_subdev_info *info, 41*9f09e317SLiu Ying int info_cnt, struct resource *res) 42*9f09e317SLiu Ying { 43*9f09e317SLiu Ying int i; 44*9f09e317SLiu Ying 45*9f09e317SLiu Ying if (!res) 46*9f09e317SLiu Ying return -EINVAL; 47*9f09e317SLiu Ying 48*9f09e317SLiu Ying for (i = 0; i < info_cnt; i++) 49*9f09e317SLiu Ying if (info[i].reg_start == res->start) 50*9f09e317SLiu Ying return info[i].id; 51*9f09e317SLiu Ying 52*9f09e317SLiu Ying return -EINVAL; 53*9f09e317SLiu Ying } 54*9f09e317SLiu Ying 55*9f09e317SLiu Ying void dc_de_post_bind(struct dc_drm_device *dc_drm); 56*9f09e317SLiu Ying 57*9f09e317SLiu Ying #endif /* __DC_DRV_H__ */ 58