1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (C) 2015 Google, Inc
4 * Written by Simon Glass <sjg@chromium.org>
13 * struct video_bridge_priv - uclass information for video bridges
15 * @sleep: GPIO to assert to power down the bridge
16 * @reset: GPIO to assert to reset the bridge
17 * @hotplug: Optional GPIO to check if bridge is connected
19 struct video_bridge_priv {
20 struct gpio_desc sleep;
21 struct gpio_desc reset;
22 struct gpio_desc hotplug;
26 * Operations for video bridges
28 struct video_bridge_ops {
30 * attach() - attach a video bridge
32 * @return 0 if OK, -ve on error
34 int (*attach)(struct udevice *dev);
37 * check_attached() - check if a bridge is correctly attached
39 * This method is optional - if not provided then the hotplug GPIO
40 * will be checked instead.
42 * @dev: Device to check
43 * @return 0 if attached, -EENOTCONN if not, or other -ve error
45 int (*check_attached)(struct udevice *dev);
48 * set_backlight() - Set the backlight brightness
50 * @dev: device to adjust
51 * @percent: brightness percentage (0=off, 100=full brightness)
52 * @return 0 if OK, -ve on error
54 int (*set_backlight)(struct udevice *dev, int percent);
57 * read_edid() - Read information from EDID
59 * @dev: Device to read from
60 * @buf: Buffer to read into
61 * @buf_size: Buffer size
62 * @return number of bytes read, <=0 for error
64 int (*read_edid)(struct udevice *dev, u8 *buf, int buf_size);
67 #define video_bridge_get_ops(dev) \
68 ((struct video_bridge_ops *)(dev)->driver->ops)
71 * video_bridge_attach() - attach a video bridge
73 * @return 0 if OK, -ve on error
75 int video_bridge_attach(struct udevice *dev);
78 * video_bridge_set_backlight() - Set the backlight brightness
80 * @percent: brightness percentage (0=off, 100=full brightness)
81 * @return 0 if OK, -ve on error
83 int video_bridge_set_backlight(struct udevice *dev, int percent);
86 * video_bridge_set_active() - take the bridge in/out of reset/powerdown
88 * @dev: Device to adjust
89 * @active: true to power up and reset, false to power down
91 int video_bridge_set_active(struct udevice *dev, bool active);
94 * check_attached() - check if a bridge is correctly attached
96 * @dev: Device to check
97 * @return 0 if attached, -EENOTCONN if not, or other -ve error
99 int video_bridge_check_attached(struct udevice *dev);
102 * video_bridge_read_edid() - Read information from EDID
104 * @dev: Device to read from
105 * @buf: Buffer to read into
106 * @buf_size: Buffer size
107 * @return number of bytes read, <=0 for error
109 int video_bridge_read_edid(struct udevice *dev, u8 *buf, int buf_size);