Skip to content

Commit 0159a81

Browse files
CodeChenLretro98boy
andcommitted
patch: sm8250: current: some reasonable modifications were made
Based on the AI review, Co-authored-by: retro98boy <retro98boy@qq.com> Signed-off-by: CodeChenL <2540735020@qq.com>
1 parent 12e53e2 commit 0159a81

6 files changed

+72
-58
lines changed

patch/kernel/archive/sm8250-6.18/0005-ASoC-qcom-sm8250-Add-tdm-support.patch

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Subject: [PATCH 05/62] ASoC: qcom: sm8250: Add tdm support
55

66
Signed-off-by: Jiali Chen <chenjiali@radxa.com>
77
---
8-
sound/soc/qcom/sm8250.c | 75 +++++++++++++++++++++++++++++++++++++++++
9-
1 file changed, 75 insertions(+)
8+
sound/soc/qcom/sm8250.c | 83 +++++++++++++++++++++++++++++++++++++++++
9+
1 file changed, 83 insertions(+)
1010

1111
diff --git a/sound/soc/qcom/sm8250.c b/sound/soc/qcom/sm8250.c
1212
index f5b75a06e5bd..a383f74c5187 100644
@@ -88,29 +88,37 @@ index f5b75a06e5bd..a383f74c5187 100644
8888

