108 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2#ifndef SH_MOBILE_LCDCFB_H3#define SH_MOBILE_LCDCFB_H4 5#include <linux/completion.h>6#include <linux/fb.h>7#include <linux/mutex.h>8#include <linux/wait.h>9 10/* per-channel registers */11enum { LDDCKPAT1R, LDDCKPAT2R, LDMT1R, LDMT2R, LDMT3R, LDDFR, LDSM1R,12 LDSM2R, LDSA1R, LDSA2R, LDMLSR, LDHCNR, LDHSYNR, LDVLNR, LDVSYNR, LDPMR,13 LDHAJR,14 NR_CH_REGS };15 16#define PALETTE_NR 1617 18struct backlight_device;19struct fb_info;20struct module;21struct sh_mobile_lcdc_chan;22struct sh_mobile_lcdc_entity;23struct sh_mobile_lcdc_format_info;24struct sh_mobile_lcdc_priv;25 26#define SH_MOBILE_LCDC_DISPLAY_DISCONNECTED 027#define SH_MOBILE_LCDC_DISPLAY_CONNECTED 128 29struct sh_mobile_lcdc_entity_ops {30 /* Display */31 int (*display_on)(struct sh_mobile_lcdc_entity *entity);32 void (*display_off)(struct sh_mobile_lcdc_entity *entity);33};34 35enum sh_mobile_lcdc_entity_event {36 SH_MOBILE_LCDC_EVENT_DISPLAY_CONNECT,37 SH_MOBILE_LCDC_EVENT_DISPLAY_DISCONNECT,38 SH_MOBILE_LCDC_EVENT_DISPLAY_MODE,39};40 41struct sh_mobile_lcdc_entity {42 struct module *owner;43 const struct sh_mobile_lcdc_entity_ops *ops;44 struct sh_mobile_lcdc_chan *lcdc;45 struct fb_videomode def_mode;46};47 48/*49 * struct sh_mobile_lcdc_chan - LCDC display channel50 *51 * @pan_y_offset: Panning linear offset in bytes (luma component)52 * @base_addr_y: Frame buffer viewport base address (luma component)53 * @base_addr_c: Frame buffer viewport base address (chroma component)54 * @pitch: Frame buffer line pitch55 */56struct sh_mobile_lcdc_chan {57 struct sh_mobile_lcdc_priv *lcdc;58 struct sh_mobile_lcdc_entity *tx_dev;59 const struct sh_mobile_lcdc_chan_cfg *cfg;60 61 unsigned long *reg_offs;62 unsigned long ldmt1r_value;63 unsigned long enabled; /* ME and SE in LDCNT2R */64 65 struct mutex open_lock; /* protects the use counter */66 int use_count;67 68 void *fb_mem;69 unsigned long fb_size;70 71 dma_addr_t dma_handle;72 unsigned long pan_y_offset;73 74 unsigned long frame_end;75 wait_queue_head_t frame_end_wait;76 struct completion vsync_completion;77 78 const struct sh_mobile_lcdc_format_info *format;79 u32 colorspace;80 unsigned int xres;81 unsigned int xres_virtual;82 unsigned int yres;83 unsigned int yres_virtual;84 unsigned int pitch;85 86 unsigned long base_addr_y;87 unsigned long base_addr_c;88 unsigned int line_size;89 90 /* Backlight */91 struct backlight_device *bl;92 unsigned int bl_brightness;93 94 /* FB */95 struct fb_info *info;96 u32 pseudo_palette[PALETTE_NR];97 struct {98 unsigned int width;99 unsigned int height;100 struct fb_videomode mode;101 } display;102 struct fb_deferred_io defio;103 struct scatterlist *sglist;104 int blank_status;105};106 107#endif108