blob: 6086e302006279559cd2d54942781eb48878b086 [file] [log] [blame]
Simon Glass040b0462023-08-14 16:40:25 -06001/* 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 Glass2dee81f2023-08-14 16:40:33 -060010struct abuf;
Simon Glass040b0462023-08-14 16:40:25 -060011struct expo;
Simon Glass8d0f8902023-08-14 16:40:27 -060012struct scene;
Simon Glass040b0462023-08-14 16:40:25 -060013struct video_priv;
14
Simon Glass2dee81f2023-08-14 16:40:33 -060015enum {
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
23extern struct expo *cur_exp;
24
Simon Glass040b0462023-08-14 16:40:25 -060025/**
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 */
33int 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 */
43int cedit_run(struct expo *exp);
44
Simon Glass8d0f8902023-08-14 16:40:27 -060045/**
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 */
56int cedit_prepare(struct expo *exp, struct video_priv **vid_privp,
57 struct scene **scnp);
58
Simon Glass2dee81f2023-08-14 16:40:33 -060059/**
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 */
68int cedit_write_settings(struct expo *exp, struct abuf *buf);
69
Simon Glass040b0462023-08-14 16:40:25 -060070#endif /* __CEDIT_H */