8989
switch (cpu_dai->id) {
9090
case PRIMARY_MI2S_RX:
91-
@@ -105,6 +160,21 @@ static int sm8250_snd_startup(struct snd_pcm_substream *substream)
91+
@@ -105,6 +160,29 @@ static int sm8250_snd_startup(struct snd_pcm_substream *substream)
9292
snd_soc_dai_set_fmt(cpu_dai, fmt);
9393
snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
9494
break;
9595
+ case TERTIARY_TDM_RX_0:
9696
+ codec_dai_fmt |= SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_DSP_A;
97-
+ snd_soc_dai_set_sysclk(cpu_dai,
97+
+ ret = snd_soc_dai_set_sysclk(cpu_dai,
9898
+ Q6AFE_LPASS_CLK_ID_TER_TDM_IBIT,
9999
+ TDM_BCLK_RATE, SNDRV_PCM_STREAM_PLAYBACK);
100+
+ if (ret < 0) {
101+
+ dev_err(rtd->dev, "TDM cpu sysclk err:%d\n", ret);
102+
+ return ret;
103+
+ }
100104
+
101105
+ for_each_rtd_codec_dais(rtd, j, codec_dai) {
102106
+ ret = snd_soc_dai_set_fmt(codec_dai, codec_dai_fmt);
103-
+ snd_soc_dai_set_sysclk(codec_dai, 0, TDM_BCLK_RATE, SNDRV_PCM_STREAM_PLAYBACK);
104107
+ if (ret < 0) {
105108
+ dev_err(rtd->dev, "TDM fmt err:%d\n", ret);
106109
+ return ret;
107110
+ }
111+
+ ret = snd_soc_dai_set_sysclk(codec_dai, 0, TDM_BCLK_RATE, SNDRV_PCM_STREAM_PLAYBACK);
112+
+ if (ret < 0) {
113+
+ dev_err(rtd->dev, "TDM sysclk err:%d\n", ret);
114+
+ return ret;
115+
+ }
108116
+ }
109117
+ break;
110118
default:
111119
break;
112120
}
113-
@@ -130,6 +200,11 @@ static int sm8250_snd_hw_params(struct snd_pcm_substream *substream,
121+
@@ -130,6 +208,11 @@ static int sm8250_snd_hw_params(struct snd_pcm_substream *substream,
114122
struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
115123
struct sm8250_snd_data *pdata = snd_soc_card_get_drvdata(rtd->card);
116124

patch/kernel/archive/sm8250-6.18/0008-arm64-dts-qcom-sm8250-oneplus-instantnoodlep-Add-dev.patch

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ Subject: [PATCH 08/62] arm64: dts: qcom: sm8250-oneplus-instantnoodlep: Add
77
Signed-off-by: Jiali Chen <chenjiali@radxa.com>
88
---
99
arch/arm64/boot/dts/qcom/Makefile | 1 +
10-
.../qcom/sm8250-oneplus-instantnoodlep.dts | 832 ++++++++++++++++++
11-
2 files changed, 833 insertions(+)
10+
.../qcom/sm8250-oneplus-instantnoodlep.dts | 831 ++++++++++++++++++
11+
2 files changed, 832 insertions(+)
1212
create mode 100644 arch/arm64/boot/dts/qcom/sm8250-oneplus-instantnoodlep.dts
1313

1414
diff --git a/arch/arm64/boot/dts/qcom/Makefile b/arch/arm64/boot/dts/qcom/Makefile
1515
index 4bfa926b6a08..4dc01668765d 100644
1616
--- a/arch/arm64/boot/dts/qcom/Makefile
1717
+++ b/arch/arm64/boot/dts/qcom/Makefile
18-
@@ -275,6 +275,7 @@ dtb-$(CONFIG_ARCH_QCOM) += sm8150-sony-xperia-kumano-bahamut.dtb
18+
@@ -281,6 +281,7 @@ dtb-$(CONFIG_ARCH_QCOM) += sm8150-sony-xperia-kumano-bahamut.dtb
1919
dtb-$(CONFIG_ARCH_QCOM) += sm8150-sony-xperia-kumano-griffin.dtb
2020
dtb-$(CONFIG_ARCH_QCOM) += sm8250-hdk.dtb
2121
dtb-$(CONFIG_ARCH_QCOM) += sm8250-mtp.dtb
@@ -28,7 +28,7 @@ new file mode 100644
2828
index 000000000000..2ff46c2979e5
2929
--- /dev/null
3030
+++ b/arch/arm64/boot/dts/qcom/sm8250-oneplus-instantnoodlep.dts
31-
@@ -0,0 +1,832 @@
31+
@@ -0,0 +1,831 @@
3232
+/dts-v1/;
3333
+
3434
+#include <dt-bindings/gpio/gpio.h>
@@ -596,7 +596,6 @@ index 000000000000..2ff46c2979e5
596596
+
597597
+ charger@66 {
598598
+ compatible = "ti,bq25980";
599-
+ status = "ok";
600599
+ reg = <0x66>;
601600
+ interrupt-parent = <&tlmm>;
602601
+ interrupts = <0x0f 0x00>;

patch/kernel/archive/sm8250-6.18/0013-input-nt36xxx-Enable-pen-support.patch

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Subject: [PATCH 13/62] input: nt36xxx: Enable pen support
55

66
Signed-off-by: Jiali Chen <chenjiali@radxa.com>
77
---
8-
drivers/input/touchscreen/nt36523/nt36xxx.c | 47 +++++++++++++++++--
8+
drivers/input/touchscreen/nt36523/nt36xxx.c | 49 +++++++++++++++++--
99
drivers/input/touchscreen/nt36523/nt36xxx.h | 1 +
1010
.../touchscreen/nt36523/nt36xxx_fw_update.c | 1 +
11-
3 files changed, 45 insertions(+), 4 deletions(-)
11+
3 files changed, 47 insertions(+), 4 deletions(-)
1212

1313
diff --git a/drivers/input/touchscreen/nt36523/nt36xxx.c b/drivers/input/touchscreen/nt36523/nt36xxx.c
1414
index 63c584f681d7..3a87a38a7780 100644
@@ -82,14 +82,16 @@ index 63c584f681d7..3a87a38a7780 100644
8282
}
8383

8484
if (ts->db_wakeup) {
85-
@@ -1798,6 +1836,7 @@ static int32_t nvt_ts_resume(struct device *dev)
85+
@@ -1796,6 +1834,9 @@ static int32_t nvt_ts_resume(struct device *dev)
8686

87-
mutex_unlock(&ts->lock);
87+
bTouchIsAwake = 1;
8888

89+
+ NVT_LOG("always enable pen when resume");
8990
+ disable_pen_input_device(false);
91+
+
92+
mutex_unlock(&ts->lock);
93+
9094
if (likely(ts->ic_state == NVT_IC_RESUME_IN)) {
91-
ts->ic_state = NVT_IC_RESUME_OUT;
92-
} else {
9395
diff --git a/drivers/input/touchscreen/nt36523/nt36xxx.h b/drivers/input/touchscreen/nt36523/nt36xxx.h
9496
index 6642ec2f26cf..33c7614436b0 100644
9597
--- a/drivers/input/touchscreen/nt36523/nt36xxx.h

patch/kernel/archive/sm8250-6.18/0024-power-supply-Add-driver-for-Qualcomm-PMIC-fuel-gauge.patch

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ Signed-off-by: Jiali Chen <chenjiali@radxa.com>
3333
---
3434
drivers/power/supply/Kconfig | 8 +
3535
drivers/power/supply/Makefile | 1 +
36-
drivers/power/supply/qcom_fg.c | 1320 ++++++++++++++++++++++++++++++++
37-
3 files changed, 1329 insertions(+)
36+
drivers/power/supply/qcom_fg.c | 1325 ++++++++++++++++++++++++++++++++
37+
3 files changed, 1334 insertions(+)
3838
create mode 100644 drivers/power/supply/qcom_fg.c
3939

4040
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
4141
index 6e0559e6baed..e138bdc837a7 100644
4242
--- a/drivers/power/supply/Kconfig
4343
+++ b/drivers/power/supply/Kconfig
44-
@@ -1083,4 +1083,12 @@ config FUEL_GAUGE_MM8013
44+
@@ -1106,4 +1106,12 @@ config FUEL_GAUGE_MM8013
4545
the state of charge, temperature, cycle count, actual and design
4646
capacity, etc.
4747

@@ -58,7 +58,7 @@ diff --git a/drivers/power/supply/Makefile b/drivers/power/supply/Makefile
5858
index 60aec804ca8f..921cf6aac741 100644
5959
--- a/drivers/power/supply/Makefile
6060
+++ b/drivers/power/supply/Makefile
61-
@@ -123,3 +123,4 @@ obj-$(CONFIG_CHARGER_SURFACE) += surface_charger.o
61+
@@ -126,3 +126,4 @@ obj-$(CONFIG_CHARGER_SURFACE) += surface_charger.o
6262
obj-$(CONFIG_BATTERY_UG3105) += ug3105_battery.o
6363
obj-$(CONFIG_CHARGER_QCOM_SMB2) += qcom_smbx.o
6464
obj-$(CONFIG_FUEL_GAUGE_MM8013) += mm8013.o
@@ -68,7 +68,7 @@ new file mode 100644
6868
index 000000000000..f8dd93aa23c7
6969
--- /dev/null
7070
+++ b/drivers/power/supply/qcom_fg.c
71-
@@ -0,0 +1,1320 @@
71+
@@ -0,0 +1,1325 @@
7272
+// SPDX-License-Identifier: GPL-2.0-only
7373
+/* Copyright (c) 2020, The Linux Foundation. All rights reserved. */
7474
+
@@ -451,6 +451,8 @@ index 000000000000..f8dd93aa23c7
451451
+ }
452452
+
453453
+ while(len > 0) {
454+
+ int read_len = min(len, 4 - offset);
455+
+
454456
+ /* Set SRAM address register */
455457
+ ret = qcom_fg_write(chip, (u8 *) &addr,
456458
+ MEM_INTF_ADDR_LSB, 2);
@@ -460,15 +462,15 @@ index 000000000000..f8dd93aa23c7
460462
+ }
461463
+
462464
+ ret = qcom_fg_read(chip, rd_data,
463-
+ MEM_INTF_RD_DATA0 + offset, len);
465+
+ MEM_INTF_RD_DATA0 + offset, read_len);
464466
+
465467
+ addr += 4;
466468
+
467469
+ if (ret)
468470
+ goto out;
469471
+
470-
+ rd_data += 4 - offset;
471-
+ len -= 4 - offset;
472+
+ rd_data += read_len;
473+
+ len -= read_len;
472474
+ offset = 0;
473475
+ }
474476
+out:
@@ -502,7 +504,7 @@ index 000000000000..f8dd93aa23c7
502504
+ spin_lock(&chip->sram_rw_lock);
503505
+
504506
+ dev_vdbg(chip->dev,
505-
+ "Wrtiting address 0x%x with offset %d of length %d to SRAM",
507+
+ "Writing address 0x%x with offset %d of length %d to SRAM",
506508
+ addr, len, offset);
507509
+
508510
+ ret = qcom_fg_sram_config_access(chip, 1, (len > 4));
@@ -512,6 +514,8 @@ index 000000000000..f8dd93aa23c7
512514
+ }
513515
+
514516
+ while(len > 0) {
517+
+ int write_len = min(len, 4 - offset);
518+
+
515519
+ /* Set SRAM address register */
516520
+ ret = qcom_fg_write(chip, (u8 *) &addr,
517521
+ MEM_INTF_ADDR_LSB, 2);
@@ -521,15 +525,15 @@ index 000000000000..f8dd93aa23c7
521525
+ }
522526
+
523527
+ ret = qcom_fg_write(chip, wr_data,
524-
+ MEM_INTF_WR_DATA0 + offset, len);
528+
+ MEM_INTF_WR_DATA0 + offset, write_len);
525529
+
526530
+ addr += 4;
527531
+
528532
+ if (ret)
529533
+ goto out;
530534
+
531-
+ wr_data += 4 - offset;
532-
+ len -= 4 - offset;
535+
+ wr_data += write_len;
536+
+ len -= write_len;
533537
+ offset = 0;
534538
+ }
535539
+out:
@@ -1134,10 +1138,11 @@ index 000000000000..f8dd93aa23c7
11341138
+ if (psy == chip->chg_psy) {
11351139
+ ret = power_supply_get_property(psy,
11361140
+ POWER_SUPPLY_PROP_STATUS, &propval);
1137-
+ if (ret)
1141+
+ if (ret) {
11381142
+ chip->status = POWER_SUPPLY_STATUS_UNKNOWN;
1139-
+
1140-
+ chip->status = propval.intval;
1143+
+ } else {
1144+
+ chip->status = propval.intval;
1145+
+ }
11411146
+
11421147
+ power_supply_changed(chip->batt_psy);
11431148
+
@@ -1201,7 +1206,7 @@ index 000000000000..f8dd93aa23c7
12011206
+ MEM_INTF_IMA_CFG, BIT(3), BIT(3));
12021207
+ if (ret) {
12031208
+ dev_err(chip->dev,
1204-
+ "Failed to configure interrupt sourete: %d\n", ret);
1209+
+ "Failed to configure interrupt source: %d\n", ret);
12051210
+ return ret;
12061211
+ }
12071212
+

