Add GameForce Ace
cover Add GameForce Ace
From: Chris Morgan <[email protected]>
Add support for the GameForce Ace. The GameForce Ace is an RK3588s based gaming device with a 1080p display, touchscreen, hall effect joysticks and triggers, 128GB of eMMC, 8GB or 12GB of RAM, WiFi 5, and support for a 2242 NVME.
Chris Morgan (5):
dt-bindings: power: supply: add dual-cell for cw2015
power: supply: cw2015: Add support for dual-cell configurations
arm64: dts: rockchip: Pull up sdio pins on RK3588
dt-bindings: arm: rockchip: Add GameForce Ace
arm64: dts: rockchip: Add GameForce Ace
.../devicetree/bindings/arm/rockchip.yaml | 5 + .../bindings/power/supply/cw2015_battery.yaml | 6 + arch/arm64/boot/dts/rockchip/Makefile | 1 + .../dts/rockchip/rk3588-base-pinctrl.dtsi | 10 +- .../dts/rockchip/rk3588s-gameforce-ace.dts | 1315 +++++++++++++++++ drivers/power/supply/cw2015_battery.c | 7 + 6 files changed, 1339 insertions(+), 5 deletions(-) create mode 100644 arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dts
Signature · 1 line
2.34.1
PATCH 1/5 dt-bindings: power: supply: add dual-cell for cw2015
From: Chris Morgan <[email protected]>
According to the datasheet for the cw2015 the device supports dual-cell configurations. Add a new device tree property for this condition so that the voltage values reported to userspace are correct.
--- .../devicetree/bindings/power/supply/cw2015_battery.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml +6 -0
@@ -34,6 +34,12 @@ properties: minItems: 64 maxItems: 64 + cellwise,dual-cell: + description: | + This property specifies if the battery is used in a dual-cell series + configuration so that the correct voltage is presented to userspace. + type: boolean + cellwise,monitor-interval-ms: description: Specifies the interval in milliseconds gauge values are polled at
Signature · 1 line
2.34.1
Re: [PATCH 1/5] dt-bindings: power: supply: add dual-cell for cw2015
Quoted 16 lines · Chris Morgan
From: Chris Morgan <[email protected]>
According to the datasheet for the cw2015 the device supports dual-cell configurations. Add a new device tree property for this condition so that the voltage values reported to userspace are correct.
Signed-off-by Chris Morgan <[email protected]>--- .../devicetree/bindings/power/supply/cw2015_battery.yaml | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml +0
-0
Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml properties: · line 38
Quoted 5 lines
Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml +2
-0@@ -34,6 +34,12 @@ properties: minItems: 64 maxItems: 64 + cellwise,dual-cell: + description: |
Don't need '|' if no formatting.
Quoted 10 lines
Documentation/devicetree/bindings/power/supply/cw2015_battery.yaml +4
-0+ This property specifies if the battery is used in a dual-cell series + configuration so that the correct voltage is presented to userspace. + type: boolean + cellwise,monitor-interval-ms: description: Specifies the interval in milliseconds gauge values are polled atSignature · 1 line
2.34.1
PATCH 2/5 power: supply: cw2015: Add support for dual-cell configurations
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
The Cellwise cw2015 datasheet reports that it can handle two cells in a series configuration. Allow a device tree parameter to note this condition so that the driver reports the correct voltage values to userspace.
--- drivers/power/supply/cw2015_battery.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/power/supply/cw2015_battery.c +7 -0
@@ -77,6 +77,8 @@ struct cw_battery {u32 poll_interval_ms;u8 alert_level; +bool dual_cell; +unsigned int read_errors;unsigned int charge_stuck_cnt; };
@@ -325,6 +327,9 @@ static int cw_get_voltage(struct cw_battery *cw_bat)*/ voltage_mv = avg *312 /1024 ; +if (cw_bat->dual_cell) + voltage_mv *=2 ; +dev_dbg (cw_bat->dev,"Read voltage: %d mV, raw=0x%04x\n" , voltage_mv, reg_val);return voltage_mv;
@@ -587,6 +592,8 @@ static int cw2015_parse_properties(struct cw_battery *cw_bat)return ret; } + cw_bat->dual_cell =device_property_read_bool (dev,"cellwise,dual-cell" ); + ret =device_property_read_u32 (dev,"cellwise,monitor-interval-ms" , &cw_bat->poll_interval_ms);if (ret) {
Signature · 1 line
2.34.1
Re: [PATCH 2/5] power: supply: cw2015: Add support for dual-cell configurations
Hi,
Quoted 6 lines · Chris Morgan
From: Chris Morgan <[email protected]>
The Cellwise cw2015 datasheet reports that it can handle two cells in a series configuration. Allow a device tree parameter to note this condition so that the driver reports the correct voltage values to userspace.
I found this:
http://www.cellwise-semi.com/Public/assests/menu/20230302/6400076806706.pdf
Which says:
CW2015 can be used in 2 or more batteries connected in series, or several cells connected in parallel.
So dual-cell seems like a bad property name. Instead the number of serial cells should be provided. This property is then not really specific to the Cellwise fuel gauge and instead a property of the battery pack (i.e. simple-battery.yaml).
Quoted 19 lines
Signed-off-by Chris Morgan <[email protected]>--- drivers/power/supply/cw2015_battery.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/power/supply/cw2015_battery.c +2
-0@@ -77,6 +77,8 @@ struct cw_battery {u32 poll_interval_ms;u8 alert_level; +bool dual_cell; +unsigned int read_errors;unsigned int charge_stuck_cnt; };
drivers/power/supply/cw2015_battery.c static int cw_get_voltage(struct cw_battery *cw_bat) · line 331
Quoted 5 lines
drivers/power/supply/cw2015_battery.c +2
-0@@ -325,6 +327,9 @@ static int cw_get_voltage(struct cw_battery *cw_bat)*/ voltage_mv = avg *312 /1024 ; +if (cw_bat->dual_cell) + voltage_mv *=2 ;
Unfortunately there are no details in the document, but this looks very fishy. Does it only measure the first cell and hope that the other cells have the same voltage?
This (unmerged) series also applies to your problem to some degree:
https://lore.kernel.org/all/[email protected]/
-- Sebastian
Quoted 16 lines
drivers/power/supply/cw2015_battery.c +2
-0dev_dbg (cw_bat->dev,"Read voltage: %d mV, raw=0x%04x\n" , voltage_mv, reg_val);return voltage_mv;@@ -587,6 +592,8 @@ static int cw2015_parse_properties(struct cw_battery *cw_bat)return ret; } + cw_bat->dual_cell =device_property_read_bool (dev,"cellwise,dual-cell" ); + ret =device_property_read_u32 (dev,"cellwise,monitor-interval-ms" , &cw_bat->poll_interval_ms);if (ret) {Signature · 1 line
2.34.1
Re: [PATCH 2/5] power: supply: cw2015: Add support for dual-cell configurations
Quoted 16 lines · Sebastian Reichel
Hi,
Quoted 6 lines · Chris Morgan
From: Chris Morgan <[email protected]>
The Cellwise cw2015 datasheet reports that it can handle two cells in a series configuration. Allow a device tree parameter to note this condition so that the driver reports the correct voltage values to userspace.
I found this:
http://www.cellwise-semi.com/Public/assests/menu/20230302/6400076806706.pdf
Which says:
Quoted 7 lines
CW2015 can be used in 2 or more batteries connected in series, or several cells connected in parallel.
So dual-cell seems like a bad property name. Instead the number of serial cells should be provided. This property is then not really specific to the Cellwise fuel gauge and instead a property of the battery pack (i.e.
simple-battery.yaml).
It's conflicting information (which further confuses me). I see in that datasheet it says 2 or more, whereas the datasheet found here says only 2 cells:
But I agree in principle that we should be setting this as a property of a simple-battery rather than a manufacturer specific parameter.
Quoted 30 lines
Quoted 20 lines
Signed-off-by Chris Morgan <[email protected]>--- drivers/power/supply/cw2015_battery.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/power/supply/cw2015_battery.c +2
-0@@ -77,6 +77,8 @@ struct cw_battery {u32 poll_interval_ms;u8 alert_level; +bool dual_cell; +unsigned int read_errors;unsigned int charge_stuck_cnt; };drivers/power/supply/cw2015_battery.c static int cw_get_voltage(struct cw_battery *cw_bat) · line 331
Quoted 5 lines
drivers/power/supply/cw2015_battery.c +2
-0@@ -325,6 +327,9 @@ static int cw_get_voltage(struct cw_battery *cw_bat)*/ voltage_mv = avg *312 /1024 ; +if (cw_bat->dual_cell) + voltage_mv *=2 ;Unfortunately there are no details in the document, but this looks very fishy. Does it only measure the first cell and hope that the other cells have the same voltage?
Quoted 3 lines
This (unmerged) series also applies to your problem to some degree:
I think based on the application diagram it is in fact measuring the cell voltage. That said, this ultimately boils down to a cosmetic thing as not having this property simply means userspace sees the battery voltage as 3.8v instead of 7.6v as is written on the side.
I think for simplification sake I will remove this from the series, add a note to the device tree, and wait for the other battery series to get pulled. When it gets pulled I'll request a device tree property so we can add POWER_SUPPLY_PROP_NUMBER_OF_SERIAL_CELLS to the simple-battery and then parse this value. Or if that series ends up getting abandoned I can just add a quick and dirty new property like this.
Thank you,
Chris
Quoted 19 lines
-- Sebastian
Quoted 16 lines
drivers/power/supply/cw2015_battery.c +2
-0dev_dbg (cw_bat->dev,"Read voltage: %d mV, raw=0x%04x\n" , voltage_mv, reg_val);return voltage_mv;@@ -587,6 +592,8 @@ static int cw2015_parse_properties(struct cw_battery *cw_bat)return ret; } + cw_bat->dual_cell =device_property_read_bool (dev,"cellwise,dual-cell" ); + ret =device_property_read_u32 (dev,"cellwise,monitor-interval-ms" , &cw_bat->poll_interval_ms);if (ret) {Signature · 1 line
2.34.1
Re: [PATCH 2/5] power: supply: cw2015: Add support for dual-cell configurations
Hi,
Quoted 66 lines · Chris Morgan
Quoted 16 lines · Sebastian Reichel
Hi,
Quoted 6 lines · Chris Morgan
From: Chris Morgan <[email protected]>
The Cellwise cw2015 datasheet reports that it can handle two cells in a series configuration. Allow a device tree parameter to note this condition so that the driver reports the correct voltage values to userspace.
I found this:
http://www.cellwise-semi.com/Public/assests/menu/20230302/6400076806706.pdf
Which says:
Quoted 7 lines
CW2015 can be used in 2 or more batteries connected in series, or several cells connected in parallel.
So dual-cell seems like a bad property name. Instead the number of serial cells should be provided. This property is then not really specific to the Cellwise fuel gauge and instead a property of the battery pack (i.e.
simple-battery.yaml).It's conflicting information (which further confuses me). I see in that datasheet it says 2 or more, whereas the datasheet found here says only 2 cells:
But I agree in principle that we should be setting this as a property of a simple-battery rather than a manufacturer specific parameter.
Quoted 32 lines
Quoted 20 lines
Signed-off-by Chris Morgan <[email protected]>--- drivers/power/supply/cw2015_battery.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/power/supply/cw2015_battery.c +2
-0@@ -77,6 +77,8 @@ struct cw_battery {u32 poll_interval_ms;u8 alert_level; +bool dual_cell; +unsigned int read_errors;unsigned int charge_stuck_cnt; };drivers/power/supply/cw2015_battery.c static int cw_get_voltage(struct cw_battery *cw_bat) · line 331
Quoted 5 lines
drivers/power/supply/cw2015_battery.c +2
-0@@ -325,6 +327,9 @@ static int cw_get_voltage(struct cw_battery *cw_bat)*/ voltage_mv = avg *312 /1024 ; +if (cw_bat->dual_cell) + voltage_mv *=2 ;Unfortunately there are no details in the document, but this looks very fishy. Does it only measure the first cell and hope that the other cells have the same voltage?
This (unmerged) series also applies to your problem to some degree:
Quoted 8 lines
Quoted 1 line
I think based on the application diagram it is in fact measuring the cell voltage.
That said, this ultimately boils down to a cosmetic thing as not having this property simply means userspace sees the battery voltage as 3.8v instead of 7.6v as is written on the side.
With the cells being connected in serial, the voltage of both cells can be different. There is not "the cell voltage". Instead there is a voltage for cell 1 and a voltage for cell 2. In a perfect battery they are the same, but in reality they are not. In the extreme case one of the cells may be broken while the other is still fine. It sounds as if this is just measuring the voltage from the first cell and assumes the second cell has the same voltage.
Ideally the voltage on these platforms is not exposed via the normal VOLTAGE property and instead uses a new property for telling userspace the voltage for a single cell. The kernel simply does not know the voltage of the whole battery pack.
FWIW this is the worst battery measurement system I've seen so far if my understanding of the hardware design is correct.
-- Sebastian
Quoted 33 lines
I think for simplification sake I will remove this from the series, add a note to the device tree, and wait for the other battery series to get pulled. When it gets pulled I'll request a device tree property so we can add
POWER_SUPPLY_PROP_NUMBER_OF_SERIAL_CELLSto the simple-battery and then parse this value. Or if that series ends up getting abandoned I can just add a quick and dirty new property like this.Thank you,
ChrisQuoted 19 lines
-- Sebastian
Quoted 16 lines
drivers/power/supply/cw2015_battery.c +2
-0dev_dbg (cw_bat->dev,"Read voltage: %d mV, raw=0x%04x\n" , voltage_mv, reg_val);return voltage_mv;@@ -587,6 +592,8 @@ static int cw2015_parse_properties(struct cw_battery *cw_bat)return ret; } + cw_bat->dual_cell =device_property_read_bool (dev,"cellwise,dual-cell" ); + ret =device_property_read_u32 (dev,"cellwise,monitor-interval-ms" , &cw_bat->poll_interval_ms);if (ret) {Signature · 1 line
2.34.1
Re: [PATCH 2/5] power: supply: cw2015: Add support for dual-cell configurations
Quoted 91 lines · Sebastian Reichel
Hi,
Quoted 66 lines · Chris Morgan
Quoted 16 lines · Sebastian Reichel
Hi,
Quoted 6 lines · Chris Morgan
From: Chris Morgan <[email protected]>
The Cellwise cw2015 datasheet reports that it can handle two cells in a series configuration. Allow a device tree parameter to note this condition so that the driver reports the correct voltage values to userspace.
I found this:
http://www.cellwise-semi.com/Public/assests/menu/20230302/6400076806706.pdf
Which says:
Quoted 7 lines
CW2015 can be used in 2 or more batteries connected in series, or several cells connected in parallel.
So dual-cell seems like a bad property name. Instead the number of serial cells should be provided. This property is then not really specific to the Cellwise fuel gauge and instead a property of the battery pack (i.e.
simple-battery.yaml).It's conflicting information (which further confuses me). I see in that datasheet it says 2 or more, whereas the datasheet found here says only 2 cells:
But I agree in principle that we should be setting this as a property of a simple-battery rather than a manufacturer specific parameter.
Quoted 32 lines
Quoted 20 lines
Signed-off-by Chris Morgan <[email protected]>--- drivers/power/supply/cw2015_battery.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/power/supply/cw2015_battery.c +2
-0@@ -77,6 +77,8 @@ struct cw_battery {u32 poll_interval_ms;u8 alert_level; +bool dual_cell; +unsigned int read_errors;unsigned int charge_stuck_cnt; };drivers/power/supply/cw2015_battery.c static int cw_get_voltage(struct cw_battery *cw_bat) · line 331
Quoted 5 lines
drivers/power/supply/cw2015_battery.c +2
-0@@ -325,6 +327,9 @@ static int cw_get_voltage(struct cw_battery *cw_bat)*/ voltage_mv = avg *312 /1024 ; +if (cw_bat->dual_cell) + voltage_mv *=2 ;Unfortunately there are no details in the document, but this looks very fishy. Does it only measure the first cell and hope that the other cells have the same voltage?
This (unmerged) series also applies to your problem to some degree:
Quoted 8 lines
Quoted 1 line
I think based on the application diagram it is in fact measuring the cell voltage.
That said, this ultimately boils down to a cosmetic thing as not having this property simply means userspace sees the battery voltage as 3.8v instead of 7.6v as is written on the side.
With the cells being connected in serial, the voltage of both cells can be different. There is not "the cell voltage". Instead there is a voltage for cell 1 and a voltage for cell 2. In a perfect battery they are the same, but in reality they are not. In the extreme case one of the cells may be broken while the other is still fine. It sounds as if this is just measuring the voltage from the first cell and assumes the second cell has the same voltage.
Ideally the voltage on these platforms is not exposed via the normal VOLTAGE property and instead uses a new property for telling userspace the voltage for a single cell. The kernel simply does not know the voltage of the whole battery pack.
Quoted 5 lines
FWIW this is the worst battery measurement system I've seen so far if my understanding of the hardware design is correct.
-- Sebastian
Don't get me started, this whole stack is a nightmare. The battery won't charge at all without a bq25703 driver (so this current DTS basically has the device running while plugged in); and for some reason the fcs,fc302 chip wants to go interrupt crazy if you're not using a PD charger. Part of the reason of getting this upstreamed is so I can have a common base for others to help me get this last bit of nonsense sorted out. Displaying the correct voltage on the battery however isn't critical, as the device will still report the correct SoC and will even charge and function just fine when a driver is in place for the bq25703. It's just the voltage reported in sysfs will be wrong.
Thank you,
Chris
Quoted 33 lines
Quoted 33 lines
I think for simplification sake I will remove this from the series, add a note to the device tree, and wait for the other battery series to get pulled. When it gets pulled I'll request a device tree property so we can add
POWER_SUPPLY_PROP_NUMBER_OF_SERIAL_CELLSto the simple-battery and then parse this value. Or if that series ends up getting abandoned I can just add a quick and dirty new property like this.Thank you,
ChrisQuoted 19 lines
-- Sebastian
Quoted 16 lines
drivers/power/supply/cw2015_battery.c +2
-0dev_dbg (cw_bat->dev,"Read voltage: %d mV, raw=0x%04x\n" , voltage_mv, reg_val);return voltage_mv;@@ -587,6 +592,8 @@ static int cw2015_parse_properties(struct cw_battery *cw_bat)return ret; } + cw_bat->dual_cell =device_property_read_bool (dev,"cellwise,dual-cell" ); + ret =device_property_read_u32 (dev,"cellwise,monitor-interval-ms" , &cw_bat->poll_interval_ms);if (ret) {Signature · 1 line
2.34.1
Re: [PATCH 2/5] power: supply: cw2015: Add support for dual-cell configurations
In reply to Sebastian ReichelHello all,
Quoted 82 lines · Sebastian Reichel
Quoted 64 lines · Chris Morgan
Quoted 14 lines · Sebastian Reichel
Quoted 6 lines · Chris Morgan
From: Chris Morgan <[email protected]>
The Cellwise cw2015 datasheet reports that it can handle two cells in a series configuration. Allow a device tree parameter to note this condition so that the driver reports the correct voltage values to userspace.
I found this:
http://www.cellwise-semi.com/Public/assests/menu/20230302/6400076806706.pdf
Which says:
Quoted 7 lines
CW2015 can be used in 2 or more batteries connected in series, or several cells connected in parallel.
So dual-cell seems like a bad property name. Instead the number of serial cells should be provided. This property is then not really specific to the Cellwise fuel gauge and instead a property of the battery pack (i.e.
simple-battery.yaml).It's conflicting information (which further confuses me). I see in that datasheet it says 2 or more, whereas the datasheet found here says only 2 cells:
But I agree in principle that we should be setting this as a property of a simple-battery rather than a manufacturer specific parameter.
Quoted 32 lines
Quoted 20 lines
Signed-off-by Chris Morgan <[email protected]>--- drivers/power/supply/cw2015_battery.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/power/supply/cw2015_battery.c +2
-0@@ -77,6 +77,8 @@ struct cw_battery {u32 poll_interval_ms;u8 alert_level; +bool dual_cell; +unsigned int read_errors;unsigned int charge_stuck_cnt; };drivers/power/supply/cw2015_battery.c static int cw_get_voltage(struct cw_battery *cw_bat) · line 331
Quoted 5 lines
drivers/power/supply/cw2015_battery.c +2
-0@@ -325,6 +327,9 @@ static int cw_get_voltage(struct cw_battery *cw_bat)*/ voltage_mv = avg *312 /1024 ; +if (cw_bat->dual_cell) + voltage_mv *=2 ;Unfortunately there are no details in the document, but this looks very fishy. Does it only measure the first cell and hope that the other cells have the same voltage?
This (unmerged) series also applies to your problem to some degree:
Quoted 8 lines
Quoted 1 line
I think based on the application diagram it is in fact measuring the cell voltage.
That said, this ultimately boils down to a cosmetic thing as not having this property simply means userspace sees the battery voltage as 3.8v instead of 7.6v as is written on the side.
With the cells being connected in serial, the voltage of both cells can be different. There is not "the cell voltage". Instead there is a voltage for cell 1 and a voltage for cell 2. In a perfect battery they are the same, but in reality they are not. In the extreme case one of the cells may be broken while the other is still fine. It sounds as if this is just measuring the voltage from the first cell and assumes the second cell has the same voltage.
Quoted 7 lines
Ideally the voltage on these platforms is not exposed via the normal VOLTAGE property and instead uses a new property for telling userspace the voltage for a single cell. The kernel simply does not know the voltage of the whole battery pack.
FWIW this is the worst battery measurement system I've seen so far if my understanding of the hardware design is correct.
Please note that two facts should be considered here:
- The GenBook schematic [1] clearly shows that the individual battery cells aren't exposed at its internal battery connector and, as a result, aren't available for individual cell voltage monitoring
- The GenBook uses a CW2013 as it fuel gauge, [1] instead of CW2015 as mentioned here a few times, but I haven't went through the CW2013 datasheet(s) yet to see what are the actual differences between it and the CW2015
[1] https://wiki.cool-pi.com/notebook/coolpi-genbook-v20.pdf
Quoted 21 lines
Quoted 21 lines
I think for simplification sake I will remove this from the series, add a note to the device tree, and wait for the other battery series to get pulled. When it gets pulled I'll request a device tree property so we can add
POWER_SUPPLY_PROP_NUMBER_OF_SERIAL_CELLSto the simple-battery and then parse this value. Or if that series ends up getting abandoned I can just add a quick and dirty new property like this.Quoted 15 lines
Quoted 15 lines
drivers/power/supply/cw2015_battery.c +2
-1dev_dbg (cw_bat->dev,"Read voltage: %d mV, raw=0x%04x\n" , voltage_mv, reg_val);return voltage_mv;@@ -587,6 +592,8 @@ static int cw2015_parse_properties(struct cw_battery *cw_bat)return ret; } + cw_bat->dual_cell =device_property_read_bool (dev,"cellwise,dual-cell" ); + ret =device_property_read_u32 (dev,"cellwise,monitor-interval-ms" , &cw_bat->poll_interval_ms);if (ret) { --2.34.1
Re: [PATCH 2/5] power: supply: cw2015: Add support for dual-cell configurations
Hi,
Quoted 99 lines · Dragan Simic
Quoted 84 lines · Sebastian Reichel
Quoted 66 lines · Chris Morgan
Quoted 14 lines · Sebastian Reichel
Quoted 6 lines · Chris Morgan
From: Chris Morgan <[email protected]>
The Cellwise cw2015 datasheet reports that it can handle two cells in a series configuration. Allow a device tree parameter to note this condition so that the driver reports the correct voltage values to userspace.
I found this:
http://www.cellwise-semi.com/Public/assests/menu/20230302/6400076806706.pdf
Which says:
Quoted 7 lines
CW2015 can be used in 2 or more batteries connected in series, or several cells connected in parallel.
So dual-cell seems like a bad property name. Instead the number of serial cells should be provided. This property is then not really specific to the Cellwise fuel gauge and instead a property of the battery pack (i.e.
simple-battery.yaml).It's conflicting information (which further confuses me). I see in that
datasheet it says 2 or more, whereas the datasheet found here says only
2 cells:But I agree in principle that we should be setting this as a property of a simple-battery rather than a manufacturer specific parameter.
Quoted 32 lines
Quoted 20 lines
Signed-off-by Chris Morgan <[email protected]>--- drivers/power/supply/cw2015_battery.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/power/supply/cw2015_battery.c +2
-0@@ -77,6 +77,8 @@ struct cw_battery {u32 poll_interval_ms;u8 alert_level; +bool dual_cell; +unsigned int read_errors;unsigned int charge_stuck_cnt; };drivers/power/supply/cw2015_battery.c static int cw_get_voltage(struct cw_battery *cw_bat) · line 331
Quoted 5 lines
drivers/power/supply/cw2015_battery.c +2
-0@@ -325,6 +327,9 @@ static int cw_get_voltage(struct cw_battery *cw_bat)*/ voltage_mv = avg *312 /1024 ; +if (cw_bat->dual_cell) + voltage_mv *=2 ;Unfortunately there are no details in the document, but this looks very fishy. Does it only measure the first cell and hope that the other cells have the same voltage?
This (unmerged) series also applies to your problem to some degree:
Quoted 8 lines
Quoted 1 line
I think based on the application diagram it is in fact measuring the cell voltage.
That said, this ultimately boils down to a cosmetic thing as not having this property simply means userspace sees the battery voltage as 3.8v instead of 7.6v as is written on the side.
With the cells being connected in serial, the voltage of both cells can be different. There is not "the cell voltage". Instead there is a voltage for cell 1 and a voltage for cell 2. In a perfect battery they are the same, but in reality they are not. In the extreme case one of the cells may be broken while the other is still fine. It sounds as if this is just measuring the voltage from the first cell and assumes the second cell has the same voltage.
Quoted 7 lines
Ideally the voltage on these platforms is not exposed via the normal VOLTAGE property and instead uses a new property for telling userspace the voltage for a single cell. The kernel simply does not know the voltage of the whole battery pack.
FWIW this is the worst battery measurement system I've seen so far if my understanding of the hardware design is correct.
Please note that two facts should be considered here:
- The GenBook schematic [1] clearly shows that the individual battery cells aren't exposed at its internal battery connector and, as a result, aren't available for individual cell voltage monitoring
Quoted 6 lines
- The GenBook uses a CW2013 as it fuel gauge, [1] instead of CW2015 as mentioned here a few times, but I haven't went through the CW2013 datasheet(s) yet to see what are the actual differences between it and the CW2015
[1] https://wiki.cool-pi.com/notebook/coolpi-genbook-v20.pdf
Ah, thanks for pointing to the schematics. So the fuel gauge can only measure the voltage of the whole battery, but VCELL register provides the voltage for 1 cell? What is the origin of the dual-cell property? Was this something you came up with yourself when noticing the wrong voltage?
Based on the above information my guess would be that CW2013 uses a different voltage resolution than CW2015 for the VCELL register. The datasheet for CW2015 says 14bit ADC with 305uV resolution. Maybe the CW2013 simply uses a different ADC. Do you have the datasheet for the chip?
-- Sebastian
_______________________________________________
Linux-rockchip mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-rockchip
Re: [PATCH 2/5] power: supply: cw2015: Add support for dual-cell configurations
Hello Sebastian,
(I'm adding a couple of Cool Pi contacts to the Cc list.)
Quoted 106 lines · Sebastian Reichel
Quoted 105 lines · Dragan Simic
Quoted 84 lines · Sebastian Reichel
Quoted 66 lines · Chris Morgan
Quoted 14 lines · Sebastian Reichel
Quoted 6 lines · Chris Morgan
From: Chris Morgan <[email protected]>
The Cellwise cw2015 datasheet reports that it can handle two cells in a series configuration. Allow a device tree parameter to note this condition so that the driver reports the correct voltage values to userspace.
I found this:
http://www.cellwise-semi.com/Public/assests/menu/20230302/6400076806706.pdf
Which says:
Quoted 7 lines
CW2015 can be used in 2 or more batteries connected in series, or several cells connected in parallel.
So dual-cell seems like a bad property name. Instead the number of serial cells should be provided. This property is then not really specific to the Cellwise fuel gauge and instead a property of the battery pack (i.e.
simple-battery.yaml).It's conflicting information (which further confuses me). I see in that
datasheet it says 2 or more, whereas the datasheet found here says only
2 cells:But I agree in principle that we should be setting this as a property of a simple-battery rather than a manufacturer specific parameter.
Quoted 32 lines
Quoted 20 lines
Signed-off-by Chris Morgan <[email protected]>--- drivers/power/supply/cw2015_battery.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/power/supply/cw2015_battery.c +2
-0@@ -77,6 +77,8 @@ struct cw_battery {u32 poll_interval_ms;u8 alert_level; +bool dual_cell; +unsigned int read_errors;unsigned int charge_stuck_cnt; };drivers/power/supply/cw2015_battery.c static int cw_get_voltage(struct cw_battery *cw_bat) · line 331
Quoted 5 lines
drivers/power/supply/cw2015_battery.c +2
-0@@ -325,6 +327,9 @@ static int cw_get_voltage(struct cw_battery *cw_bat)*/ voltage_mv = avg *312 /1024 ; +if (cw_bat->dual_cell) + voltage_mv *=2 ;Unfortunately there are no details in the document, but this looks very fishy. Does it only measure the first cell and hope that the other cells have the same voltage?
This (unmerged) series also applies to your problem to some degree:
Quoted 8 lines
Quoted 1 line
I think based on the application diagram it is in fact measuring the cell voltage.
That said, this ultimately boils down to a cosmetic thing as not having this property simply means userspace sees the battery voltage as 3.8v instead of 7.6v as is written on the side.
With the cells being connected in serial, the voltage of both cells can be different. There is not "the cell voltage". Instead there is a voltage for cell 1 and a voltage for cell 2. In a perfect battery they are the same, but in reality they are not. In the extreme case one of the cells may be broken while the other is still fine. It sounds as if this is just measuring the voltage from the first cell and assumes the second cell has the same voltage.
Quoted 7 lines
Ideally the voltage on these platforms is not exposed via the normal VOLTAGE property and instead uses a new property for telling userspace the voltage for a single cell. The kernel simply does not know the voltage of the whole battery pack.
FWIW this is the worst battery measurement system I've seen so far if my understanding of the hardware design is correct.
Please note that two facts should be considered here:
- The GenBook schematic [1] clearly shows that the individual battery cells aren't exposed at its internal battery connector and, as a result, aren't available for individual cell voltage monitoring
- The GenBook uses a CW2013 as it fuel gauge, [1] instead of CW2015 as mentioned here a few times, but I haven't went through the
CW2013
datasheet(s) yet to see what are the actual differences between it and the CW2015
Quoted 7 lines
Quoted 1 line
[1] https://wiki.cool-pi.com/notebook/coolpi-genbook-v20.pdf
Ah, thanks for pointing to the schematics. So the fuel gauge can only measure the voltage of the whole battery, but VCELL register provides the voltage for 1 cell? What is the origin of the dual-cell property? Was this something you came up with yourself when noticing the wrong voltage?
I'm not sure where does the idea for the dual-cell property come from, but please note that it wasn't me who invented it, so to speak. :) I don't even have the required hardware to test and develop these patches on, i.e. I don't have a CM5-based GenBook.
Quoted 5 lines
Based on the above information my guess would be that CW2013 uses a different voltage resolution than CW2015 for the VCELL register. The datasheet for CW2015 says 14bit ADC with 305uV resolution. Maybe the CW2013 simply uses a different ADC. Do you have the datasheet for the chip?
I've managed to find a few (seemingly a bit different) CW2013 datasheets, but as usual with CellWise, some of them may contain a bit confusing or incomplete information. I'd suggest that you wait for a couple of days until I sift through the obtained datasheets, to save you from doing the same. :) Of course, I'll then send over the datasheet that seems correct and the most complete to me.
I'll see to add support for CW2013 to the cw2015 driver, for which I already have a couple of pending cleanup patches.
PATCH 3/5 arm64: dts: rockchip: Pull up sdio pins on RK3588
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
When using an Ampak derived bcm43456 on an RK3588s based GameForce Ace the WiFi failed to work properly until I set the SDIO pins from pull-none to pull-up. This matches the vendor kernel located at [1]. I tested this then on an RK3588s based Indiedroid Nova and did not observe any adverse effects.
[1] https://github.com/rockchip-linux/kernel/commit/b96485b7af46a99c14f3c4818eb18c7836eb809c
--- arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi +5 -5
@@ -2449,15 +2449,15 @@ sdiom1_pins: sdiom1-pins { /* sdio_clk_m1 */ <3 RK_PA5 2 &pcfg_pull_none>, /* sdio_cmd_m1 */ - <3 RK_PA4 2 &pcfg_pull_none>, + <3 RK_PA4 2 &pcfg_pull_up>, /* sdio_d0_m1 */ - <3 RK_PA0 2 &pcfg_pull_none>, + <3 RK_PA0 2 &pcfg_pull_up>, /* sdio_d1_m1 */ - <3 RK_PA1 2 &pcfg_pull_none>, + <3 RK_PA1 2 &pcfg_pull_up>, /* sdio_d2_m1 */ - <3 RK_PA2 2 &pcfg_pull_none>, + <3 RK_PA2 2 &pcfg_pull_up>, /* sdio_d3_m1 */ - <3 RK_PA3 2 &pcfg_pull_none>; + <3 RK_PA3 2 &pcfg_pull_up>; }; };
Signature · 1 line
2.34.1
Heiko Stübner
maintainerRe: [PATCH 3/5] arm64: dts: rockchip: Pull up sdio pins on RK3588
Am Freitag, 26. Juli 2024, 21:49:46 CEST schrieb Chris Morgan:
Quoted 9 lines
From: Chris Morgan <[email protected]>
When using an Ampak derived bcm43456 on an RK3588s based GameForce Ace the WiFi failed to work properly until I set the SDIO pins from pull-none to pull-up. This matches the vendor kernel located at [1]. I tested this then on an RK3588s based Indiedroid Nova and did not observe any adverse effects.
[1] https://github.com/rockchip-linux/kernel/commit/b96485b7af46a99c14f3c4818eb18c7836eb809c
As you're essentially duplicating the change by Alex Zhao it might be nice to keep their authorship?
So, "From" + first Signed-off from Alex, then you add a
below that.
Quoted 32 lines
Signed-off-by Chris Morgan <[email protected]>--- arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi +5
-5@@ -2449,15 +2449,15 @@ sdiom1_pins: sdiom1-pins { /* sdio_clk_m1 */ <3 RK_PA5 2 &pcfg_pull_none>, /* sdio_cmd_m1 */ - <3 RK_PA4 2 &pcfg_pull_none>, + <3 RK_PA4 2 &pcfg_pull_up>, /* sdio_d0_m1 */ - <3 RK_PA0 2 &pcfg_pull_none>, + <3 RK_PA0 2 &pcfg_pull_up>, /* sdio_d1_m1 */ - <3 RK_PA1 2 &pcfg_pull_none>, + <3 RK_PA1 2 &pcfg_pull_up>, /* sdio_d2_m1 */ - <3 RK_PA2 2 &pcfg_pull_none>, + <3 RK_PA2 2 &pcfg_pull_up>, /* sdio_d3_m1 */ - <3 RK_PA3 2 &pcfg_pull_none>; + <3 RK_PA3 2 &pcfg_pull_up>; }; };
Re: [PATCH 3/5] arm64: dts: rockchip: Pull up sdio pins on RK3588
Quoted 11 lines · Heiko Stübner
Am Freitag, 26. Juli 2024, 21:49:46 CEST schrieb Chris Morgan:
Quoted 9 lines
From: Chris Morgan <[email protected]>
When using an Ampak derived bcm43456 on an RK3588s based GameForce Ace the WiFi failed to work properly until I set the SDIO pins from pull-none to pull-up. This matches the vendor kernel located at [1]. I tested this then on an RK3588s based Indiedroid Nova and did not observe any adverse effects.
[1] https://github.com/rockchip-linux/kernel/commit/b96485b7af46a99c14f3c4818eb18c7836eb809c
Quoted 8 lines
As you're essentially duplicating the change by Alex Zhao it might be nice to keep their authorship?
So, "From" + first Signed-off from Alex, then you add a
[adapted to pinctrl filename change]Signed-off-by Chris Morgan <[email protected]>below that.
Thank you, that was an oversight but I'll get it done in v2.
Quoted 37 lines
Quoted 33 lines
Signed-off-by Chris Morgan <[email protected]>--- arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)arch/arm64/boot/dts/rockchip/rk3588-base-pinctrl.dtsi +5
-5@@ -2449,15 +2449,15 @@ sdiom1_pins: sdiom1-pins { /* sdio_clk_m1 */ <3 RK_PA5 2 &pcfg_pull_none>, /* sdio_cmd_m1 */ - <3 RK_PA4 2 &pcfg_pull_none>, + <3 RK_PA4 2 &pcfg_pull_up>, /* sdio_d0_m1 */ - <3 RK_PA0 2 &pcfg_pull_none>, + <3 RK_PA0 2 &pcfg_pull_up>, /* sdio_d1_m1 */ - <3 RK_PA1 2 &pcfg_pull_none>, + <3 RK_PA1 2 &pcfg_pull_up>, /* sdio_d2_m1 */ - <3 RK_PA2 2 &pcfg_pull_none>, + <3 RK_PA2 2 &pcfg_pull_up>, /* sdio_d3_m1 */ - <3 RK_PA3 2 &pcfg_pull_none>; + <3 RK_PA3 2 &pcfg_pull_up>; }; };
PATCH 4/5 dt-bindings: arm: rockchip: Add GameForce Ace
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
Add devicetree binding for the GameForce Ace.
--- Documentation/devicetree/bindings/arm/rockchip.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Documentation/devicetree/bindings/arm/rockchip.yaml +5 -0
@@ -255,6 +255,11 @@ properties: - const: friendlyarm,cm3588 - const: rockchip,rk3588 + - description: GameForce Ace + items: + - const: gameforce,ace + - const: rockchip,rk3588s + - description: GameForce Chi items: - const: gameforce,chi
Signature · 1 line
2.34.1
Re: [PATCH 4/5] dt-bindings: arm: rockchip: Add GameForce Ace
Quoted 8 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Add devicetree binding for the GameForce Ace.
Signed-off-by Chris Morgan <[email protected]>--- Documentation/devicetree/bindings/arm/rockchip.yaml | 5 +++++ 1 file changed, 5 insertions(+)
Best regards,
Krzysztof
PATCH 5/5 arm64: dts: rockchip: Add GameForce Ace
In reply to Chris MorganFrom: Chris Morgan <[email protected]>
The GameForce Ace is a portable gaming device based on the Rockchip RK3588s SoC.
The device contains the following hardware that is tested/working:
- 128GB eMMC
- SDMMC card slot
- Ampak SDIO WiFi 5/BT
- NVME 2242 socket
- 8 or 12GB of RAM
- Goodix based touchscreen
- Stereo speakers, internal microphone, and TRRS headphone jack.
- Dual GPIO vibrators (implemented as gpio-pwm because they are quite strong)
- Multiple face buttons, dual analog joysticks, and dual analog triggers
- PWM fan with tach pin.
The device also contains the following hardware that is partially or currently not working:
- 1920x1080 DSI display
- HDMI port
- USB-C port with DP alt-mode
- TI bq25703 charger controller
--- arch/arm64/boot/dts/rockchip/Makefile | 1 + .../dts/rockchip/rk3588s-gameforce-ace.dts | 1315 +++++++++++++++++ 2 files changed, 1316 insertions(+) create mode 100644 arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dts
arch/arm64/boot/dts/rockchip/Makefile +1 -0
@@ -139,6 +139,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-tiger-haikou.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-toybrick-x0.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-turing-rk1.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-coolpi-4b.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-gameforce-ace.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-indiedroid-nova.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-khadas-edge2.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588s-nanopi-r6s.dtb
arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dts new file +1315 -0
1,315 lines not on this page · raw message
Signature · 1 line
2.34.1
Rob Herring (Arm)
maintainerQuoted 23 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Add support for the GameForce Ace. The GameForce Ace is an RK3588s based gaming device with a 1080p display, touchscreen, hall effect joysticks and triggers, 128GB of eMMC, 8GB or 12GB of RAM, WiFi 5, and support for a 2242 NVME.
Chris Morgan (5):
dt-bindings: power: supply: add dual-cell for cw2015
power: supply: cw2015: Add support for dual-cell configurations
arm64: dts: rockchip: Pull up sdio pins on RK3588
dt-bindings: arm: rockchip: Add GameForce Ace
arm64: dts: rockchip: Add GameForce Ace.../devicetree/bindings/arm/rockchip.yaml | 5 + .../bindings/power/supply/cw2015_battery.yaml | 6 + arch/arm64/boot/dts/rockchip/Makefile | 1 + .../dts/rockchip/rk3588-base-pinctrl.dtsi | 10 +- .../dts/rockchip/rk3588s-gameforce-ace.dts | 1315 +++++++++++++++++ drivers/power/supply/cw2015_battery.c | 7 + 6 files changed, 1339 insertions(+), 5 deletions(-) create mode 100644 arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dts
Quoted 5 lines
--
2.34.1
My bot found new DTB warnings on the .dts files added or changed in this series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:
pip3 install dtschema --upgrade
New warnings running 'make CHECK_DTBS=y rockchip/rk3588s-gameforce-ace.dtb' for [email protected]:
arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dtb: typec-portc@22: 'vbus-supply' is a required property
from schema $id: http://devicetree.org/schemas/usb/fcs,fusb302.yaml#
Quoted 43 lines · Rob Herring (Arm)
Quoted 23 lines · Chris Morgan
From: Chris Morgan <[email protected]>
Add support for the GameForce Ace. The GameForce Ace is an RK3588s based gaming device with a 1080p display, touchscreen, hall effect joysticks and triggers, 128GB of eMMC, 8GB or 12GB of RAM, WiFi 5, and support for a 2242 NVME.
Chris Morgan (5):
dt-bindings: power: supply: add dual-cell for cw2015
power: supply: cw2015: Add support for dual-cell configurations
arm64: dts: rockchip: Pull up sdio pins on RK3588
dt-bindings: arm: rockchip: Add GameForce Ace
arm64: dts: rockchip: Add GameForce Ace.../devicetree/bindings/arm/rockchip.yaml | 5 + .../bindings/power/supply/cw2015_battery.yaml | 6 + arch/arm64/boot/dts/rockchip/Makefile | 1 + .../dts/rockchip/rk3588-base-pinctrl.dtsi | 10 +- .../dts/rockchip/rk3588s-gameforce-ace.dts | 1315 +++++++++++++++++ drivers/power/supply/cw2015_battery.c | 7 + 6 files changed, 1339 insertions(+), 5 deletions(-) create mode 100644 arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dtsQuoted 5 lines
--
2.34.1My bot found new DTB warnings on the .dts files added or changed in this series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:
Quoted 8 lines
pip3 install dtschema --upgradeNew warnings running 'make CHECK_DTBS=y rockchip/rk3588s-gameforce-ace.dtb' for [email protected]:
arch/arm64/boot/dts/rockchip/rk3588s-gameforce-ace.dtb: typec-portc@22: 'vbus-supply' is a required property
from schema $id: http://devicetree.org/schemas/usb/fcs,fusb302.yaml#
For the moment this is expected, because the regulator is driven by a TI BQ25703 chip that I'm still working on getting supported. Is it preferable to either keep it empty (and cause this error) or fill it with a dummy regulator for now?
Thank you.