Linux Input/HID development
 help / color / mirror / Atom feed
* Re: [PATCH] Input: adp5588-keys: fix check on return code
From: Nuno Sá @ 2024-09-20 11:07 UTC (permalink / raw)
  To: Dmitry Torokhov, nuno.sa; +Cc: Andy Shevchenko, linux-input, Michael Hennerich
In-Reply-To: <Zu0vq0ogr2HzXWv7@google.com>

On Fri, 2024-09-20 at 08:17 +0000, Dmitry Torokhov wrote:
> On Fri, Sep 20, 2024 at 09:22:52AM +0200, Nuno Sa via B4 Relay wrote:
> > From: Nuno Sa <nuno.sa@analog.com>
> > 
> > During adp5588_setup(), we read all the events to clear the event FIFO.
> > However, adp5588_read() just calls i2c_smbus_read_byte_data() which
> > returns the byte read in case everything goes well. Hence, we need to
> > explicitly check for a negative error code instead of checking for
> > something different than 0.
> > 
> > Fixes: e960309ce318 ("Input: adp5588-keys - bail out on returned error")
> > Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> > ---
> >  drivers/input/keyboard/adp5588-keys.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/input/keyboard/adp5588-keys.c
> > b/drivers/input/keyboard/adp5588-keys.c
> > index b5f4becf5cb6f..d25d63a807f23 100644
> > --- a/drivers/input/keyboard/adp5588-keys.c
> > +++ b/drivers/input/keyboard/adp5588-keys.c
> > @@ -620,7 +620,7 @@ static int adp5588_setup(struct adp5588_kpad *kpad)
> >  
> >  	for (i = 0; i < KEYP_MAX_EVENT; i++) {
> >  		ret = adp5588_read(client, KEY_EVENTA);
> > -		if (ret)
> > +		if (ret < 0)
> >  			return ret;
> >  	}
> 
> Hmm... There are a bunch of places where we do not check result of
> adp5588_read(). I wonder if we should:
> 
> 1. add the checks
> 2. change it to return error or 0 and return the value through a pointer
> argument.

It does make sense. I can take care of that. 

And similar work will be needed in the adp5589 driver. I'll include it in the series
I'm preparing for the FW properties.

- Nuno Sá



^ permalink raw reply

* [PATCH] Input: adp5588-keys - Added checking of key and key_val variables
From: Denis Arefev @ 2024-09-20  9:23 UTC (permalink / raw)
  To: Michael Hennerich
  Cc: Dmitry Torokhov, linux-input, linux-kernel, lvc-project, stable

If the adp5588_read function returns 0, then there will be an
overflow of the kpad->keycode buffer.

If the adp5588_read function returns a negative value, then the
logic is broken - the wrong value is used as an index of
the kpad->keycode array.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Cc: stable@vger.kernel.org # v5.10+
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
 drivers/input/keyboard/adp5588-keys.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index 1b0279393df4..d05387f9c11f 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -526,14 +526,17 @@ static void adp5588_report_events(struct adp5588_kpad *kpad, int ev_cnt)
 	int i;
 
 	for (i = 0; i < ev_cnt; i++) {
-		int key = adp5588_read(kpad->client, KEY_EVENTA + i);
-		int key_val = key & KEY_EV_MASK;
-		int key_press = key & KEY_EV_PRESSED;
+		int key, key_val, key_press;
 
+		key = adp5588_read(kpad->client, KEY_EVENTA + i);
+		if (key < 0)
+			continue;
+		key_val = key & KEY_EV_MASK;
+		key_press = key & KEY_EV_PRESSED;
 		if (key_val >= GPI_PIN_BASE && key_val <= GPI_PIN_END) {
 			/* gpio line used as IRQ source */
 			adp5588_gpio_irq_handle(kpad, key_val, key_press);
-		} else {
+		} else if (key_val > 0) {
 			int row = (key_val - 1) / ADP5588_COLS_MAX;
 			int col =  (key_val - 1) % ADP5588_COLS_MAX;
 			int code = MATRIX_SCAN_CODE(row, col, kpad->row_shift);
-- 
2.25.1


^ permalink raw reply related

* [PATCH v5 2/2] input: touchscreen: ad7877: add dt support
From: Antoniu Miclaus @ 2024-09-20  8:24 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Michael Hennerich, Mark Brown, Antoniu Miclaus, linux-input,
	devicetree, linux-kernel, linux-spi
In-Reply-To: <20240920082520.10094-1-antoniu.miclaus@analog.com>

Add devicetree support within the driver.

Remove old platform data approach since it is no longer used.

Add match table.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 drivers/input/touchscreen/ad7877.c | 176 ++++++++++++++++++++++++-----
 include/linux/spi/ad7877.h         |  25 ----
 2 files changed, 145 insertions(+), 56 deletions(-)
 delete mode 100644 include/linux/spi/ad7877.h

diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index a0598e9c7aff..30c247ae59e5 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -25,11 +25,13 @@
 #include <linux/device.h>
 #include <linux/delay.h>
 #include <linux/input.h>
+#include <linux/input/touchscreen.h>
 #include <linux/interrupt.h>
+#include <linux/mod_devicetable.h>
 #include <linux/pm.h>
+#include <linux/property.h>
 #include <linux/slab.h>
 #include <linux/spi/spi.h>
-#include <linux/spi/ad7877.h>
 #include <linux/module.h>
 #include <asm/irq.h>
 
@@ -174,6 +176,8 @@ struct ad7877 {
 	u8			averaging;
 	u8			pen_down_acc_interval;
 
+	struct touchscreen_properties prop;
+
 	struct spi_transfer	xfer[AD7877_NR_SENSE + 2];
 	struct spi_message	msg;
 
@@ -353,8 +357,7 @@ static int ad7877_process_data(struct ad7877 *ts)
 		if (!timer_pending(&ts->timer))
 			input_report_key(input_dev, BTN_TOUCH, 1);
 
-		input_report_abs(input_dev, ABS_X, x);
-		input_report_abs(input_dev, ABS_Y, y);
+		touchscreen_report_pos(input_dev, &ts->prop, x, y, false);
 		input_report_abs(input_dev, ABS_PRESSURE, Rt);
 		input_sync(input_dev);
 
@@ -667,11 +670,136 @@ static void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts)
 	}
 }
 
+static int ad7877_parse_props(struct ad7877 *ts)
+{
+	struct device *dev = &ts->spi->dev;
+	u32 value, average;
+	int ret;
+
+	ts->model = (uintptr_t)device_get_match_data(dev);
+	if (!ts->model)
+		ts->model = 7877;
+
+	ret = device_property_match_string(dev, "adi,stopacq-polarity", "low");
+	if (ret < 0) {
+		ret = device_property_match_string(dev, "adi,stopacq-polarity", "high");
+		if (ret < 0)
+			ts->stopacq_polarity = 0;
+		ts->stopacq_polarity = 1;
+	} else {
+		ts->stopacq_polarity = 0;
+	}
+
+	ret = device_property_read_u32(dev, "adi,first-conv-delay-ns", &value);
+	if (!ret) {
+		switch (value) {
+		case 500:
+			ts->first_conversion_delay = 0;
+			break;
+		case 128000:
+			ts->first_conversion_delay = 1;
+			break;
+		case 1000000:
+			ts->first_conversion_delay = 2;
+			break;
+		case 8000000:
+			ts->first_conversion_delay = 3;
+			break;
+		default:
+			return dev_err_probe(dev, -EINVAL,
+					"Invalid adi,first-conv-delay-ns value\n");
+		}
+	}
+
+	device_property_read_u32(dev, "adi,pen-down-acc-interval-us",
+				 &value);
+	if (!ret) {
+		switch (value) {
+		case 0:
+			ts->acquisition_time = 0;
+			break;
+		case 500:
+			ts->acquisition_time = 1;
+			break;
+		case 1000:
+			ts->acquisition_time = 2;
+			break;
+		case 8000:
+			ts->acquisition_time = 3;
+			break;
+		default:
+			return dev_err_probe(dev, -EINVAL,
+					"Invalid adi,pen-down-acc-interval-us value\n");
+		}
+	}
+
+	ret = device_property_read_u32(dev, "adi,acquisition-time-us", &value);
+	if (!ret) {
+		switch (value) {
+		case 2:
+			ts->acquisition_time = 0;
+			break;
+		case 4:
+			ts->acquisition_time = 1;
+			break;
+		case 8:
+			ts->acquisition_time = 2;
+			break;
+		case 16:
+			ts->acquisition_time = 3;
+			break;
+		default:
+			return dev_err_probe(dev, -EINVAL,
+					"Invalid adi,first-conv-delay-ns value\n");
+		}
+	}
+
+	device_property_read_u32(dev, "adi,vref-delay-us",
+				 &value);
+	if (!value)
+		ts->vref_delay_usecs = 100;
+	else
+		ts->vref_delay_usecs = (u16)value;
+
+	device_property_read_u32(dev, "touchscreen-x-plate-ohms", &value);
+	if (value)
+		ts->x_plate_ohms = (u16)value;
+	else
+		ts->x_plate_ohms = 400;
+
+	/*
+	 * The property is parsed also in the touchscreen_parse_properties()
+	 * but is required for the ad7877_process_data() so we need to store it.
+	 */
+	device_property_read_u32(dev, "touchscreen-max-pressure", &value);
+	ts->pressure_max = (u16)value;
+
+	device_property_read_u32(dev, "touchscreen-average-samples", &average);
+	switch (average) {
+	case 1:
+		ts->averaging = 0;
+		break;
+	case 4:
+		ts->averaging = 1;
+		break;
+	case 8:
+		ts->averaging = 2;
+		break;
+	case 16:
+		ts->averaging = 3;
+		break;
+	default:
+		return dev_err_probe(dev, -EINVAL,
+				     "touchscreen-average-samples must be 1, 4, 8, or 16\n");
+	}
+
+	return 0;
+}
+
 static int ad7877_probe(struct spi_device *spi)
 {
 	struct ad7877			*ts;
 	struct input_dev		*input_dev;
-	struct ad7877_platform_data	*pdata = dev_get_platdata(&spi->dev);
 	int				err;
 	u16				verify;
 
@@ -680,11 +808,6 @@ static int ad7877_probe(struct spi_device *spi)
 		return -ENODEV;
 	}
 
