diff options
author | Simon Glass <sjg@chromium.org> | 2015-07-02 18:16:08 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-08-05 21:06:13 -0600 |
commit | 801ab9e93c228b30bb526bb1b431e042d46ba2e8 (patch) | |
tree | 36662fffee086bb94a7346e41a3c8b65c18da7a7 /include/video_bridge.h | |
parent | 224d1ddcc5fa18d88e2c735778c39b8df61016ea (diff) | |
download | u-boot-801ab9e93c228b30bb526bb1b431e042d46ba2e8.tar.gz |
dm: video: Add support for video bridges
A video bridge typically converts video from one format to another, e.g.
DisplayPort to LVDS. Add driver model support for these with a simple
interface to control activation and backlight. The uclass supports GPIO
control of power and reset lines.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/video_bridge.h')
-rw-r--r-- | include/video_bridge.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/include/video_bridge.h b/include/video_bridge.h new file mode 100644 index 0000000000..c7b8681849 --- /dev/null +++ b/include/video_bridge.h @@ -0,0 +1,92 @@ +/* + * Copyright (C) 2015 Google, Inc + * Written by Simon Glass <sjg@chromium.org> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __VIDEO_BRIDGE +#define __VIDEO_BRIDGE + +#include <asm/gpio.h> + +/** + * struct video_bridge_priv - uclass information for video bridges + * + * @sleep: GPIO to assert to power down the bridge + * @reset: GPIO to assert to reset the bridge + * @hotplug: Optional GPIO to check if bridge is connected + */ +struct video_bridge_priv { + struct gpio_desc sleep; + struct gpio_desc reset; + struct gpio_desc hotplug; +}; + +/** + * Operations for video bridges + */ +struct video_bridge_ops { + /** + * attach() - attach a video bridge + * + * @return 0 if OK, -ve on error + */ + int (*attach)(struct udevice *dev); + + /** + * check_attached() - check if a bridge is correctly attached + * + * This method is optional - if not provided then the hotplug GPIO + * will be checked instead. + * + * @dev: Device to check + * @return 0 if attached, -EENOTCONN if not, or other -ve error + */ + int (*check_attached)(struct udevice *dev); + + /** + * set_backlight() - Set the backlight brightness + * + * @dev: device to adjust + * @percent: brightness percentage (0=off, 100=full brightness) + * @return 0 if OK, -ve on error + */ + int (*set_backlight)(struct udevice *dev, int percent); +}; + +#define video_bridge_get_ops(dev) \ + ((struct video_bridge_ops *)(dev)->driver->ops) + +/** + * video_bridge_attach() - attach a video bridge + * + * @return 0 if OK, -ve on error + */ +int video_bridge_attach(struct udevice *dev); + +/** + * video_bridge_set_backlight() - Set the backlight brightness + * + * @percent: brightness percentage (0=off, 100=full brightness) + * @return 0 if OK, -ve on error + */ +int video_bridge_set_backlight(struct udevice *dev, int percent); + +/** + * video_bridge_set_active() - take the bridge in/out of reset/powerdown + * + * @dev: Device to adjust + * @active: true to power up and reset, false to power down + */ +int video_bridge_set_active(struct udevice *dev, bool active); + +/** + * check_attached() - check if a bridge is correctly attached + * + * @dev: Device to check + * @return 0 if attached, -EENOTCONN if not, or other -ve error + */ +int video_bridge_check_attached(struct udevice *dev); + +#endif |