patch/kernel/archive/sm8250-6.18/0025-power-qcom_fg-Add-initial-pm8150b-support.patch

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ index f8dd93aa23c7..dd5b2738d553 100644
106106
if (ret) {
107107
dev_err(chip->dev, "Failed to configure SRAM access: %d\n", ret);
108108
return ret;
109-
@@ -382,14 +387,14 @@ static int qcom_fg_sram_read(struct qcom_fg_chip *chip,
110-
while(len > 0) {
109+
@@ -384,14 +389,14 @@ static int qcom_fg_sram_read(struct qcom_fg_chip *chip,
110+
111111
/* Set SRAM address register */
112112
ret = qcom_fg_write(chip, (u8 *) &addr,
113113
- MEM_INTF_ADDR_LSB, 2);
@@ -118,13 +118,13 @@ index f8dd93aa23c7..dd5b2738d553 100644
118118
}
119119

120120
ret = qcom_fg_read(chip, rd_data,
121-
- MEM_INTF_RD_DATA0 + offset, len);
122-
+ MEM_INTF_RD_DATA0(chip) + offset, len);
121+
- MEM_INTF_RD_DATA0 + offset, read_len);
122+
+ MEM_INTF_RD_DATA0(chip) + offset, read_len);
123123

124124
addr += 4;
125125

