1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * 4 * (C) COPYRIGHT 2012-2013 ARM Limited. All rights reserved. 5 * 6 * Parts of this file were based on sources as follows: 7 * 8 * Copyright (c) 2006-2008 Intel Corporation 9 * Copyright (c) 2007 Dave Airlie <airlied@linux.ie> 10 * Copyright (C) 2011 Texas Instruments 11 */ 12 13 #ifndef _PL111_DRM_H_ 14 #define _PL111_DRM_H_ 15 16 #include <drm/drm_gem.h> 17 #include <drm/drm_simple_kms_helper.h> 18 #include <drm/drm_connector.h> 19 #include <drm/drm_encoder.h> 20 #include <drm/drm_panel.h> 21 #include <drm/drm_bridge.h> 22 #include <linux/clk-provider.h> 23 #include <linux/interrupt.h> 24 25 #define CLCD_IRQ_NEXTBASE_UPDATE BIT(2) 26 27 struct drm_minor; 28 29 /** 30 * struct pl111_variant_data - encodes IP differences 31 * @name: the name of this variant 32 * @is_pl110: this is the early PL110 variant 33 * @is_lcdc: this is the ST Microelectronics Nomadik LCDC variant 34 * @external_bgr: this is the Versatile Pl110 variant with external 35 * BGR/RGB routing 36 * @broken_clockdivider: the clock divider is broken and we need to 37 * use the supplied clock directly 38 * @broken_vblank: the vblank IRQ is broken on this variant 39 * @st_bitmux_control: this variant is using the ST Micro bitmux 40 * extensions to the control register 41 * @formats: array of supported pixel formats on this variant 42 * @nformats: the length of the array of supported pixel formats 43 * @fb_bpp: desired bits per pixel on the default framebuffer 44 */ 45 struct pl111_variant_data { 46 const char *name; 47 bool is_pl110; 48 bool is_lcdc; 49 bool external_bgr; 50 bool broken_clockdivider; 51 bool broken_vblank; 52 bool st_bitmux_control; 53 const u32 *formats; 54 unsigned int nformats; 55 unsigned int fb_bpp; 56 }; 57 58 struct pl111_drm_dev_private { 59 struct drm_device *drm; 60 61 struct drm_connector *connector; 62 struct drm_panel *panel; 63 struct drm_bridge *bridge; 64 struct drm_simple_display_pipe pipe; 65 66 void *regs; 67 u32 memory_bw; 68 u32 ienb; 69 u32 ctrl; 70 /* The pixel clock (a reference to our clock divider off of CLCDCLK). */ 71 struct clk *clk; 72 /* pl111's internal clock divider. */ 73 struct clk_hw clk_div; 74 /* Lock to sync access to CLCD_TIM2 between the common clock 75 * subsystem and pl111_display_enable(). 76 */ 77 spinlock_t tim2_lock; 78 const struct pl111_variant_data *variant; 79 void (*variant_display_enable) (struct drm_device *drm, u32 format); 80 void (*variant_display_disable) (struct drm_device *drm); 81 bool use_device_memory; 82 }; 83 84 int pl111_display_init(struct drm_device *dev); 85 irqreturn_t pl111_irq(int irq, void *data); 86 int pl111_debugfs_init(struct drm_minor *minor); 87 88 #endif /* _PL111_DRM_H_ */ 89