mipi_dsi_northwest.h 2.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
/*
 * Copyright (C) 2016 Freescale Semiconductor, Inc. All Rights Reserved.
 * Copyright 2017 NXP
 *
 * SPDX-License-Identifier:	GPL-2.0+
 */


#ifndef __MIPI_DSI_NORTHWEST_H
#define __MIPI_DSI_NORTHWEST_H

#include <linux/fb.h>

#define	DSI_CMD_BUF_MAXSIZE         (128)

/*
 * device structure for mipi-dsi based lcd panel.
 *
 * @name: name of the device to use with this device,
 *    the name will be used for binding driver.
 * @mode: video mode parameters for the panel.
 * @bpp:  bits per pixel. only 24 bits is supported.
 * @virtual_ch_id: virtual channel id for this dsi device.
 * @data_lane_num:  the data lane number, max is 2.
 * @host: pointer to the host driver instance, will be setup
 *    during register device.
 */
struct mipi_dsi_northwest_panel_device {
	const char			*name;
	struct fb_videomode mode;
	int				 bpp;
	u32				 virtual_ch_id;
	u32				 data_lane_num;

	struct mipi_dsi_northwest_info *host;
};


/*
 * driver structure for mipi-dsi based lcd panel.
 *
 * this structure should be registered by lcd panel driver.
 * mipi-dsi driver seeks lcd panel registered through name field
 * and calls these callback functions in appropriate time.
 *
 * @name: name of the driver to use with this device, or an
 *	alias for that name.
 * @mipi_panel_setup: callback pointer for initializing lcd panel based on mipi
 *	dsi interface.
 */
struct mipi_dsi_northwest_panel_driver {
	const char			*name;

	int	(*mipi_panel_setup)(struct mipi_dsi_northwest_panel_device *panel_dev);
};

/*
 * mipi-dsi northwest driver information structure, holds useful data for the driver.
 */
struct mipi_dsi_northwest_info {
	u32			mmio_base;
	u32			sim_base;
	int			enabled;
	struct mipi_dsi_northwest_panel_device *dsi_panel_dev;
	struct mipi_dsi_northwest_panel_driver *dsi_panel_drv;

	int (*mipi_dsi_pkt_write)(struct mipi_dsi_northwest_info *mipi_dsi,
			u8 data_type, const u32 *buf, int len);
};

/* Setup mipi dsi host driver instance, with base address and SIM address provided */
int mipi_dsi_northwest_setup(u32 base_addr, u32 sim_addr);

/* Create a LCD panel device, will search the panel driver to bind with them */
int mipi_dsi_northwest_register_panel_device(struct mipi_dsi_northwest_panel_device *panel_dev);

/* Register a LCD panel driver, will search the panel device to bind with them */
int mipi_dsi_northwest_register_panel_driver(struct mipi_dsi_northwest_panel_driver *panel_drv);

/* Enable the mipi dsi display */
int mipi_dsi_northwest_enable(void);

/* Disable and shutdown the mipi dsi display */
int mipi_dsi_northwest_shutdown(void);

void hx8363_init(void);

#endif