From ba4b8a406ed69e9e6ef2b7092bb658d0b73a0267 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Bol=C3=ADvar?= Date: Fri, 14 Apr 2023 01:22:37 -0700 Subject: [PATCH] edtlib: move PinCtrl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is just moving the class definition higher in the file to make it easier to type annotate the module. Signed-off-by: Martí Bolívar --- .../src/devicetree/edtlib.py | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/scripts/dts/python-devicetree/src/devicetree/edtlib.py b/scripts/dts/python-devicetree/src/devicetree/edtlib.py index 24c075b825..5131d38e2e 100644 --- a/scripts/dts/python-devicetree/src/devicetree/edtlib.py +++ b/scripts/dts/python-devicetree/src/devicetree/edtlib.py @@ -824,6 +824,46 @@ class ControllerAndData: return "".format(", ".join(fields)) +class PinCtrl: + """ + Represents a pin control configuration for a set of pins on a device, + e.g. pinctrl-0 or pinctrl-1. + + These attributes are available on PinCtrl objects: + + node: + The Node instance the pinctrl-* property is on + + name: + The name of the configuration, as given in pinctrl-names, or None if + there is no pinctrl-names property + + name_as_token: + Like 'name', but with non-alphanumeric characters converted to underscores. + + conf_nodes: + A list of Node instances for the pin configuration nodes, e.g. + the nodes pointed at by &state_1 and &state_2 in + + pinctrl-0 = <&state_1 &state_2>; + """ + + @property + def name_as_token(self): + "See the class docstring" + return str_as_token(self.name) if self.name is not None else None + + def __repr__(self): + fields = [] + + if self.name is not None: + fields.append("name: " + self.name) + + fields.append("configuration nodes: " + str(self.conf_nodes)) + + return "".format(", ".join(fields)) + + class EDT: """ Represents a devicetree augmented with information from bindings. @@ -2213,46 +2253,6 @@ class Node: return dict(zip(cell_names, data_list)) -class PinCtrl: - """ - Represents a pin control configuration for a set of pins on a device, - e.g. pinctrl-0 or pinctrl-1. - - These attributes are available on PinCtrl objects: - - node: - The Node instance the pinctrl-* property is on - - name: - The name of the configuration, as given in pinctrl-names, or None if - there is no pinctrl-names property - - name_as_token: - Like 'name', but with non-alphanumeric characters converted to underscores. - - conf_nodes: - A list of Node instances for the pin configuration nodes, e.g. - the nodes pointed at by &state_1 and &state_2 in - - pinctrl-0 = <&state_1 &state_2>; - """ - - @property - def name_as_token(self): - "See the class docstring" - return str_as_token(self.name) if self.name is not None else None - - def __repr__(self): - fields = [] - - if self.name is not None: - fields.append("name: " + self.name) - - fields.append("configuration nodes: " + str(self.conf_nodes)) - - return "".format(", ".join(fields)) - - def bindings_from_paths(yaml_paths, ignore_errors=False): """ Get a list of Binding objects from the yaml files 'yaml_paths'.