2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2015-04-15 03:03:38 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2014 Google Inc.
|
|
|
|
*/
|
|
|
|
|
2016-01-22 02:45:00 +00:00
|
|
|
#ifndef _DISPLAY_H
|
|
|
|
#define _DISPLAY_H
|
2015-04-15 03:03:38 +00:00
|
|
|
|
|
|
|
struct udevice;
|
|
|
|
struct display_timing;
|
|
|
|
|
|
|
|
/**
|
2016-01-22 02:45:00 +00:00
|
|
|
* Display uclass platform data for each device
|
|
|
|
*
|
|
|
|
* @source_id: ID for the source of the display data, typically a video
|
|
|
|
* controller
|
|
|
|
* @src_dev: Source device providing the video
|
2016-11-13 21:22:07 +00:00
|
|
|
* @in_use: Display is being used
|
2016-01-22 02:45:00 +00:00
|
|
|
*/
|
|
|
|
struct display_plat {
|
|
|
|
int source_id;
|
|
|
|
struct udevice *src_dev;
|
2016-11-13 21:22:07 +00:00
|
|
|
bool in_use;
|
2016-01-22 02:45:00 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2016-03-14 03:20:14 +00:00
|
|
|
* display_read_timing() - Read timing information
|
2015-04-15 03:03:38 +00:00
|
|
|
*
|
|
|
|
* @dev: Device to read from
|
2016-01-22 02:45:00 +00:00
|
|
|
* @return 0 if OK, -ve on error
|
2015-04-15 03:03:38 +00:00
|
|
|
*/
|
2016-01-22 02:45:00 +00:00
|
|
|
int display_read_timing(struct udevice *dev, struct display_timing *timing);
|
2015-04-15 03:03:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* display_port_enable() - Enable a display port device
|
|
|
|
*
|
|
|
|
* @dev: Device to enable
|
|
|
|
* @panel_bpp: Number of bits per pixel for panel
|
|
|
|
* @timing: Display timings
|
|
|
|
* @return 0 if OK, -ve on error
|
|
|
|
*/
|
2016-01-22 02:45:00 +00:00
|
|
|
int display_enable(struct udevice *dev, int panel_bpp,
|
|
|
|
const struct display_timing *timing);
|
2015-04-15 03:03:38 +00:00
|
|
|
|
2016-11-13 21:22:07 +00:00
|
|
|
/**
|
|
|
|
* display_in_use() - Check if a display is in use by any device
|
|
|
|
*
|
|
|
|
* @return true if the device is in use (display_enable() has been called
|
|
|
|
* successfully), else false
|
|
|
|
*/
|
|
|
|
bool display_in_use(struct udevice *dev);
|
|
|
|
|
2016-01-22 02:45:00 +00:00
|
|
|
struct dm_display_ops {
|
2016-03-14 03:20:14 +00:00
|
|
|
/**
|
|
|
|
* read_timing() - Read information directly
|
|
|
|
*
|
|
|
|
* @dev: Device to read from
|
|
|
|
* @timing: Display timings
|
|
|
|
* @return 0 if OK, -ve on error
|
|
|
|
*/
|
|
|
|
int (*read_timing)(struct udevice *dev, struct display_timing *timing);
|
|
|
|
|
2015-04-15 03:03:38 +00:00
|
|
|
/**
|
|
|
|
* read_edid() - Read information from EDID
|
|
|
|
*
|
|
|
|
* @dev: Device to read from
|
|
|
|
* @buf: Buffer to read into (should be EDID_SIZE bytes)
|
|
|
|
* @buf_size: Buffer size (should be EDID_SIZE)
|
|
|
|
* @return number of bytes read, <=0 for error
|
|
|
|
*/
|
|
|
|
int (*read_edid)(struct udevice *dev, u8 *buf, int buf_size);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* enable() - Enable the display port device
|
|
|
|
*
|
|
|
|
* @dev: Device to enable
|
|
|
|
* @panel_bpp: Number of bits per pixel for panel
|
|
|
|
* @timing: Display timings
|
|
|
|
* @return 0 if OK, -ve on error
|
|
|
|
*/
|
|
|
|
int (*enable)(struct udevice *dev, int panel_bpp,
|
|
|
|
const struct display_timing *timing);
|
2019-07-04 13:52:07 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* mode_valid() - Check if mode is supported
|
|
|
|
*
|
|
|
|
* @dev: Device to enable
|
|
|
|
* @timing: Display timings
|
|
|
|
* @return true if supported, false if not
|
|
|
|
*/
|
|
|
|
bool (*mode_valid)(struct udevice *dev,
|
|
|
|
const struct display_timing *timing);
|
2015-04-15 03:03:38 +00:00
|
|
|
};
|
|
|
|
|
2016-01-22 02:45:00 +00:00
|
|
|
#define display_get_ops(dev) ((struct dm_display_ops *)(dev)->driver->ops)
|
2015-04-15 03:03:38 +00:00
|
|
|
|
|
|
|
#endif
|