[v3,19/23] libtuning: Add static module
diff mbox series

Message ID 20240703141726.252368-20-stefan.klug@ideasonboard.com
State Superseded
Headers show
Series
  • Add ccm calibration to libtuning
Related show

Commit Message

Stefan Klug July 3, 2024, 2:17 p.m. UTC
Add a static module class, that can be used to add static data to the
tuning file. This is propably not the best solution, but allows us to
progress without writing lots of dummy classes for static cases.

Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 utils/tuning/libtuning/modules/static.py | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)
 create mode 100644 utils/tuning/libtuning/modules/static.py

Comments

Paul Elder July 4, 2024, 9:59 a.m. UTC | #1
On Wed, Jul 03, 2024 at 04:17:08PM +0200, Stefan Klug wrote:
> Add a static module class, that can be used to add static data to the
> tuning file. This is propably not the best solution, but allows us to
> progress without writing lots of dummy classes for static cases.

I think this is actually a pretty good idea.

> 
> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>

> ---
>  utils/tuning/libtuning/modules/static.py | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>  create mode 100644 utils/tuning/libtuning/modules/static.py
> 
> diff --git a/utils/tuning/libtuning/modules/static.py b/utils/tuning/libtuning/modules/static.py
> new file mode 100644
> index 000000000000..4d0f7e18c24e
> --- /dev/null
> +++ b/utils/tuning/libtuning/modules/static.py
> @@ -0,0 +1,24 @@
> +# SPDX-License-Identifier: GPL-2.0-or-later
> +#
> +# Copyright (C) 2024, Ideas on Board
> +#
> +# Module implementation for static data
> +
> +from .module import Module
> +
> +
> +# This module can be used in cases where the tuning file should contain
> +# static data.
> +class StaticModule(Module):
> +    def __init__(self, out_name: str, output: dict = {}):
> +        super().__init__()
> +        self.out_name = out_name
> +        self.hr_name = f'Static {out_name}'
> +        self.type = f'static_{out_name}'
> +        self.output = output
> +
> +    def validate_config(self, config: dict) -> bool:
> +        return True
> +
> +    def process(self, config: dict, images: list, outputs: dict) -> dict:
> +        return self.output
> -- 
> 2.43.0
>

Patch
diff mbox series

diff --git a/utils/tuning/libtuning/modules/static.py b/utils/tuning/libtuning/modules/static.py
new file mode 100644
index 000000000000..4d0f7e18c24e
--- /dev/null
+++ b/utils/tuning/libtuning/modules/static.py
@@ -0,0 +1,24 @@ 
+# SPDX-License-Identifier: GPL-2.0-or-later
+#
+# Copyright (C) 2024, Ideas on Board
+#
+# Module implementation for static data
+
+from .module import Module
+
+
+# This module can be used in cases where the tuning file should contain
+# static data.
+class StaticModule(Module):
+    def __init__(self, out_name: str, output: dict = {}):
+        super().__init__()
+        self.out_name = out_name
+        self.hr_name = f'Static {out_name}'
+        self.type = f'static_{out_name}'
+        self.output = output
+
+    def validate_config(self, config: dict) -> bool:
+        return True
+
+    def process(self, config: dict, images: list, outputs: dict) -> dict:
+        return self.output