126-
@@ -443,14 +448,14 @@ static int qcom_fg_sram_write(struct qcom_fg_chip *chip,
127-
while(len > 0) {
126+
@@ -447,14 +452,14 @@ static int qcom_fg_sram_write(struct qcom_fg_chip *chip,
127+
128128
/* Set SRAM address register */
129129
ret = qcom_fg_write(chip, (u8 *) &addr,
130130
- MEM_INTF_ADDR_LSB, 2);
@@ -135,12 +135,12 @@ index f8dd93aa23c7..dd5b2738d553 100644
135135
}
136136

137137
ret = qcom_fg_write(chip, wr_data,
138-
- MEM_INTF_WR_DATA0 + offset, len);
139-
+ MEM_INTF_WR_DATA0(chip) + offset, len);
138+
- MEM_INTF_WR_DATA0 + offset, write_len);
139+
+ MEM_INTF_WR_DATA0(chip) + offset, write_len);
140140

141141
addr += 4;
142142

143-
@@ -784,6 +789,34 @@ static int qcom_fg_gen3_get_temp_threshold(struct qcom_fg_chip *chip,
143+
@@ -788,6 +793,34 @@ static int qcom_fg_gen3_get_temp_threshold(struct qcom_fg_chip *chip,
144144
return 0;
145145
}
146146

@@ -175,15 +175,15 @@ index f8dd93aa23c7..dd5b2738d553 100644
175175
/************************
176176
* BATTERY POWER SUPPLY
177177
* **********************/
178-
@@ -796,6 +829,7 @@ static const struct qcom_fg_ops ops_fg = {
178+
@@ -800,6 +833,7 @@ static const struct qcom_fg_ops ops_fg = {
179179
.get_voltage = qcom_fg_get_voltage,
180180
.get_temp_threshold = qcom_fg_get_temp_threshold,
181181
.set_temp_threshold = qcom_fg_set_temp_threshold,
182182
+ .memif_base = 0x400,
183183
};
184184

185185
/* Gen3 fuel gauge. PMI8998 and newer */
186-
@@ -805,6 +839,17 @@ static const struct qcom_fg_ops ops_fg_gen3 = {
186+
@@ -809,6 +843,17 @@ static const struct qcom_fg_ops ops_fg_gen3 = {
187187
.get_current = qcom_fg_gen3_get_current,
188188
.get_voltage = qcom_fg_gen3_get_voltage,
189189
.get_temp_threshold = qcom_fg_gen3_get_temp_threshold,
@@ -201,7 +201,7 @@ index f8dd93aa23c7..dd5b2738d553 100644
201201
};
202202

203203
static enum power_supply_property qcom_fg_props[] = {
204-
@@ -837,7 +882,7 @@ static int qcom_fg_get_property(struct power_supply *psy,
204+
@@ -841,7 +886,7 @@ static int qcom_fg_get_property(struct power_supply *psy,
205205
case POWER_SUPPLY_PROP_STATUS:
206206
/* Get status from charger if available */
207207
if (chip->chg_psy &&
@@ -210,7 +210,7 @@ index f8dd93aa23c7..dd5b2738d553 100644
210210
val->intval = chip->status;
211211
break;
212212
} else {
213-
@@ -928,33 +973,33 @@ static int qcom_fg_iacs_clear_sequence(struct qcom_fg_chip *chip)
213+
@@ -932,33 +977,33 @@ static int qcom_fg_iacs_clear_sequence(struct qcom_fg_chip *chip)
214214
int ret;
215215

216216
/* clear the error */
@@ -249,7 +249,7 @@ index f8dd93aa23c7..dd5b2738d553 100644
249249
if (ret) {
250250
dev_err(chip->dev, "Failed to write IMA_CFG: %d\n", ret);
251251
return ret;
252-
@@ -971,14 +1016,14 @@ static int qcom_fg_clear_ima(struct qcom_fg_chip *chip,
252+
@@ -975,14 +1020,14 @@ static int qcom_fg_clear_ima(struct qcom_fg_chip *chip,
253253
int ret;
254254

255255
ret = qcom_fg_read(chip, &err_sts,
@@ -266,7 +266,7 @@ index f8dd93aa23c7..dd5b2738d553 100644
266266
if (ret) {
267267
dev_err(chip->dev, "Failed to read IMA_EXP_STS: %d\n", ret);
268268
return ret;
269-
@@ -986,7 +1031,7 @@ static int qcom_fg_clear_ima(struct qcom_fg_chip *chip,
269+
@@ -990,7 +1035,7 @@ static int qcom_fg_clear_ima(struct qcom_fg_chip *chip,
270270

271271
if (check_hw_sts) {
272272
ret = qcom_fg_read(chip, &hw_sts,
@@ -275,16 +275,16 @@ index f8dd93aa23c7..dd5b2738d553 100644
275275
if (ret) {
276276
dev_err(chip->dev, "Failed to read IMA_HW_STS: %d\n", ret);
277277
return ret;
278-
@@ -1127,7 +1172,7 @@ static int qcom_fg_probe(struct platform_device *pdev)
278+
@@ -1132,7 +1177,7 @@ static int qcom_fg_probe(struct platform_device *pdev)
279279
* IACS_INTR_SRC_SLCT is BIT(3)
280280
*/
281281
ret = qcom_fg_masked_write(chip,
282282
- MEM_INTF_IMA_CFG, BIT(3), BIT(3));
283283
+ MEM_INTF_IMA_CFG(chip), BIT(3), BIT(3));
284284
if (ret) {
285285
dev_err(chip->dev,
286-
"Failed to configure interrupt sourete: %d\n", ret);
287-
@@ -1141,14 +1186,14 @@ static int qcom_fg_probe(struct platform_device *pdev)
286+
"Failed to configure interrupt source: %d\n", ret);
287+
@@ -1146,14 +1191,14 @@ static int qcom_fg_probe(struct platform_device *pdev)
288288
}
289289

290290
/* Check and clear DMA errors */
@@ -301,7 +301,7 @@ index f8dd93aa23c7..dd5b2738d553 100644
301301
error_present ? BIT(0) : 0);
302302
if (ret < 0) {
303303
dev_err(chip->dev, "Failed to write dma_ctl: %d\n", ret);
304-
@@ -1287,7 +1332,7 @@ static int qcom_fg_remove(struct platform_device *pdev)
304+
@@ -1292,7 +1337,7 @@ static int qcom_fg_remove(struct platform_device *pdev)
305305
{
306306
struct qcom_fg_chip *chip = platform_get_drvdata(pdev);
307307

@@ -310,7 +310,7 @@ index f8dd93aa23c7..dd5b2738d553 100644
310310

311311
if(chip->sram_wq)
312312
destroy_workqueue(chip->sram_wq);
313-
@@ -1298,6 +1343,7 @@ static int qcom_fg_remove(struct platform_device *pdev)
313+
@@ -1303,6 +1348,7 @@ static int qcom_fg_remove(struct platform_device *pdev)
314314
static const struct of_device_id fg_match_id_table[] = {
315315
{ .compatible = "qcom,pmi8994-fg", .data = &ops_fg },
316316
{ .compatible = "qcom,pmi8998-fg", .data = &ops_fg_gen3 },

0 commit comments

Comments
 (0)