Simon Glass | 040b046 | 2023-08-14 16:40:25 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
| 2 | /* |
| 3 | * Copyright 2023 Google LLC |
| 4 | * Written by Simon Glass <sjg@chromium.org> |
| 5 | */ |
| 6 | |
| 7 | #ifndef __CEDIT_H |
| 8 | #define __CEDIT_H |
| 9 | |
Simon Glass | 2dee81f | 2023-08-14 16:40:33 -0600 | [diff] [blame^] | 10 | struct abuf; |
Simon Glass | 040b046 | 2023-08-14 16:40:25 -0600 | [diff] [blame] | 11 | struct expo; |
Simon Glass | 8d0f890 | 2023-08-14 16:40:27 -0600 | [diff] [blame] | 12 | struct scene; |
Simon Glass | 040b046 | 2023-08-14 16:40:25 -0600 | [diff] [blame] | 13 | struct video_priv; |
| 14 | |
Simon Glass | 2dee81f | 2023-08-14 16:40:33 -0600 | [diff] [blame^] | 15 | enum { |
| 16 | /* size increment for writing FDT */ |
| 17 | CEDIT_SIZE_INC = 1024, |
| 18 | }; |
| 19 | |
| 20 | /* Name of the cedit node in the devicetree */ |
| 21 | #define CEDIT_NODE_NAME "cedit-values" |
| 22 | |
| 23 | extern struct expo *cur_exp; |
| 24 | |
Simon Glass | 040b046 | 2023-08-14 16:40:25 -0600 | [diff] [blame] | 25 | /** |
| 26 | * cedit_arange() - Arrange objects in a configuration-editor scene |
| 27 | * |
| 28 | * @exp: Expo to update |
| 29 | * @vid_priv: Private info of the video device |
| 30 | * @scene_id: scene ID to arrange |
| 31 | * Returns: 0 if OK, -ve on error |
| 32 | */ |
| 33 | int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id); |
| 34 | |
| 35 | /** |
| 36 | * cedit_run() - Run a configuration editor |
| 37 | * |
| 38 | * This accepts input until the user quits with Escape |
| 39 | * |
| 40 | * @exp: Expo to use |
| 41 | * Returns: 0 if OK, -ve on error |
| 42 | */ |
| 43 | int cedit_run(struct expo *exp); |
| 44 | |
Simon Glass | 8d0f890 | 2023-08-14 16:40:27 -0600 | [diff] [blame] | 45 | /** |
| 46 | * cedit_prepare() - Prepare to run a cedit |
| 47 | * |
| 48 | * Set up the video device, select the first scene and highlight the first item. |
| 49 | * This ensures that all menus have a selected item. |
| 50 | * |
| 51 | * @exp: Expo to use |
| 52 | * @vid_privp: Set to private data for the video device |
| 53 | * @scnp: Set to the first scene |
| 54 | * Return: scene ID of first scene if OK, -ve on error |
| 55 | */ |
| 56 | int cedit_prepare(struct expo *exp, struct video_priv **vid_privp, |
| 57 | struct scene **scnp); |
| 58 | |
Simon Glass | 2dee81f | 2023-08-14 16:40:33 -0600 | [diff] [blame^] | 59 | /** |
| 60 | * cedit_write_settings() - Write settings in FDT format |
| 61 | * |
| 62 | * Sets up an FDT with the settings |
| 63 | * |
| 64 | * @exp: Expo to write settings from |
| 65 | * @buf: Returns abuf containing the settings FDT (inited by this function) |
| 66 | * Return: 0 if OK, -ve on error |
| 67 | */ |
| 68 | int cedit_write_settings(struct expo *exp, struct abuf *buf); |
| 69 | |
Simon Glass | 040b046 | 2023-08-14 16:40:25 -0600 | [diff] [blame] | 70 | #endif /* __CEDIT_H */ |