-	if (!pdata) {
-		dev_dbg(&spi->dev, "no platform data?\n");
-		return -ENODEV;
-	}
-
 	/* don't exceed max specified SPI CLK frequency */
 	if (spi->max_speed_hz > MAX_SPI_FREQ_HZ) {
 		dev_dbg(&spi->dev, "SPI CLK %d Hz?\n",spi->max_speed_hz);
@@ -714,27 +837,22 @@ static int ad7877_probe(struct spi_device *spi)
 	ts->spi = spi;
 	ts->input = input_dev;
 
+	err = ad7877_parse_props(ts);
+	if (err)
+		return err;
+
 	timer_setup(&ts->timer, ad7877_timer, 0);
 	mutex_init(&ts->mutex);
 	spin_lock_init(&ts->lock);
 
-	ts->model = pdata->model ? : 7877;
-	ts->vref_delay_usecs = pdata->vref_delay_usecs ? : 100;
-	ts->x_plate_ohms = pdata->x_plate_ohms ? : 400;
-	ts->pressure_max = pdata->pressure_max ? : ~0;
-
-	ts->stopacq_polarity = pdata->stopacq_polarity;
-	ts->first_conversion_delay = pdata->first_conversion_delay;
-	ts->acquisition_time = pdata->acquisition_time;
-	ts->averaging = pdata->averaging;
-	ts->pen_down_acc_interval = pdata->pen_down_acc_interval;
-
 	snprintf(ts->phys, sizeof(ts->phys), "%s/input0", dev_name(&spi->dev));
 
 	input_dev->name = "AD7877 Touchscreen";
 	input_dev->phys = ts->phys;
 	input_dev->dev.parent = &spi->dev;
 
+	touchscreen_parse_properties(ts->input, false, &ts->prop);
+
 	__set_bit(EV_KEY, input_dev->evbit);
 	__set_bit(BTN_TOUCH, input_dev->keybit);
 	__set_bit(EV_ABS, input_dev->evbit);
@@ -742,17 +860,6 @@ static int ad7877_probe(struct spi_device *spi)
 	__set_bit(ABS_Y, input_dev->absbit);
 	__set_bit(ABS_PRESSURE, input_dev->absbit);
 
-	input_set_abs_params(input_dev, ABS_X,
-			pdata->x_min ? : 0,
-			pdata->x_max ? : MAX_12BIT,
-			0, 0);
-	input_set_abs_params(input_dev, ABS_Y,
-			pdata->y_min ? : 0,
-			pdata->y_max ? : MAX_12BIT,
-			0, 0);
-	input_set_abs_params(input_dev, ABS_PRESSURE,
-			pdata->pressure_min, pdata->pressure_max, 0, 0);
-
 	ad7877_write(spi, AD7877_REG_SEQ1, AD7877_MM_SEQUENCE);
 
 	verify = ad7877_read(spi, AD7877_REG_SEQ1);
@@ -805,10 +912,17 @@ static int ad7877_resume(struct device *dev)
 
 static DEFINE_SIMPLE_DEV_PM_OPS(ad7877_pm, ad7877_suspend, ad7877_resume);
 
+static const struct of_device_id ad7877_of_match[] = {
+	{ .compatible = "adi,ad7877", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, ad7877_of_match);
+
 static struct spi_driver ad7877_driver = {
 	.driver = {
 		.name		= "ad7877",
 		.dev_groups	= ad7877_groups,
+		.of_match_table = ad7877_of_match,
 		.pm		= pm_sleep_ptr(&ad7877_pm),
 	},
 	.probe		= ad7877_probe,
diff --git a/include/linux/spi/ad7877.h b/include/linux/spi/ad7877.h
deleted file mode 100644
index b7be843c88e2..000000000000
--- a/include/linux/spi/ad7877.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-/* linux/spi/ad7877.h */
-
-/* Touchscreen characteristics vary between boards and models.  The
- * platform_data for the device's "struct device" holds this information.
- *
- * It's OK if the min/max values are zero.
- */
-struct ad7877_platform_data {
-	u16	model;			/* 7877 */
-	u16	vref_delay_usecs;	/* 0 for external vref; etc */
-	u16	x_plate_ohms;
-	u16	y_plate_ohms;
-
-	u16	x_min, x_max;
-	u16	y_min, y_max;
-	u16	pressure_min, pressure_max;
-
-	u8	stopacq_polarity;	/* 1 = Active HIGH, 0 = Active LOW */
-	u8	first_conversion_delay;	/* 0 = 0.5us, 1 = 128us, 2 = 1ms, 3 = 8ms */
-	u8	acquisition_time;	/* 0 = 2us, 1 = 4us, 2 = 8us, 3 = 16us */
-	u8	averaging;		/* 0 = 1, 1 = 4, 2 = 8, 3 = 16 */
-	u8	pen_down_acc_interval;	/* 0 = covert once, 1 = every 0.5 ms,
-					   2 = ever 1 ms,   3 = every 8 ms,*/
-};
-- 
2.46.0


^ permalink raw reply related

* [PATCH v5 1/2] dt-bindings: touchscreen: add ad7877 support
From: Antoniu Miclaus @ 2024-09-20  8:24 UTC (permalink / raw)
  To: Dmitry Torokhov, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Michael Hennerich, Mark Brown, Antoniu Miclaus, linux-input,
	devicetree, linux-kernel, linux-spi
  Cc: Krzysztof Kozlowski

Add device tree bindings for ad7877.

Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
changes in v5:
 - add missing defaults for first-conv-delay-ns and stopacq-polarity
 .../input/touchscreen/adi,ad7877.yaml         | 108 ++++++++++++++++++
 1 file changed, 108 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml

diff --git a/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml b/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml
new file mode 100644
index 000000000000..be737cfbe471
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/touchscreen/adi,ad7877.yaml
@@ -0,0 +1,108 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/touchscreen/adi,ad7877.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices AD7877 Touch Screen Controller
+
+maintainers:
+  - Antoniu Miclaus <antoniu.miclaus@analog.com>
+
+description: |
+  Analog Devices Touch Screen Controller
+  https://www.analog.com/media/en/technical-documentation/data-sheets/AD7877.pdf
+
+allOf:
+  - $ref: touchscreen.yaml#
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    enum:
+      - adi,ad7877
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  spi-max-frequency:
+    description: AD7877 SPI bus clock frequency.
+    minimum: 10000
+    maximum: 20000000
+
+  adi,stopacq-polarity:
+    description: The polarity of the signal applied to the STOPACQ pin.
+    $ref: /schemas/types.yaml#/definitions/string
+    enum: [low, high]
+    default: low
+
+  adi,first-conv-delay-ns:
+    description: Delay in ns before the first conversion.
+    enum: [500, 128000, 1000000, 8000000]
+    default: 500
+
+  adi,pen-down-acc-interval-us:
+    description: Enable the ADC to repeatedly perform conversions.
+    enum: [0, 500, 1000, 8000]
+    default: 0
+
+  adi,acquisition-time-us:
+    description: Select acquisition times in us for the ADC.
+    enum: [2, 4, 8, 16]
+    default: 2
+
+  adi,vref-delay-us:
+    description: Delay required for the SPI transfers depending on the VREF used.
+    default: 100
+
+  touchscreen-average-samples:
+    enum: [1, 4, 8, 16]
+
+  touchscreen-x-plate-ohms:
+    default: 400
+
+  touchscreen-min-x: true
+  touchscreen-min-y: true
+  touchscreen-size-x: true
+  touchscreen-size-y: true
+  touchscreen-max-pressure: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - touchscreen-average-samples
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      touchscreen@0 {
+        compatible = "adi,ad7877";
+        reg = <0>;
+        spi-max-frequency = <20000000>;
+        interrupts = <21 IRQ_TYPE_EDGE_FALLING>;
+        interrupt-parent = <&gpio>;
+        adi,vref-delay-us = <100>;
+        adi,stopacq-polarity = "low";
+        adi,first-conv-delay-ns = <500>;
+        adi,pen-down-acc-interval-us = <0>;
+        adi,acquisition-time-us = <2>;
+        touchscreen-average-samples = <16>;
+        touchscreen-x-plate-ohms = <400>;
+        touchscreen-min-x = <0>;
+        touchscreen-min-y = <0>;
+        touchscreen-size-x = <800>;
+        touchscreen-size-y = <480>;
+        touchscreen-max-pressure = <4095>;
+      };
+    };
+...
-- 
2.46.0


^ permalink raw reply related

* Re: [PATCH] Input: adp5588-keys: fix check on return code
From: Dmitry Torokhov @ 2024-09-20  8:17 UTC (permalink / raw)
  To: nuno.sa; +Cc: Andy Shevchenko, linux-input, Michael Hennerich
In-Reply-To: <20240920-fix-adp5588-err-check-v1-1-81f6e957ef24@analog.com>

On Fri, Sep 20, 2024 at 09:22:52AM +0200, Nuno Sa via B4 Relay wrote:
> From: Nuno Sa <nuno.sa@analog.com>
> 
> During adp5588_setup(), we read all the events to clear the event FIFO.
> However, adp5588_read() just calls i2c_smbus_read_byte_data() which
> returns the byte read in case everything goes well. Hence, we need to
> explicitly check for a negative error code instead of checking for
> something different than 0.
> 
> Fixes: e960309ce318 ("Input: adp5588-keys - bail out on returned error")
> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> ---
>  drivers/input/keyboard/adp5588-keys.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
> index b5f4becf5cb6f..d25d63a807f23 100644
> --- a/drivers/input/keyboard/adp5588-keys.c
> +++ b/drivers/input/keyboard/adp5588-keys.c
> @@ -620,7 +620,7 @@ static int adp5588_setup(struct adp5588_kpad *kpad)
>  
>  	for (i = 0; i < KEYP_MAX_EVENT; i++) {
>  		ret = adp5588_read(client, KEY_EVENTA);
> -		if (ret)
> +		if (ret < 0)
>  			return ret;
>  	}

Hmm... There are a bunch of places where we do not check result of
adp5588_read(). I wonder if we should:

1. add the checks
2. change it to return error or 0 and return the value through a pointer
argument.

In the meantime I'll apply this patch.

Thanks.

-- 
Dmitry

^ permalink raw reply

* Re: [PATCH v6 2/2] dt-bindings: mfd: mediatek: mt6397: Convert to DT schema format
From: AngeloGioacchino Del Regno @ 2024-09-20  7:31 UTC (permalink / raw)
  To: Macpaul Lin, Alexandre Belloni
  Cc: Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	Liam Girdwood, Mark Brown, Sean Wang, Sen Chu, netdev, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, Dmitry Torokhov,
	Pavel Machek, Lee Jones, Sebastian Reichel, Chen Zhong,
	linux-input, linux-leds, linux-pm, linux-rtc, linux-sound,
	Alexandre Mergnat, Bear Wang, Pablo Sun, Macpaul Lin,
	Chris-qj chen, MediaTek Chromebook Upstream, Chen-Yu Tsai
In-Reply-To: <2af0621d-14ac-b7f3-b28d-2df698931121@mediatek.com>

Il 18/09/24 16:18, Macpaul Lin ha scritto:
> 
> On 9/18/24 19:56, Alexandre Belloni wrote:
>>
>> On 18/09/2024 13:51:51+0200, Alexandre Belloni wrote:
>>> > Changes for v4:
>>> >  - Remove "mediatek,mt6357" from PMIC's compatible string since there is a
>>> >    seperated DT schema for PMIC mt6357.
>>> > > Changes for v5:
>>> >  - Rebase to next-20240913 (linux-next/master).
>>> >  - Fix the "title" (device type) of mfd/mediatek,mt6397.yaml to "PMIC".
>>> >  - RTC:
>>> >   - Drop "start-year"
>>>
>>> Maybe, instead of dropping the property, you should add support in the
>>> driver by setting range_min and range_max.
>>
>> Looking at this even more, the driver can probably be simplified by
>> setting start_year in probe and dropping RTC_MIN_YEAR_OFFSET.
> 
> Thank you for pointing out where and how the driver should be changed.
> However, I'm wondering if this should be a fix with a separated
> patchset (bindings and the driver)? The board or SoC's device trees
> should be reviewed as well. I'll need to get someone's help (permission) inside 
> MediaTek to check those dts and construct the patch for RTC driver.
> That will take sometime.
> 

Alexandre, I definitely agree with you on the fact that the MTK PMIC RTC driver
can (and needs to) be improved, and that it can make use of some nice cleanup...

... but!

This series performs a conversion to schema, and the previous txt file didn't
say anything about the start-year property - which was not mandatory to support
at that time (nor now, afaik?), so adding support for that is out of scope for
this series.

Eventually, that can come as a series on top, adding support for that in the
binding (and, of course, in the driver).

I should be able to tackle that... most probably next week - but still, the
improvements would come as a series on top of this one.

Cheers,
Angelo

^ permalink raw reply

* [PATCH] Input: adp5588-keys: fix check on return code
From: Nuno Sa via B4 Relay @ 2024-09-20  7:22 UTC (permalink / raw)
  To: Andy Shevchenko, Dmitry Torokhov; +Cc: linux-input, Michael Hennerich

From: Nuno Sa <nuno.sa@analog.com>

During adp5588_setup(), we read all the events to clear the event FIFO.
However, adp5588_read() just calls i2c_smbus_read_byte_data() which
returns the byte read in case everything goes well. Hence, we need to
explicitly check for a negative error code instead of checking for
something different than 0.

Fixes: e960309ce318 ("Input: adp5588-keys - bail out on returned error")
Signed-off-by: Nuno Sa <nuno.sa@analog.com>
---
 drivers/input/keyboard/adp5588-keys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index b5f4becf5cb6f..d25d63a807f23 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -620,7 +620,7 @@ static int adp5588_setup(struct adp5588_kpad *kpad)
 
 	for (i = 0; i < KEYP_MAX_EVENT; i++) {
 		ret = adp5588_read(client, KEY_EVENTA);
-		if (ret)
+		if (ret < 0)
 			return ret;
 	}
 

---
base-commit: 55bef83509f0cbe4cc54a583ac0313389dabee66
change-id: 20240920-fix-adp5588-err-check-6ee553b7b856
--

Thanks!
- Nuno Sá



^ permalink raw reply related

* [dtor-input:next] BUILD SUCCESS 55bef83509f0cbe4cc54a583ac0313389dabee66
From: kernel test robot @ 2024-09-20  4:38 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
branch HEAD: 55bef83509f0cbe4cc54a583ac0313389dabee66  Input: Convert comma to semicolon

elapsed time: 2445m

configs tested: 104
configs skipped: 0

The following configs have been built successfully.
More configs may be tested in the coming days.

tested configs:
alpha                             allnoconfig    gcc-13.3.0
arc                               allnoconfig    gcc-13.2.0
arc                   randconfig-001-20240920    gcc-13.2.0
arc                   randconfig-002-20240920    gcc-13.2.0
arm                               allnoconfig    clang-20
arm                   randconfig-001-20240920    gcc-14.1.0
arm                   randconfig-002-20240920    gcc-14.1.0
arm                   randconfig-003-20240920    gcc-14.1.0
arm                   randconfig-004-20240920    gcc-14.1.0
arm64                             allnoconfig    gcc-14.1.0
arm64                 randconfig-001-20240920    gcc-14.1.0
arm64                 randconfig-002-20240920    clang-20
arm64                 randconfig-003-20240920    clang-20
arm64                 randconfig-004-20240920    clang-20
csky                              allnoconfig    gcc-14.1.0
csky                  randconfig-001-20240920    gcc-14.1.0
csky                  randconfig-002-20240920    gcc-14.1.0
hexagon                           allnoconfig    clang-20
hexagon               randconfig-001-20240920    clang-20
hexagon               randconfig-002-20240920    clang-20
i386                             allmodconfig    gcc-12
i386                              allnoconfig    gcc-12
i386                             allyesconfig    gcc-12
i386        buildonly-randconfig-001-20240919    clang-18
i386        buildonly-randconfig-001-20240920    clang-18
i386        buildonly-randconfig-002-20240919    gcc-12
i386        buildonly-randconfig-002-20240920    clang-18
i386        buildonly-randconfig-003-20240919    clang-18
i386        buildonly-randconfig-003-20240920    clang-18
i386        buildonly-randconfig-004-20240919    gcc-12
i386        buildonly-randconfig-004-20240920    clang-18
i386        buildonly-randconfig-005-20240919    clang-18
i386        buildonly-randconfig-005-20240920    gcc-12
i386        buildonly-randconfig-006-20240919    clang-18
i386        buildonly-randconfig-006-20240920    gcc-12
i386                                defconfig    clang-18
i386                  randconfig-001-20240919    clang-18
i386                  randconfig-001-20240920    gcc-12
i386                  randconfig-002-20240919    clang-18
i386                  randconfig-002-20240920    gcc-11
i386                  randconfig-003-20240919    gcc-12
i386                  randconfig-003-20240920    clang-18
i386                  randconfig-004-20240919    clang-18
i386                  randconfig-004-20240920    gcc-12
i386                  randconfig-005-20240919    clang-18
i386                  randconfig-005-20240920    gcc-12
i386                  randconfig-006-20240919    clang-18
i386                  randconfig-006-20240920    clang-18
i386                  randconfig-011-20240919    gcc-12
i386                  randconfig-011-20240920    clang-18
i386                  randconfig-012-20240919    gcc-12
i386                  randconfig-012-20240920    clang-18
i386                  randconfig-013-20240919    clang-18
i386                  randconfig-013-20240920    clang-18
i386                  randconfig-014-20240919    gcc-12
i386                  randconfig-014-20240920    clang-18
i386                  randconfig-015-20240919    gcc-11
i386                  randconfig-015-20240920    gcc-12
i386                  randconfig-016-20240919    clang-18
i386                  randconfig-016-20240920    clang-18
loongarch                        allmodconfig    gcc-14.1.0
loongarch                         allnoconfig    gcc-14.1.0
loongarch             randconfig-001-20240920    gcc-14.1.0
loongarch             randconfig-002-20240920    gcc-14.1.0
m68k                             allmodconfig    gcc-14.1.0
m68k                              allnoconfig    gcc-14.1.0
m68k                             allyesconfig    gcc-14.1.0
microblaze                       allmodconfig    gcc-14.1.0
microblaze                        allnoconfig    gcc-14.1.0
microblaze                       allyesconfig    gcc-14.1.0
mips                              allnoconfig    gcc-14.1.0
nios2                             allnoconfig    gcc-14.1.0
nios2                 randconfig-001-20240920    gcc-14.1.0
nios2                 randconfig-002-20240920    gcc-14.1.0
openrisc                          allnoconfig    gcc-14.1.0
openrisc                         allyesconfig    gcc-14.1.0
parisc                           allmodconfig    gcc-14.1.0
parisc                            allnoconfig    gcc-14.1.0
parisc                           allyesconfig    gcc-14.1.0
parisc                randconfig-001-20240920    gcc-14.1.0
parisc                randconfig-002-20240920    gcc-14.1.0
powerpc                          allmodconfig    gcc-14.1.0
powerpc                           allnoconfig    gcc-14.1.0
powerpc               randconfig-001-20240920    gcc-14.1.0
powerpc               randconfig-002-20240920    clang-20
powerpc               randconfig-003-20240920    gcc-14.1.0
powerpc64             randconfig-001-20240920    gcc-14.1.0
powerpc64             randconfig-002-20240920    clang-20
powerpc64             randconfig-003-20240920    gcc-14.1.0
riscv                             allnoconfig    gcc-14.1.0
riscv                 randconfig-001-20240920    gcc-14.1.0
s390                              allnoconfig    clang-20
sh                               allmodconfig    gcc-14.1.0
sh                                allnoconfig    gcc-14.1.0
sh                               allyesconfig    gcc-14.1.0
um                                allnoconfig    clang-17
x86_64                            allnoconfig    clang-18
x86_64                           allyesconfig    clang-18
x86_64                              defconfig    gcc-11
x86_64                           rhel-8.3-bpf    gcc-12
x86_64                         rhel-8.3-kunit    gcc-12
x86_64                           rhel-8.3-ltp    gcc-12
x86_64                          rhel-8.3-rust    clang-18
xtensa                            allnoconfig    gcc-14.1.0

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply

* Re: [PATCH 5/10] Input: adp5588-keys - added a check key_val
From: Dmitry Torokhov @ 2024-09-19 14:45 UTC (permalink / raw)
  To: Denis Arefev
  Cc: stable, Greg Kroah-Hartman, Michael Hennerich, linux-input,
	linux-kernel, lvc-project
In-Reply-To: <20240919142914.100609-1-arefev@swemel.ru>

Hi Denis,

On Thu, Sep 19, 2024 at 05:29:14PM +0300, Denis Arefev wrote:
> No upstream commit exists for this commit.

Sorry, what does this mean?

> 
> If the adp5588_read function returns 0, then there will be an
> overflow of the kpad->keycode[key_val - 1] buffer.
> 
> If the adp5588_read function returns a negative value, then the
> logic is broken - the wrong value is used as an index of
> the kpad->keycode array.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 69a4af606ed4 ("Input: adp5588-keys - support GPI events for ADP5588 devices")
> Cc: stable@vger.kernel.org
> Signed-off-by: Denis Arefev <arefev@swemel.ru>
> ---
>  drivers/input/keyboard/adp5588-keys.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
> index 90a59b973d00..19be8054eb5f 100644
> --- a/drivers/input/keyboard/adp5588-keys.c
> +++ b/drivers/input/keyboard/adp5588-keys.c
> @@ -272,6 +272,8 @@ static void adp5588_report_events(struct adp5588_kpad *kpad, int ev_cnt)
>  		int key = adp5588_read(kpad->client, Key_EVENTA + i);
>  		int key_val = key & KEY_EV_MASK;
>  
> +		if (key_val <= 0)
> +			continue;

We should be checking the original value (key) and not masked value.
Masked value will never be negative.

		int key, key_vali, key_press;

		key = adp5588_read(kpad->client, Key_EVENTA + i);
		if (key < 0)
			continue;

		key_val = key & key & KEY_EV_MASK;
		key_press = key & KEY_EV_PRESSED;
		if (key_val >= GPI_PIN_BASE && key_val <= GPI_PIN_END) {
			...
		} else if (key_val > 0) {
			...
		}

Thanks.

-- 
Dmitry

^ permalink raw reply

* [PATCH 5/10] Input: adp5588-keys - added a check key_val
From: Denis Arefev @ 2024-09-19 14:29 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Michael Hennerich, Dmitry Torokhov, linux-input, linux-kernel,
	lvc-project

No upstream commit exists for this commit.

If the adp5588_read function returns 0, then there will be an
overflow of the kpad->keycode[key_val - 1] buffer.

If the adp5588_read function returns a negative value, then the
logic is broken - the wrong value is used as an index of
the kpad->keycode array.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 69a4af606ed4 ("Input: adp5588-keys - support GPI events for ADP5588 devices")
Cc: stable@vger.kernel.org
Signed-off-by: Denis Arefev <arefev@swemel.ru>
---
 drivers/input/keyboard/adp5588-keys.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index 90a59b973d00..19be8054eb5f 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -272,6 +272,8 @@ static void adp5588_report_events(struct adp5588_kpad *kpad, int ev_cnt)
 		int key = adp5588_read(kpad->client, Key_EVENTA + i);
 		int key_val = key & KEY_EV_MASK;
 
+		if (key_val <= 0)
+			continue;
 		if (key_val >= GPI_PIN_BASE && key_val <= GPI_PIN_END) {
 			for (j = 0; j < kpad->gpimapsize; j++) {
 				if (key_val == kpad->gpimap[j].pin) {
-- 
2.25.1


^ permalink raw reply related

* Re: [PATCH v4 15/27] regulator: add s2dos05 regulator support
From: Dzmitry Sankouski @ 2024-09-19 14:28 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sebastian Reichel, Bjorn Andersson, Michael Turquette,
	Stephen Boyd, Neil Armstrong, Jessica Zhang, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Dmitry Torokhov, Pavel Machek, Liam Girdwood, Mark Brown,
	Uwe Kleine-König, Chanwoo Choi, Simona Vetter,
	cros-qcom-dts-watchers, Konrad Dybcio, Simona Vetter, linux-pm,
	linux-kernel, linux-arm-msm, linux-clk, dri-devel, devicetree,
	linux-input, linux-leds, linux-pwm, linux-samsung-soc
In-Reply-To: <35liocltjuxv3gjueuvpaytx44crebbc4c63atztakuq5dfpax@bquve7tkrvtx>

> > diff --git a/include/linux/regulator/s2dos05.h b/include/linux/regulator/s2dos05.h
> > new file mode 100644
> > index 000000000000..2e89fcbce769
> > --- /dev/null
> > +++ b/include/linux/regulator/s2dos05.h
> > @@ -0,0 +1,73 @@
> > +/* SPDX-License-Identifier: GPL-2.0+ */
>
> Are you sure that here (and other places) you want any newer GPL? This
> is quite odd. Does original code (from which you took 2016 copyrights)
> have this as well?
>
Original code permits redistribution under 2+ license [1].
Is 2+ preferable over 2 only?

[1]: https://github.com/klabit87/twrp_android_samsung_kernel_sdm845/blob/android-8.0/include/linux/regulator/s2dos05.h#L9

^ permalink raw reply

* Re: [PATCH v4 23/27] arm64: dts: qcom: starqltechn: add display PMIC
From: Krzysztof Kozlowski @ 2024-09-19 14:00 UTC (permalink / raw)
  To: Dzmitry Sankouski
  Cc: Sebastian Reichel, Bjorn Andersson, Michael Turquette,
	Stephen Boyd, Neil Armstrong, Jessica Zhang, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Dmitry Torokhov, Pavel Machek, Liam Girdwood, Mark Brown,
	Uwe Kleine-König, Chanwoo Choi, Simona Vetter,
	cros-qcom-dts-watchers, Konrad Dybcio, Simona Vetter, linux-pm,
	linux-kernel, linux-arm-msm, linux-clk, dri-devel, devicetree,
	linux-input, linux-leds, linux-pwm, linux-samsung-soc
In-Reply-To: <CABTCjFCwg9HJcAQOG4+jeHviPiXoSiQgzX-ogUPQt1M2494aBQ@mail.gmail.com>

On 19/09/2024 15:17, Dzmitry Sankouski wrote:
>>> +             pmic@60 {
>>> +                     compatible = "samsung,s2dos05";
>>> +                     reg = <0x60>;
>>> +
>>> +                     regulators {
>>> +                             s2dos05_ldo1: ldo1 {
>>> +                                     regulator-active-discharge = <1>;
>>> +                                     regulator-enable-ramp-delay = <12000>;
>>> +                                     regulator-min-microvolt = <1500000>;
>>> +                                     regulator-max-microvolt = <2000000>;
>>> +                                     regulator-name = "s2dos05-ldo1";
>>
>> Useless name. Please use rather names from the schematics, but I guess
>> you might not have them, so maybe downstream has reasonable name?
> 
> Unfortunately, downstream uses that same name.

Then "ldo1" is enough.

Best regards,
Krzysztof


^ permalink raw reply

* Re: [PATCH v4 23/27] arm64: dts: qcom: starqltechn: add display PMIC
From: Dzmitry Sankouski @ 2024-09-19 13:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sebastian Reichel, Bjorn Andersson, Michael Turquette,
	Stephen Boyd, Neil Armstrong, Jessica Zhang, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Dmitry Torokhov, Pavel Machek, Liam Girdwood, Mark Brown,
	Uwe Kleine-König, Chanwoo Choi, Simona Vetter,
	cros-qcom-dts-watchers, Konrad Dybcio, Simona Vetter, linux-pm,
	linux-kernel, linux-arm-msm, linux-clk, dri-devel, devicetree,
	linux-input, linux-leds, linux-pwm, linux-samsung-soc
In-Reply-To: <rfoxnd4axyqxvexgq3mm2zntzvpihv4g424hepkoh7bfr2izjz@htjeqbfuq2gu>

> > +             pmic@60 {
> > +                     compatible = "samsung,s2dos05";
> > +                     reg = <0x60>;
> > +
> > +                     regulators {
> > +                             s2dos05_ldo1: ldo1 {
> > +                                     regulator-active-discharge = <1>;
> > +                                     regulator-enable-ramp-delay = <12000>;
> > +                                     regulator-min-microvolt = <1500000>;
> > +                                     regulator-max-microvolt = <2000000>;
> > +                                     regulator-name = "s2dos05-ldo1";
>
> Useless name. Please use rather names from the schematics, but I guess
> you might not have them, so maybe downstream has reasonable name?

Unfortunately, downstream uses that same name.

-- 

Best regards,
Dzmitry

^ permalink raw reply

* Re: [PATCH v4 06/27] dt-bindings: mfd: add samsung,s2dos05
From: Dzmitry Sankouski @ 2024-09-19 12:50 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sebastian Reichel, Bjorn Andersson, Michael Turquette,
	Stephen Boyd, Neil Armstrong, Jessica Zhang, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Dmitry Torokhov, Pavel Machek, Liam Girdwood, Mark Brown,
	Uwe Kleine-König, Chanwoo Choi, Simona Vetter,
	cros-qcom-dts-watchers, Konrad Dybcio, Simona Vetter, linux-pm,
	linux-kernel, linux-arm-msm, linux-clk, dri-devel, devicetree,
	linux-input, linux-leds, linux-pwm, linux-samsung-soc
In-Reply-To: <bpujvanzp4yph2jkgog2rkvoywjtqad3jgk47kkex6v223flpb@66zporslyjzt>

пн, 16 сент. 2024 г. в 12:14, Krzysztof Kozlowski <krzk@kernel.org>:
>
> On Fri, Sep 13, 2024 at 06:07:49PM +0300, Dzmitry Sankouski wrote:
> > Add samsung,s2dos05 MFD module binding.
> >
> > Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> >
> > ---
> > Changes in v4:
> > - split long(>80) lines
> > - fix indentation
> > - merge with regulators binding
> > - drop pmic suffix
> > - drop unused labels in example
> > - correct description
> > ---
> >  .../devicetree/bindings/mfd/samsung,s2dos05.yaml   | 99 ++++++++++++++++++++++
> >  MAINTAINERS                                        |  1 +
> >  2 files changed, 100 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/mfd/samsung,s2dos05.yaml b/Documentation/devicetree/bindings/mfd/samsung,s2dos05.yaml
> > new file mode 100644
> > index 000000000000..534434002045
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/samsung,s2dos05.yaml
> > @@ -0,0 +1,99 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/mfd/samsung,s2dos05.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Samsung S2DOS05 Power Management IC
> > +
> > +maintainers:
> > +  - Dzmitry Sankouski <dsankouski@gmail.com>
> > +
> > +description:
> > +  This is a device tree bindings for S2DOS family of Power Management IC (PMIC).
>
> Drop this sentence, not really useful. I know that I put it into other
> Samsung PMIC bindings, but let's don't grow this pattern.
>
> > +
> > +  The S2DOS05 is a companion power management IC for the panel and touchscreen
> > +  in smart phones. Provides voltage regulators and
> > +  ADC for power/current measurements.
> > +
> > +  Regulator section has 4 LDO and 1 BUCK regulators and also
> > +  provides ELVDD, ELVSS, AVDD lines.
>
> What are these? Input supplies?
>

ELVSS and ELVDD are common abbreviations for AMOLED panel backlight supplies,
AVDD for panel electronics. I conclude that s2dos05 ic provides
ELVSS, ELVDD, AVDD from the facts, it can measure its current and power.
Those power lines are controlled by display hardware [1],
i.e. vendor kernel driver has no clue how to control those regulators.

I guess they just combined regular regulator ic with ELVSS, ELVDD, AVDD ic
like [2].

[1]: https://github.com/klabit87/twrp_android_samsung_kernel_sdm845/blob/android-8.0/drivers/gpu/drm/msm/samsung/S6E3HA8_AMB577PX01/dsi_panel_S6E3HA8_AMB577PX01_wqhd_octa_cmd.dtsi#L3508
[2]: https://www.st.com/resource/en/data_brief/stmp30.pdf

^ permalink raw reply

* Re: [PATCH v4 08/27] mfd: max77693: remove unused declarations
From: Krzysztof Kozlowski @ 2024-09-19 10:07 UTC (permalink / raw)
  To: Dzmitry Sankouski
  Cc: Sebastian Reichel, Bjorn Andersson, Michael Turquette,
	Stephen Boyd, Neil Armstrong, Jessica Zhang, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Dmitry Torokhov, Pavel Machek, Liam Girdwood, Mark Brown,
	Uwe Kleine-König, Chanwoo Choi, Simona Vetter,
	cros-qcom-dts-watchers, Konrad Dybcio, Simona Vetter, linux-pm,
	linux-kernel, linux-arm-msm, linux-clk, dri-devel, devicetree,
	linux-input, linux-leds, linux-pwm, linux-samsung-soc
In-Reply-To: <CABTCjFDKuEM2wogLcJXX+0eCOTCDUSycPi7JCjvdRCbXaP2EOg@mail.gmail.com>

On 19/09/2024 10:40, Dzmitry Sankouski wrote:
> чт, 19 сент. 2024 г. в 10:00, Krzysztof Kozlowski <krzk@kernel.org>:
>>
>> On 18/09/2024 14:53, Dzmitry Sankouski wrote:
>>> пн, 16 сент. 2024 г. в 12:10, Krzysztof Kozlowski <krzk@kernel.org>:
>>>>
>>>> On Fri, Sep 13, 2024 at 06:07:51PM +0300, Dzmitry Sankouski wrote:
>>>>> Remove `enum max77693_irq_source` declaration because unused.
>>>>>
>>>>> Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
>>>>> ---
>>>>>  include/linux/mfd/max77693-private.h | 11 -----------
>>>>>  1 file changed, 11 deletions(-)
>>>>
>>>> Please split your patchset per subsystems. There is no dependency on MFD
>>>> bits from your DTS... (if there is, this needs to be fixed anyway)
>>>
>>> Indeed, my dts has no dependency on this patch.
>>> However, my dts has dependency on MAX77705, so AFAIU,
>>> I should send this patch separately, while leaving other drivers in same
>>> patchset, right?
>>
>> How DTS could have dependency on MAX77705? It's a clear no go - broken
>> patch. And something very weird, almost never happening for new hardware.
>>
> Oh right, dts only depends on driver bindings, not driver code, so I
> can send dts
> patches with bindings in separate series, and per subsystem series for new
> driver code.

This is how you can organize patchsets:
https://lore.kernel.org/all/20231121-topic-sm8650-upstream-dt-v3-0-db9d0507ffd3@linaro.org/


Here is a brief description how to organize the patchset:
https://lore.kernel.org/linux-samsung-soc/CADrjBPq_0nUYRABKpskRF_dhHu+4K=duPVZX==0pr+cjSL_caQ@mail.gmail.com/T/#m2d9130a1342ab201ab49670fa6c858ee3724c83c
Best regards,
Krzysztof


^ permalink raw reply

* Re: [PATCH v4 08/27] mfd: max77693: remove unused declarations
From: Dzmitry Sankouski @ 2024-09-19  8:40 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sebastian Reichel, Bjorn Andersson, Michael Turquette,
	Stephen Boyd, Neil Armstrong, Jessica Zhang, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Dmitry Torokhov, Pavel Machek, Liam Girdwood, Mark Brown,
	Uwe Kleine-König, Chanwoo Choi, Simona Vetter,
	cros-qcom-dts-watchers, Konrad Dybcio, Simona Vetter, linux-pm,
	linux-kernel, linux-arm-msm, linux-clk, dri-devel, devicetree,
	linux-input, linux-leds, linux-pwm, linux-samsung-soc
In-Reply-To: <6886f561-b9e4-468b-9515-72053d57911f@kernel.org>

чт, 19 сент. 2024 г. в 10:00, Krzysztof Kozlowski <krzk@kernel.org>:
>
> On 18/09/2024 14:53, Dzmitry Sankouski wrote:
> > пн, 16 сент. 2024 г. в 12:10, Krzysztof Kozlowski <krzk@kernel.org>:
> >>
> >> On Fri, Sep 13, 2024 at 06:07:51PM +0300, Dzmitry Sankouski wrote:
> >>> Remove `enum max77693_irq_source` declaration because unused.
> >>>
> >>> Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> >>> ---
> >>>  include/linux/mfd/max77693-private.h | 11 -----------
> >>>  1 file changed, 11 deletions(-)
> >>
> >> Please split your patchset per subsystems. There is no dependency on MFD
> >> bits from your DTS... (if there is, this needs to be fixed anyway)
> >
> > Indeed, my dts has no dependency on this patch.
> > However, my dts has dependency on MAX77705, so AFAIU,
> > I should send this patch separately, while leaving other drivers in same
> > patchset, right?
>
> How DTS could have dependency on MAX77705? It's a clear no go - broken
> patch. And something very weird, almost never happening for new hardware.
>
Oh right, dts only depends on driver bindings, not driver code, so I
can send dts
patches with bindings in separate series, and per subsystem series for new
driver code.

^ permalink raw reply

* Re: [PATCH v4 08/27] mfd: max77693: remove unused declarations
From: Krzysztof Kozlowski @ 2024-09-19  7:00 UTC (permalink / raw)
  To: Dzmitry Sankouski
  Cc: Sebastian Reichel, Bjorn Andersson, Michael Turquette,
	Stephen Boyd, Neil Armstrong, Jessica Zhang, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Dmitry Torokhov, Pavel Machek, Liam Girdwood, Mark Brown,
	Uwe Kleine-König, Chanwoo Choi, Simona Vetter,
	cros-qcom-dts-watchers, Konrad Dybcio, Simona Vetter, linux-pm,
	linux-kernel, linux-arm-msm, linux-clk, dri-devel, devicetree,
	linux-input, linux-leds, linux-pwm, linux-samsung-soc
In-Reply-To: <CABTCjFAvXYrRJS3Dwf-TMq3OW_vN1hskk+qPjosbRym7xOvy1Q@mail.gmail.com>

On 18/09/2024 14:53, Dzmitry Sankouski wrote:
> пн, 16 сент. 2024 г. в 12:10, Krzysztof Kozlowski <krzk@kernel.org>:
>>
>> On Fri, Sep 13, 2024 at 06:07:51PM +0300, Dzmitry Sankouski wrote:
>>> Remove `enum max77693_irq_source` declaration because unused.
>>>
>>> Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
>>> ---
>>>  include/linux/mfd/max77693-private.h | 11 -----------
>>>  1 file changed, 11 deletions(-)
>>
>> Please split your patchset per subsystems. There is no dependency on MFD
>> bits from your DTS... (if there is, this needs to be fixed anyway)
> 
> Indeed, my dts has no dependency on this patch.
> However, my dts has dependency on MAX77705, so AFAIU,
> I should send this patch separately, while leaving other drivers in same
> patchset, right?

How DTS could have dependency on MAX77705? It's a clear no go - broken
patch. And something very weird, almost never happening for new hardware.

Best regards,
Krzysztof


^ permalink raw reply

* Re: [PATCH v6 2/2] dt-bindings: mfd: mediatek: mt6397: Convert to DT schema format
From: Macpaul Lin @ 2024-09-18 14:18 UTC (permalink / raw)
  To: Alexandre Belloni
  Cc: Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, Liam Girdwood, Mark Brown, Sean Wang,
	Sen Chu, netdev, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Dmitry Torokhov, Pavel Machek, Lee Jones,
	Sebastian Reichel, Chen Zhong, linux-input, linux-leds, linux-pm,
	linux-rtc, linux-sound, Alexandre Mergnat, Bear Wang, Pablo Sun,
	Macpaul Lin, Chris-qj chen, MediaTek Chromebook Upstream,
	Chen-Yu Tsai
In-Reply-To: <20240918115651c1475d36@mail.local>


On 9/18/24 19:56, Alexandre Belloni wrote:
> 
> On 18/09/2024 13:51:51+0200, Alexandre Belloni wrote:
>> > Changes for v4:
>> >  - Remove "mediatek,mt6357" from PMIC's compatible string since there is a
>> >    seperated DT schema for PMIC mt6357.
>> > 
>> > Changes for v5:
>> >  - Rebase to next-20240913 (linux-next/master).
>> >  - Fix the "title" (device type) of mfd/mediatek,mt6397.yaml to "PMIC".
>> >  - RTC:
>> >   - Drop "start-year"
>> 
>> Maybe, instead of dropping the property, you should add support in the
>> driver by setting range_min and range_max.
> 
> Looking at this even more, the driver can probably be simplified by
> setting start_year in probe and dropping RTC_MIN_YEAR_OFFSET.

Thank you for pointing out where and how the driver should be changed.
However, I'm wondering if this should be a fix with a separated
patchset (bindings and the driver)? The board or SoC's device trees
should be reviewed as well. I'll need to get someone's help (permission) 
inside MediaTek to check those dts and construct the patch for RTC driver.
That will take sometime.

[snip]

Thanks.
Best Regards,
Macpaul Lin

^ permalink raw reply

* Re: [PATCH v4 08/27] mfd: max77693: remove unused declarations
From: Dzmitry Sankouski @ 2024-09-18 12:53 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Sebastian Reichel, Bjorn Andersson, Michael Turquette,
	Stephen Boyd, Neil Armstrong, Jessica Zhang, Sam Ravnborg,
	Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Lee Jones,
	Dmitry Torokhov, Pavel Machek, Liam Girdwood, Mark Brown,
	Uwe Kleine-König, Chanwoo Choi, Simona Vetter,
	cros-qcom-dts-watchers, Konrad Dybcio, Simona Vetter, linux-pm,
	linux-kernel, linux-arm-msm, linux-clk, dri-devel, devicetree,
	linux-input, linux-leds, linux-pwm, linux-samsung-soc
In-Reply-To: <wywp6vj2pqqe7to55k7ssh5sbqrmy7emvwruvm2waytancf3r4@aygtw3y6huwx>

пн, 16 сент. 2024 г. в 12:10, Krzysztof Kozlowski <krzk@kernel.org>:
>
> On Fri, Sep 13, 2024 at 06:07:51PM +0300, Dzmitry Sankouski wrote:
> > Remove `enum max77693_irq_source` declaration because unused.
> >
> > Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> > ---
> >  include/linux/mfd/max77693-private.h | 11 -----------
> >  1 file changed, 11 deletions(-)
>
> Please split your patchset per subsystems. There is no dependency on MFD
> bits from your DTS... (if there is, this needs to be fixed anyway)

Indeed, my dts has no dependency on this patch.
However, my dts has dependency on MAX77705, so AFAIU,
I should send this patch separately, while leaving other drivers in same
patchset, right?

^ permalink raw reply

* Re: [PATCH v6 1/2] regulator: dt-bindings: mt6323: Convert to DT schema
From: AngeloGioacchino Del Regno @ 2024-09-18 12:20 UTC (permalink / raw)
  To: Macpaul Lin, Andrew Lunn, Florian Fainelli, Vladimir Oltean,
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	Liam Girdwood, Mark Brown, Sean Wang, Sen Chu, netdev, devicetree,
	linux-kernel, linux-arm-kernel, linux-mediatek, Dmitry Torokhov,
	Pavel Machek, Lee Jones, Sebastian Reichel, Alexandre Belloni,
	Chen Zhong, linux-input, linux-leds, linux-pm, linux-rtc,
	linux-sound, Alexandre Mergnat
  Cc: Bear Wang, Pablo Sun, Macpaul Lin, Chris-qj chen,
	MediaTek Chromebook Upstream, Chen-Yu Tsai
In-Reply-To: <20240918064955.6518-1-macpaul.lin@mediatek.com>

Il 18/09/24 08:49, Macpaul Lin ha scritto:
> Convert the MT6323 regulator binding from the old text-based format to
> the new DT schema style. The property "regulator-name" has been added
> as required property to reflect current usage in mt6323.dtsi.
> 
> Examples have been streamlined and relocated to the parent schema file:
>    mfd/mediatek,mt6397.yaml.
> 
> Update maintainer and submitter information with new entries from MediaTek.
> 
> The reference document cited in "mediatek,mt7530.yaml" has been updated
> to point to this new DT schema file
> 
> Signed-off-by: Sen Chu <sen.chu@mediatek.com>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>



^ permalink raw reply

* [PATCH] HID: wiimote: Improve error handling in two functions
From: Markus Elfring @ 2024-09-18 12:00 UTC (permalink / raw)
  To: linux-input, Benjamin Tissoires, David Rheinsberg, Jiri Kosina; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Sep 2024 13:51:29 +0200

Add jump targets so that a bit of exception handling can be better reused
at the end of two function implementations.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/hid/hid-wiimote-modules.c | 34 ++++++++++++++++---------------
 1 file changed, 18 insertions(+), 16 deletions(-)

diff --git a/drivers/hid/hid-wiimote-modules.c b/drivers/hid/hid-wiimote-modules.c
index dbccdfa63916..3c10b1c68984 100644
--- a/drivers/hid/hid-wiimote-modules.c
+++ b/drivers/hid/hid-wiimote-modules.c
@@ -1424,15 +1424,12 @@ static ssize_t wiimod_bboard_calib_show(struct device *dev,
 		return ret;

 	ret = wiimote_cmd_read(wdata, 0xa40024, buf, 12);
-	if (ret != 12) {
-		wiimote_cmd_release(wdata);
-		return ret < 0 ? ret : -EIO;
-	}
+	if (ret != 12)
+		goto release_wdata;
+
 	ret = wiimote_cmd_read(wdata, 0xa40024 + 12, buf + 12, 12);
-	if (ret != 12) {
-		wiimote_cmd_release(wdata);
-		return ret < 0 ? ret : -EIO;
-	}
+	if (ret != 12)
+		goto release_wdata;

 	wiimote_cmd_release(wdata);

@@ -1460,6 +1457,10 @@ static ssize_t wiimod_bboard_calib_show(struct device *dev,
 	}

 	return ret;
+
+release_wdata:
+	wiimote_cmd_release(wdata);
+	return ret < 0 ? ret : -EIO;
 }

 static DEVICE_ATTR(bboard_calib, S_IRUGO, wiimod_bboard_calib_show, NULL);
@@ -1473,15 +1474,12 @@ static int wiimod_bboard_probe(const struct wiimod_ops *ops,
 	wiimote_cmd_acquire_noint(wdata);

 	ret = wiimote_cmd_read(wdata, 0xa40024, buf, 12);
-	if (ret != 12) {
-		wiimote_cmd_release(wdata);
-		return ret < 0 ? ret : -EIO;
-	}
+	if (ret != 12)
+		goto release_wdata;
+
 	ret = wiimote_cmd_read(wdata, 0xa40024 + 12, buf + 12, 12);
-	if (ret != 12) {
-		wiimote_cmd_release(wdata);
-		return ret < 0 ? ret : -EIO;
-	}
+	if (ret != 12)
+		goto release_wdata;

 	wiimote_cmd_release(wdata);

@@ -1546,6 +1544,10 @@ static int wiimod_bboard_probe(const struct wiimod_ops *ops,
 	input_free_device(wdata->extension.input);
 	wdata->extension.input = NULL;
 	return ret;
+
+release_wdata:
+	wiimote_cmd_release(wdata);
+	return ret < 0 ? ret : -EIO;
 }

 static void wiimod_bboard_remove(const struct wiimod_ops *ops,
--
2.46.0


^ permalink raw reply related

* Re: [PATCH v6 2/2] dt-bindings: mfd: mediatek: mt6397: Convert to DT schema format
From: Alexandre Belloni @ 2024-09-18 11:56 UTC (permalink / raw)
  To: Macpaul Lin
  Cc: Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, Liam Girdwood, Mark Brown, Sean Wang,
	Sen Chu, netdev, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Dmitry Torokhov, Pavel Machek, Lee Jones,
	Sebastian Reichel, Chen Zhong, linux-input, linux-leds, linux-pm,
	linux-rtc, linux-sound, Alexandre Mergnat, Bear Wang, Pablo Sun,
	Macpaul Lin, Chris-qj chen, MediaTek Chromebook Upstream,
	Chen-Yu Tsai
In-Reply-To: <20240918115151c896f33f@mail.local>

On 18/09/2024 13:51:51+0200, Alexandre Belloni wrote:
> > Changes for v4:
> >  - Remove "mediatek,mt6357" from PMIC's compatible string since there is a
> >    seperated DT schema for PMIC mt6357.
> > 
> > Changes for v5:
> >  - Rebase to next-20240913 (linux-next/master).
> >  - Fix the "title" (device type) of mfd/mediatek,mt6397.yaml to "PMIC".
> >  - RTC:
> >   - Drop "start-year"
> 
> Maybe, instead of dropping the property, you should add support in the
> driver by setting range_min and range_max.

Looking at this even more, the driver can probably be simplified by
setting start_year in probe and dropping RTC_MIN_YEAR_OFFSET.

> 
> >  - Regulators:
> >   - Add blank lines between description and properties.
> >   - Drop allOf for the $ref section on property.
> >  - clocks:
> >   - Fix no need '|' in descriptoin.
> >   - Add blank lines between description and properties.
> >  - Keys:
> >   - Drop compatible since these enums are already in $ref.
> >  - pinctrl:
> >   - Drop compatible since it is already in $ref.
> >  - examples:
> >   - Fix indentations for leds and keys.
> > 
> > Changes for v6:
> >  - Commit message:
> >   - Add note for simplifying examples of mt6358 and mt6397.
> >  - examples:
> >   - Fix indentations for mt6323-keys.
> >   - MT6358 and MT6397: simplify settings in regulators.
> >    - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
> >      sections as they contain typical settings for different PMICs.
> > 
> > diff --git a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> > index 70567d9..466566a 100644
> > --- a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> > +++ b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> > @@ -19,7 +19,7 @@ description: |
> >    by the PMIC that is defined as a Multi-Function Device (MFD).
> >  
> >    For MediaTek MT6323/MT6397 PMIC bindings see
> > -  Documentation/devicetree/bindings/mfd/mt6397.txt
> > +  Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> >  
> >  properties:
> >    compatible:
> > diff --git a/Documentation/devicetree/bindings/leds/leds-mt6323.txt b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> > deleted file mode 100644
> > index 052dccb8..0000000
> > --- a/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> > +++ /dev/null
> > @@ -1,63 +0,0 @@
> > -Device Tree Bindings for LED support on MT6323 PMIC
> > -
> > -MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
> > -controllers are defined as the subnode of the function node provided by MT6323
> > -PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
> > -using shared bus called PMIC wrapper for each subfunction to access remote
> > -MT6323 PMIC hardware.
> > -
> > -For MT6323 MFD bindings see:
> > -Documentation/devicetree/bindings/mfd/mt6397.txt
> > -For MediaTek PMIC wrapper bindings see:
> > -Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
> > -
> > -Required properties:
> > -- compatible : Must be one of
> > -  - "mediatek,mt6323-led"
> > -  - "mediatek,mt6331-led"
> > -  - "mediatek,mt6332-led"
> > -- address-cells : Must be 1
> > -- size-cells : Must be 0
> > -
> > -Each led is represented as a child node of the mediatek,mt6323-led that
> > -describes the initial behavior for each LED physically and currently only four
> > -LED child nodes can be supported.
> > -
> > -Required properties for the LED child node:
> > -- reg : LED channel number (0..3)
> > -
> > -Optional properties for the LED child node:
> > -- label : See Documentation/devicetree/bindings/leds/common.txt
> > -- linux,default-trigger : See Documentation/devicetree/bindings/leds/common.txt
> > -- default-state: See Documentation/devicetree/bindings/leds/common.txt
> > -
> > -Example:
> > -
> > -	mt6323: pmic {
> > -		compatible = "mediatek,mt6323";
> > -
> > -		...
> > -
> > -		mt6323led: leds {
> > -			compatible = "mediatek,mt6323-led";
> > -			#address-cells = <1>;
> > -			#size-cells = <0>;
> > -
> > -			led@0 {
> > -				reg = <0>;
> > -				label = "LED0";
> > -				linux,default-trigger = "timer";
> > -				default-state = "on";
> > -			};
> > -			led@1 {
> > -				reg = <1>;
> > -				label = "LED1";
> > -				default-state = "off";
> > -			};
> > -			led@2 {
> > -				reg = <2>;
> > -				label = "LED2";
> > -				default-state = "on";
> > -			};
> > -		};
> > -	};
> > diff --git a/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> > new file mode 100644
> > index 0000000..953358b
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> > @@ -0,0 +1,601 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: MediaTek MT6397/MT6323 PMIC
> > +
> > +maintainers:
> > +  - Sen Chu <sen.chu@mediatek.com>
> > +  - Macpaul Lin <macpaul.lin@mediatek.com>
> > +
> > +description: |
> > +  MT6397/MT6323 is a power management system chip.
> > +  Please see the sub-modules below for supported features.
> > +
> > +  MT6397/MT6323 is a multifunction device with the following sub modules:
> > +  - Regulators
> > +  - RTC
> > +  - Audio codec
> > +  - GPIO
> > +  - Clock
> > +  - LED
> > +  - Keys
> > +  - Power controller
> > +
> > +  It is interfaced to host controller using SPI interface by a proprietary hardware
> > +  called PMIC wrapper or pwrap. MT6397/MT6323 PMIC is a child device of pwrap.
> > +  See the following for pwrap node definitions:
> > +  Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - enum:
> > +          - mediatek,mt6323
> > +          - mediatek,mt6331 # "mediatek,mt6331" for PMIC MT6331 and MT6332.
> > +          - mediatek,mt6358
> > +          - mediatek,mt6359
> > +          - mediatek,mt6397
> > +      - items:
> > +          - enum:
> > +              - mediatek,mt6366
> > +          - const: mediatek,mt6358
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  interrupt-controller: true
> > +
> > +  "#interrupt-cells":
> > +    const: 2
> > +
> > +  rtc:
> > +    type: object
> > +    $ref: /schemas/rtc/rtc.yaml#
> > +    unevaluatedProperties: false
> > +    description:
> > +      MT6397 Real Time Clock.
> > +
> > +    properties:
> > +      compatible:
> > +        oneOf:
> > +          - enum:
> > +              - mediatek,mt6323-rtc
> > +              - mediatek,mt6331-rtc
> > +              - mediatek,mt6358-rtc
> > +              - mediatek,mt6397-rtc
> > +          - items:
> > +              - enum:
> > +                  - mediatek,mt6366-rtc
> > +              - const: mediatek,mt6358-rtc
> > +
> > +    required:
> > +      - compatible
> > +
> > +  regulators:
> > +    type: object
> > +    description:
> > +      List of child nodes that specify the regulators.
> > +    additionalProperties: true
> > +
> > +    properties:
> > +      compatible:
> > +        oneOf:
> > +          - enum:
> > +              - mediatek,mt6323-regulator
> > +              - mediatek,mt6358-regulator
> > +              - mediatek,mt6397-regulator
> > +          - items:
> > +              - enum:
> > +                  - mediatek,mt6366-regulator
> > +              - const: mediatek,mt6358-regulator
> > +
> > +    required:
> > +      - compatible
> > +
> > +  audio-codec:
> > +    type: object
> > +    additionalProperties: false
> > +    description:
> > +      Audio codec support with MT6397 and MT6358.
> > +
> > +    properties:
> > +      compatible:
> > +        oneOf:
> > +          - enum:
> > +              - mediatek,mt6397-codec
> > +              - mediatek,mt6358-sound
> > +          - items:
> > +              - enum:
> > +                  - mediatek,mt6366-sound
> > +              - const: mediatek,mt6358-sound
> > +
> > +      mediatek,dmic-mode:
> > +        description: |
> > +          Indicates how many data pins are used to transmit two channels of PDM
> > +          signal.
> > +          0 - two wires;
> > +          1 - one wire;
> > +          Default value is 0.
> > +        enum: [0, 1]
> > +        default: 0
> > +
> > +      Avdd-supply:
> > +        description: Power source of AVDD.
> > +
> > +    required:
> > +      - compatible
> > +
> > +  clocks:
> > +    type: object
> > +    additionalProperties: false
> > +    description:
> > +      This is a clock buffer node for mt6397. However, there are no sub nodes
> > +      or any public document exposed in public.
> > +
> > +    properties:
> > +      compatible:
> > +        const: mediatek,mt6397-clk
> > +
> > +      '#clock-cells':
> > +        const: 1
> > +
> > +    required:
> > +      - compatible
> > +
> > +  leds:
> > +    type: object
> > +    additionalProperties: false
> > +    description: |
> > +      MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
> > +      controllers are defined as the subnode of the function node provided by MT6323
> > +      PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
> > +      using shared bus called PMIC wrapper for each subfunction to access remote
> > +      MT6323 PMIC hardware.
> > +
> > +      Each led is represented as a child node of the mediatek,mt6323-led that
> > +      describes the initial behavior for each LED physically and currently only four
> > +      LED child nodes can be supported.
> > +
> > +    properties:
> > +      compatible:
> > +        enum:
> > +          - mediatek,mt6323-led
> > +          - mediatek,mt6331-led
> > +          - mediatek,mt6332-led
> > +
> > +      reg:
> > +        maxItems: 1
> > +
> > +      "#address-cells":
> > +        const: 1
> > +
> > +      "#size-cells":
> > +        const: 0
> > +
> > +    patternProperties:
> > +      "^led@[0-3]$":
> > +        type: object
> > +        $ref: /schemas/leds/common.yaml#
> > +        unevaluatedProperties: false
> > +
> > +        properties:
> > +          reg:
> > +            description:
> > +              LED channel number (0..3)
> > +            minimum: 0
> > +            maximum: 3
> > +
> > +        required:
> > +          - reg
> > +
> > +    required:
> > +      - compatible
> > +      - "#address-cells"
> > +      - "#size-cells"
> > +
> > +  keys:
> > +    type: object
> > +    $ref: /schemas/input/mediatek,pmic-keys.yaml
> > +    unevaluatedProperties: false
> > +    description:
> > +      Power and Home keys.
> > +
> > +  power-controller:
> > +    type: object
> > +    additionalProperties: false
> > +    description:
> > +      The power controller which could be found on PMIC is responsible for
> > +      externally powering off or on the remote MediaTek SoC through the
> > +      circuit BBPU (baseband power up).
> > +
> > +    properties:
> > +      compatible:
> > +        const: mediatek,mt6323-pwrc
> > +
> > +      '#power-domain-cells':
> > +        const: 0
> > +
> > +  pinctrl:
> > +    type: object
> > +    $ref: /schemas/pinctrl/mediatek,mt65xx-pinctrl.yaml
> > +    unevaluatedProperties: false
> > +    description:
> > +      Pin controller
> > +
> > +required:
> > +  - compatible
> > +  - regulators
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +    #include <dt-bindings/leds/common.h>
> > +
> > +    pmic {
> > +        compatible = "mediatek,mt6323";
> > +        interrupt-parent = <&pio>;
> > +        interrupts = <150 IRQ_TYPE_LEVEL_HIGH>;
> > +        interrupt-controller;
> > +        #interrupt-cells = <2>;
> > +
> > +        leds {
> > +            compatible = "mediatek,mt6323-led";
> > +            #address-cells = <1>;
> > +            #size-cells = <0>;
> > +        };
> > +
> > +        regulators {
> > +            compatible = "mediatek,mt6323-regulator";
> > +
> > +            buck_vproc {
> > +                regulator-name = "vproc";
> > +                regulator-min-microvolt = < 700000>;
> > +                regulator-max-microvolt = <1350000>;
> > +                regulator-ramp-delay = <12500>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            buck_vsys {
> > +                regulator-name = "vsys";
> > +                regulator-min-microvolt = <1400000>;
> > +                regulator-max-microvolt = <2987500>;
> > +                regulator-ramp-delay = <25000>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            buck_vpa {
> > +                regulator-name = "vpa";
> > +                regulator-min-microvolt = < 500000>;
> > +                regulator-max-microvolt = <3650000>;
> > +            };
> > +
> > +            ldo_vtcxo {
> > +                regulator-name = "vtcxo";
> > +                regulator-min-microvolt = <2800000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-enable-ramp-delay = <90>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vcn28 {
> > +                regulator-name = "vcn28";
> > +                regulator-min-microvolt = <2800000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-enable-ramp-delay = <185>;
> > +            };
> > +
> > +            ldo_vcn33_bt {
> > +                regulator-name = "vcn33_bt";
> > +                regulator-min-microvolt = <3300000>;
> > +                regulator-max-microvolt = <3600000>;
> > +                regulator-enable-ramp-delay = <185>;
> > +            };
> > +
> > +            ldo_vcn33_wifi {
> > +                regulator-name = "vcn33_wifi";
> > +                regulator-min-microvolt = <3300000>;
> > +                regulator-max-microvolt = <3600000>;
> > +                regulator-enable-ramp-delay = <185>;
> > +            };
> > +
> > +            ldo_va {
> > +                regulator-name = "va";
> > +                regulator-min-microvolt = <2800000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vcama {
> > +                regulator-name = "vcama";
> > +                regulator-min-microvolt = <1500000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vio28 {
> > +                regulator-name = "vio28";
> > +                regulator-min-microvolt = <2800000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vusb {
> > +                regulator-name = "vusb";
> > +                regulator-min-microvolt = <3300000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vmc {
> > +                regulator-name = "vmc";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <36>;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vmch {
> > +                regulator-name = "vmch";
> > +                regulator-min-microvolt = <3000000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <36>;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vemc3v3 {
> > +                regulator-name = "vemc3v3";
> > +                regulator-min-microvolt = <3000000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <36>;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vgp1 {
> > +                regulator-name = "vgp1";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vgp2 {
> > +                regulator-name = "vgp2";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <3000000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vgp3 {
> > +                regulator-name = "vgp3";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vcn18 {
> > +                regulator-name = "vcn18";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vsim1 {
> > +                regulator-name = "vsim1";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <3000000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vsim2 {
> > +                regulator-name = "vsim2";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <3000000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vrtc {
> > +                regulator-name = "vrtc";
> > +                regulator-min-microvolt = <2800000>;
> > +                regulator-max-microvolt = <2800000>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vcamaf {
> > +                regulator-name = "vcamaf";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vibr {
> > +                regulator-name = "vibr";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <36>;
> > +            };
> > +
> > +            ldo_vrf18 {
> > +                regulator-name = "vrf18";
> > +                regulator-min-microvolt = <1825000>;
> > +                regulator-max-microvolt = <1825000>;
> > +                regulator-enable-ramp-delay = <187>;
> > +            };
> > +
> > +            ldo_vm {
> > +                regulator-name = "vm";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +            ldo_vio18 {
> > +                regulator-name = "vio18";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +                regulator-always-on;
> > +                regulator-boot-on;
> > +            };
> > +
> > +           ldo_vcamd {
> > +                regulator-name = "vcamd";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +
> > +            ldo_vcamio {
> > +                regulator-name = "vcamio";
> > +                regulator-min-microvolt = <1800000>;
> > +                regulator-max-microvolt = <1800000>;
> > +                regulator-enable-ramp-delay = <216>;
> > +            };
> > +        };
> > +
> > +        keys {
> > +            compatible = "mediatek,mt6323-keys";
> > +            mediatek,long-press-mode = <1>;
> > +            power-off-time-sec = <0>;
> > +
> > +            power {
> > +                linux,keycodes = <116>;
> > +                wakeup-source;
> > +            };
> > +
> > +            home {
> > +                linux,keycodes = <114>;
> > +            };
> > +        };
> > +
> > +        power-controller {
> > +            compatible = "mediatek,mt6323-pwrc";
> > +            #power-domain-cells = <0>;
> > +        };
> > +
> > +        rtc {
> > +            compatible = "mediatek,mt6323-rtc";
> > +        };
> > +    };
> > +
> > +  - |
> > +    #include <dt-bindings/input/input.h>
> > +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +
> > +    pmic {
> > +        compatible = "mediatek,mt6358";
> > +        interrupt-controller;
> > +        #interrupt-cells = <2>;
> > +
> > +        audio-codec {
> > +            compatible = "mediatek,mt6358-sound";
> > +            Avdd-supply = <&mt6358_vaud28_reg>;
> > +            mediatek,dmic-mode = <0>;
> > +        };
> > +
> > +        regulators {
> > +            compatible = "mediatek,mt6358-regulator";
> > +
> > +            buck_vdram1 {
> > +                regulator-name = "vdram1";
> > +                regulator-min-microvolt = <500000>;
> > +                regulator-max-microvolt = <2087500>;
> > +                regulator-ramp-delay = <12500>;
> > +                regulator-enable-ramp-delay = <0>;
> > +                regulator-always-on;
> > +                regulator-allowed-modes = <0 1>;
> > +            };
> > +
> > +            // ...
> > +
> > +            ldo_vsim2 {
> > +                regulator-name = "vsim2";
> > +                regulator-min-microvolt = <1700000>;
> > +                regulator-max-microvolt = <3100000>;
> > +                regulator-enable-ramp-delay = <540>;
> > +            };
> > +        };
> > +
> > +        rtc {
> > +            compatible = "mediatek,mt6358-rtc";
> > +        };
> > +
> > +        keys {
> > +            compatible = "mediatek,mt6358-keys";
> > +
> > +            power {
> > +                linux,keycodes = <KEY_POWER>;
> > +                wakeup-source;
> > +            };
> > +
> > +            home {
> > +                linux,keycodes = <KEY_HOME>;
> > +            };
> > +        };
> > +    };
> > +
> > +  - |
> > +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> > +
> > +    pmic {
> > +        compatible = "mediatek,mt6397";
> > +
> > +        interrupt-parent = <&pio>;
> > +        interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>;
> > +        interrupt-controller;
> > +        #interrupt-cells = <2>;
> > +
> > +        audio-codec {
> > +            compatible = "mediatek,mt6397-codec";
> > +        };
> > +
> > +        clocks {
> > +            compatible = "mediatek,mt6397-clk";
> > +            #clock-cells = <1>;
> > +        };
> > +
> > +        pinctrl {
> > +            compatible = "mediatek,mt6397-pinctrl";
> > +            gpio-controller;
> > +            #gpio-cells = <2>;
> > +        };
> > +
> > +        regulators {
> > +            compatible = "mediatek,mt6397-regulator";
> > +
> > +            buck_vpca15 {
> > +                regulator-name = "vpca15";
> > +                regulator-min-microvolt = < 850000>;
> > +                regulator-max-microvolt = <1350000>;
> > +                regulator-ramp-delay = <12500>;
> > +                regulator-enable-ramp-delay = <200>;
> > +            };
> > +
> > +            // ...
> > +
> > +            ldo_vibr {
> > +                regulator-name = "vibr";
> > +                regulator-min-microvolt = <1200000>;
> > +                regulator-max-microvolt = <3300000>;
> > +                regulator-enable-ramp-delay = <218>;
> > +            };
> > +        };
> > +
> > +        rtc {
> > +            compatible = "mediatek,mt6397-rtc";
> > +        };
> > +    };
> > diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt
> > deleted file mode 100644
> > index 10540aa..0000000
> > --- a/Documentation/devicetree/bindings/mfd/mt6397.txt
> > +++ /dev/null
> > @@ -1,110 +0,0 @@
> > -MediaTek MT6397/MT6323 Multifunction Device Driver
> > -
> > -MT6397/MT6323 is a multifunction device with the following sub modules:
> > -- Regulator
> > -- RTC
> > -- Audio codec
> > -- GPIO
> > -- Clock
> > -- LED
> > -- Keys
> > -- Power controller
> > -
> > -It is interfaced to host controller using SPI interface by a proprietary hardware
> > -called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap.
> > -See the following for pwarp node definitions:
> > -../soc/mediatek/mediatek,pwrap.yaml
> > -
> > -This document describes the binding for MFD device and its sub module.
> > -
> > -Required properties:
> > -compatible:
> > -	"mediatek,mt6323" for PMIC MT6323
> > -	"mediatek,mt6331" for PMIC MT6331 and MT6332
> > -	"mediatek,mt6357" for PMIC MT6357
> > -	"mediatek,mt6358" for PMIC MT6358
> > -	"mediatek,mt6359" for PMIC MT6359
> > -	"mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366
> > -	"mediatek,mt6397" for PMIC MT6397
> > -
> > -Optional subnodes:
> > -
> > -- rtc
> > -	Required properties: Should be one of follows
> > -		- compatible: "mediatek,mt6323-rtc"
> > -		- compatible: "mediatek,mt6331-rtc"
> > -		- compatible: "mediatek,mt6358-rtc"
> > -		- compatible: "mediatek,mt6397-rtc"
> > -	For details, see ../rtc/rtc-mt6397.txt
> > -- regulators
> > -	Required properties:
> > -		- compatible: "mediatek,mt6323-regulator"
> > -	see ../regulator/mt6323-regulator.txt
> > -		- compatible: "mediatek,mt6358-regulator"
> > -		- compatible: "mediatek,mt6366-regulator", "mediatek-mt6358-regulator"
> > -	see ../regulator/mt6358-regulator.txt
> > -		- compatible: "mediatek,mt6397-regulator"
> > -	see ../regulator/mt6397-regulator.txt
> > -- codec
> > -	Required properties:
> > -		- compatible: "mediatek,mt6397-codec" or "mediatek,mt6358-sound"
> > -- clk
> > -	Required properties:
> > -		- compatible: "mediatek,mt6397-clk"
> > -- led
> > -	Required properties:
> > -		- compatible: "mediatek,mt6323-led"
> > -	see ../leds/leds-mt6323.txt
> > -
> > -- keys
> > -	Required properties: Should be one of the following
> > -		- compatible: "mediatek,mt6323-keys"
> > -		- compatible: "mediatek,mt6331-keys"
> > -		- compatible: "mediatek,mt6397-keys"
> > -	see ../input/mtk-pmic-keys.txt
> > -
> > -- power-controller
> > -	Required properties:
> > -		- compatible: "mediatek,mt6323-pwrc"
> > -	For details, see ../power/reset/mt6323-poweroff.txt
> > -
> > -- pin-controller
> > -	Required properties:
> > -		- compatible: "mediatek,mt6397-pinctrl"
> > -	For details, see ../pinctrl/pinctrl-mt65xx.txt
> > -
> > -Example:
> > -	pwrap: pwrap@1000f000 {
> > -		compatible = "mediatek,mt8135-pwrap";
> > -
> > -		...
> > -
> > -		pmic {
> > -			compatible = "mediatek,mt6397";
> > -
> > -			codec: mt6397codec {
> > -				compatible = "mediatek,mt6397-codec";
> > -			};
> > -
> > -			regulators {
> > -				compatible = "mediatek,mt6397-regulator";
> > -
> > -				mt6397_vpca15_reg: buck_vpca15 {
> > -					regulator-compatible = "buck_vpca15";
> > -					regulator-name = "vpca15";
> > -					regulator-min-microvolt = <850000>;
> > -					regulator-max-microvolt = <1400000>;
> > -					regulator-ramp-delay = <12500>;
> > -					regulator-always-on;
> > -				};
> > -
> > -				mt6397_vgp4_reg: ldo_vgp4 {
> > -					regulator-compatible = "ldo_vgp4";
> > -					regulator-name = "vgp4";
> > -					regulator-min-microvolt = <1200000>;
> > -					regulator-max-microvolt = <3300000>;
> > -					regulator-enable-ramp-delay = <218>;
> > -				};
> > -			};
> > -		};
> > -	};
> > diff --git a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> > deleted file mode 100644
> > index 933f0c4..0000000
> > --- a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> > +++ /dev/null
> > @@ -1,20 +0,0 @@
> > -Device Tree Bindings for Power Controller on MediaTek PMIC
> > -
> > -The power controller which could be found on PMIC is responsible for externally
> > -powering off or on the remote MediaTek SoC through the circuit BBPU.
> > -
> > -Required properties:
> > -- compatible: Should be one of follows
> > -       "mediatek,mt6323-pwrc": for MT6323 PMIC
> > -
> > -Example:
> > -
> > -       pmic {
> > -               compatible = "mediatek,mt6323";
> > -
> > -               ...
> > -
> > -               power-controller {
> > -                       compatible = "mediatek,mt6323-pwrc";
> > -               };
> > -       }
> > diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
> > deleted file mode 100644
> > index 7212076..0000000
> > --- a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
> > +++ /dev/null
> > @@ -1,31 +0,0 @@
> > -Device-Tree bindings for MediaTek PMIC based RTC
> > -
> > -MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works
> > -as a type of multi-function device (MFD). The RTC can be configured and set up
> > -with PMIC wrapper bus which is a common resource shared with the other
> > -functions found on the same PMIC.
> > -
> > -For MediaTek PMIC MFD bindings, see:
> > -../mfd/mt6397.txt
> > -
> > -For MediaTek PMIC wrapper bus bindings, see:
> > -../soc/mediatek/pwrap.txt
> > -
> > -Required properties:
> > -- compatible: Should be one of follows
> > -       "mediatek,mt6323-rtc": for MT6323 PMIC
> > -       "mediatek,mt6358-rtc": for MT6358 PMIC
> > -       "mediatek,mt6366-rtc", "mediatek,mt6358-rtc": for MT6366 PMIC
> > -       "mediatek,mt6397-rtc": for MT6397 PMIC
> > -
> > -Example:
> > -
> > -       pmic {
> > -               compatible = "mediatek,mt6323";
> > -
> > -               ...
> > -
> > -               rtc {
> > -                       compatible = "mediatek,mt6323-rtc";
> > -               };
> > -       };
> > diff --git a/Documentation/devicetree/bindings/sound/mt6358.txt b/Documentation/devicetree/bindings/sound/mt6358.txt
> > deleted file mode 100644
> > index fbe9e55..0000000
> > --- a/Documentation/devicetree/bindings/sound/mt6358.txt
> > +++ /dev/null
> > @@ -1,26 +0,0 @@
> > -Mediatek MT6358 Audio Codec
> > -
> > -The communication between MT6358 and SoC is through Mediatek PMIC wrapper.
> > -For more detail, please visit Mediatek PMIC wrapper documentation.
> > -
> > -Must be a child node of PMIC wrapper.
> > -
> > -Required properties:
> > -
> > -- compatible - "string" - One of:
> > -    "mediatek,mt6358-sound"
> > -    "mediatek,mt6366-sound"
> > -- Avdd-supply : power source of AVDD
> > -
> > -Optional properties:
> > -- mediatek,dmic-mode : Indicates how many data pins are used to transmit two
> > -	channels of PDM signal. 0 means two wires, 1 means one wire. Default
> > -	value is 0.
> > -
> > -Example:
> > -
> > -mt6358_snd {
> > -	compatible = "mediatek,mt6358-sound";
> > -	Avdd-supply = <&mt6358_vaud28_reg>;
> > -	mediatek,dmic-mode = <0>;
> > -};
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 2cdd7ca..e97b5ae 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -14418,10 +14418,12 @@ F:	Documentation/devicetree/bindings/net/bluetooth/mediatek,mt7921s-bluetooth.ya
> >  F:	drivers/bluetooth/btmtkuart.c
> >  
> >  MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS
> > +M:	Sen Chu <sen.chu@mediatek.com>
> >  M:	Sean Wang <sean.wang@mediatek.com>
> > +M:	Macpaul Lin <macpaul.lin@mediatek.com>
> >  L:	linux-pm@vger.kernel.org
> >  S:	Maintained
> > -F:	Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> > +F:	Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> >  F:	drivers/power/reset/mt6323-poweroff.c
> >  
> >  MEDIATEK CIR DRIVER
> > @@ -14582,9 +14584,11 @@ F:	Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml
> >  F:	drivers/mtd/nand/raw/mtk_*
> >  
> >  MEDIATEK PMIC LED DRIVER
> > +M:	Sen Chu <sen.chu@mediatek.com>
> >  M:	Sean Wang <sean.wang@mediatek.com>
> > +M:	Macpaul Lin <macpaul.lin@mediatek.com>
> >  S:	Maintained
> > -F:	Documentation/devicetree/bindings/leds/leds-mt6323.txt
> > +F:	Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> >  F:	drivers/leds/leds-mt6323.c
> >  
> >  MEDIATEK RANDOM NUMBER GENERATOR SUPPORT
> > -- 
> > 2.45.2
> > 
> > 
> 
> -- 
> Alexandre Belloni, co-owner and COO, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply

* Re: [PATCH v6 2/2] dt-bindings: mfd: mediatek: mt6397: Convert to DT schema format
From: Alexandre Belloni @ 2024-09-18 11:51 UTC (permalink / raw)
  To: Macpaul Lin
  Cc: Andrew Lunn, Florian Fainelli, Vladimir Oltean, David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Matthias Brugger,
	AngeloGioacchino Del Regno, Liam Girdwood, Mark Brown, Sean Wang,
	Sen Chu, netdev, devicetree, linux-kernel, linux-arm-kernel,
	linux-mediatek, Dmitry Torokhov, Pavel Machek, Lee Jones,
	Sebastian Reichel, Chen Zhong, linux-input, linux-leds, linux-pm,
	linux-rtc, linux-sound, Alexandre Mergnat, Bear Wang, Pablo Sun,
	Macpaul Lin, Chris-qj chen, MediaTek Chromebook Upstream,
	Chen-Yu Tsai
In-Reply-To: <20240918064955.6518-2-macpaul.lin@mediatek.com>

On 18/09/2024 14:49:55+0800, Macpaul Lin wrote:
> Convert the mfd: mediatek: mt6397 binding to DT schema format.
> 
> MT6323, MT6358, and MT6397 are PMIC devices with multiple function
> subdevices. They share a common PMIC design but have variations in
> subdevice combinations.
> 
> Key updates in this conversion:
> 
> 1. RTC:
>    - Convert rtc-mt6397.txt and merge into parent MT6397 PMIC DT schema.
> 
> 2. Regulators:
>    - Align to generic name "regulators".
>    - Update references from .txt to .yaml for mt6323, mt6358, and mt6397
>      regulators.
>    - Simplify regulator name labels in device tree examples.
> 
> 3. Audio Codec:
>    - Convert sound/mt6358.txt and merge into parent MT6397 PMIC DT schema.
>    - Align to generic name "audio-codec" for codec and sound subdevices.
>    - Add "mediatek,dmic-mode" and "Avdd-supply" properties.
> 
> 4. Clocks:
>    - Align to generic name "clocks" for clockbuffer subdevices.
> 
> 5. LEDs:
>    - Convert leds-mt6323.txt and merge into parent MT6397 PMIC DT schema.
>    - Update LED binding.
> 
> 6. Keys:
>    - Add detailed descriptions for power and home keys.
>    - Add compatible: mediatek,mt6358-keys.
> 
> 7. Power Controller:
>    - Convert mt6323-poweroff.txt and merge into parent MT6397 PMIC DT
>      schema.
>    - Add #power-domain-cells property to fix dt-binding check error.
>    - Clarify "BBPU" as "Baseband power up".
> 
> 8. Pinctrl:
>    - Align to generic name "pinctrl" instead of "pin-controller".
> 
> 9. Compatible:
>    - Drop "mediatek,mt6357" since there is a separated DT Schema
>      for PMIC MT6357.
> 
> 10. Examples:
>    - MT6323: Retain complete examples for this PMIC.
>    - MT6358 and MT6397: simplify settings in regulators.
>     - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
>       sections as they contain typical settings for different PMICs.
> 
> Additional updates:
> - MAINTAINERS: Add co-maintainers and reference to
>   mfd/mediatek,mt6397.yaml for LED and power-controller drivers.
> - input/mediatek,pmic-keys.yaml: Update reference to
>   mfd/mediatek,mt6397.yaml.
> 
> Signed-off-by: Sen Chu <sen.chu@mediatek.com>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
> ---
>  .../bindings/input/mediatek,pmic-keys.yaml    |   2 +-
>  .../devicetree/bindings/leds/leds-mt6323.txt  |  63 --
>  .../bindings/mfd/mediatek,mt6397.yaml         | 601 ++++++++++++++++++
>  .../devicetree/bindings/mfd/mt6397.txt        | 110 ----
>  .../bindings/power/reset/mt6323-poweroff.txt  |  20 -
>  .../devicetree/bindings/rtc/rtc-mt6397.txt    |  31 -
>  .../devicetree/bindings/sound/mt6358.txt      |  26 -
>  MAINTAINERS                                   |   8 +-
>  8 files changed, 608 insertions(+), 253 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/leds/leds-mt6323.txt
>  create mode 100644 Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
>  delete mode 100644 Documentation/devicetree/bindings/mfd/mt6397.txt
>  delete mode 100644 Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
>  delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
>  delete mode 100644 Documentation/devicetree/bindings/sound/mt6358.txt
> 
> Changes for v1:
>  - This patch depends on conversion of mediatek,mt6397-regulator.yaml
>    [1] https://lore.kernel.org/lkml/20240807091738.18387-1-macpaul.lin@mediatek.com/T/
> 
> Changes for v2:
>  - This patch has been made base on linux-next/master git repo.
>  - Keep the parent and child relationship with mediatek,pwrap in description.
>    [2] https://lore.kernel.org/all/20240826-slurp-earphone-0d5173923ae8@spud/
>  - Keep the $ref for regulators since dt_binding_check didn't report any issue
>    based on linux-next/master repo.
>  - Fix description of mt6397/mt6323 devices, use "power management chip"
>    instead of "multifunction device"
>  - Drop unnecessary comments or description according to the review.
>  - Convert sub-modules to DT Schema:
>   - RTC, LEDs, power-controllers, regulators
>  - Drop duplicate sub node name and description for sub-modules
>   - RTC, Keys
>  - examples:
>   - drop parent pwrap node
>   - Add examples from mediatek,mt6323-regulator.yaml
>   - Add examples from mediatek,mt6358-regulator.yaml
>   - Add examples from mediatek,mt6397-regulator.yaml
>   - Complete the examples as could as possible.
> 
> Changes for v3:
>  - Rebased on linux-next/master git repo near next-20240906.
>  - Revise commit message.
>  - Regulators:
>   - Use "additionalProperties: true" and add "contains" for matching
>     $ref DT bindings.
>   - Simplify regulator name labels in device tree examples.
>  - LEDs:
>   - Use LED bindings.
>  - Squash following patches in v2 for removing old text format DT bindings
>    into this patch, includes:
>   - leds-mt6323.txt, mt6323-poweroff.txt, rtc-mt6397.txt, sound/mt6358.txt.
>  - Fix file format of DT schemas, add blank between properties.
>  - Fix 'make checkrefdoc' errors, update reference in mediatek,pmic-keys.yaml.
> 
> Changes for v4:
>  - Remove "mediatek,mt6357" from PMIC's compatible string since there is a
>    seperated DT schema for PMIC mt6357.
> 
> Changes for v5:
>  - Rebase to next-20240913 (linux-next/master).
>  - Fix the "title" (device type) of mfd/mediatek,mt6397.yaml to "PMIC".
>  - RTC:
>   - Drop "start-year"

Maybe, instead of dropping the property, you should add support in the
driver by setting range_min and range_max.

>  - Regulators:
>   - Add blank lines between description and properties.
>   - Drop allOf for the $ref section on property.
>  - clocks:
>   - Fix no need '|' in descriptoin.
>   - Add blank lines between description and properties.
>  - Keys:
>   - Drop compatible since these enums are already in $ref.
>  - pinctrl:
>   - Drop compatible since it is already in $ref.
>  - examples:
>   - Fix indentations for leds and keys.
> 
> Changes for v6:
>  - Commit message:
>   - Add note for simplifying examples of mt6358 and mt6397.
>  - examples:
>   - Fix indentations for mt6323-keys.
>   - MT6358 and MT6397: simplify settings in regulators.
>    - Preserve "audio-codec", "clocks", "pinctrl", "rtc", and "keys"
>      sections as they contain typical settings for different PMICs.
> 
> diff --git a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> index 70567d9..466566a 100644
> --- a/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> +++ b/Documentation/devicetree/bindings/input/mediatek,pmic-keys.yaml
> @@ -19,7 +19,7 @@ description: |
>    by the PMIC that is defined as a Multi-Function Device (MFD).
>  
>    For MediaTek MT6323/MT6397 PMIC bindings see
> -  Documentation/devicetree/bindings/mfd/mt6397.txt
> +  Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
>  
>  properties:
>    compatible:
> diff --git a/Documentation/devicetree/bindings/leds/leds-mt6323.txt b/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> deleted file mode 100644
> index 052dccb8..0000000
> --- a/Documentation/devicetree/bindings/leds/leds-mt6323.txt
> +++ /dev/null
> @@ -1,63 +0,0 @@
> -Device Tree Bindings for LED support on MT6323 PMIC
> -
> -MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
> -controllers are defined as the subnode of the function node provided by MT6323
> -PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
> -using shared bus called PMIC wrapper for each subfunction to access remote
> -MT6323 PMIC hardware.
> -
> -For MT6323 MFD bindings see:
> -Documentation/devicetree/bindings/mfd/mt6397.txt
> -For MediaTek PMIC wrapper bindings see:
> -Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
> -
> -Required properties:
> -- compatible : Must be one of
> -  - "mediatek,mt6323-led"
> -  - "mediatek,mt6331-led"
> -  - "mediatek,mt6332-led"
> -- address-cells : Must be 1
> -- size-cells : Must be 0
> -
> -Each led is represented as a child node of the mediatek,mt6323-led that
> -describes the initial behavior for each LED physically and currently only four
> -LED child nodes can be supported.
> -
> -Required properties for the LED child node:
> -- reg : LED channel number (0..3)
> -
> -Optional properties for the LED child node:
> -- label : See Documentation/devicetree/bindings/leds/common.txt
> -- linux,default-trigger : See Documentation/devicetree/bindings/leds/common.txt
> -- default-state: See Documentation/devicetree/bindings/leds/common.txt
> -
> -Example:
> -
> -	mt6323: pmic {
> -		compatible = "mediatek,mt6323";
> -
> -		...
> -
> -		mt6323led: leds {
> -			compatible = "mediatek,mt6323-led";
> -			#address-cells = <1>;
> -			#size-cells = <0>;
> -
> -			led@0 {
> -				reg = <0>;
> -				label = "LED0";
> -				linux,default-trigger = "timer";
> -				default-state = "on";
> -			};
> -			led@1 {
> -				reg = <1>;
> -				label = "LED1";
> -				default-state = "off";
> -			};
> -			led@2 {
> -				reg = <2>;
> -				label = "LED2";
> -				default-state = "on";
> -			};
> -		};
> -	};
> diff --git a/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> new file mode 100644
> index 0000000..953358b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
> @@ -0,0 +1,601 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mfd/mediatek,mt6397.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: MediaTek MT6397/MT6323 PMIC
> +
> +maintainers:
> +  - Sen Chu <sen.chu@mediatek.com>
> +  - Macpaul Lin <macpaul.lin@mediatek.com>
> +
> +description: |
> +  MT6397/MT6323 is a power management system chip.
> +  Please see the sub-modules below for supported features.
> +
> +  MT6397/MT6323 is a multifunction device with the following sub modules:
> +  - Regulators
> +  - RTC
> +  - Audio codec
> +  - GPIO
> +  - Clock
> +  - LED
> +  - Keys
> +  - Power controller
> +
> +  It is interfaced to host controller using SPI interface by a proprietary hardware
> +  called PMIC wrapper or pwrap. MT6397/MT6323 PMIC is a child device of pwrap.
> +  See the following for pwrap node definitions:
> +  Documentation/devicetree/bindings/soc/mediatek/mediatek,pwrap.yaml
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - enum:
> +          - mediatek,mt6323
> +          - mediatek,mt6331 # "mediatek,mt6331" for PMIC MT6331 and MT6332.
> +          - mediatek,mt6358
> +          - mediatek,mt6359
> +          - mediatek,mt6397
> +      - items:
> +          - enum:
> +              - mediatek,mt6366
> +          - const: mediatek,mt6358
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  interrupt-controller: true
> +
> +  "#interrupt-cells":
> +    const: 2
> +
> +  rtc:
> +    type: object
> +    $ref: /schemas/rtc/rtc.yaml#
> +    unevaluatedProperties: false
> +    description:
> +      MT6397 Real Time Clock.
> +
> +    properties:
> +      compatible:
> +        oneOf:
> +          - enum:
> +              - mediatek,mt6323-rtc
> +              - mediatek,mt6331-rtc
> +              - mediatek,mt6358-rtc
> +              - mediatek,mt6397-rtc
> +          - items:
> +              - enum:
> +                  - mediatek,mt6366-rtc
> +              - const: mediatek,mt6358-rtc
> +
> +    required:
> +      - compatible
> +
> +  regulators:
> +    type: object
> +    description:
> +      List of child nodes that specify the regulators.
> +    additionalProperties: true
> +
> +    properties:
> +      compatible:
> +        oneOf:
> +          - enum:
> +              - mediatek,mt6323-regulator
> +              - mediatek,mt6358-regulator
> +              - mediatek,mt6397-regulator
> +          - items:
> +              - enum:
> +                  - mediatek,mt6366-regulator
> +              - const: mediatek,mt6358-regulator
> +
> +    required:
> +      - compatible
> +
> +  audio-codec:
> +    type: object
> +    additionalProperties: false
> +    description:
> +      Audio codec support with MT6397 and MT6358.
> +
> +    properties:
> +      compatible:
> +        oneOf:
> +          - enum:
> +              - mediatek,mt6397-codec
> +              - mediatek,mt6358-sound
> +          - items:
> +              - enum:
> +                  - mediatek,mt6366-sound
> +              - const: mediatek,mt6358-sound
> +
> +      mediatek,dmic-mode:
> +        description: |
> +          Indicates how many data pins are used to transmit two channels of PDM
> +          signal.
> +          0 - two wires;
> +          1 - one wire;
> +          Default value is 0.
> +        enum: [0, 1]
> +        default: 0
> +
> +      Avdd-supply:
> +        description: Power source of AVDD.
> +
> +    required:
> +      - compatible
> +
> +  clocks:
> +    type: object
> +    additionalProperties: false
> +    description:
> +      This is a clock buffer node for mt6397. However, there are no sub nodes
> +      or any public document exposed in public.
> +
> +    properties:
> +      compatible:
> +        const: mediatek,mt6397-clk
> +
> +      '#clock-cells':
> +        const: 1
> +
> +    required:
> +      - compatible
> +
> +  leds:
> +    type: object
> +    additionalProperties: false
> +    description: |
> +      MT6323 LED controller is subfunction provided by MT6323 PMIC, so the LED
> +      controllers are defined as the subnode of the function node provided by MT6323
> +      PMIC controller that is being defined as one kind of Muti-Function Device (MFD)
> +      using shared bus called PMIC wrapper for each subfunction to access remote
> +      MT6323 PMIC hardware.
> +
> +      Each led is represented as a child node of the mediatek,mt6323-led that
> +      describes the initial behavior for each LED physically and currently only four
> +      LED child nodes can be supported.
> +
> +    properties:
> +      compatible:
> +        enum:
> +          - mediatek,mt6323-led
> +          - mediatek,mt6331-led
> +          - mediatek,mt6332-led
> +
> +      reg:
> +        maxItems: 1
> +
> +      "#address-cells":
> +        const: 1
> +
> +      "#size-cells":
> +        const: 0
> +
> +    patternProperties:
> +      "^led@[0-3]$":
> +        type: object
> +        $ref: /schemas/leds/common.yaml#
> +        unevaluatedProperties: false
> +
> +        properties:
> +          reg:
> +            description:
> +              LED channel number (0..3)
> +            minimum: 0
> +            maximum: 3
> +
> +        required:
> +          - reg
> +
> +    required:
> +      - compatible
> +      - "#address-cells"
> +      - "#size-cells"
> +
> +  keys:
> +    type: object
> +    $ref: /schemas/input/mediatek,pmic-keys.yaml
> +    unevaluatedProperties: false
> +    description:
> +      Power and Home keys.
> +
> +  power-controller:
> +    type: object
> +    additionalProperties: false
> +    description:
> +      The power controller which could be found on PMIC is responsible for
> +      externally powering off or on the remote MediaTek SoC through the
> +      circuit BBPU (baseband power up).
> +
> +    properties:
> +      compatible:
> +        const: mediatek,mt6323-pwrc
> +
> +      '#power-domain-cells':
> +        const: 0
> +
> +  pinctrl:
> +    type: object
> +    $ref: /schemas/pinctrl/mediatek,mt65xx-pinctrl.yaml
> +    unevaluatedProperties: false
> +    description:
> +      Pin controller
> +
> +required:
> +  - compatible
> +  - regulators
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/leds/common.h>
> +
> +    pmic {
> +        compatible = "mediatek,mt6323";
> +        interrupt-parent = <&pio>;
> +        interrupts = <150 IRQ_TYPE_LEVEL_HIGH>;
> +        interrupt-controller;
> +        #interrupt-cells = <2>;
> +
> +        leds {
> +            compatible = "mediatek,mt6323-led";
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +        };
> +
> +        regulators {
> +            compatible = "mediatek,mt6323-regulator";
> +
> +            buck_vproc {
> +                regulator-name = "vproc";
> +                regulator-min-microvolt = < 700000>;
> +                regulator-max-microvolt = <1350000>;
> +                regulator-ramp-delay = <12500>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            buck_vsys {
> +                regulator-name = "vsys";
> +                regulator-min-microvolt = <1400000>;
> +                regulator-max-microvolt = <2987500>;
> +                regulator-ramp-delay = <25000>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            buck_vpa {
> +                regulator-name = "vpa";
> +                regulator-min-microvolt = < 500000>;
> +                regulator-max-microvolt = <3650000>;
> +            };
> +
> +            ldo_vtcxo {
> +                regulator-name = "vtcxo";
> +                regulator-min-microvolt = <2800000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-enable-ramp-delay = <90>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vcn28 {
> +                regulator-name = "vcn28";
> +                regulator-min-microvolt = <2800000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-enable-ramp-delay = <185>;
> +            };
> +
> +            ldo_vcn33_bt {
> +                regulator-name = "vcn33_bt";
> +                regulator-min-microvolt = <3300000>;
> +                regulator-max-microvolt = <3600000>;
> +                regulator-enable-ramp-delay = <185>;
> +            };
> +
> +            ldo_vcn33_wifi {
> +                regulator-name = "vcn33_wifi";
> +                regulator-min-microvolt = <3300000>;
> +                regulator-max-microvolt = <3600000>;
> +                regulator-enable-ramp-delay = <185>;
> +            };
> +
> +            ldo_va {
> +                regulator-name = "va";
> +                regulator-min-microvolt = <2800000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-enable-ramp-delay = <216>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vcama {
> +                regulator-name = "vcama";
> +                regulator-min-microvolt = <1500000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vio28 {
> +                regulator-name = "vio28";
> +                regulator-min-microvolt = <2800000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-enable-ramp-delay = <216>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vusb {
> +                regulator-name = "vusb";
> +                regulator-min-microvolt = <3300000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <216>;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vmc {
> +                regulator-name = "vmc";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <36>;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vmch {
> +                regulator-name = "vmch";
> +                regulator-min-microvolt = <3000000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <36>;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vemc3v3 {
> +                regulator-name = "vemc3v3";
> +                regulator-min-microvolt = <3000000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <36>;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vgp1 {
> +                regulator-name = "vgp1";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vgp2 {
> +                regulator-name = "vgp2";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <3000000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vgp3 {
> +                regulator-name = "vgp3";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vcn18 {
> +                regulator-name = "vcn18";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vsim1 {
> +                regulator-name = "vsim1";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <3000000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vsim2 {
> +                regulator-name = "vsim2";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <3000000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vrtc {
> +                regulator-name = "vrtc";
> +                regulator-min-microvolt = <2800000>;
> +                regulator-max-microvolt = <2800000>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vcamaf {
> +                regulator-name = "vcamaf";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vibr {
> +                regulator-name = "vibr";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <36>;
> +            };
> +
> +            ldo_vrf18 {
> +                regulator-name = "vrf18";
> +                regulator-min-microvolt = <1825000>;
> +                regulator-max-microvolt = <1825000>;
> +                regulator-enable-ramp-delay = <187>;
> +            };
> +
> +            ldo_vm {
> +                regulator-name = "vm";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +            ldo_vio18 {
> +                regulator-name = "vio18";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +                regulator-always-on;
> +                regulator-boot-on;
> +            };
> +
> +           ldo_vcamd {
> +                regulator-name = "vcamd";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +
> +            ldo_vcamio {
> +                regulator-name = "vcamio";
> +                regulator-min-microvolt = <1800000>;
> +                regulator-max-microvolt = <1800000>;
> +                regulator-enable-ramp-delay = <216>;
> +            };
> +        };
> +
> +        keys {
> +            compatible = "mediatek,mt6323-keys";
> +            mediatek,long-press-mode = <1>;
> +            power-off-time-sec = <0>;
> +
> +            power {
> +                linux,keycodes = <116>;
> +                wakeup-source;
> +            };
> +
> +            home {
> +                linux,keycodes = <114>;
> +            };
> +        };
> +
> +        power-controller {
> +            compatible = "mediatek,mt6323-pwrc";
> +            #power-domain-cells = <0>;
> +        };
> +
> +        rtc {
> +            compatible = "mediatek,mt6323-rtc";
> +        };
> +    };
> +
> +  - |
> +    #include <dt-bindings/input/input.h>
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    pmic {
> +        compatible = "mediatek,mt6358";
> +        interrupt-controller;
> +        #interrupt-cells = <2>;
> +
> +        audio-codec {
> +            compatible = "mediatek,mt6358-sound";
> +            Avdd-supply = <&mt6358_vaud28_reg>;
> +            mediatek,dmic-mode = <0>;
> +        };
> +
> +        regulators {
> +            compatible = "mediatek,mt6358-regulator";
> +
> +            buck_vdram1 {
> +                regulator-name = "vdram1";
> +                regulator-min-microvolt = <500000>;
> +                regulator-max-microvolt = <2087500>;
> +                regulator-ramp-delay = <12500>;
> +                regulator-enable-ramp-delay = <0>;
> +                regulator-always-on;
> +                regulator-allowed-modes = <0 1>;
> +            };
> +
> +            // ...
> +
> +            ldo_vsim2 {
> +                regulator-name = "vsim2";
> +                regulator-min-microvolt = <1700000>;
> +                regulator-max-microvolt = <3100000>;
> +                regulator-enable-ramp-delay = <540>;
> +            };
> +        };
> +
> +        rtc {
> +            compatible = "mediatek,mt6358-rtc";
> +        };
> +
> +        keys {
> +            compatible = "mediatek,mt6358-keys";
> +
> +            power {
> +                linux,keycodes = <KEY_POWER>;
> +                wakeup-source;
> +            };
> +
> +            home {
> +                linux,keycodes = <KEY_HOME>;
> +            };
> +        };
> +    };
> +
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    pmic {
> +        compatible = "mediatek,mt6397";
> +
> +        interrupt-parent = <&pio>;
> +        interrupts-extended = <&pio 222 IRQ_TYPE_LEVEL_HIGH>;
> +        interrupt-controller;
> +        #interrupt-cells = <2>;
> +
> +        audio-codec {
> +            compatible = "mediatek,mt6397-codec";
> +        };
> +
> +        clocks {
> +            compatible = "mediatek,mt6397-clk";
> +            #clock-cells = <1>;
> +        };
> +
> +        pinctrl {
> +            compatible = "mediatek,mt6397-pinctrl";
> +            gpio-controller;
> +            #gpio-cells = <2>;
> +        };
> +
> +        regulators {
> +            compatible = "mediatek,mt6397-regulator";
> +
> +            buck_vpca15 {
> +                regulator-name = "vpca15";
> +                regulator-min-microvolt = < 850000>;
> +                regulator-max-microvolt = <1350000>;
> +                regulator-ramp-delay = <12500>;
> +                regulator-enable-ramp-delay = <200>;
> +            };
> +
> +            // ...
> +
> +            ldo_vibr {
> +                regulator-name = "vibr";
> +                regulator-min-microvolt = <1200000>;
> +                regulator-max-microvolt = <3300000>;
> +                regulator-enable-ramp-delay = <218>;
> +            };
> +        };
> +
> +        rtc {
> +            compatible = "mediatek,mt6397-rtc";
> +        };
> +    };
> diff --git a/Documentation/devicetree/bindings/mfd/mt6397.txt b/Documentation/devicetree/bindings/mfd/mt6397.txt
> deleted file mode 100644
> index 10540aa..0000000
> --- a/Documentation/devicetree/bindings/mfd/mt6397.txt
> +++ /dev/null
> @@ -1,110 +0,0 @@
> -MediaTek MT6397/MT6323 Multifunction Device Driver
> -
> -MT6397/MT6323 is a multifunction device with the following sub modules:
> -- Regulator
> -- RTC
> -- Audio codec
> -- GPIO
> -- Clock
> -- LED
> -- Keys
> -- Power controller
> -
> -It is interfaced to host controller using SPI interface by a proprietary hardware
> -called PMIC wrapper or pwrap. MT6397/MT6323 MFD is a child device of pwrap.
> -See the following for pwarp node definitions:
> -../soc/mediatek/mediatek,pwrap.yaml
> -
> -This document describes the binding for MFD device and its sub module.
> -
> -Required properties:
> -compatible:
> -	"mediatek,mt6323" for PMIC MT6323
> -	"mediatek,mt6331" for PMIC MT6331 and MT6332
> -	"mediatek,mt6357" for PMIC MT6357
> -	"mediatek,mt6358" for PMIC MT6358
> -	"mediatek,mt6359" for PMIC MT6359
> -	"mediatek,mt6366", "mediatek,mt6358" for PMIC MT6366
> -	"mediatek,mt6397" for PMIC MT6397
> -
> -Optional subnodes:
> -
> -- rtc
> -	Required properties: Should be one of follows
> -		- compatible: "mediatek,mt6323-rtc"
> -		- compatible: "mediatek,mt6331-rtc"
> -		- compatible: "mediatek,mt6358-rtc"
> -		- compatible: "mediatek,mt6397-rtc"
> -	For details, see ../rtc/rtc-mt6397.txt
> -- regulators
> -	Required properties:
> -		- compatible: "mediatek,mt6323-regulator"
> -	see ../regulator/mt6323-regulator.txt
> -		- compatible: "mediatek,mt6358-regulator"
> -		- compatible: "mediatek,mt6366-regulator", "mediatek-mt6358-regulator"
> -	see ../regulator/mt6358-regulator.txt
> -		- compatible: "mediatek,mt6397-regulator"
> -	see ../regulator/mt6397-regulator.txt
> -- codec
> -	Required properties:
> -		- compatible: "mediatek,mt6397-codec" or "mediatek,mt6358-sound"
> -- clk
> -	Required properties:
> -		- compatible: "mediatek,mt6397-clk"
> -- led
> -	Required properties:
> -		- compatible: "mediatek,mt6323-led"
> -	see ../leds/leds-mt6323.txt
> -
> -- keys
> -	Required properties: Should be one of the following
> -		- compatible: "mediatek,mt6323-keys"
> -		- compatible: "mediatek,mt6331-keys"
> -		- compatible: "mediatek,mt6397-keys"
> -	see ../input/mtk-pmic-keys.txt
> -
> -- power-controller
> -	Required properties:
> -		- compatible: "mediatek,mt6323-pwrc"
> -	For details, see ../power/reset/mt6323-poweroff.txt
> -
> -- pin-controller
> -	Required properties:
> -		- compatible: "mediatek,mt6397-pinctrl"
> -	For details, see ../pinctrl/pinctrl-mt65xx.txt
> -
> -Example:
> -	pwrap: pwrap@1000f000 {
> -		compatible = "mediatek,mt8135-pwrap";
> -
> -		...
> -
> -		pmic {
> -			compatible = "mediatek,mt6397";
> -
> -			codec: mt6397codec {
> -				compatible = "mediatek,mt6397-codec";
> -			};
> -
> -			regulators {
> -				compatible = "mediatek,mt6397-regulator";
> -
> -				mt6397_vpca15_reg: buck_vpca15 {
> -					regulator-compatible = "buck_vpca15";
> -					regulator-name = "vpca15";
> -					regulator-min-microvolt = <850000>;
> -					regulator-max-microvolt = <1400000>;
> -					regulator-ramp-delay = <12500>;
> -					regulator-always-on;
> -				};
> -
> -				mt6397_vgp4_reg: ldo_vgp4 {
> -					regulator-compatible = "ldo_vgp4";
> -					regulator-name = "vgp4";
> -					regulator-min-microvolt = <1200000>;
> -					regulator-max-microvolt = <3300000>;
> -					regulator-enable-ramp-delay = <218>;
> -				};
> -			};
> -		};
> -	};
> diff --git a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt b/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> deleted file mode 100644
> index 933f0c4..0000000
> --- a/Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> +++ /dev/null
> @@ -1,20 +0,0 @@
> -Device Tree Bindings for Power Controller on MediaTek PMIC
> -
> -The power controller which could be found on PMIC is responsible for externally
> -powering off or on the remote MediaTek SoC through the circuit BBPU.
> -
> -Required properties:
> -- compatible: Should be one of follows
> -       "mediatek,mt6323-pwrc": for MT6323 PMIC
> -
> -Example:
> -
> -       pmic {
> -               compatible = "mediatek,mt6323";
> -
> -               ...
> -
> -               power-controller {
> -                       compatible = "mediatek,mt6323-pwrc";
> -               };
> -       }
> diff --git a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt b/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
> deleted file mode 100644
> index 7212076..0000000
> --- a/Documentation/devicetree/bindings/rtc/rtc-mt6397.txt
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -Device-Tree bindings for MediaTek PMIC based RTC
> -
> -MediaTek PMIC based RTC is an independent function of MediaTek PMIC that works
> -as a type of multi-function device (MFD). The RTC can be configured and set up
> -with PMIC wrapper bus which is a common resource shared with the other
> -functions found on the same PMIC.
> -
> -For MediaTek PMIC MFD bindings, see:
> -../mfd/mt6397.txt
> -
> -For MediaTek PMIC wrapper bus bindings, see:
> -../soc/mediatek/pwrap.txt
> -
> -Required properties:
> -- compatible: Should be one of follows
> -       "mediatek,mt6323-rtc": for MT6323 PMIC
> -       "mediatek,mt6358-rtc": for MT6358 PMIC
> -       "mediatek,mt6366-rtc", "mediatek,mt6358-rtc": for MT6366 PMIC
> -       "mediatek,mt6397-rtc": for MT6397 PMIC
> -
> -Example:
> -
> -       pmic {
> -               compatible = "mediatek,mt6323";
> -
> -               ...
> -
> -               rtc {
> -                       compatible = "mediatek,mt6323-rtc";
> -               };
> -       };
> diff --git a/Documentation/devicetree/bindings/sound/mt6358.txt b/Documentation/devicetree/bindings/sound/mt6358.txt
> deleted file mode 100644
> index fbe9e55..0000000
> --- a/Documentation/devicetree/bindings/sound/mt6358.txt
> +++ /dev/null
> @@ -1,26 +0,0 @@
> -Mediatek MT6358 Audio Codec
> -
> -The communication between MT6358 and SoC is through Mediatek PMIC wrapper.
> -For more detail, please visit Mediatek PMIC wrapper documentation.
> -
> -Must be a child node of PMIC wrapper.
> -
> -Required properties:
> -
> -- compatible - "string" - One of:
> -    "mediatek,mt6358-sound"
> -    "mediatek,mt6366-sound"
> -- Avdd-supply : power source of AVDD
> -
> -Optional properties:
> -- mediatek,dmic-mode : Indicates how many data pins are used to transmit two
> -	channels of PDM signal. 0 means two wires, 1 means one wire. Default
> -	value is 0.
> -
> -Example:
> -
> -mt6358_snd {
> -	compatible = "mediatek,mt6358-sound";
> -	Avdd-supply = <&mt6358_vaud28_reg>;
> -	mediatek,dmic-mode = <0>;
> -};
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 2cdd7ca..e97b5ae 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -14418,10 +14418,12 @@ F:	Documentation/devicetree/bindings/net/bluetooth/mediatek,mt7921s-bluetooth.ya
>  F:	drivers/bluetooth/btmtkuart.c
>  
>  MEDIATEK BOARD LEVEL SHUTDOWN DRIVERS
> +M:	Sen Chu <sen.chu@mediatek.com>
>  M:	Sean Wang <sean.wang@mediatek.com>
> +M:	Macpaul Lin <macpaul.lin@mediatek.com>
>  L:	linux-pm@vger.kernel.org
>  S:	Maintained
> -F:	Documentation/devicetree/bindings/power/reset/mt6323-poweroff.txt
> +F:	Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
>  F:	drivers/power/reset/mt6323-poweroff.c
>  
>  MEDIATEK CIR DRIVER
> @@ -14582,9 +14584,11 @@ F:	Documentation/devicetree/bindings/mtd/mediatek,mtk-nfc.yaml
>  F:	drivers/mtd/nand/raw/mtk_*
>  
>  MEDIATEK PMIC LED DRIVER
> +M:	Sen Chu <sen.chu@mediatek.com>
>  M:	Sean Wang <sean.wang@mediatek.com>
> +M:	Macpaul Lin <macpaul.lin@mediatek.com>
>  S:	Maintained
> -F:	Documentation/devicetree/bindings/leds/leds-mt6323.txt
> +F:	Documentation/devicetree/bindings/mfd/mediatek,mt6397.yaml
>  F:	drivers/leds/leds-mt6323.c
>  
>  MEDIATEK RANDOM NUMBER GENERATOR SUPPORT
> -- 
> 2.45.2
> 
> 

-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply

* [PATCH] HID: amd_sfh: Use amd_sfh_clear_intr(mp2) call only once in sfh_init_work()
From: Markus Elfring @ 2024-09-18 11:20 UTC (permalink / raw)
  To: linux-input, Basavaraj Natikar, Benjamin Tissoires, Jiri Kosina; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 18 Sep 2024 13:11:00 +0200

A amd_sfh_clear_intr(mp2) call was immediately used after a return code
check for a amd_sfh_hid_client_init() call in this function implementation.
Thus use such a function call only once instead directly before the check.

This issue was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/hid/amd-sfh-hid/amd_sfh_pcie.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
index 0c28ca349bcd..2322555e5181 100644
--- a/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
+++ b/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
@@ -350,13 +350,12 @@ static void sfh_init_work(struct work_struct *work)
 	int rc;

 	rc = amd_sfh_hid_client_init(mp2);
+	amd_sfh_clear_intr(mp2);
 	if (rc) {
-		amd_sfh_clear_intr(mp2);
 		dev_err(&pdev->dev, "amd_sfh_hid_client_init failed err %d\n", rc);
 		return;
 	}

-	amd_sfh_clear_intr(mp2);
 	mp2->init_done = 1;
 }

--
2.46.0


^ permalink raw reply related

* Re: [PATCH v1] input: Convert comma to semicolon
From: Dmitry Torokhov @ 2024-09-18 10:48 UTC (permalink / raw)
  To: Shen Lichuan; +Cc: rydberg, linux-input, linux-kernel, opensource.kernel
In-Reply-To: <20240918032246.9147-1-shenlichuan@vivo.com>

On Wed, Sep 18, 2024 at 11:22:46AM +0800, Shen Lichuan wrote:
> To ensure code clarity and prevent potential errors, it's advisable
> to employ the ';' as a statement separator, except when ',' are
> intentionally used for specific purposes.
> 
> Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>

Applied, thank you.

-- 
Dmitry

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox