linux/drivers/video/fbdev/smscufx.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * smscufx.c -- Framebuffer driver for SMSC UFX USB controller
 *
 * Copyright (C) 2011 Steve Glendinning <[email protected]>
 * Copyright (C) 2009 Roberto De Ioris <[email protected]>
 * Copyright (C) 2009 Jaya Kumar <[email protected]>
 * Copyright (C) 2009 Bernie Thompson <[email protected]>
 *
 * Based on udlfb, with work from Florian Echtler, Henrik Bjerregaard Pedersen,
 * and others.
 *
 * Works well with Bernie Thompson's X DAMAGE patch to xf86-video-fbdev
 * available from http://git.plugable.com
 *
 * Layout is based on skeletonfb by James Simmons and Geert Uytterhoeven,
 * usb-skeleton by GregKH.
 */

#define pr_fmt(fmt)

#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/usb.h>
#include <linux/uaccess.h>
#include <linux/mm.h>
#include <linux/fb.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include "edid.h"

#define check_warn(status, fmt, args...)

#define check_warn_return(status, fmt, args...)

#define check_warn_goto_error(status, fmt, args...)

#define all_bits_set(x, bits)

#define USB_VENDOR_REQUEST_WRITE_REGISTER
#define USB_VENDOR_REQUEST_READ_REGISTER

/*
 * TODO: Propose standard fb.h ioctl for reporting damage,
 * using _IOWR() and one of the existing area structs from fb.h
 * Consider these ioctls deprecated, but they're still used by the
 * DisplayLink X server as yet - need both to be modified in tandem
 * when new ioctl(s) are ready.
 */
#define UFX_IOCTL_RETURN_EDID
#define UFX_IOCTL_REPORT_DAMAGE

/* -BULK_SIZE as per usb-skeleton. Can we get full page and avoid overhead? */
#define BULK_SIZE
#define MAX_TRANSFER
#define WRITES_IN_FLIGHT

#define GET_URB_TIMEOUT
#define FREE_URB_TIMEOUT

#define BPP

#define UFX_DEFIO_WRITE_DELAY
#define UFX_DEFIO_WRITE_DISABLE

struct dloarea {};

struct urb_node {};

struct urb_list {};

struct ufx_data {};

static struct fb_fix_screeninfo ufx_fix =;

static const u32 smscufx_info_flags =;

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

/* module options */
static bool console;   /* Optionally allow fbcon to consume first framebuffer */
static bool fb_defio =;  /* Optionally enable fb_defio mmap support */

/* ufx keeps a list of urbs for efficient bulk transfers */
static void ufx_urb_completion(struct urb *urb);
static struct urb *ufx_get_urb(struct ufx_data *dev);
static int ufx_submit_urb(struct ufx_data *dev, struct urb * urb, size_t len);
static int ufx_alloc_urb_list(struct ufx_data *dev, int count, size_t size);
static void ufx_free_urb_list(struct ufx_data *dev);

static DEFINE_MUTEX(disconnect_mutex);

/* reads a control register */
static int ufx_reg_read(struct ufx_data *dev, u32 index, u32 *data)
{}

/* writes a control register */
static int ufx_reg_write(struct ufx_data *dev, u32 index, u32 data)
{}

static int ufx_reg_clear_and_set_bits(struct ufx_data *dev, u32 index,
	u32 bits_to_clear, u32 bits_to_set)
{}

static int ufx_reg_set_bits(struct ufx_data *dev, u32 index, u32 bits)
{}

static int ufx_reg_clear_bits(struct ufx_data *dev, u32 index, u32 bits)
{}

static int ufx_lite_reset(struct ufx_data *dev)
{}

/* If display is unblanked, then blank it */
static int ufx_blank(struct ufx_data *dev, bool wait)
{}

/* If display is blanked, then unblank it */
static int ufx_unblank(struct ufx_data *dev, bool wait)
{}

/* If display is enabled, then disable it */
static int ufx_disable(struct ufx_data *dev, bool wait)
{}

/* If display is disabled, then enable it */
static int ufx_enable(struct ufx_data *dev, bool wait)
{}

static int ufx_config_sys_clk(struct ufx_data *dev)
{}

static int ufx_config_ddr2(struct ufx_data *dev)
{}

struct pll_values {};

static u32 ufx_calc_range(u32 ref_freq)
{}

/* calculates PLL divider settings for a desired target frequency */
static void ufx_calc_pll_values(const u32 clk_pixel_pll, struct pll_values *asic_pll)
{}

/* sets analog bit PLL configuration values */
static int ufx_config_pix_clk(struct ufx_data *dev, u32 pixclock)
{}

static int ufx_set_vid_mode(struct ufx_data *dev, struct fb_var_screeninfo *var)
{}

static int ufx_ops_mmap(struct fb_info *info, struct vm_area_struct *vma)
{}

static void ufx_raw_rect(struct ufx_data *dev, u16 *cmd, int x, int y,
	int width, int height)
{}

