linux/drivers/gpu/drm/tiny/gm12u320.c

// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright 2019 Hans de Goede <[email protected]>
 */

#include <linux/module.h>
#include <linux/pm.h>
#include <linux/usb.h>

#include <drm/drm_atomic_helper.h>
#include <drm/drm_atomic_state_helper.h>
#include <drm/drm_connector.h>
#include <drm/drm_damage_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_fbdev_shmem.h>
#include <drm/drm_file.h>
#include <drm/drm_format_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_ioctl.h>
#include <drm/drm_managed.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_simple_kms_helper.h>

static bool eco_mode;
module_param(eco_mode, bool, 0644);
MODULE_PARM_DESC();

#define DRIVER_NAME
#define DRIVER_DESC
#define DRIVER_DATE
#define DRIVER_MAJOR
#define DRIVER_MINOR

/*
 * The DLP has an actual width of 854 pixels, but that is not a multiple
 * of 8, breaking things left and right, so we export a width of 848.
 */
#define GM12U320_USER_WIDTH
#define GM12U320_REAL_WIDTH
#define GM12U320_HEIGHT

#define GM12U320_BLOCK_COUNT

#define GM12U320_ERR(fmt, ...)

#define MISC_RCV_EPT
#define DATA_RCV_EPT
#define DATA_SND_EPT
#define MISC_SND_EPT

#define DATA_BLOCK_HEADER_SIZE
#define DATA_BLOCK_CONTENT_SIZE
#define DATA_BLOCK_FOOTER_SIZE
#define DATA_BLOCK_SIZE
#define DATA_LAST_BLOCK_CONTENT_SIZE
#define DATA_LAST_BLOCK_SIZE

#define CMD_SIZE
#define READ_STATUS_SIZE
#define MISC_VALUE_SIZE

#define CMD_TIMEOUT
#define DATA_TIMEOUT
#define IDLE_TIMEOUT
#define FIRST_FRAME_TIMEOUT

#define MISC_REQ_GET_SET_ECO_A
#define MISC_REQ_GET_SET_ECO_B
/* Windows driver does once every second, with arg d = 1, other args 0 */
#define MISC_REQ_UNKNOWN1_A
#define MISC_REQ_UNKNOWN1_B
/* Windows driver does this on init, with arg a, b = 0, c = 0xa0, d = 4 */
#define MISC_REQ_UNKNOWN2_A
#define MISC_REQ_UNKNOWN2_B

struct gm12u320_device {};

#define to_gm12u320(__dev)

static const char cmd_data[CMD_SIZE] =;

static const char cmd_draw[CMD_SIZE] =;

static const char cmd_misc[CMD_SIZE] =;

static const char data_block_header[DATA_BLOCK_HEADER_SIZE] =;

static const char data_last_block_header[DATA_BLOCK_HEADER_SIZE] =;

static const char data_block_footer[DATA_BLOCK_FOOTER_SIZE] =;

static inline struct usb_device *gm12u320_to_usb_device(struct gm12u320_device *gm12u320)
{}

static int gm12u320_usb_alloc(struct gm12u320_device *gm12u320)
{}

static int gm12u320_misc_request(struct gm12u320_device *gm12u320,
				 u8 req_a, u8 req_b,
				 u8 arg_a, u8 arg_b, u8 arg_c, u8 arg_d)
{}

static void gm12u320_32bpp_to_24bpp_packed(u8 *dst, u8 *src, int len)
{}

static void gm12u320_copy_fb_to_blocks(struct gm12u320_device *gm12u320)
{}

static void gm12u320_fb_update_work(struct work_struct *work)
{}

static void gm12u320_fb_mark_dirty(struct drm_framebuffer *fb,
				   const struct iosys_map *map,
				   struct drm_rect *dirty)
{}

static void gm12u320_stop_fb_update(struct gm12u320_device *gm12u320)
{}

static int gm12u320_set_ecomode(struct gm12u320_device *gm12u320)
{}

/* ------------------------------------------------------------------ */
/* gm12u320 connector						      */

/*
 * We use fake EDID info so that userspace know that it is dealing with
 * an Acer projector, rather then listing this as an "unknown" monitor.
 * Note this assumes this driver is only ever used with the Acer C120, if we
 * add support for other devices the vendor and model should be parameterized.
 */
static struct edid gm12u320_edid =;

static int gm12u320_conn_get_modes(struct drm_connector *connector)
{}

static const struct drm_connector_helper_funcs gm12u320_conn_helper_funcs =;

static const struct drm_connector_funcs gm12u320_conn_funcs =;

static int gm12u320_conn_init(struct gm12u320_device *gm12u320)
{}

/* ------------------------------------------------------------------ */
/* gm12u320 (simple) display pipe				      */

static void gm12u320_pipe_enable(struct drm_simple_display_pipe *pipe,
				 struct drm_crtc_state *crtc_state,
				 struct drm_plane_state *plane_state)
{}

static void gm12u320_pipe_disable(struct drm_simple_display_pipe *pipe)
{}

static void gm12u320_pipe_update(struct drm_simple_display_pipe *pipe,
				 struct drm_plane_state *old_state)
{}

static const struct drm_simple_display_pipe_funcs gm12u320_pipe_funcs =;

static const uint32_t gm12u320_pipe_formats[] =;

static const uint64_t gm12u320_pipe_modifiers[] =;

/*
 * FIXME: Dma-buf sharing requires DMA support by the importing device.
 *        This function is a workaround to make USB devices work as well.
 *        See todo.rst for how to fix the issue in the dma-buf framework.
 */
static struct drm_gem_object *gm12u320_gem_prime_import(struct drm_device *dev,
							struct dma_buf *dma_buf)
{}

DEFINE_DRM_GEM_FOPS(gm12u320_fops);

static const struct drm_driver gm12u320_drm_driver =;

static const struct drm_mode_config_funcs gm12u320_mode_config_funcs =;

static int gm12u320_usb_probe(struct usb_interface *interface,
			      const struct usb_device_id *id)
{}

static void gm12u320_usb_disconnect(struct usb_interface *interface)
{}

static int gm12u320_suspend(struct usb_interface *interface,
			    pm_message_t message)
{}

static int gm12u320_resume(struct usb_interface *interface)
{}

static const struct usb_device_id id_table[] =;
MODULE_DEVICE_TABLE(usb, id_table);

static struct usb_driver gm12u320_usb_driver =;

module_usb_driver();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();