From f8f4e0c36a674963c725f8876728d23ece8cc3ff Mon Sep 17 00:00:00 2001 From: Hyungwoo Yang Date: Fri, 19 Mar 2021 18:20:27 -0700 Subject: zephyr: DT: support sensor driver data This has basic support to create instances of sensor-specific driver data using the information from device tree. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang Change-Id: I196d7595e8bd880e2314290660f08274ad99e172 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778815 Reviewed-by: Simon Glass --- .../cros-ec,accelgyro-als-channel-scale.yaml | 29 ++++++++++ .../drvdata/cros-ec,accelgyro-als-drv-data.yaml | 44 +++++++++++++++ .../drvdata/cros-ec,accelgyro-rgb-calibration.yaml | 63 ++++++++++++++++++++++ .../bindings/motionsense/drvdata/drvdata-base.yaml | 11 ++++ 4 files changed, 147 insertions(+) create mode 100644 zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-als-channel-scale.yaml create mode 100644 zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-als-drv-data.yaml create mode 100644 zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-rgb-calibration.yaml create mode 100644 zephyr/dts/bindings/motionsense/drvdata/drvdata-base.yaml (limited to 'zephyr/dts/bindings') diff --git a/zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-als-channel-scale.yaml b/zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-als-channel-scale.yaml new file mode 100644 index 0000000000..753edc7ea8 --- /dev/null +++ b/zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-als-channel-scale.yaml @@ -0,0 +1,29 @@ +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +description: | + Bindings for als_channel_scale_t in accelgyro.h. + Each channel has scaling factor for normalization & cover + +compatible: cros-ec,accelgyro-als-channel-scale + +properties: + k-channel-scale: + type: int + required: true + description: Channel scale factor + cover-scale: + type: int + required: true + description: Cover compensation scale factor + +# +# examples: +# +# als-channel-scale { +# compatible = "cros-ec,accelgyro-als-channel-scale"; +# k-channel-scale = <1>; +# cover-scale = <1>; +# }; +# diff --git a/zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-als-drv-data.yaml b/zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-als-drv-data.yaml new file mode 100644 index 0000000000..7d64689cf2 --- /dev/null +++ b/zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-als-drv-data.yaml @@ -0,0 +1,44 @@ +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +description: ALS driver data + +compatible: "cros-ec,accelgyro-als-drv-data" + +child-binding: + description: ALS calibration data + properties: + scale: + type: int + required: true + description: | + Scale, uscale, and offset are used to correct the raw 16 bit ALS data + and then to convert it to 32 bit using the following equations + raw_value += offset;\n + adjusted_value = raw_value * scale + raw_value * uscale / 10000; + uscale: + type: int + required: true + description: uscale + offset: + type: int + required: true + description: offset + +# +# examples: +# als-drv-data { +# compatible = "cros-ec,accelgyro-als-drv-data"; +# als-cal { +# scale = <1>; +# uscale = <0>; +# offset = <0>; +# als-channel-scale { +# compatible = "cros-ec,accelgyro-als-channel-scale"; +# k-channel-scale = <1>; +# cover-scale = <1>; +# }; +# }; +# }; +# diff --git a/zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-rgb-calibration.yaml b/zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-rgb-calibration.yaml new file mode 100644 index 0000000000..4204a63cff --- /dev/null +++ b/zephyr/dts/bindings/motionsense/drvdata/cros-ec,accelgyro-rgb-calibration.yaml @@ -0,0 +1,63 @@ +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +description: bindings for rgb_calibration_t in accelgyro.h + +compatible: "cros-ec,accelgyro-rgb-calibration" + +properties: + irt: + type: int + required: true + description: incandecent scaling factor + +child-binding: + description: RGB ALS Calibration Data + properties: + offset: + type: int + required: true + description: Any offset to add to raw channel data + coeff: + type: array + required: true + description: Clear, R, G, and B coefficients for this channel + +# +# examples: +# +# rgb_calibration { +# compatible = "cros-ec,accelgyro-rgb-calibration"; +# +# irt = <1>; +# +# rgb-cal-x { +# offset = <0>; +# coeff = <0 0 0 0>; +# als-channel-scale { +# compatible = "cros-ec,accelgyro-als-channel-scale"; +# k-channel-scale = <1>; +# cover-scale = <1>; +# }; +# }; +# rgb-cal-y { +# offset = <0>; +# coeff = <0 0 0 0>; +# als-channel-scale { +# compatible = "cros-ec,accelgyro-als-channel-scale"; +# k-channel-scale = <1>; +# cover-scale = <1>; +# }; +# }; +# rgb-cal-z { +# offset = <0>; +# coeff = <0 0 0 0>; +# als-channel-scale { +# compatible = "cros-ec,accelgyro-als-channel-scale"; +# k-channel-scale = <1>; +# cover-scale = <1>; +# }; +# }; +# }; +# diff --git a/zephyr/dts/bindings/motionsense/drvdata/drvdata-base.yaml b/zephyr/dts/bindings/motionsense/drvdata/drvdata-base.yaml new file mode 100644 index 0000000000..dc32d69d21 --- /dev/null +++ b/zephyr/dts/bindings/motionsense/drvdata/drvdata-base.yaml @@ -0,0 +1,11 @@ +# Copyright 2021 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# common fields for driver data + +include: base.yaml + +properties: + status: + required: true -- cgit v1.2.1