Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | /* SPDX-License-Identifier: GPL-2.0+ */ /* * Copyright (C) 2015 Google, Inc * Written by Simon Glass <sjg@chromium.org> */ #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); /** * get_display_timing() - Get display timings from bridge. * * @dev: Bridge device containing the linked display timings * @tim: Place to put timings * @return 0 if OK, -ve on error * * This call it totally optional and useful mainly for integrated * bridges with fixed output device. */ int (*get_display_timing)(struct udevice *dev, struct display_timing *timing); /** * read_edid() - Read information from EDID * * @dev: Device to read from * @buf: Buffer to read into * @buf_size: Buffer size * @return number of bytes read, <=0 for error */ int (*read_edid)(struct udevice *dev, u8 *buf, int buf_size); }; #define video_bridge_get_ops(dev) \ ((struct video_bridge_ops *)(dev)->driver->ops) #if CONFIG_IS_ENABLED(VIDEO_BRIDGE) /** * 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); /** * video_bridge_get_display_timing() - Get display timings from bridge. * * @dev: Bridge device containing the linked display timings * Return: 0 if OK, -ve on error */ int video_bridge_get_display_timing(struct udevice *dev, struct display_timing *timing); /** * video_bridge_read_edid() - Read information from EDID * * @dev: Device to read from * @buf: Buffer to read into * @buf_size: Buffer size * Return: number of bytes read, <=0 for error */ int video_bridge_read_edid(struct udevice *dev, u8 *buf, int buf_size); #else static inline int video_bridge_attach(struct udevice *dev) { return -ENOSYS; } static inline int video_bridge_set_backlight(struct udevice *dev, int percent) { return -ENOSYS; } static inline int video_bridge_set_active(struct udevice *dev, bool active) { return -ENOSYS; } static inline int video_bridge_check_attached(struct udevice *dev) { return -ENOSYS; } static inline int video_bridge_get_display_timing(struct udevice *dev, struct display_timing *timing) { return -ENOSYS; } static inline int video_bridge_read_edid(struct udevice *dev, u8 *buf, int buf_size) { return -ENOSYS; } #endif /* CONFIG_VIDEO_BRIDGE */ #endif |