static int ufx_handle_damage(struct ufx_data *dev, int x, int y,
	int width, int height)
{}

/* NOTE: fb_defio.c is holding info->fbdefio.mutex
 *   Touching ANY framebuffer memory that triggers a page fault
 *   in fb_defio will cause a deadlock, when it also tries to
 *   grab the same mutex. */
static void ufx_dpy_deferred_io(struct fb_info *info, struct list_head *pagereflist)
{}

static int ufx_ops_ioctl(struct fb_info *info, unsigned int cmd,
			 unsigned long arg)
{}

/* taken from vesafb */
static int
ufx_ops_setcolreg(unsigned regno, unsigned red, unsigned green,
	       unsigned blue, unsigned transp, struct fb_info *info)
{}

/* It's common for several clients to have framebuffer open simultaneously.
 * e.g. both fbcon and X. Makes things interesting.
 * Assumes caller is holding info->lock (for open and release at least) */
static int ufx_ops_open(struct fb_info *info, int user)
{}

/*
 * Called when all client interfaces to start transactions have been disabled,
 * and all references to our device instance (ufx_data) are released.
 * Every transaction must have a reference, so we know are fully spun down
 */
static void ufx_free(struct kref *kref)
{}

static void ufx_ops_destory(struct fb_info *info)
{}


static void ufx_release_urb_work(struct work_struct *work)
{}

static void ufx_free_framebuffer(struct ufx_data *dev)
{}

/*
 * Assumes caller is holding info->lock mutex (for open and release at least)
 */
static int ufx_ops_release(struct fb_info *info, int user)
{}

/* Check whether a video mode is supported by the chip
 * We start from monitor's modes, so don't need to filter that here */
static int ufx_is_valid_mode(struct fb_videomode *mode,
		struct fb_info *info)
{}

static void ufx_var_color_format(struct fb_var_screeninfo *var)
{}

static int ufx_ops_check_var(struct fb_var_screeninfo *var,
				struct fb_info *info)
{}

static int ufx_ops_set_par(struct fb_info *info)
{}

/* In order to come back from full DPMS off, we need to set the mode again */
static int ufx_ops_blank(int blank_mode, struct fb_info *info)
{}

static void ufx_ops_damage_range(struct fb_info *info, off_t off, size_t len)
{}

static void ufx_ops_damage_area(struct fb_info *info, u32 x, u32 y, u32 width, u32 height)
{}

FB_GEN_DEFAULT_DEFERRED_SYSMEM_OPS(ufx_ops,
				   ufx_ops_damage_range,
				   ufx_ops_damage_area)

static const struct fb_ops ufx_ops =;

/* Assumes &info->lock held by caller
 * Assumes no active clients have framebuffer open */
static int ufx_realloc_framebuffer(struct ufx_data *dev, struct fb_info *info)
{}

/* sets up DDC channel for 100 Kbps, std. speed, 7-bit addr, controller mode,
 * restart enabled, but no start byte, enable controller */
static int ufx_i2c_init(struct ufx_data *dev)
{}

/* sets the I2C port mux and target address */
static int ufx_i2c_configure(struct ufx_data *dev)
{}

/* wait for BUSY to clear, with a timeout of 50ms with 10ms sleeps. if no
 * monitor is connected, there is no error except for timeout */
static int ufx_i2c_wait_busy(struct ufx_data *dev)
{}

/* reads a 128-byte EDID block from the currently selected port and TAR */
static int ufx_read_edid(struct ufx_data *dev, u8 *edid, int edid_len)
{}

/* 1) use sw default
 * 2) Parse into various fb_info structs
 * 3) Allocate virtual framebuffer memory to back highest res mode
 *
 * Parses EDID into three places used by various parts of fbdev:
 * fb_var_screeninfo contains the timing of the monitor's preferred mode
 * fb_info.monspecs is full parsed EDID info, including monspecs.modedb
 * fb_info.modelist is a linked list of all monitor & VESA modes which work
 *
 * If EDID is not readable/valid, then modelist is all VESA modes,
 * monspecs is NULL, and fb_var_screeninfo is set to safe VESA mode
 * Returns 0 if successful */
static int ufx_setup_modes(struct ufx_data *dev, struct fb_info *info,
	char *default_edid, size_t default_edid_size)
{}

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

static void ufx_usb_disconnect(struct usb_interface *interface)
{}

static struct usb_driver ufx_driver =;

module_usb_driver();

static void ufx_urb_completion(struct urb *urb)
{}

static void ufx_free_urb_list(struct ufx_data *dev)
{}

static int ufx_alloc_urb_list(struct ufx_data *dev, int count, size_t size)
{}

static struct urb *ufx_get_urb(struct ufx_data *dev)
{}

static int ufx_submit_urb(struct ufx_data *dev, struct urb *urb, size_t len)
{}

module_param(console, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
MODULE_PARM_DESC();

module_param(fb_defio, bool, S_IWUSR | S_IRUSR | S_IWGRP | S_IRGRP);
MODULE_PARM_DESC();

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