* [PATCH v6 3/8] i2c: rtl9300: introduce F_BUSY to the reg_fields struct
From: Rustam Adilov @ 2026-04-01 18:06 UTC (permalink / raw)
To: Chris Packham, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-i2c, devicetree, linux-kernel
Cc: Rustam Adilov
In-Reply-To: <20260401180648.337834-1-adilov@disroot.org>
In RTL9607C i2c controller the busy check operation is done on the
separate bit of the command register as opposed to self clearing
command trigger bit on the rtl9300 and rtl9310 i2c controllers.
Introduce a new F_BUSY field to the reg_fields struct for that
and change the regmap read poll function to use F_BUSY
instead of I2C_TRIG.
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Rustam Adilov <adilov@disroot.org>
---
drivers/i2c/busses/i2c-rtl9300.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c
index 2cada6038b44..e40b4692a3fa 100644
--- a/drivers/i2c/busses/i2c-rtl9300.c
+++ b/drivers/i2c/busses/i2c-rtl9300.c
@@ -53,6 +53,7 @@ enum rtl9300_i2c_reg_fields {
F_SCL_SEL,
F_SDA_OUT_SEL,
F_SDA_SEL,
+ F_BUSY,
/* keep last */
F_NUM_FIELDS
@@ -262,7 +263,7 @@ static int rtl9300_i2c_do_xfer(struct rtl9300_i2c *i2c, struct rtl9300_i2c_xfer
if (ret)
return ret;
- ret = regmap_field_read_poll_timeout(i2c->fields[F_I2C_TRIG], val, !val, 100, 100000);
+ ret = regmap_field_read_poll_timeout(i2c->fields[F_BUSY], val, !val, 100, 100000);
if (ret)
return ret;
@@ -505,6 +506,7 @@ static const struct rtl9300_i2c_drv_data rtl9300_i2c_drv_data = {
[F_MEM_ADDR_WIDTH] = MST_REG_FIELD(RTL9300_I2C_MST_CTRL2, 2, 3),
[F_SCL_FREQ] = MST_REG_FIELD(RTL9300_I2C_MST_CTRL2, 0, 1),
[F_SDA_SEL] = GLB_REG_FIELD(RTL9300_I2C_MST_GLB_CTRL, 0, 7),
+ [F_BUSY] = MST_REG_FIELD(RTL9300_I2C_MST_CTRL1, 0, 0),
},
.select_scl = rtl9300_i2c_select_scl,
.rd_reg = RTL9300_I2C_MST_DATA_WORD0,
@@ -527,6 +529,7 @@ static const struct rtl9300_i2c_drv_data rtl9310_i2c_drv_data = {
[F_I2C_FAIL] = MST_REG_FIELD(RTL9310_I2C_MST_CTRL, 1, 1),
[F_I2C_TRIG] = MST_REG_FIELD(RTL9310_I2C_MST_CTRL, 0, 0),
[F_MEM_ADDR] = MST_REG_FIELD(RTL9310_I2C_MST_MEMADDR_CTRL, 0, 23),
+ [F_BUSY] = MST_REG_FIELD(RTL9310_I2C_MST_CTRL, 0, 0),
},
.select_scl = rtl9310_i2c_select_scl,
.rd_reg = RTL9310_I2C_MST_DATA_CTRL,
--
2.53.0
^ permalink raw reply related
* [PATCH v6 1/8] i2c: rtl9300: split data_reg into read and write reg
From: Rustam Adilov @ 2026-04-01 18:06 UTC (permalink / raw)
To: Chris Packham, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-i2c, devicetree, linux-kernel
Cc: Rustam Adilov
In-Reply-To: <20260401180648.337834-1-adilov@disroot.org>
In RTL9607C i2c controller, there are 2 separate registers for reads
and writes as opposed the combined 1 on rtl9300 and rtl9310.
In preparation for RTL9607C support, split it up into rd_reg and wd_reg
properties and change the i2c read and write functions accordingly.
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Rustam Adilov <adilov@disroot.org>
---
drivers/i2c/busses/i2c-rtl9300.c | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c
index 67a5c4228fc9..9bf4c6b08e05 100644
--- a/drivers/i2c/busses/i2c-rtl9300.c
+++ b/drivers/i2c/busses/i2c-rtl9300.c
@@ -61,7 +61,8 @@ enum rtl9300_i2c_reg_fields {
struct rtl9300_i2c_drv_data {
struct rtl9300_i2c_reg_field field_desc[F_NUM_FIELDS];
int (*select_scl)(struct rtl9300_i2c *i2c, u8 scl);
- u32 data_reg;
+ u32 rd_reg;
+ u32 wd_reg;
u8 max_nchan;
};
@@ -74,7 +75,8 @@ struct rtl9300_i2c {
struct rtl9300_i2c_chan chans[RTL9310_I2C_MUX_NCHAN];
struct regmap_field *fields[F_NUM_FIELDS];
u32 reg_base;
- u32 data_reg;
+ u32 rd_reg;
+ u32 wd_reg;
u8 scl_num;
u8 sda_num;
struct mutex lock;
@@ -171,7 +173,7 @@ static int rtl9300_i2c_read(struct rtl9300_i2c *i2c, u8 *buf, u8 len)
if (len > 16)
return -EIO;
- ret = regmap_bulk_read(i2c->regmap, i2c->data_reg, vals, ARRAY_SIZE(vals));
+ ret = regmap_bulk_read(i2c->regmap, i2c->rd_reg, vals, ARRAY_SIZE(vals));
if (ret)
return ret;
@@ -198,12 +200,12 @@ static int rtl9300_i2c_write(struct rtl9300_i2c *i2c, u8 *buf, u8 len)
vals[reg] |= buf[i] << shift;
}
- return regmap_bulk_write(i2c->regmap, i2c->data_reg, vals, ARRAY_SIZE(vals));
+ return regmap_bulk_write(i2c->regmap, i2c->wd_reg, vals, ARRAY_SIZE(vals));
}
static int rtl9300_i2c_writel(struct rtl9300_i2c *i2c, u32 data)
{
- return regmap_write(i2c->regmap, i2c->data_reg, data);
+ return regmap_write(i2c->regmap, i2c->wd_reg, data);
}
static int rtl9300_i2c_prepare_xfer(struct rtl9300_i2c *i2c, struct rtl9300_i2c_xfer *xfer)
@@ -268,14 +270,14 @@ static int rtl9300_i2c_do_xfer(struct rtl9300_i2c *i2c, struct rtl9300_i2c_xfer
if (!xfer->write) {
switch (xfer->type) {
case RTL9300_I2C_XFER_BYTE:
- ret = regmap_read(i2c->regmap, i2c->data_reg, &val);
+ ret = regmap_read(i2c->regmap, i2c->rd_reg, &val);
if (ret)
return ret;
*xfer->data = val & 0xff;
break;
case RTL9300_I2C_XFER_WORD:
- ret = regmap_read(i2c->regmap, i2c->data_reg, &val);
+ ret = regmap_read(i2c->regmap, i2c->rd_reg, &val);
if (ret)
return ret;
@@ -408,7 +410,8 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
if (device_get_child_node_count(dev) > drv_data->max_nchan)
return dev_err_probe(dev, -EINVAL, "Too many channels\n");
- i2c->data_reg = i2c->reg_base + drv_data->data_reg;
+ i2c->rd_reg = i2c->reg_base + drv_data->rd_reg;
+ i2c->wd_reg = i2c->reg_base + drv_data->wd_reg;
for (i = 0; i < F_NUM_FIELDS; i++) {
fields[i] = drv_data->field_desc[i].field;
if (drv_data->field_desc[i].scope == REG_SCOPE_MASTER)
@@ -499,7 +502,8 @@ static const struct rtl9300_i2c_drv_data rtl9300_i2c_drv_data = {
[F_SDA_SEL] = GLB_REG_FIELD(RTL9300_I2C_MST_GLB_CTRL, 0, 7),
},
.select_scl = rtl9300_i2c_select_scl,
- .data_reg = RTL9300_I2C_MST_DATA_WORD0,
+ .rd_reg = RTL9300_I2C_MST_DATA_WORD0,
+ .wd_reg = RTL9300_I2C_MST_DATA_WORD0,
.max_nchan = RTL9300_I2C_MUX_NCHAN,
};
@@ -519,7 +523,8 @@ static const struct rtl9300_i2c_drv_data rtl9310_i2c_drv_data = {
[F_MEM_ADDR] = MST_REG_FIELD(RTL9310_I2C_MST_MEMADDR_CTRL, 0, 23),
},
.select_scl = rtl9310_i2c_select_scl,
- .data_reg = RTL9310_I2C_MST_DATA_CTRL,
+ .rd_reg = RTL9310_I2C_MST_DATA_CTRL,
+ .wd_reg = RTL9310_I2C_MST_DATA_CTRL,
.max_nchan = RTL9310_I2C_MUX_NCHAN,
};
--
2.53.0
^ permalink raw reply related
* [PATCH v6 0/8] i2c: rtl9300: support for RTL9607C I2C controller
From: Rustam Adilov @ 2026-04-01 18:06 UTC (permalink / raw)
To: Chris Packham, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-i2c, devicetree, linux-kernel
Cc: Rustam Adilov
This patch series for the RTL9300 I2C driver adds i2c support for
RTL9607C SoC. They are somewhat different to the RTL9300 and
RTL9310 but not enough to warrant a new whole driver.
The patch series was split into patches that add/change something in the
driver to smooth out the RTL9607C support addition in the end and for
ease of review. Because of that, the patch 8 depends on all the prior
patches before it.
RTL9607C primarly uses the i2c controller for communication with laser
driver over on i2c interface 1 or 2.
I have successfully tested the byte read operations on my RTL9607C board
which has GN25L95 laser driver in OpenWrt.
This patch series depends on the patch [1] from Jan Kantert to be applied
first before applying my patch series.
[1] -
https://lore.kernel.org/all/20260227111134.2163701-1-jan-kernel@kantert.net/
---
Changelog in v6
- fixed a typo in the commit subject of Patch 7 "intoduce -> introduce".
- added "Acked-by Conor Dooley" to Patch 5.
- Link to v5: https://lore.kernel.org/linux-i2c/20260326152656.14030-1-adilov@disroot.org/
Changelog in v5
- reworded the commit message in Patch 5 to make it clear that the existing
devices also have i2c master controller clocks.
- Link to v4: https://lore.kernel.org/linux-i2c/20260323071337.15410-1-adilov@disroot.org/
Changelog in v4
- moved the patch 7 that changes bindings to be before patch 5 where clk
is introduced in the driver.
- changed the "realtek,rtl9607-i2c" compatible to require the "clocks" to
be specified and with it moved it out of "realtek,rtl9310-i2c" check to its
own place for cleanliness (how it was originally in v1).
- Link to v3: https://lore.kernel.org/linux-i2c/20260322123411.32102-1-adilov@disroot.org/
Changelog in v3
- Patch 7
- reworded the commit message to better describe i2c clock.
- make clocks property available for all compatibles.
- change "realtek,rtl9607-i2c" compatible to be under the same if statement
as "realtek,rtl9310-i2c" for "realtek,scl".
- Link to v2: https://lore.kernel.org/linux-i2c/20260319175753.32338-1-adilov@disroot.org/
Changelog in v2
- rebased on top of the patch from Jan Kantert.
- Patch 7 (to my best understanding of Krzysztof's request):
- added the "clocks: false" for compatibles that are not realtek,rtl9607-i2c.
- Link to v1: https://lore.kernel.org/linux-i2c/20260314082628.25206-1-adilov@disroot.org/
Rustam Adilov (8):
i2c: rtl9300: split data_reg into read and write reg
i2c: rtl9300: introduce max length property to driver data
i2c: rtl9300: introduce F_BUSY to the reg_fields struct
i2c: rtl9300: introduce a property for 8 bit width reg address
dt-bindings: i2c: realtek,rtl9301-i2c: extend for clocks and RTL9607C
support
i2c: rtl9300: introduce clk struct for upcoming rtl9607 support
i2c: rtl9300: introduce new function properties to driver data
i2c: rtl9300: add RTL9607C i2c controller support
.../bindings/i2c/realtek,rtl9301-i2c.yaml | 15 ++
drivers/i2c/busses/i2c-rtl9300.c | 191 ++++++++++++++----
2 files changed, 171 insertions(+), 35 deletions(-)
--
2.53.0
^ permalink raw reply
* [PATCH v6 2/8] i2c: rtl9300: introduce max length property to driver data
From: Rustam Adilov @ 2026-04-01 18:06 UTC (permalink / raw)
To: Chris Packham, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-i2c, devicetree, linux-kernel
Cc: Rustam Adilov
In-Reply-To: <20260401180648.337834-1-adilov@disroot.org>
In RTL9607C i2c controller, theoretical maximum the data length
can be is 4 bytes as opposed to 16 bytes on rtl9300 and rtl9310.
Introduce a new property to the driver data struct for that.
Adjust if statement in prepare_xfer function to follow that new
property instead of the hardcoded value.
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Rustam Adilov <adilov@disroot.org>
---
drivers/i2c/busses/i2c-rtl9300.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c
index 9bf4c6b08e05..2cada6038b44 100644
--- a/drivers/i2c/busses/i2c-rtl9300.c
+++ b/drivers/i2c/busses/i2c-rtl9300.c
@@ -64,11 +64,14 @@ struct rtl9300_i2c_drv_data {
u32 rd_reg;
u32 wd_reg;
u8 max_nchan;
+ u8 max_data_len;
};
#define RTL9300_I2C_MUX_NCHAN 8
#define RTL9310_I2C_MUX_NCHAN 12
+#define RTL9300_I2C_MAX_DATA_LEN 16
+
struct rtl9300_i2c {
struct regmap *regmap;
struct device *dev;
@@ -210,9 +213,11 @@ static int rtl9300_i2c_writel(struct rtl9300_i2c *i2c, u32 data)
static int rtl9300_i2c_prepare_xfer(struct rtl9300_i2c *i2c, struct rtl9300_i2c_xfer *xfer)
{
+ const struct rtl9300_i2c_drv_data *drv_data;
int ret;
- if (xfer->data_len < 1 || xfer->data_len > 16)
+ drv_data = device_get_match_data(i2c->dev);
+ if (xfer->data_len < 1 || xfer->data_len > drv_data->max_data_len)
return -EINVAL;
ret = regmap_field_write(i2c->fields[F_DEV_ADDR], xfer->dev_addr);
@@ -505,6 +510,7 @@ static const struct rtl9300_i2c_drv_data rtl9300_i2c_drv_data = {
.rd_reg = RTL9300_I2C_MST_DATA_WORD0,
.wd_reg = RTL9300_I2C_MST_DATA_WORD0,
.max_nchan = RTL9300_I2C_MUX_NCHAN,
+ .max_data_len = RTL9300_I2C_MAX_DATA_LEN,
};
static const struct rtl9300_i2c_drv_data rtl9310_i2c_drv_data = {
@@ -526,6 +532,7 @@ static const struct rtl9300_i2c_drv_data rtl9310_i2c_drv_data = {
.rd_reg = RTL9310_I2C_MST_DATA_CTRL,
.wd_reg = RTL9310_I2C_MST_DATA_CTRL,
.max_nchan = RTL9310_I2C_MUX_NCHAN,
+ .max_data_len = RTL9300_I2C_MAX_DATA_LEN,
};
static const struct of_device_id i2c_rtl9300_dt_ids[] = {
--
2.53.0
^ permalink raw reply related
* [PATCH v6 5/8] dt-bindings: i2c: realtek,rtl9301-i2c: extend for clocks and RTL9607C support
From: Rustam Adilov @ 2026-04-01 18:06 UTC (permalink / raw)
To: Chris Packham, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-i2c, devicetree, linux-kernel
Cc: Rustam Adilov, Conor Dooley
In-Reply-To: <20260401180648.337834-1-adilov@disroot.org>
Add the "realtek,rtl9607-i2c" compatible for i2c controller on the
RTL9607C SoC series.
Add a clocks property to the properties to describe the i2c reference
clock and make it available for all the compatibles. This i2c reference
clock is assumed to be coming from switchcore region via Lexra bus as
the other SoC peripherals.
According to the info available about the existing devices, they also
have the i2c master controller clocks.
RTL9607C requires the "realtek,scl" and "clocks" to be specified
and so handle it under separate if check for "realtek,rtl9607-i2c".
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Rustam Adilov <adilov@disroot.org>
---
.../bindings/i2c/realtek,rtl9301-i2c.yaml | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/Documentation/devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml b/Documentation/devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml
index f9a449fee2b0..5873cfdc5b3e 100644
--- a/Documentation/devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml
+++ b/Documentation/devicetree/bindings/i2c/realtek,rtl9301-i2c.yaml
@@ -15,6 +15,8 @@ description:
assigned to either I2C controller.
RTL9310 SoCs have equal capabilities but support 12 common SDA lines which
can be assigned to either I2C controller.
+ RTL9607C SoCs have equal capabilities but each controller only supports 1
+ SCL/SDA line.
properties:
compatible:
@@ -34,6 +36,7 @@ properties:
- enum:
- realtek,rtl9301-i2c
- realtek,rtl9310-i2c
+ - realtek,rtl9607-i2c
reg:
items:
@@ -51,6 +54,9 @@ properties:
The SCL line number of this I2C controller.
enum: [ 0, 1 ]
+ clocks:
+ maxItems: 1
+
patternProperties:
'^i2c@[0-9ab]$':
$ref: /schemas/i2c/i2c-controller.yaml
@@ -81,6 +87,15 @@ allOf:
then:
patternProperties:
'^i2c@[89ab]$': false
+ - if:
+ properties:
+ compatible:
+ contains:
+ const: realtek,rtl9607-i2c
+ then:
+ required:
+ - realtek,scl
+ - clocks
required:
- compatible
--
2.53.0
^ permalink raw reply related
* [PATCH v6 6/8] i2c: rtl9300: introduce clk struct for upcoming rtl9607 support
From: Rustam Adilov @ 2026-04-01 18:06 UTC (permalink / raw)
To: Chris Packham, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-i2c, devicetree, linux-kernel
Cc: Rustam Adilov
In-Reply-To: <20260401180648.337834-1-adilov@disroot.org>
In RTL9607C i2c controller, there is 10 bit CLK_DIV field for
setting the clock of i2c interface which depends on the rate
of i2c clk (which seems be fixed to 62.5MHz according to Realtek SDK).
Introduce the clk struct and the respective F_CLK_DIV and clk_div
which are going to be used in the upcoming patch for rtl9607c i2c
controller support addition.
devm_clk_get_optional_enabled() function was used for cleaner code
as it automatically returns NULL if the clk is not present, which is
going to be the case for RTL9300 and RTL9310 i2c controllers.
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Rustam Adilov <adilov@disroot.org>
---
drivers/i2c/busses/i2c-rtl9300.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c
index ffbc6c52861b..16af49ccd1dd 100644
--- a/drivers/i2c/busses/i2c-rtl9300.c
+++ b/drivers/i2c/busses/i2c-rtl9300.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/bits.h>
+#include <linux/clk.h>
#include <linux/i2c.h>
#include <linux/i2c-mux.h>
#include <linux/mod_devicetable.h>
@@ -28,6 +29,7 @@ struct rtl9300_i2c_chan {
struct rtl9300_i2c *i2c;
enum rtl9300_bus_freq bus_freq;
u8 sda_num;
+ u32 clk_div;
};
enum rtl9300_i2c_reg_scope {
@@ -54,6 +56,7 @@ enum rtl9300_i2c_reg_fields {
F_SDA_OUT_SEL,
F_SDA_SEL,
F_BUSY,
+ F_CLK_DIV,
/* keep last */
F_NUM_FIELDS
@@ -85,6 +88,7 @@ struct rtl9300_i2c {
u8 scl_num;
u8 sda_num;
struct mutex lock;
+ struct clk *clk;
};
DEFINE_GUARD(rtl9300_i2c, struct rtl9300_i2c *, mutex_lock(&_T->lock), mutex_unlock(&_T->lock))
@@ -432,6 +436,10 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
if (ret)
return ret;
+ i2c->clk = devm_clk_get_optional_enabled(dev, NULL);
+ if (IS_ERR(i2c->clk))
+ return dev_err_probe(dev, PTR_ERR(i2c->clk), "Failed to enable i2c clock\n");
+
i = 0;
for_each_child_of_node_scoped(dev->of_node, child) {
struct rtl9300_i2c_chan *chan = &i2c->chans[i];
--
2.53.0
^ permalink raw reply related
* [PATCH v6 7/8] i2c: rtl9300: introduce new function properties to driver data
From: Rustam Adilov @ 2026-04-01 18:06 UTC (permalink / raw)
To: Chris Packham, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-i2c, devicetree, linux-kernel
Cc: Rustam Adilov
In-Reply-To: <20260401180648.337834-1-adilov@disroot.org>
Due to the very nature of differences between RTL9607C i2c controller
and RTL9300 / RTL9310 that are incompatible with each other in some areas
of this driver, for example in clock configuration, channel configuration
and initialization at the end of the probe, introduce new function
properties to the driver data struct to handle those differences.
With these new properties, create configuration functions for RTL9300 and
RTL9310 and assign them to their respective driver data structs.
Signed-off-by: Rustam Adilov <adilov@disroot.org>
---
drivers/i2c/busses/i2c-rtl9300.c | 66 +++++++++++++++++++++-----------
1 file changed, 44 insertions(+), 22 deletions(-)
diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c
index 16af49ccd1dd..b718b74afe0d 100644
--- a/drivers/i2c/busses/i2c-rtl9300.c
+++ b/drivers/i2c/busses/i2c-rtl9300.c
@@ -65,6 +65,9 @@ enum rtl9300_i2c_reg_fields {
struct rtl9300_i2c_drv_data {
struct rtl9300_i2c_reg_field field_desc[F_NUM_FIELDS];
int (*select_scl)(struct rtl9300_i2c *i2c, u8 scl);
+ int (*config_chan)(struct rtl9300_i2c *i2c, struct rtl9300_i2c_chan *chan);
+ void (*config_clock)(u32 clock_freq, struct rtl9300_i2c_chan *chan);
+ int (*misc_init)(struct rtl9300_i2c *i2c);
u32 rd_reg;
u32 wd_reg;
u8 max_nchan;
@@ -175,6 +178,30 @@ static int rtl9300_i2c_config_chan(struct rtl9300_i2c *i2c, struct rtl9300_i2c_c
return 0;
}
+static void rtl9300_i2c_config_clock(u32 clock_freq, struct rtl9300_i2c_chan *chan)
+{
+ struct rtl9300_i2c *i2c = chan->i2c;
+
+ switch (clock_freq) {
+ case I2C_MAX_STANDARD_MODE_FREQ:
+ chan->bus_freq = RTL9300_I2C_STD_FREQ;
+ break;
+ case I2C_MAX_FAST_MODE_FREQ:
+ chan->bus_freq = RTL9300_I2C_FAST_FREQ;
+ break;
+ case RTL9300_I2C_MAX_SUPER_FAST_FREQ:
+ chan->bus_freq = RTL9300_I2C_SUPER_FAST_FREQ;
+ break;
+ case RTL9300_I2C_MAX_SLOW_FREQ:
+ chan->bus_freq = RTL9300_I2C_SLOW_FREQ;
+ break;
+ default:
+ dev_warn(i2c->dev, "SDA%d clock-frequency %d not supported using default\n",
+ chan->sda_num, clock_freq);
+ break;
+ }
+}
+
static int rtl9300_i2c_read(struct rtl9300_i2c *i2c, u8 *buf, u8 len)
{
u32 vals[4] = {};
@@ -322,7 +349,7 @@ static int rtl9300_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, unsigned s
guard(rtl9300_i2c)(i2c);
drv_data = device_get_match_data(i2c->dev);
- ret = rtl9300_i2c_config_chan(i2c, chan);
+ ret = drv_data->config_chan(i2c, chan);
if (ret)
return ret;
@@ -389,6 +416,12 @@ static struct i2c_adapter_quirks rtl9300_i2c_quirks = {
.max_write_len = 16,
};
+static int rtl9300_i2c_init(struct rtl9300_i2c *i2c)
+{
+ /* only use standard read format */
+ return regmap_field_write(i2c->fields[F_RD_MODE], 0);
+}
+
static int rtl9300_i2c_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -453,27 +486,11 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
if (ret)
clock_freq = I2C_MAX_STANDARD_MODE_FREQ;
- switch (clock_freq) {
- case I2C_MAX_STANDARD_MODE_FREQ:
- chan->bus_freq = RTL9300_I2C_STD_FREQ;
- break;
- case I2C_MAX_FAST_MODE_FREQ:
- chan->bus_freq = RTL9300_I2C_FAST_FREQ;
- break;
- case RTL9300_I2C_MAX_SUPER_FAST_FREQ:
- chan->bus_freq = RTL9300_I2C_SUPER_FAST_FREQ;
- break;
- case RTL9300_I2C_MAX_SLOW_FREQ:
- chan->bus_freq = RTL9300_I2C_SLOW_FREQ;
- break;
- default:
- dev_warn(i2c->dev, "SDA%d clock-frequency %d not supported using default\n",
- sda_num, clock_freq);
- break;
- }
-
chan->sda_num = sda_num;
chan->i2c = i2c;
+
+ drv_data->config_clock(clock_freq, chan);
+
adap = &i2c->chans[i].adap;
adap->owner = THIS_MODULE;
adap->algo = &rtl9300_i2c_algo;
@@ -491,8 +508,7 @@ static int rtl9300_i2c_probe(struct platform_device *pdev)
}
i2c->sda_num = 0xff;
- /* only use standard read format */
- ret = regmap_field_write(i2c->fields[F_RD_MODE], 0);
+ ret = drv_data->misc_init(i2c);
if (ret)
return ret;
@@ -521,6 +537,9 @@ static const struct rtl9300_i2c_drv_data rtl9300_i2c_drv_data = {
[F_BUSY] = MST_REG_FIELD(RTL9300_I2C_MST_CTRL1, 0, 0),
},
.select_scl = rtl9300_i2c_select_scl,
+ .config_chan = rtl9300_i2c_config_chan,
+ .config_clock = rtl9300_i2c_config_clock,
+ .misc_init = rtl9300_i2c_init,
.rd_reg = RTL9300_I2C_MST_DATA_WORD0,
.wd_reg = RTL9300_I2C_MST_DATA_WORD0,
.max_nchan = RTL9300_I2C_MUX_NCHAN,
@@ -545,6 +564,9 @@ static const struct rtl9300_i2c_drv_data rtl9310_i2c_drv_data = {
[F_BUSY] = MST_REG_FIELD(RTL9310_I2C_MST_CTRL, 0, 0),
},
.select_scl = rtl9310_i2c_select_scl,
+ .config_chan = rtl9300_i2c_config_chan,
+ .config_clock = rtl9300_i2c_config_clock,
+ .misc_init = rtl9300_i2c_init,
.rd_reg = RTL9310_I2C_MST_DATA_CTRL,
.wd_reg = RTL9310_I2C_MST_DATA_CTRL,
.max_nchan = RTL9310_I2C_MUX_NCHAN,
--
2.53.0
^ permalink raw reply related
* [PATCH v6 8/8] i2c: rtl9300: add RTL9607C i2c controller support
From: Rustam Adilov @ 2026-04-01 18:06 UTC (permalink / raw)
To: Chris Packham, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-i2c, devicetree, linux-kernel
Cc: Rustam Adilov
In-Reply-To: <20260401180648.337834-1-adilov@disroot.org>
Add support for the internal I2C controllers of RTL9607C series based
SoCs. Add register definitions, chip-specific functions and macros too.
Make use of the clk introduced from the previous patch to get the clk_div
value and use it during the rtl9607c channel configuration.
Introduce a new EXT_SCK_5MS field to the reg fields struct which is going
to be initialized by rtl9607c init function at the end of the probe.
This patch depends on all the previous patches in this patch series.
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Rustam Adilov <adilov@disroot.org>
---
drivers/i2c/busses/i2c-rtl9300.c | 70 ++++++++++++++++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c
index b718b74afe0d..8cedffbb2964 100644
--- a/drivers/i2c/busses/i2c-rtl9300.c
+++ b/drivers/i2c/busses/i2c-rtl9300.c
@@ -57,6 +57,7 @@ enum rtl9300_i2c_reg_fields {
F_SDA_SEL,
F_BUSY,
F_CLK_DIV,
+ F_EXT_SCK_5MS,
/* keep last */
F_NUM_FIELDS
@@ -77,8 +78,10 @@ struct rtl9300_i2c_drv_data {
#define RTL9300_I2C_MUX_NCHAN 8
#define RTL9310_I2C_MUX_NCHAN 12
+#define RTL9607_I2C_MUX_NCHAN 1
#define RTL9300_I2C_MAX_DATA_LEN 16
+#define RTL9607_I2C_MAX_DATA_LEN 4
struct rtl9300_i2c {
struct regmap *regmap;
@@ -127,6 +130,14 @@ struct rtl9300_i2c_xfer {
#define RTL9310_I2C_MST_MEMADDR_CTRL 0x4
#define RTL9310_I2C_MST_DATA_CTRL 0x8
+#define RTL9607_I2C_CONFIG 0x22f50
+#define RTL9607_IO_MODE_EN 0x23014
+#define RTL9607_I2C_IND_WD 0x0
+#define RTL9607_I2C_IND_ADR 0x8
+#define RTL9607_I2C_IND_CMD 0x10
+#define RTL9607_I2C_IND_RD 0x18
+#define RTL9607_REG_ADDR_8BIT_LEN 0
+
static int rtl9300_i2c_reg_addr_set(struct rtl9300_i2c *i2c, u32 reg, u16 len)
{
int ret;
@@ -178,6 +189,27 @@ static int rtl9300_i2c_config_chan(struct rtl9300_i2c *i2c, struct rtl9300_i2c_c
return 0;
}
+static int rtl9607_i2c_config_chan(struct rtl9300_i2c *i2c, struct rtl9300_i2c_chan *chan)
+{
+ const struct rtl9300_i2c_drv_data *drv_data;
+ int ret;
+
+ if (i2c->sda_num == chan->sda_num)
+ return 0;
+
+ ret = regmap_field_write(i2c->fields[F_CLK_DIV], chan->clk_div);
+ if (ret)
+ return ret;
+
+ drv_data = device_get_match_data(i2c->dev);
+ ret = drv_data->select_scl(i2c, i2c->scl_num);
+ if (ret)
+ return ret;
+
+ i2c->sda_num = chan->sda_num;
+ return 0;
+}
+
static void rtl9300_i2c_config_clock(u32 clock_freq, struct rtl9300_i2c_chan *chan)
{
struct rtl9300_i2c *i2c = chan->i2c;
@@ -202,6 +234,13 @@ static void rtl9300_i2c_config_clock(u32 clock_freq, struct rtl9300_i2c_chan *ch
}
}
+static void rtl9607_i2c_config_clock(u32 clock_freq, struct rtl9300_i2c_chan *chan)
+{
+ struct rtl9300_i2c *i2c = chan->i2c;
+
+ chan->clk_div = clk_get_rate(i2c->clk) / clock_freq - 1;
+}
+
static int rtl9300_i2c_read(struct rtl9300_i2c *i2c, u8 *buf, u8 len)
{
u32 vals[4] = {};
@@ -422,6 +461,11 @@ static int rtl9300_i2c_init(struct rtl9300_i2c *i2c)
return regmap_field_write(i2c->fields[F_RD_MODE], 0);
}
+static int rtl9607_i2c_init(struct rtl9300_i2c *i2c)
+{
+ return regmap_field_write(i2c->fields[F_EXT_SCK_5MS], 1);
+}
+
static int rtl9300_i2c_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -574,6 +618,31 @@ static const struct rtl9300_i2c_drv_data rtl9310_i2c_drv_data = {
.reg_addr_8bit_len = RTL9300_REG_ADDR_8BIT_LEN,
};
+static const struct rtl9300_i2c_drv_data rtl9607_i2c_drv_data = {
+ .field_desc = {
+ [F_SCL_SEL] = GLB_REG_FIELD(RTL9607_IO_MODE_EN, 13, 14),
+ [F_EXT_SCK_5MS] = MST_REG_FIELD(RTL9607_I2C_CONFIG, 26, 26),
+ [F_DEV_ADDR] = MST_REG_FIELD(RTL9607_I2C_CONFIG, 14, 20),
+ [F_MEM_ADDR_WIDTH] = MST_REG_FIELD(RTL9607_I2C_CONFIG, 12, 13),
+ [F_DATA_WIDTH] = MST_REG_FIELD(RTL9607_I2C_CONFIG, 10, 11),
+ [F_CLK_DIV] = MST_REG_FIELD(RTL9607_I2C_CONFIG, 0, 9),
+ [F_I2C_FAIL] = MST_REG_FIELD(RTL9607_I2C_IND_CMD, 3, 3),
+ [F_BUSY] = MST_REG_FIELD(RTL9607_I2C_IND_CMD, 2, 2),
+ [F_RWOP] = MST_REG_FIELD(RTL9607_I2C_IND_CMD, 1, 1),
+ [F_I2C_TRIG] = MST_REG_FIELD(RTL9607_I2C_IND_CMD, 0, 0),
+ [F_MEM_ADDR] = MST_REG_FIELD(RTL9607_I2C_IND_ADR, 0, 31),
+ },
+ .select_scl = rtl9310_i2c_select_scl,
+ .config_chan = rtl9607_i2c_config_chan,
+ .config_clock = rtl9607_i2c_config_clock,
+ .misc_init = rtl9607_i2c_init,
+ .rd_reg = RTL9607_I2C_IND_RD,
+ .wd_reg = RTL9607_I2C_IND_WD,
+ .max_nchan = RTL9607_I2C_MUX_NCHAN,
+ .max_data_len = RTL9607_I2C_MAX_DATA_LEN,
+ .reg_addr_8bit_len = RTL9607_REG_ADDR_8BIT_LEN,
+};
+
static const struct of_device_id i2c_rtl9300_dt_ids[] = {
{ .compatible = "realtek,rtl9301-i2c", .data = (void *) &rtl9300_i2c_drv_data },
{ .compatible = "realtek,rtl9302b-i2c", .data = (void *) &rtl9300_i2c_drv_data },
@@ -583,6 +652,7 @@ static const struct of_device_id i2c_rtl9300_dt_ids[] = {
{ .compatible = "realtek,rtl9311-i2c", .data = (void *) &rtl9310_i2c_drv_data },
{ .compatible = "realtek,rtl9312-i2c", .data = (void *) &rtl9310_i2c_drv_data },
{ .compatible = "realtek,rtl9313-i2c", .data = (void *) &rtl9310_i2c_drv_data },
+ { .compatible = "realtek,rtl9607-i2c", .data = (void *) &rtl9607_i2c_drv_data },
{}
};
MODULE_DEVICE_TABLE(of, i2c_rtl9300_dt_ids);
--
2.53.0
^ permalink raw reply related
* [PATCH v6 4/8] i2c: rtl9300: introduce a property for 8 bit width reg address
From: Rustam Adilov @ 2026-04-01 18:06 UTC (permalink / raw)
To: Chris Packham, Andi Shyti, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, linux-i2c, devicetree, linux-kernel
Cc: Rustam Adilov
In-Reply-To: <20260401180648.337834-1-adilov@disroot.org>
In RTL9607C i2c controller, in order to indicate that the width of
memory address is 8 bits, 0 is written to MEM_ADDR_WIDTH field as
opposed to 1 for RTL9300 and RTL9310.
Introduce a new property to a driver data to indicate what value
need to written to MEM_ADDR_WIDTH field for this case.
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Rustam Adilov <adilov@disroot.org>
---
drivers/i2c/busses/i2c-rtl9300.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-rtl9300.c b/drivers/i2c/busses/i2c-rtl9300.c
index e40b4692a3fa..ffbc6c52861b 100644
--- a/drivers/i2c/busses/i2c-rtl9300.c
+++ b/drivers/i2c/busses/i2c-rtl9300.c
@@ -66,6 +66,7 @@ struct rtl9300_i2c_drv_data {
u32 wd_reg;
u8 max_nchan;
u8 max_data_len;
+ u8 reg_addr_8bit_len;
};
#define RTL9300_I2C_MUX_NCHAN 8
@@ -111,6 +112,7 @@ struct rtl9300_i2c_xfer {
#define RTL9300_I2C_MST_DATA_WORD2 0x10
#define RTL9300_I2C_MST_DATA_WORD3 0x14
#define RTL9300_I2C_MST_GLB_CTRL 0x384
+#define RTL9300_REG_ADDR_8BIT_LEN 1
#define RTL9310_I2C_MST_IF_CTRL 0x1004
#define RTL9310_I2C_MST_IF_SEL 0x1008
@@ -305,6 +307,7 @@ static int rtl9300_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, unsigned s
union i2c_smbus_data *data)
{
struct rtl9300_i2c_chan *chan = i2c_get_adapdata(adap);
+ const struct rtl9300_i2c_drv_data *drv_data;
struct rtl9300_i2c *i2c = chan->i2c;
struct rtl9300_i2c_xfer xfer = {0};
int ret;
@@ -314,6 +317,7 @@ static int rtl9300_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, unsigned s
guard(rtl9300_i2c)(i2c);
+ drv_data = device_get_match_data(i2c->dev);
ret = rtl9300_i2c_config_chan(i2c, chan);
if (ret)
return ret;
@@ -321,7 +325,7 @@ static int rtl9300_i2c_smbus_xfer(struct i2c_adapter *adap, u16 addr, unsigned s
xfer.dev_addr = addr & 0x7f;
xfer.write = (read_write == I2C_SMBUS_WRITE);
xfer.reg_addr = command;
- xfer.reg_addr_len = 1;
+ xfer.reg_addr_len = drv_data->reg_addr_8bit_len;
switch (size) {
case I2C_SMBUS_BYTE:
@@ -513,6 +517,7 @@ static const struct rtl9300_i2c_drv_data rtl9300_i2c_drv_data = {
.wd_reg = RTL9300_I2C_MST_DATA_WORD0,
.max_nchan = RTL9300_I2C_MUX_NCHAN,
.max_data_len = RTL9300_I2C_MAX_DATA_LEN,
+ .reg_addr_8bit_len = RTL9300_REG_ADDR_8BIT_LEN,
};
static const struct rtl9300_i2c_drv_data rtl9310_i2c_drv_data = {
@@ -536,6 +541,7 @@ static const struct rtl9300_i2c_drv_data rtl9310_i2c_drv_data = {
.wd_reg = RTL9310_I2C_MST_DATA_CTRL,
.max_nchan = RTL9310_I2C_MUX_NCHAN,
.max_data_len = RTL9300_I2C_MAX_DATA_LEN,
+ .reg_addr_8bit_len = RTL9300_REG_ADDR_8BIT_LEN,
};
static const struct of_device_id i2c_rtl9300_dt_ids[] = {
--
2.53.0
^ permalink raw reply related
* Re: [PATCH v2] dt-bindings: mfd: twl: Reference converted schemas for subnodes
From: Jihed Chaibi @ 2026-04-01 18:19 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: andreas, lee, robh, krzk+dt, conor+dt, devicetree, linux-kernel
In-Reply-To: <a7f8048f-eb35-4ffc-aad9-a5275e830952@kernel.org>
On Wed, Apr 1, 2026 at 8:03 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> > Replace the inline compatible definitions with $ref to the appropriate
> > schemas and unevaluatedProperties: false, matching the pattern already
> > used by the madc, gpadc, and charger subnodes.
>
> I told you: no.
>
> Why do you replace correct code?
>
> Best regards,
> Krzysztof
Got it. Dropping this patch.
Best regards,
^ permalink raw reply
* [PATCH 0/2] Fix ICE reg size on Kodiak and SM8450 dts
From: Kuldeep Singh @ 2026-04-01 18:35 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Luca Weiss, Eric Biggers
Cc: linux-arm-msm, devicetree, linux-kernel, Kuldeep Singh
Update ICE reg size for kodiak and sm8450.
Ice reg size for kodiak/sm8450 is currently written incorrectly and
doesn't match hardware specification. This series attempt to fix it.
Note: I attempted to send patch series to myself but some mishap
happened but patch isn't sent to ML. Sending it again properly.
Sorry for inconvenience.
Signed-off-by: Kuldeep Singh <kuldeep.singh@oss.qualcomm.com>
---
Kuldeep Singh (2):
arm64: dts: qcom: kodiak: Fix ICE reg size
arm64: dts: qcom: sm8450: Fix ICE reg size
arch/arm64/boot/dts/qcom/kodiak.dtsi | 2 +-
arch/arm64/boot/dts/qcom/sm8450.dtsi | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
base-commit: d0c3bcd5b8976159d835a897254048e078f447e6
change-id: 20260331-ice_dt_reg_fix-eda625cda3e2
Best regards,
--
Kuldeep Singh <kuldeep.singh@oss.qualcomm.com>
^ permalink raw reply
* [PATCH 1/2] arm64: dts: qcom: kodiak: Fix ICE reg size
From: Kuldeep Singh @ 2026-04-01 18:35 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Luca Weiss, Eric Biggers
Cc: linux-arm-msm, devicetree, linux-kernel, Kuldeep Singh
In-Reply-To: <20260402-ice_dt_reg_fix-v1-0-74e4c2129238@oss.qualcomm.com>
The ICE register region on Kodiak is currently defined as 0x8000 bytes.
According to the hardware specification, the correct register size is
0x18000.
Update the ICE node reg property to match the hardware.
Fixes: dfd5ee7b34bb ("arm64: dts: qcom: sc7280: Add inline crypto engine")
Signed-off-by: Kuldeep Singh <kuldeep.singh@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/kodiak.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/kodiak.dtsi b/arch/arm64/boot/dts/qcom/kodiak.dtsi
index 6079e67ea829..ed8361f79e28 100644
--- a/arch/arm64/boot/dts/qcom/kodiak.dtsi
+++ b/arch/arm64/boot/dts/qcom/kodiak.dtsi
@@ -2578,7 +2578,7 @@ ufs_mem_phy: phy@1d87000 {
ice: crypto@1d88000 {
compatible = "qcom,sc7280-inline-crypto-engine",
"qcom,inline-crypto-engine";
- reg = <0 0x01d88000 0 0x8000>;
+ reg = <0 0x01d88000 0 0x18000>;
clocks = <&gcc GCC_UFS_PHY_ICE_CORE_CLK>;
};
--
2.34.1
^ permalink raw reply related
* [PATCH 2/2] arm64: dts: qcom: sm8450: Fix ICE reg size
From: Kuldeep Singh @ 2026-04-01 18:35 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Luca Weiss, Eric Biggers
Cc: linux-arm-msm, devicetree, linux-kernel, Kuldeep Singh
In-Reply-To: <20260402-ice_dt_reg_fix-v1-0-74e4c2129238@oss.qualcomm.com>
The ICE register region size was originally described incorrectly when
the ICE hardware was first introduced. The same value was later carried
over unchanged when the ICE node was split out from the UFS node into
its own DT entry.
Correct the register size to match the hardware specification.
Fixes: 276ee34a40c1 ("arm64: dts: qcom: sm8450: add Inline Crypto Engine registers and clock")
Signed-off-by: Kuldeep Singh <kuldeep.singh@oss.qualcomm.com>
---
arch/arm64/boot/dts/qcom/sm8450.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/sm8450.dtsi b/arch/arm64/boot/dts/qcom/sm8450.dtsi
index 920a2d1c04d0..3984d6f8932d 100644
--- a/arch/arm64/boot/dts/qcom/sm8450.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8450.dtsi
@@ -5373,7 +5373,7 @@ ufs_mem_phy: phy@1d87000 {
ice: crypto@1d88000 {
compatible = "qcom,sm8450-inline-crypto-engine",
"qcom,inline-crypto-engine";
- reg = <0 0x01d88000 0 0x8000>;
+ reg = <0 0x01d88000 0 0x18000>;
clocks = <&gcc GCC_UFS_PHY_ICE_CORE_CLK>;
};
--
2.34.1
^ permalink raw reply related
* [PATCH v3 2/2] hwmon: pmbus: Add support for Sony APS-379
From: Chris Packham @ 2026-04-01 19:42 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, linux
Cc: devicetree, linux-hwmon, linux-kernel, Chris Packham
In-Reply-To: <20260401194235.2149796-1-chris.packham@alliedtelesis.co.nz>
Add pmbus support for Sony APS-379 power supplies. There are a few PMBUS
commands that return data that is undocumented/invalid so these need to
be rejected with -ENXIO. The READ_VOUT command returns data in linear11
format instead of linear16 so we need to workaround this.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---
Notes:
Changes in v3:
- Add missing MODULE_DEVICE_TABLE(i2c, ...) and move aps_379_id to just
above the probe.
- Remove unnecessary sign_extend32
- Zero initialise array on stack
Changes in v2:
- Simplify code per recommendations from Guenter
- Add driver documentation
Documentation/hwmon/aps-379.rst | 58 +++++++++++
Documentation/hwmon/index.rst | 1 +
drivers/hwmon/pmbus/Kconfig | 6 ++
drivers/hwmon/pmbus/Makefile | 1 +
drivers/hwmon/pmbus/aps-379.c | 169 ++++++++++++++++++++++++++++++++
5 files changed, 235 insertions(+)
create mode 100644 Documentation/hwmon/aps-379.rst
create mode 100644 drivers/hwmon/pmbus/aps-379.c
diff --git a/Documentation/hwmon/aps-379.rst b/Documentation/hwmon/aps-379.rst
new file mode 100644
index 000000000000..468ec5a98fd6
--- /dev/null
+++ b/Documentation/hwmon/aps-379.rst
@@ -0,0 +1,58 @@
+Kernel driver aps-379
+=====================
+
+Supported chips:
+
+ * Sony APS-379
+
+ Prefix: 'aps-379'
+
+ Addresses scanned: -
+
+ Authors:
+ - Chris Packham
+
+Description
+-----------
+
+This driver implements support for the PMBus monitor on the Sony APS-379
+modular power supply. The APS-379 deviates from the PMBus standard for the
+READ_VOUT command by using the linear11 format instead of linear16.
+
+The known supported PMBus commands are:
+
+=== ============================= ========= ======= =====
+Cmd Function Protocol Scaling Bytes
+=== ============================= ========= ======= =====
+01 On / Off Command (OPERATION) Byte R/W -- 1
+10 WRITE_PROTECT Byte R/W -- 1
+3B FAN_COMMAND_1 Word R/W -- 2
+46 Current Limit (in percent) Word R/W 2^0 2
+47 Current Limit Fault Response Byte R/W -- 1
+79 Alarm Data Bits (STATUS_WORD) Word Rd -- 2
+8B Output Voltage (READ_VOUT) Word Rd 2^-4 2
+8C Output Current (READ_IOUT) Word Rd 2^-2 2
+8D Power Supply Ambient Temp Word Rd 2^0 2
+90 READ_FAN_SPEED_1 Word Rd 2^6 2
+91 READ_FAN_SPEED_2 Word Rd 2^6 2
+96 Output Wattage (READ_POUT) Word Rd 2^1 2
+97 Input Wattage (READ_PIN) Word Rd 2^1 2
+9A Unit Model Number (MFR_MODEL) Block R/W -- 10
+9B Unit Revision Number Block R/W -- 10
+9E Unit Serial Number Block R/W -- 8
+99 Unit Manufacturer ID (MFR_ID) Block R/W -- 8
+D0 Unit Run Time Information Block Rd -- 4
+D5 Firmware Version Rd cust -- 8
+B0 User Data 1 (USER_DATA_00) Block R/W -- 4
+B1 User Data 2 (USER_DATA_01) Block R/W -- 4
+B2 User Data 3 (USER_DATA_02) Block R/W -- 4
+B3 User Data 4 (USER_DATA_03) Block R/W -- 4
+B4 User Data 5 (USER_DATA_04) Block R/W -- 4
+B5 User Data 6 (USER_DATA_05) Block R/W -- 4
+B6 User Data 7 (USER_DATA_06) Block R/W -- 4
+B7 User Data 8 (USER_DATA_07) Block R/W -- 4
+F0 Calibration command Byte R/W -- 1
+F1 Calibration data Word Wr 2^9 2
+F2 Unlock Calibration Byte Wr -- 1
+=== ============================= ========= ======= =====
+
diff --git a/Documentation/hwmon/index.rst b/Documentation/hwmon/index.rst
index b2ca8513cfcd..2bc8d88b5724 100644
--- a/Documentation/hwmon/index.rst
+++ b/Documentation/hwmon/index.rst
@@ -41,6 +41,7 @@ Hardware Monitoring Kernel Drivers
adt7475
aht10
amc6821
+ aps-379
aquacomputer_d5next
asb100
asc7621
diff --git a/drivers/hwmon/pmbus/Kconfig b/drivers/hwmon/pmbus/Kconfig
index fc1273abe357..29076921e330 100644
--- a/drivers/hwmon/pmbus/Kconfig
+++ b/drivers/hwmon/pmbus/Kconfig
@@ -77,6 +77,12 @@ config SENSORS_ADP1050_REGULATOR
µModule regulators that can provide microprocessor power from 54V
power distribution architecture.
+config SENSORS_APS_379
+ tristate "Sony APS-379 Power Supplies"
+ help
+ If you say yes here you get hardware monitoring support for Sony
+ APS-379 Power Supplies.
+
config SENSORS_BEL_PFE
tristate "Bel PFE Compatible Power Supplies"
help
diff --git a/drivers/hwmon/pmbus/Makefile b/drivers/hwmon/pmbus/Makefile
index d6c86924f887..94f36c7069ec 100644
--- a/drivers/hwmon/pmbus/Makefile
+++ b/drivers/hwmon/pmbus/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_SENSORS_ACBEL_FSG032) += acbel-fsg032.o
obj-$(CONFIG_SENSORS_ADM1266) += adm1266.o
obj-$(CONFIG_SENSORS_ADM1275) += adm1275.o
obj-$(CONFIG_SENSORS_ADP1050) += adp1050.o
+obj-$(CONFIG_SENSORS_APS_379) += aps-379.o
obj-$(CONFIG_SENSORS_BEL_PFE) += bel-pfe.o
obj-$(CONFIG_SENSORS_BPA_RS600) += bpa-rs600.o
obj-$(CONFIG_SENSORS_DELTA_AHE50DC_FAN) += delta-ahe50dc-fan.o
diff --git a/drivers/hwmon/pmbus/aps-379.c b/drivers/hwmon/pmbus/aps-379.c
new file mode 100644
index 000000000000..5446f663d0b5
--- /dev/null
+++ b/drivers/hwmon/pmbus/aps-379.c
@@ -0,0 +1,169 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Hardware monitoring driver for Sony APS-379 Power Supplies
+ *
+ * Copyright 2026 Allied Telesis Labs
+ */
+
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/pmbus.h>
+#include "pmbus.h"
+
+struct aps_379_data {
+ struct pmbus_driver_info info;
+ u8 vout_linear_exponent;
+};
+
+#define to_aps_379_data(x) container_of(x, struct aps_379_data, info)
+
+static int aps_379_read_byte_data(struct i2c_client *client, int page, int reg)
+{
+ const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
+ struct aps_379_data *data = to_aps_379_data(info);
+
+ switch (reg) {
+ case PMBUS_VOUT_MODE:
+ /*
+ * The VOUT format used by the chip is linear11,
+ * not linear16. Report that VOUT is in linear mode
+ * and return exponent value extracted while probing
+ * the chip.
+ */
+ return data->vout_linear_exponent;
+ default:
+ return -ENODATA;
+ }
+}
+
+/*
+ * The APS-379 uses linear11 format instead of linear16. We've reported the exponent
+ * via the PMBUS_VOUT_MODE so we just return the mantissa here.
+ */
+static int aps_379_read_vout(struct i2c_client *client)
+{
+ int ret;
+
+ ret = pmbus_read_word_data(client, 0, 0xff, PMBUS_READ_VOUT);
+ if (ret < 0)
+ return ret;
+
+ return ret & 0x7ff;
+}
+
+static int aps_379_read_word_data(struct i2c_client *client, int page, int phase, int reg)
+{
+ switch (reg) {
+ case PMBUS_VOUT_UV_WARN_LIMIT:
+ case PMBUS_VOUT_OV_WARN_LIMIT:
+ case PMBUS_VOUT_UV_FAULT_LIMIT:
+ case PMBUS_VOUT_OV_FAULT_LIMIT:
+ case PMBUS_PIN_OP_WARN_LIMIT:
+ case PMBUS_POUT_OP_WARN_LIMIT:
+ case PMBUS_MFR_IIN_MAX:
+ case PMBUS_MFR_PIN_MAX:
+ case PMBUS_MFR_VOUT_MIN:
+ case PMBUS_MFR_VOUT_MAX:
+ case PMBUS_MFR_IOUT_MAX:
+ case PMBUS_MFR_POUT_MAX:
+ case PMBUS_MFR_MAX_TEMP_1:
+ /* These commands return data but it is invalid/un-documented */
+ return -ENXIO;
+ case PMBUS_READ_VOUT:
+ return aps_379_read_vout(client);
+ default:
+ if (reg >= PMBUS_VIRT_BASE)
+ return -ENXIO;
+ else
+ return -ENODATA;
+ }
+}
+
+static struct pmbus_driver_info aps_379_info = {
+ .pages = 1,
+ .format[PSC_VOLTAGE_OUT] = linear,
+ .format[PSC_CURRENT_OUT] = linear,
+ .format[PSC_POWER] = linear,
+ .format[PSC_TEMPERATURE] = linear,
+ .format[PSC_FAN] = linear,
+ .func[0] = PMBUS_HAVE_VOUT |
+ PMBUS_HAVE_IOUT |
+ PMBUS_HAVE_PIN | PMBUS_HAVE_POUT |
+ PMBUS_HAVE_TEMP |
+ PMBUS_HAVE_FAN12,
+ .read_byte_data = aps_379_read_byte_data,
+ .read_word_data = aps_379_read_word_data,
+};
+
+static const struct i2c_device_id aps_379_id[] = {
+ { "aps-379", 0 },
+ {},
+};
+MODULE_DEVICE_TABLE(i2c, aps_379_id);
+
+static int aps_379_probe(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ struct pmbus_driver_info *info;
+ struct aps_379_data *data;
+ u8 buf[I2C_SMBUS_BLOCK_MAX + 1] = { 0 };
+ int ret;
+
+ data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
+ if (!data)
+ return -ENOMEM;
+
+ memcpy(&data->info, &aps_379_info, sizeof(*info));
+ info = &data->info;
+
+ if (!i2c_check_functionality(client->adapter,
+ I2C_FUNC_SMBUS_READ_BYTE_DATA
+ | I2C_FUNC_SMBUS_READ_WORD_DATA
+ | I2C_FUNC_SMBUS_READ_BLOCK_DATA))
+ return -ENODEV;
+
+ ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, buf);
+ if (ret < 0) {
+ dev_err(dev, "Failed to read Manufacturer Model\n");
+ return ret;
+ }
+
+ if (strncasecmp(buf, aps_379_id[0].name, strlen(aps_379_id[0].name)) != 0) {
+ buf[ret] = '\0';
+ dev_err(dev, "Unsupported Manufacturer Model '%s'\n", buf);
+ return -ENODEV;
+ }
+
+ ret = i2c_smbus_read_word_data(client, PMBUS_READ_VOUT);
+ if (ret < 0) {
+ dev_err(dev, "Can't get vout exponent.\n");
+ return ret;
+ }
+ data->vout_linear_exponent = (u8)((ret >> 11) & 0x1f);
+
+ return pmbus_do_probe(client, info);
+}
+
+static const struct of_device_id __maybe_unused aps_379_of_match[] = {
+ { .compatible = "sony,aps-379" },
+ {},
+};
+MODULE_DEVICE_TABLE(of, aps_379_of_match);
+
+static struct i2c_driver aps_379_driver = {
+ .driver = {
+ .name = "aps-379",
+ .of_match_table = of_match_ptr(aps_379_of_match),
+ },
+ .probe = aps_379_probe,
+ .id_table = aps_379_id,
+};
+
+module_i2c_driver(aps_379_driver);
+
+MODULE_AUTHOR("Chris Packham");
+MODULE_DESCRIPTION("PMBus driver for Sony APS-379");
+MODULE_LICENSE("GPL");
+MODULE_IMPORT_NS("PMBUS");
--
2.53.0
^ permalink raw reply related
* [PATCH v3 0/2] hwmon: pmbus: Sony APS-379
From: Chris Packham @ 2026-04-01 19:42 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, linux
Cc: devicetree, linux-hwmon, linux-kernel, Chris Packham
This series add support for the PMBus hwmon on the Sony
APS-379 power supply module. There's some deviations from
the PMBus specification that need to be dealt with.
Chris Packham (2):
dt-bindings: trivial-devices: Add sony,aps-379
hwmon: pmbus: Add support for Sony APS-379
.../devicetree/bindings/trivial-devices.yaml | 2 +
Documentation/hwmon/aps-379.rst | 58 ++++++
Documentation/hwmon/index.rst | 1 +
drivers/hwmon/pmbus/Kconfig | 6 +
drivers/hwmon/pmbus/Makefile | 1 +
drivers/hwmon/pmbus/aps-379.c | 169 ++++++++++++++++++
6 files changed, 237 insertions(+)
create mode 100644 Documentation/hwmon/aps-379.rst
create mode 100644 drivers/hwmon/pmbus/aps-379.c
--
2.53.0
^ permalink raw reply
* [PATCH v3 1/2] dt-bindings: trivial-devices: Add sony,aps-379
From: Chris Packham @ 2026-04-01 19:42 UTC (permalink / raw)
To: robh, krzk+dt, conor+dt, linux
Cc: devicetree, linux-hwmon, linux-kernel, Chris Packham
In-Reply-To: <20260401194235.2149796-1-chris.packham@alliedtelesis.co.nz>
Add the compatible string for the sony,aps-379. This is a simple PMBus
(I2C) device that requires no additional attributes.
Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
---
Notes:
Changes in v3:
- Collect Ack from Krysztof
Documentation/devicetree/bindings/trivial-devices.yaml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index a482aeadcd44..0a559beff878 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -430,6 +430,8 @@ properties:
- smsc,emc6d103s
# Socionext Uniphier SMP control registers
- socionext,uniphier-smpctrl
+ # Sony APS-379 Power Supply
+ - sony,aps-379
# SparkFun Qwiic Joystick (COM-15168) with i2c interface
- sparkfun,qwiic-joystick
# STMicroelectronics Hot-swap controller stef48h28
--
2.53.0
^ permalink raw reply related
* [PATCH v3 3/4] ARM: dts: qcom: msm8960: Add GSBI5 I2C controller
From: Rudraksha Gupta via B4 Relay @ 2026-04-01 20:32 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-msm, devicetree, linux-kernel, Rudraksha Gupta,
Konrad Dybcio
In-Reply-To: <20260401-expressatt_fuel_guage-v3-0-9674cfc0b5a2@gmail.com>
From: Rudraksha Gupta <guptarud@gmail.com>
Add the I2C controller node for GSBI5 (gpio24/gpio25) alongside
its pinctrl default and sleep states.
Assisted-by: Claude:claude-opus-4.6
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
arch/arm/boot/dts/qcom/qcom-msm8960.dtsi | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
index 6069fb925672..a427f0f41cd1 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
+++ b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
@@ -173,6 +173,20 @@ i2c3_sleep_state: i2c3-sleep-state {
bias-bus-hold;
};
+ i2c5_default_state: i2c5-default-state {
+ pins = "gpio24", "gpio25";
+ function = "gsbi5";
+ drive-strength = <8>;
+ bias-disable;
+ };
+
+ i2c5_sleep_state: i2c5-sleep-state {
+ pins = "gpio24", "gpio25";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-bus-hold;
+ };
+
i2c7_default_state: i2c7-default-state {
pins = "gpio32", "gpio33";
function = "gsbi7";
@@ -636,6 +650,23 @@ gsbi5_serial: serial@16440000 {
status = "disabled";
};
+
+ gsbi5_i2c: i2c@16480000 {
+ compatible = "qcom,i2c-qup-v1.1.1";
+ reg = <0x16480000 0x1000>;
+ pinctrl-0 = <&i2c5_default_state>;
+ pinctrl-1 = <&i2c5_sleep_state>;
+ pinctrl-names = "default", "sleep";
+ interrupts = <GIC_SPI 155 IRQ_TYPE_LEVEL_HIGH>;
+ clocks = <&gcc GSBI5_QUP_CLK>,
+ <&gcc GSBI5_H_CLK>;
+ clock-names = "core",
+ "iface";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "disabled";
+ };
};
gsbi7: gsbi@16600000 {
--
2.53.0
^ permalink raw reply related
* [PATCH v3 2/4] ARM: dts: qcom: msm8960: Flatten I2C pinctrl state subnodes
From: Rudraksha Gupta via B4 Relay @ 2026-04-01 20:32 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-msm, devicetree, linux-kernel, Rudraksha Gupta
In-Reply-To: <20260401-expressatt_fuel_guage-v3-0-9674cfc0b5a2@gmail.com>
From: Rudraksha Gupta <guptarud@gmail.com>
Remove unnecessary inner i2c*-pins {} wrapper nodes from the I2C
pinctrl state definitions. Properties are moved directly under the
-state {} node, consistent with modern DT style.
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
arch/arm/boot/dts/qcom/qcom-msm8960.dtsi | 140 +++++++++++++------------------
1 file changed, 56 insertions(+), 84 deletions(-)
diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
index fd28401cebb5..6069fb925672 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
+++ b/arch/arm/boot/dts/qcom/qcom-msm8960.dtsi
@@ -132,129 +132,101 @@ tlmm: pinctrl@800000 {
#interrupt-cells = <2>;
i2c1_default_state: i2c1-default-state {
- i2c1-pins {
- pins = "gpio8", "gpio9";
- function = "gsbi1";
- drive-strength = <8>;
- bias-disable;
- };
+ pins = "gpio8", "gpio9";
+ function = "gsbi1";
+ drive-strength = <8>;
+ bias-disable;
};
i2c1_sleep_state: i2c1-sleep-state {
- i2c1-pins {
- pins = "gpio8", "gpio9";
- function = "gpio";
- drive-strength = <2>;
- bias-bus-hold;
- };
+ pins = "gpio8", "gpio9";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-bus-hold;
};
i2c2_default_state: i2c2-default-state {
- i2c2-pins {
- pins = "gpio12", "gpio13";
- function = "gsbi2";
- drive-strength = <8>;
- bias-disable;
- };
+ pins = "gpio12", "gpio13";
+ function = "gsbi2";
+ drive-strength = <8>;
+ bias-disable;
};
i2c2_sleep_state: i2c2-sleep-state {
- i2c2-pins {
- pins = "gpio12", "gpio13";
- function = "gpio";
- drive-strength = <2>;
- bias-bus-hold;
- };
+ pins = "gpio12", "gpio13";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-bus-hold;
};
i2c3_default_state: i2c3-default-state {
- i2c3-pins {
- pins = "gpio16", "gpio17";
- function = "gsbi3";
- drive-strength = <8>;
- bias-disable;
- };
+ pins = "gpio16", "gpio17";
+ function = "gsbi3";
+ drive-strength = <8>;
+ bias-disable;
};
i2c3_sleep_state: i2c3-sleep-state {
- i2c3-pins {
- pins = "gpio16", "gpio17";
- function = "gpio";
- drive-strength = <2>;
- bias-bus-hold;
- };
+ pins = "gpio16", "gpio17";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-bus-hold;
};
i2c7_default_state: i2c7-default-state {
- i2c7-pins {
- pins = "gpio32", "gpio33";
- function = "gsbi7";
- drive-strength = <8>;
- bias-disable;
- };
+ pins = "gpio32", "gpio33";
+ function = "gsbi7";
+ drive-strength = <8>;
+ bias-disable;
};
i2c7_sleep_state: i2c7-sleep-state {
- i2c7-pins {
- pins = "gpio32", "gpio33";
- function = "gpio";
- drive-strength = <2>;
- bias-bus-hold;
- };
+ pins = "gpio32", "gpio33";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-bus-hold;
};
i2c8_default_state: i2c8-default-state {
- i2c8-pins {
- pins = "gpio36", "gpio37";
- function = "gsbi8";
- drive-strength = <8>;
- bias-disable;
- };
+ pins = "gpio36", "gpio37";
+ function = "gsbi8";
+ drive-strength = <8>;
+ bias-disable;
};
i2c8_sleep_state: i2c8-sleep-state {
- i2c8-pins {
- pins = "gpio36", "gpio37";
- function = "gpio";
- drive-strength = <2>;
- bias-bus-hold;
- };
+ pins = "gpio36", "gpio37";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-bus-hold;
};
i2c10_default_state: i2c10-default-state {
- i2c10-pins {
- pins = "gpio73", "gpio74";
- function = "gsbi10";
- drive-strength = <8>;
- bias-disable;
- };
+ pins = "gpio73", "gpio74";
+ function = "gsbi10";
+ drive-strength = <8>;
+ bias-disable;
};
i2c10_sleep_state: i2c10-sleep-state {
- i2c10-pins {
- pins = "gpio73", "gpio74";
- function = "gpio";
- drive-strength = <2>;
- bias-bus-hold;
- };
+ pins = "gpio73", "gpio74";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-bus-hold;
};
i2c12_default_state: i2c12-default-state {
- i2c12-pins {
- pins = "gpio44", "gpio45";
- function = "gsbi12";
- drive-strength = <8>;
- bias-disable;
- };
+ pins = "gpio44", "gpio45";
+ function = "gsbi12";
+ drive-strength = <8>;
+ bias-disable;
};
i2c12_sleep_state: i2c12-sleep-state {
- i2c12-pins {
- pins = "gpio44", "gpio45";
- function = "gpio";
- drive-strength = <2>;
- bias-bus-hold;
- };
+ pins = "gpio44", "gpio45";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-bus-hold;
};
sdcc3_default_state: sdcc3-default-state {
--
2.53.0
^ permalink raw reply related
* [PATCH v3 1/4] ARM: dts: qcom: msm8960: expressatt: Sort node references and includes
From: Rudraksha Gupta via B4 Relay @ 2026-04-01 20:32 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-msm, devicetree, linux-kernel, Rudraksha Gupta
In-Reply-To: <20260401-expressatt_fuel_guage-v3-0-9674cfc0b5a2@gmail.com>
From: Rudraksha Gupta <guptarud@gmail.com>
Reorganize the DTS file for consistency with other msm8960 board files.
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
.../dts/qcom/qcom-msm8960-samsung-expressatt.dts | 408 +++++++++++----------
1 file changed, 207 insertions(+), 201 deletions(-)
diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
index 35514fd53e3d..0e6959f7af6f 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
+++ b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: GPL-2.0
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/gpio-keys.h>
#include <dt-bindings/input/input.h>
#include <dt-bindings/leds/common.h>
+#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
#include <dt-bindings/reset/qcom,gcc-msm8960.h>
#include "qcom-msm8960.dtsi"
#include "pm8921.dtsi"
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
-#include <dt-bindings/input/gpio-keys.h>
/ {
model = "Samsung Galaxy Express SGH-I437";
@@ -27,8 +27,8 @@ chosen {
gpio-keys {
compatible = "gpio-keys";
- pinctrl-names = "default";
pinctrl-0 = <&gpio_keys_pin_a>;
+ pinctrl-names = "default";
key-home {
label = "Home";
@@ -54,58 +54,25 @@ key-volume-down {
};
};
- touchkey_enable: touchkey-enable {
- compatible = "regulator-fixed";
- regulator-name = "touchkey_enable";
- gpio = <&tlmm 51 GPIO_ACTIVE_HIGH>;
- enable-active-high;
- regulator-boot-on;
- };
-
- vreg_flash: regulator-flash {
- compatible = "regulator-fixed";
- regulator-name = "VREG_FLASH_3P3";
- regulator-min-microvolt = <3300000>;
- regulator-max-microvolt = <3300000>;
- gpio = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
- enable-active-high;
- pinctrl-0 = <&flash_led_unlock>;
- pinctrl-names = "default";
- };
-
- led-controller {
- compatible = "richtek,rt8515";
- enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
- vin-supply = <&vreg_flash>;
- richtek,rfs-ohms = <16000>;
- pinctrl-0 = <&cam_flash_en>;
- pinctrl-names = "default";
-
- led {
- function = LED_FUNCTION_FLASH;
- color = <LED_COLOR_ID_WHITE>;
- flash-max-timeout-us = <250000>;
- };
- };
-
i2c-gpio-touchkey {
compatible = "i2c-gpio";
#address-cells = <1>;
#size-cells = <0>;
sda-gpios = <&tlmm 71 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
scl-gpios = <&tlmm 72 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
- pinctrl-names = "default";
pinctrl-0 = <&touchkey_i2c_pins>;
- status = "okay";
+ pinctrl-names = "default";
i2c-gpio,delay-us = <2>;
+ status = "okay";
+
touchkey@20 {
compatible = "coreriver,tc360-touchkey";
reg = <0x20>;
interrupts-extended = <&tlmm 52 IRQ_TYPE_EDGE_FALLING>;
- pinctrl-names = "default";
pinctrl-0 = <&touchkey_irq_pin>;
+ pinctrl-names = "default";
vddio-supply = <&touchkey_enable>;
vdd-supply = <&pm8921_l29>;
@@ -114,6 +81,52 @@ touchkey@20 {
linux,keycodes = <KEY_MENU KEY_BACK>;
};
};
+
+ led-controller {
+ compatible = "richtek,rt8515";
+ enf-gpios = <&tlmm 3 GPIO_ACTIVE_HIGH>;
+ vin-supply = <&vreg_flash>;
+ richtek,rfs-ohms = <16000>;
+ pinctrl-0 = <&cam_flash_en>;
+ pinctrl-names = "default";
+
+ led {
+ function = LED_FUNCTION_FLASH;
+ color = <LED_COLOR_ID_WHITE>;
+ flash-max-timeout-us = <250000>;
+ };
+ };
+
+ vreg_flash: regulator-flash {
+ compatible = "regulator-fixed";
+ regulator-name = "VREG_FLASH_3P3";
+ regulator-min-microvolt = <3300000>;
+ regulator-max-microvolt = <3300000>;
+ gpio = <&pm8921_mpps 4 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ pinctrl-0 = <&flash_led_unlock>;
+ pinctrl-names = "default";
+ };
+
+ touchkey_enable: touchkey-enable {
+ compatible = "regulator-fixed";
+ regulator-name = "touchkey_enable";
+ gpio = <&tlmm 51 GPIO_ACTIVE_HIGH>;
+ enable-active-high;
+ regulator-boot-on;
+ };
+};
+
+&gsbi1 {
+ qcom,mode = <GSBI_PROT_SPI>;
+ pinctrl-0 = <&spi1_default>;
+ pinctrl-names = "default";
+
+ status = "okay";
+};
+
+&gsbi1_spi {
+ status = "okay";
};
&gsbi2 {
@@ -141,51 +154,16 @@ light-sensor@39 {
};
};
-&gsbi5 {
- qcom,mode = <GSBI_PROT_I2C_UART>;
- status = "okay";
-};
-
-&gsbi5_serial {
- status = "okay";
-};
-
-&sdcc1 {
- vmmc-supply = <&pm8921_l5>;
- status = "okay";
-};
-
-&sdcc3 {
- vmmc-supply = <&pm8921_l6>;
- vqmmc-supply = <&pm8921_l7>;
-
- pinctrl-0 = <&sdcc3_default_state>;
- pinctrl-1 = <&sdcc3_sleep_state>;
- pinctrl-names = "default", "sleep";
-
- status = "okay";
-};
-
-&gsbi1 {
- qcom,mode = <GSBI_PROT_SPI>;
- pinctrl-0 = <&spi1_default>;
- pinctrl-names = "default";
- status = "okay";
-};
-
-&gsbi1_spi {
- status = "okay";
-};
-
&gsbi3 {
qcom,mode = <GSBI_PROT_I2C>;
+
status = "okay";
};
&gsbi3_i2c {
status = "okay";
- // Atmel mXT224S touchscreen
+ /* Atmel mXT224S touchscreen */
touchscreen@4a {
compatible = "atmel,maxtouch";
reg = <0x4a>;
@@ -193,93 +171,69 @@ touchscreen@4a {
interrupts = <11 IRQ_TYPE_EDGE_FALLING>;
vdda-supply = <&pm8921_lvs6>;
vdd-supply = <&pm8921_l17>;
- pinctrl-names = "default";
pinctrl-0 = <&touchscreen>;
+ pinctrl-names = "default";
};
};
-&tlmm {
- cam_flash_en: cam-flash-en-state {
- pins = "gpio3";
- function = "gpio";
- drive-strength = <16>;
- bias-pull-down;
- };
+&gsbi5 {
+ qcom,mode = <GSBI_PROT_I2C_UART>;
- spi1_default: spi1-default-state {
- mosi-pins {
- pins = "gpio6";
- function = "gsbi1";
- drive-strength = <12>;
- bias-disable;
- };
+ status = "okay";
+};
- miso-pins {
- pins = "gpio7";
- function = "gsbi1";
- drive-strength = <12>;
- bias-disable;
- };
+&gsbi5_serial {
+ status = "okay";
+};
- cs-pins {
- pins = "gpio8";
- function = "gsbi1";
- drive-strength = <12>;
- bias-disable;
- output-low;
- };
+&gsbi7 {
+ qcom,mode = <GSBI_PROT_I2C>;
- clk-pins {
- pins = "gpio9";
- function = "gsbi1";
- drive-strength = <12>;
- bias-disable;
- };
- };
+ status = "okay";
+};
- gpio_keys_pin_a: gpio-keys-active-state {
- pins = "gpio40", "gpio50", "gpio81";
- function = "gpio";
- drive-strength = <8>;
- bias-disable;
- };
+&gsbi7_i2c {
+ status = "okay";
- touchscreen: touchscreen-int-state {
- pins = "gpio11";
- function = "gpio";
- output-enable;
- bias-disable;
- drive-strength = <2>;
+ nfc@2b {
+ compatible = "nxp,pn544-i2c";
+ reg = <0x2b>;
+ interrupts-extended = <&tlmm 106 IRQ_TYPE_EDGE_RISING>;
+ enable-gpios = <&pm8921_gpio 21 GPIO_ACTIVE_HIGH>;
+ firmware-gpios = <&tlmm 92 GPIO_ACTIVE_HIGH>;
+
+ pinctrl-0 = <&nfc_default &nfc_enable>;
+ pinctrl-names = "default";
};
+};
- nfc_default: nfc-default-state {
- irq-pins {
- pins = "gpio106";
- function = "gpio";
- drive-strength = <2>;
- bias-pull-down;
- };
+&gsbi12 {
+ qcom,mode = <GSBI_PROT_I2C>;
- firmware-pins {
- pins = "gpio92";
- function = "gpio";
- drive-strength = <2>;
- bias-disable;
- };
- };
+ status = "okay";
+};
- touchkey_i2c_pins: touchkey-i2c-state {
- pins = "gpio71", "gpio72";
- function = "gpio";
- drive-strength = <2>;
- bias-disable;
+&gsbi12_i2c {
+ status = "okay";
+
+ accelerometer@18 {
+ compatible = "bosch,bma254";
+ reg = <0x18>;
+ vdd-supply = <&pm8921_l9>;
+ vddio-supply = <&pm8921_lvs4>;
+
+ mount-matrix = "-1", "0", "0",
+ "0", "-1", "0",
+ "0", "0", "1";
};
- touchkey_irq_pin: touchkey-irq-state {
- pins = "gpio52";
- function = "gpio";
- drive-strength = <2>;
- bias-disable;
+ magnetometer@2e {
+ compatible = "yamaha,yas532";
+ reg = <0x2e>;
+ vdd-supply = <&pm8921_l9>;
+ iovdd-supply = <&pm8921_lvs4>;
+
+ /* TODO: Figure out Mount Matrix */
};
};
@@ -288,18 +242,27 @@ &pm8921 {
};
&pm8921_gpio {
+ nfc_enable: nfc-enable-state {
+ pins = "gpio21";
+ function = "normal";
+ bias-disable;
+ qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
+ power-source = <PM8921_GPIO_S4>;
+ };
+
prox_sensor_int: prox-sensor-int-state {
pins = "gpio6";
function = "normal";
input-enable;
bias-disable;
};
+};
- nfc_enable: nfc-enable-state {
- pins = "gpio21";
- function = "normal";
- bias-disable;
- qcom,drive-strength = <PMIC_GPIO_STRENGTH_LOW>;
+&pm8921_mpps {
+ flash_led_unlock: flash-led-unlock-state {
+ pins = "mpp4";
+ function = "digital";
+ output-low;
power-source = <PM8921_GPIO_S4>;
};
};
@@ -546,72 +509,115 @@ pm8921_ncp: ncp {
};
};
-&usb_hs1_phy {
- v3p3-supply = <&pm8921_l3>;
- v1p8-supply = <&pm8921_l4>;
-};
+&sdcc1 {
+ vmmc-supply = <&pm8921_l5>;
-&usb1 {
- dr_mode = "otg";
status = "okay";
};
-&gsbi7 {
- qcom,mode = <GSBI_PROT_I2C>;
+&sdcc3 {
+ vmmc-supply = <&pm8921_l6>;
+ vqmmc-supply = <&pm8921_l7>;
+
+ pinctrl-0 = <&sdcc3_default_state>;
+ pinctrl-1 = <&sdcc3_sleep_state>;
+ pinctrl-names = "default", "sleep";
status = "okay";
};
-&gsbi7_i2c {
- status = "okay";
+&tlmm {
+ cam_flash_en: cam-flash-en-state {
+ pins = "gpio3";
+ function = "gpio";
+ drive-strength = <16>;
+ bias-pull-down;
+ };
- nfc@2b {
- compatible = "nxp,pn544-i2c";
- reg = <0x2b>;
- interrupts-extended = <&tlmm 106 IRQ_TYPE_EDGE_RISING>;
- enable-gpios = <&pm8921_gpio 21 GPIO_ACTIVE_HIGH>;
- firmware-gpios = <&tlmm 92 GPIO_ACTIVE_HIGH>;
+ spi1_default: spi1-default-state {
+ mosi-pins {
+ pins = "gpio6";
+ function = "gsbi1";
+ drive-strength = <12>;
+ bias-disable;
+ };
- pinctrl-0 = <&nfc_default &nfc_enable>;
- pinctrl-names = "default";
- };
-};
+ miso-pins {
+ pins = "gpio7";
+ function = "gsbi1";
+ drive-strength = <12>;
+ bias-disable;
+ };
-&gsbi12 {
- qcom,mode = <GSBI_PROT_I2C>;
+ cs-pins {
+ pins = "gpio8";
+ function = "gsbi1";
+ drive-strength = <12>;
+ bias-disable;
+ output-low;
+ };
- status = "okay";
-};
+ clk-pins {
+ pins = "gpio9";
+ function = "gsbi1";
+ drive-strength = <12>;
+ bias-disable;
+ };
+ };
-&gsbi12_i2c {
- status = "okay";
+ touchscreen: touchscreen-int-state {
+ pins = "gpio11";
+ function = "gpio";
+ output-enable;
+ bias-disable;
+ drive-strength = <2>;
+ };
- accelerometer@18 {
- compatible = "bosch,bma254";
- reg = <0x18>;
- vdd-supply = <&pm8921_l9>;
- vddio-supply = <&pm8921_lvs4>;
+ gpio_keys_pin_a: gpio-keys-active-state {
+ pins = "gpio40", "gpio50", "gpio81";
+ function = "gpio";
+ drive-strength = <8>;
+ bias-disable;
+ };
- mount-matrix = "-1", "0", "0",
- "0", "-1", "0",
- "0", "0", "1";
+ touchkey_irq_pin: touchkey-irq-state {
+ pins = "gpio52";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-disable;
};
- magnetometer@2e {
- compatible = "yamaha,yas532";
- reg = <0x2e>;
- vdd-supply = <&pm8921_l9>;
- iovdd-supply = <&pm8921_lvs4>;
+ touchkey_i2c_pins: touchkey-i2c-state {
+ pins = "gpio71", "gpio72";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-disable;
+ };
- /* TODO: Figure out Mount Matrix */
+ nfc_default: nfc-default-state {
+ firmware-pins {
+ pins = "gpio92";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-disable;
+ };
+
+ irq-pins {
+ pins = "gpio106";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-pull-down;
+ };
};
};
-&pm8921_mpps {
- flash_led_unlock: flash-led-unlock-state {
- pins = "mpp4";
- function = "digital";
- output-low;
- power-source = <PM8921_GPIO_S4>;
- };
+&usb_hs1_phy {
+ v3p3-supply = <&pm8921_l3>;
+ v1p8-supply = <&pm8921_l4>;
+};
+
+&usb1 {
+ dr_mode = "otg";
+
+ status = "okay";
};
--
2.53.0
^ permalink raw reply related
* [PATCH v3 0/4] Reorganize DTS and add fuel-gauge to samsung-expressatt
From: Rudraksha Gupta via B4 Relay @ 2026-04-01 20:32 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-msm, devicetree, linux-kernel, Rudraksha Gupta,
Konrad Dybcio, Dmitry Baryshkov
Reorganized the samsung-expressatt DTS and msm8960 DTSI to be more in
line with mainline standards. Introduce GSBI5 I2C
Tested battery by doing `cat /sys/class/power_supply/battery/capacity`
in upstream Linux and comparing the value with downstream Linux. Booted
on upstream Linux first, as the upstream Linux seems to use a lot
more battery than downstream, and then put the battery into another
expressatt running downstream Android to compare values. There are
some slight differences, but overall seems to line up pretty well with
downstream.
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
Changes in v3:
- Flatten i2c pinctrl subnodes in msm8960 dtsi
- change comment format from // to /* */
- \n before status
- use interrupts-extended instead
- Link to v2: https://lore.kernel.org/r/20260401-expressatt_fuel_guage-v2-0-947922834df1@gmail.com
Changes in v2:
- Previous changes were based on some outdated dependencies. Update them
- Reorganized expressatt DTS
- Switch to GSBI5
- Link to v1: https://lore.kernel.org/r/20260331-expressatt_fuel_guage-v1-1-23d1d8526b69@gmail.com
---
Rudraksha Gupta (4):
ARM: dts: qcom: msm8960: expressatt: Sort node references and includes
ARM: dts: qcom: msm8960: Flatten I2C pinctrl state subnodes
ARM: dts: qcom: msm8960: Add GSBI5 I2C controller
ARM: dts: qcom: msm8960: expressatt: Add MAX17048 fuel gauge
.../dts/qcom/qcom-msm8960-samsung-expressatt.dts | 423 +++++++++++----------
arch/arm/boot/dts/qcom/qcom-msm8960.dtsi | 171 +++++----
2 files changed, 313 insertions(+), 281 deletions(-)
---
base-commit: e9ec05addd1a067fc7cb218f20ecdc1b1b0898c0
change-id: 20260331-expressatt_fuel_guage-465dfb3f87ab
prerequisite-patch-id: 6fdd0efa5eda512b442b885df80774d1a7037df7
prerequisite-patch-id: 12d296f83ccb1bdfb8d06a72e476bf51ae5f4e6c
prerequisite-patch-id: a970acf2080143f41ae0935dd2c57bb71f5bf338
prerequisite-patch-id: fd25fef58503c5e5cf742e79b124948c7f6b98d9
prerequisite-patch-id: 68603a680b24921759425fc289e61fc4435e5ccd
prerequisite-message-id: <20251205-expressatt-touchkey-v1-1-1444b927c9f3@gmail.com>
prerequisite-patch-id: 8de4de7909722ccaf385c4224f25a623eaa72c28
prerequisite-message-id: <20260331-expressatt_camera_flash-v4-0-f1e99f474513@gmail.com>
prerequisite-patch-id: ab8b8d87fd2d518c4c5b5dace3f22238d1abbe49
prerequisite-patch-id: 47e32e653e520a27770bb05d99135694b0128ba0
prerequisite-patch-id: 7ef7df61e7ef6476a35811d765f522f793d9ecc7
Best regards,
--
Rudraksha Gupta <guptarud@gmail.com>
^ permalink raw reply
* [PATCH v3 4/4] ARM: dts: qcom: msm8960: expressatt: Add MAX17048 fuel gauge
From: Rudraksha Gupta via B4 Relay @ 2026-04-01 20:32 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-arm-msm, devicetree, linux-kernel, Rudraksha Gupta,
Dmitry Baryshkov, Konrad Dybcio
In-Reply-To: <20260401-expressatt_fuel_guage-v3-0-9674cfc0b5a2@gmail.com>
From: Rudraksha Gupta <guptarud@gmail.com>
Add MAX17048 fuel gauge support.
Tested by comparing battery capacity readings between upstream (mainline
max17040 driver) and downstream (Samsung max17048_fuelgauge driver)
across a full discharge cycle. Upstream reads ~3% lower throughout. Both
track the discharge curve correctly:
Upstream: 95 92 88 87 86 87 83 82 80 68 60 55 50 45 40 35 30 20 16 10 10 5 5 1
Downstream: 95 94 92 91 91 89 87 86 84 73 64 59 51 48 43 38 33 23 17 14 12 8 6 3
Each pair of readings was collected by checking the upstream capacity
first, then moving the battery to a second expressatt running downstream
Android to check its capacity. The battery was then moved back to the
upstream device for the next reading. This swap occasionally caused the
upstream capacity to read slightly higher than the previous value
(e.g. 86 -> 87). When this happened, the reading was retaken after the
value settled.
Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-11.0-XNG3C/arch/arm/mach-msm/board-apexq-battery.c
Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-11.0-XNG3C/drivers/battery/Makefile#L5
Link: https://github.com/LineageOS/android_kernel_samsung_d2/blob/stable/cm-11.0-XNG3C/arch/arm/mach-msm/Makefile#L308
Assisted-by: Claude:claude-opus-4.6
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Rudraksha Gupta <guptarud@gmail.com>
---
.../dts/qcom/qcom-msm8960-samsung-expressatt.dts | 23 ++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
index 0e6959f7af6f..e4a5e49a43ec 100644
--- a/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
+++ b/arch/arm/boot/dts/qcom/qcom-msm8960-samsung-expressatt.dts
@@ -186,6 +186,22 @@ &gsbi5_serial {
status = "okay";
};
+&gsbi5_i2c {
+ status = "okay";
+
+ fuel-gauge@36 {
+ compatible = "maxim,max17048";
+ reg = <0x36>;
+ maxim,double-soc;
+ maxim,rcomp = /bits/ 8 <0x62>;
+ maxim,alert-low-soc-level = <2>;
+ interrupts-extended = <&tlmm 67 IRQ_TYPE_EDGE_FALLING>;
+ pinctrl-0 = <&fuelgauge_alert_pin>;
+ pinctrl-names = "default";
+ wakeup-source;
+ };
+};
+
&gsbi7 {
qcom,mode = <GSBI_PROT_I2C>;
@@ -587,6 +603,13 @@ touchkey_irq_pin: touchkey-irq-state {
bias-disable;
};
+ fuelgauge_alert_pin: fuelgauge-alert-state {
+ pins = "gpio67";
+ function = "gpio";
+ drive-strength = <2>;
+ bias-disable;
+ };
+
touchkey_i2c_pins: touchkey-i2c-state {
pins = "gpio71", "gpio72";
function = "gpio";
--
2.53.0
^ permalink raw reply related
* [PATCH v3 2/4] arm64: dts: qcom: sdm845-oneplus: Drop address from framebuffer node
From: David Heidelberg via B4 Relay @ 2026-04-01 20:40 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, David Heidelberg, Sam Day, Dzmitry Sankouski,
Dmitry Baryshkov
Cc: linux-arm-msm, devicetree, linux-kernel, phone-devel, Petr Hodina
In-Reply-To: <20260401-beryllium-fb-v3-0-ec7d443402ab@ixit.cz>
From: David Heidelberg <david@ixit.cz>
This node has no 'reg' property, so it shouldn't have a unit address
(after '@') either
Fixes: b0d5c96e860c ("arm64: dts: qcom: sdm845-oneplus: Add framebuffer")
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
---
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
index 6b7378cf4d493..05b8d656b5fc4 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi
@@ -72,7 +72,7 @@ chosen {
stdout-path = "serial0:115200n8";
- framebuffer: framebuffer@9d400000 {
+ framebuffer {
compatible = "simple-framebuffer";
memory-region = <&cont_splash_mem>;
--
2.53.0
^ permalink raw reply related
* [PATCH v3 3/4] arm64: dts: qcom: sdm845-shift-axolotl: Convert fb to use memory-region
From: David Heidelberg via B4 Relay @ 2026-04-01 20:40 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, David Heidelberg, Sam Day, Dzmitry Sankouski,
Dmitry Baryshkov
Cc: linux-arm-msm, devicetree, linux-kernel, phone-devel, Petr Hodina
In-Reply-To: <20260401-beryllium-fb-v3-0-ec7d443402ab@ixit.cz>
From: David Heidelberg <david@ixit.cz>
Instead of manually specifying reg, reuse the memory region.
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
---
arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts b/arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts
index 740eb22550724..88d970268e282 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts
+++ b/arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts
@@ -23,7 +23,7 @@ / {
qcom,board-id = <11 0>;
aliases {
- display0 = &framebuffer0;
+ display0 = &framebuffer;
serial0 = &uart9;
serial1 = &uart6;
};
@@ -36,9 +36,9 @@ chosen {
stdout-path = "serial0";
/* Use framebuffer setup by the bootloader. */
- framebuffer0: framebuffer@9d400000 {
+ framebuffer: framebuffer {
compatible = "simple-framebuffer";
- reg = <0x0 0x9d400000 0x0 (1080 * 2160 * 4)>;
+ memory-region = <&framebuffer_mem>;
width = <1080>;
height = <2160>;
stride = <(1080 * 4)>;
@@ -62,7 +62,7 @@ key-vol-up {
};
reserved-memory {
- framebuffer@9d400000 {
+ framebuffer_mem: framebuffer@9d400000 {
reg = <0x0 0x9d400000 0x0 (1080 * 2160 * 4)>;
no-map;
};
--
2.53.0
^ permalink raw reply related
* [PATCH v3 1/4] arm64: dts: qcom: sdm845-xiaomi-beryllium: Introduce framebuffer
From: David Heidelberg via B4 Relay @ 2026-04-01 20:40 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, David Heidelberg, Sam Day, Dzmitry Sankouski,
Dmitry Baryshkov
Cc: linux-arm-msm, devicetree, linux-kernel, phone-devel, Petr Hodina
In-Reply-To: <20260401-beryllium-fb-v3-0-ec7d443402ab@ixit.cz>
From: Petr Hodina <petr.hodina@protonmail.com>
Add framebuffer for early console and u-boot support.
Signed-off-by: Petr Hodina <petr.hodina@protonmail.com>
Signed-off-by: David Heidelberg <david@ixit.cz>
---
.../boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi b/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi
index 1298485c42142..a6ee3dd171def 100644
--- a/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi
+++ b/arch/arm64/boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi
@@ -39,6 +39,22 @@ aliases {
serial1 = &uart6;
};
+ chosen {
+ #address-cells = <2>;
+ #size-cells = <2>;
+ ranges;
+
+ framebuffer {
+ compatible = "simple-framebuffer";
+ memory-region = <&cont_splash_mem>;
+
+ format = "a8r8g8b8";
+ stride = <(1080 * 4)>;
+ height = <2246>;
+ width = <1080>;
+ };
+ };
+
gpio-keys {
compatible = "gpio-keys";
autorepeat;
--
2.53.0
^ permalink raw reply related
* [PATCH v3 0/4] Add framebuffer on Xiaomi Poco F1 and disable the MDSS on tianma panel variant
From: David Heidelberg via B4 Relay @ 2026-04-01 20:40 UTC (permalink / raw)
To: Bjorn Andersson, Konrad Dybcio, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, David Heidelberg, Sam Day, Dzmitry Sankouski,
Dmitry Baryshkov
Cc: linux-arm-msm, devicetree, linux-kernel, phone-devel, Petr Hodina
Enable framebuffer for early console output.
Due to broken panel driver on tianma and no visual output it's better
to disable the MDSS so the framebuffer stays on.
In case second patch gets rejected, please apply the first one standalone
Signed-off-by: Petr Hodina <petr.hodina@protonmail.com>
---
Changes in v3:
- Strip label from framebuffer nodes where unused and remove -0 postfix. (Konrad)
- Link to v2: https://lore.kernel.org/r/20260317-beryllium-fb-v2-0-36b69dfb760c@ixit.cz
Changes in v2:
- Added few conversion to use memory-region.
- Corrected framebuffer node name. (Konrad)
- Link to v1: https://lore.kernel.org/r/20260311-beryllium-fb-v1-0-408a580d125e@ixit.cz
---
David Heidelberg (3):
arm64: dts: qcom: sdm845-oneplus: Drop address from framebuffer node
arm64: dts: qcom: sdm845-shift-axolotl: Convert fb to use memory-region
arm64: dts: qcom: sdm845-samsung-starqltechn: Convert fb to use memory-region
Petr Hodina (1):
arm64: dts: qcom: sdm845-xiaomi-beryllium: Introduce framebuffer
arch/arm64/boot/dts/qcom/sdm845-oneplus-common.dtsi | 2 +-
arch/arm64/boot/dts/qcom/sdm845-samsung-starqltechn.dts | 7 ++++---
arch/arm64/boot/dts/qcom/sdm845-shift-axolotl.dts | 8 ++++----
.../boot/dts/qcom/sdm845-xiaomi-beryllium-common.dtsi | 16 ++++++++++++++++
4 files changed, 25 insertions(+), 8 deletions(-)
---
base-commit: bd0f139e5fc11182777b81cefc3893ea508544ec
change-id: 20260107-beryllium-fb-d3e87bc20be0
Best regards,
--
David Heidelberg <david@ixit.cz>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox