]>
Commit | Line | Data |
---|---|---|
040b0468 SG |
1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
2 | /* | |
3 | * Copyright 2023 Google LLC | |
4 | * Written by Simon Glass <[email protected]> | |
5 | */ | |
6 | ||
7 | #ifndef __CEDIT_H | |
8 | #define __CEDIT_H | |
9 | ||
03de305e | 10 | #include <stdbool.h> |
472317cb | 11 | #include <dm/ofnode_decl.h> |
03de305e | 12 | #include <linux/types.h> |
472317cb | 13 | |
2dee81fe | 14 | struct abuf; |
040b0468 | 15 | struct expo; |
8d0f890a | 16 | struct scene; |
040b0468 | 17 | struct video_priv; |
03de305e | 18 | struct udevice; |
040b0468 | 19 | |
2dee81fe SG |
20 | enum { |
21 | /* size increment for writing FDT */ | |
22 | CEDIT_SIZE_INC = 1024, | |
23 | }; | |
24 | ||
25 | /* Name of the cedit node in the devicetree */ | |
26 | #define CEDIT_NODE_NAME "cedit-values" | |
27 | ||
28 | extern struct expo *cur_exp; | |
29 | ||
040b0468 SG |
30 | /** |
31 | * cedit_arange() - Arrange objects in a configuration-editor scene | |
32 | * | |
33 | * @exp: Expo to update | |
34 | * @vid_priv: Private info of the video device | |
35 | * @scene_id: scene ID to arrange | |
36 | * Returns: 0 if OK, -ve on error | |
37 | */ | |
38 | int cedit_arange(struct expo *exp, struct video_priv *vid_priv, uint scene_id); | |
39 | ||
40 | /** | |
41 | * cedit_run() - Run a configuration editor | |
42 | * | |
43 | * This accepts input until the user quits with Escape | |
44 | * | |
45 | * @exp: Expo to use | |
46 | * Returns: 0 if OK, -ve on error | |
47 | */ | |
48 | int cedit_run(struct expo *exp); | |
49 | ||
8d0f890a SG |
50 | /** |
51 | * cedit_prepare() - Prepare to run a cedit | |
52 | * | |
53 | * Set up the video device, select the first scene and highlight the first item. | |
54 | * This ensures that all menus have a selected item. | |
55 | * | |
56 | * @exp: Expo to use | |
57 | * @vid_privp: Set to private data for the video device | |
58 | * @scnp: Set to the first scene | |
59 | * Return: scene ID of first scene if OK, -ve on error | |
60 | */ | |
61 | int cedit_prepare(struct expo *exp, struct video_priv **vid_privp, | |
62 | struct scene **scnp); | |
63 | ||
2dee81fe SG |
64 | /** |
65 | * cedit_write_settings() - Write settings in FDT format | |
66 | * | |
67 | * Sets up an FDT with the settings | |
68 | * | |
69 | * @exp: Expo to write settings from | |
70 | * @buf: Returns abuf containing the settings FDT (inited by this function) | |
71 | * Return: 0 if OK, -ve on error | |
72 | */ | |
73 | int cedit_write_settings(struct expo *exp, struct abuf *buf); | |
74 | ||
472317cb SG |
75 | /** |
76 | * cedit_read_settings() - Read settings in FDT format | |
77 | * | |
78 | * Read an FDT with the settings | |
79 | * | |
80 | * @exp: Expo to read settings into | |
81 | * @tree: Tree to read from | |
82 | * Return: 0 if OK, -ve on error | |
83 | */ | |
84 | int cedit_read_settings(struct expo *exp, oftree tree); | |
85 | ||
fc9c0e07 SG |
86 | /** |
87 | * cedit_write_settings_env() - Write settings to envrionment variables | |
88 | * | |
89 | * @exp: Expo to write settings from | |
90 | * @verbose: true to print each var as it is set | |
91 | * Return: 0 if OK, -ve on error | |
92 | */ | |
93 | int cedit_write_settings_env(struct expo *exp, bool verbose); | |
94 | ||
bcf2b720 SG |
95 | /* |
96 | * cedit_read_settings_env() - Read settings from the environment | |
97 | * | |
98 | * @exp: Expo to read settings into | |
99 | * @verbose: true to print each var before it is read | |
100 | */ | |
101 | int cedit_read_settings_env(struct expo *exp, bool verbose); | |
102 | ||
eb6c71b5 SG |
103 | /** |
104 | * cedit_write_settings_cmos() - Write settings to CMOS RAM | |
105 | * | |
106 | * Write settings to the defined places in CMOS RAM | |
107 | * | |
108 | * @exp: Expo to write settings from | |
109 | * @dev: UCLASS_RTC device containing space for this information | |
110 | * Returns 0 if OK, -ve on error | |
111 | * @verbose: true to print a summary at the end | |
112 | */ | |
113 | int cedit_write_settings_cmos(struct expo *exp, struct udevice *dev, | |
114 | bool verbose); | |
115 | ||
cfc402db SG |
116 | /** |
117 | * cedit_read_settings_cmos() - Read settings from CMOS RAM | |
118 | * | |
119 | * Read settings from the defined places in CMO RAM | |
120 | * | |
121 | * @exp: Expo to read settings into | |
122 | * @dev: RTC device to read settings from | |
123 | * @verbose: true to print a summary at the end | |
124 | */ | |
125 | int cedit_read_settings_cmos(struct expo *exp, struct udevice *dev, | |
126 | bool verbose); | |
127 | ||
040b0468 | 128 | #endif /* __CEDIT_H */ |