* [PATCH 0/2] iio: proximity: hx9023s: Add performance tuning function
@ 2024-09-23 1:16 Yasin Lee
2024-09-23 1:16 ` [PATCH 1/2] dt-bindings: iio: tyhx,hx9023s: Add performance tuning configuration Yasin Lee
2024-09-23 1:16 ` [PATCH 2/2] iio: proximity: hx9023s: Add performance tuning function Yasin Lee
0 siblings, 2 replies; 5+ messages in thread
From: Yasin Lee @ 2024-09-23 1:16 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-iio, devicetree, linux-kernel, Yasin Lee
When hardware design introduces significant sensor data noise,
performance can be improved by adjusting register settings.
Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com>
---
Yasin Lee (2):
dt-bindings: iio: tyhx,hx9023s: Add performance tuning configuration
iio: proximity: hx9023s: Add performance tuning function
.../bindings/iio/proximity/tyhx,hx9023s.yaml | 14 ++++++++
drivers/iio/proximity/hx9023s.c | 37 ++++++++++++++++++++++
2 files changed, 51 insertions(+)
---
base-commit: 7f6f44a9e58cd19093b544423bc04e1d668ec341
change-id: 20240923-add-performance-tuning-configuration-e2016e4d6e02
Best regards,
--
Yasin Lee <yasin.lee.x@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] dt-bindings: iio: tyhx,hx9023s: Add performance tuning configuration
2024-09-23 1:16 [PATCH 0/2] iio: proximity: hx9023s: Add performance tuning function Yasin Lee
@ 2024-09-23 1:16 ` Yasin Lee
2024-09-24 21:59 ` Rob Herring
2024-09-23 1:16 ` [PATCH 2/2] iio: proximity: hx9023s: Add performance tuning function Yasin Lee
1 sibling, 1 reply; 5+ messages in thread
From: Yasin Lee @ 2024-09-23 1:16 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-iio, devicetree, linux-kernel, Yasin Lee
When hardware design introduces significant sensor data noise,
performance can be improved by adjusting register settings.
Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com>
---
.../devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml b/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
index 64ce8bc8bd36..417fbc0bb205 100644
--- a/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
+++ b/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
@@ -28,6 +28,13 @@ properties:
vdd-supply: true
+ tyhx,performance-tuning:
+ description:
+ Optional, When hardware design introduces significant sensor data noise,
+ performance can be improved by adjusting register settings, including
+ but not limited to sample integration time and average sample count.
+ $ref: /schemas/types.yaml#/definitions/uint8-array
+
"#address-cells":
const: 1
@@ -65,6 +72,13 @@ examples:
interrupt-parent = <&pio>;
interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
vdd-supply = <&pp1800_prox>;
+ tyhx,performance-tuning = [00 00
+ 02 17
+ 0D 44
+ 0E 44
+ 0F 04
+ 1F 65
+ 21 65];
#address-cells = <1>;
#size-cells = <0>;
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] iio: proximity: hx9023s: Add performance tuning function
2024-09-23 1:16 [PATCH 0/2] iio: proximity: hx9023s: Add performance tuning function Yasin Lee
2024-09-23 1:16 ` [PATCH 1/2] dt-bindings: iio: tyhx,hx9023s: Add performance tuning configuration Yasin Lee
@ 2024-09-23 1:16 ` Yasin Lee
1 sibling, 0 replies; 5+ messages in thread
From: Yasin Lee @ 2024-09-23 1:16 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-iio, devicetree, linux-kernel, Yasin Lee
When hardware design introduces significant sensor data noise,
performance can be improved by adjusting register settings.
Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com>
---
drivers/iio/proximity/hx9023s.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
diff --git a/drivers/iio/proximity/hx9023s.c b/drivers/iio/proximity/hx9023s.c
index 8b9f84400e00..963da240c9b9 100644
--- a/drivers/iio/proximity/hx9023s.c
+++ b/drivers/iio/proximity/hx9023s.c
@@ -582,6 +582,39 @@ static int hx9023s_ch_en(struct hx9023s_data *data, u8 ch_id, bool en)
return regmap_write(data->regmap, HX9023S_CH_NUM_CFG, data->ch_en_stat);
}
+static int hx9023s_performance_tuning(struct hx9023s_data *data)
+{
+ int ret;
+ u32 i, len;
+ u8 *reg_init;
+ u8 reg, val;
+ struct device *dev = regmap_get_device(data->regmap);
+ struct fwnode_handle *fwnode = dev_fwnode(dev);
+
+ ret = fwnode_property_read_u8_array(fwnode, "tyhx,performance-tuning", NULL, 0);
+ if (ret < 0)
+ return ret;
+
+ len = ret;
+ reg_init = devm_kmalloc(dev, len, GFP_KERNEL);
+ if (!reg_init)
+ return -ENOMEM;
+
+ ret = fwnode_property_read_u8_array(fwnode, "tyhx,performance-tuning", reg_init, len);
+ if (ret < 0)
+ return ret;
+
+ for (i = 0; i < len; i += 2) {
+ reg = reg_init[i];
+ val = reg_init[i + 1];
+ ret = regmap_write(data->regmap, reg, val);
+ if (ret)
+ return ret;
+ }
+
+ return ret;
+}
+
static int hx9023s_property_get(struct hx9023s_data *data)
{
struct device *dev = regmap_get_device(data->regmap);
@@ -1045,6 +1078,10 @@ static int hx9023s_probe(struct i2c_client *client)
if (ret)
return dev_err_probe(dev, ret, "channel config failed\n");
+ ret = hx9023s_performance_tuning(data);
+ if (ret)
+ dev_warn(dev, "performance tuning not configured\n");
+
ret = regcache_sync(data->regmap);
if (ret)
return dev_err_probe(dev, ret, "regcache sync failed\n");
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: iio: tyhx,hx9023s: Add performance tuning configuration
2024-09-23 1:16 ` [PATCH 1/2] dt-bindings: iio: tyhx,hx9023s: Add performance tuning configuration Yasin Lee
@ 2024-09-24 21:59 ` Rob Herring
2024-09-25 16:38 ` Yasin Lee
0 siblings, 1 reply; 5+ messages in thread
From: Rob Herring @ 2024-09-24 21:59 UTC (permalink / raw)
To: Yasin Lee
Cc: Jonathan Cameron, Lars-Peter Clausen, Krzysztof Kozlowski,
Conor Dooley, linux-iio, devicetree, linux-kernel
On Mon, Sep 23, 2024 at 09:16:10AM +0800, Yasin Lee wrote:
> When hardware design introduces significant sensor data noise,
> performance can be improved by adjusting register settings.
>
> Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com>
> ---
> .../devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml b/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
> index 64ce8bc8bd36..417fbc0bb205 100644
> --- a/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
> +++ b/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
> @@ -28,6 +28,13 @@ properties:
>
> vdd-supply: true
>
> + tyhx,performance-tuning:
> + description:
> + Optional, When hardware design introduces significant sensor data noise,
> + performance can be improved by adjusting register settings, including
> + but not limited to sample integration time and average sample count.
> + $ref: /schemas/types.yaml#/definitions/uint8-array
1 byte is valid? What about 10000? Add some constraints on the array
size and the values if possible
> +
> "#address-cells":
> const: 1
>
> @@ -65,6 +72,13 @@ examples:
> interrupt-parent = <&pio>;
> interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
> vdd-supply = <&pp1800_prox>;
> + tyhx,performance-tuning = [00 00
> + 02 17
> + 0D 44
> + 0E 44
> + 0F 04
> + 1F 65
> + 21 65];
>
> #address-cells = <1>;
> #size-cells = <0>;
>
> --
> 2.43.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] dt-bindings: iio: tyhx,hx9023s: Add performance tuning configuration
2024-09-24 21:59 ` Rob Herring
@ 2024-09-25 16:38 ` Yasin Lee
0 siblings, 0 replies; 5+ messages in thread
From: Yasin Lee @ 2024-09-25 16:38 UTC (permalink / raw)
To: Rob Herring
Cc: Jonathan Cameron, Lars-Peter Clausen, Krzysztof Kozlowski,
Conor Dooley, linux-iio, devicetree, linux-kernel
On 9/25/24 05:59, Rob Herring wrote:
> On Mon, Sep 23, 2024 at 09:16:10AM +0800, Yasin Lee wrote:
>> When hardware design introduces significant sensor data noise,
>> performance can be improved by adjusting register settings.
>>
>> Signed-off-by: Yasin Lee <yasin.lee.x@gmail.com>
>> ---
>> .../devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml | 14 ++++++++++++++
>> 1 file changed, 14 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml b/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
>> index 64ce8bc8bd36..417fbc0bb205 100644
>> --- a/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
>> +++ b/Documentation/devicetree/bindings/iio/proximity/tyhx,hx9023s.yaml
>> @@ -28,6 +28,13 @@ properties:
>>
>> vdd-supply: true
>>
>> + tyhx,performance-tuning:
>> + description:
>> + Optional, When hardware design introduces significant sensor data noise,
>> + performance can be improved by adjusting register settings, including
>> + but not limited to sample integration time and average sample count.
>> + $ref: /schemas/types.yaml#/definitions/uint8-array
> 1 byte is valid? What about 10000? Add some constraints on the array
> size and the values if possible
>
Hi Rob,
Thank you for your feedback.
In the next version, I've added constraints on the number of elements in
the tyhx,performance-tuning array, limiting it to between 2 and 512
elements. Additionally, I updated the description to clarify that the
number of elements must be even, as each pair represents a register
address followed by a value.
Best regards,
Yasin Lee
>> +
>> "#address-cells":
>> const: 1
>>
>> @@ -65,6 +72,13 @@ examples:
>> interrupt-parent = <&pio>;
>> interrupts = <16 IRQ_TYPE_EDGE_FALLING>;
>> vdd-supply = <&pp1800_prox>;
>> + tyhx,performance-tuning = [00 00
>> + 02 17
>> + 0D 44
>> + 0E 44
>> + 0F 04
>> + 1F 65
>> + 21 65];
>>
>> #address-cells = <1>;
>> #size-cells = <0>;
>>
>> --
>> 2.43.0
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-25 16:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-23 1:16 [PATCH 0/2] iio: proximity: hx9023s: Add performance tuning function Yasin Lee
2024-09-23 1:16 ` [PATCH 1/2] dt-bindings: iio: tyhx,hx9023s: Add performance tuning configuration Yasin Lee
2024-09-24 21:59 ` Rob Herring
2024-09-25 16:38 ` Yasin Lee
2024-09-23 1:16 ` [PATCH 2/2] iio: proximity: hx9023s: Add performance tuning function Yasin Lee
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).