Skip to content

Commit 502afe7

Browse files
committed
Merge tag 'qcom-drivers-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into arm/drivers
Qualcomm driver updates for v5.8 This contains a large set of cleanups, bug fixes, general improvements and documentation fixes for the RPMH driver. It adds a debugfs mechanism for inspecting Command DB. Socinfo got the "soc_id" attribute defines and definitions for a various variants of MSM8939. RPMH, RPMPD and RPMHPD where made possible to build as modules, but RPMH had to be reverted due to a compilation issue when tracing is enabled. RPMHPD gained power-domains for the SM8250 voltage corners. The SCM driver gained fixes for two build warnings and the SMP2P had an unnecessary error print removed. * tag 'qcom-drivers-for-5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux: (42 commits) Revert "soc: qcom: rpmh: Allow RPMH driver to be loaded as a module" soc: qcom: rpmh-rsc: Remove the pm_lock soc: qcom: rpmh-rsc: Simplify locking by eliminating the per-TCS lock kernel/cpu_pm: Fix uninitted local in cpu_pm soc: qcom: rpmh-rsc: We aren't notified of our own failure w/ NOTIFY_BAD soc: qcom: rpmh-rsc: Correctly ignore CPU_CLUSTER_PM notifications firmware: qcom_scm-legacy: Replace zero-length array with flexible-array soc: qcom: rpmh-rsc: Timeout after 1 second in write_tcs_reg_sync() soc: qcom: rpmh-rsc: Factor "tcs_reg_addr" and "tcs_cmd_addr" calculation soc: qcom: socinfo: add msm8936/39 and apq8036/39 soc ids soc: qcom: aoss: Add SM8250 compatible soc: qcom: pdr: Remove impossible error condition soc: qcom: rpmh: Dirt can only make you dirtier, not cleaner soc: qcom: rpmhpd: Add SM8250 power domains firmware: qcom_scm: fix bogous abuse of dma-direct internals dt-bindings: soc: qcom: apr: Use generic node names for APR services firmware: qcom_scm: Remove unneeded conversion to bool soc: qcom: cmd-db: Properly endian swap the slv_id for debugfs soc: qcom: cmd-db: Use 5 digits for printing address soc: qcom: cmd-db: Cast sizeof() to int to silence field width warning ... Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents 372542d + 1f7a3eb commit 502afe7

File tree

19 files changed

+775
-307
lines changed

19 files changed

+775
-307
lines changed

Documentation/devicetree/bindings/power/qcom,rpmpd.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ properties:
2323
- qcom,sc7180-rpmhpd
2424
- qcom,sdm845-rpmhpd
2525
- qcom,sm8150-rpmhpd
26+
- qcom,sm8250-rpmhpd
2627

2728
'#power-domain-cells':
2829
const: 1

Documentation/devicetree/bindings/soc/qcom/qcom,aoss-qmp.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ power-domains.
1919
"qcom,sc7180-aoss-qmp"
2020
"qcom,sdm845-aoss-qmp"
2121
"qcom,sm8150-aoss-qmp"
22+
"qcom,sm8250-aoss-qmp"
2223

2324
- reg:
2425
Usage: required

Documentation/devicetree/bindings/soc/qcom/qcom,apr.txt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,30 +65,30 @@ which uses apr as communication between Apps and QDSP.
6565
compatible = "qcom,apr-v2";
6666
qcom,apr-domain = <APR_DOMAIN_ADSP>;
6767

68-
q6core@3 {
68+
apr-service@3 {
6969
compatible = "qcom,q6core";
7070
reg = <APR_SVC_ADSP_CORE>;
7171
};
7272

73-
q6afe@4 {
73+
apr-service@4 {
7474
compatible = "qcom,q6afe";
7575
reg = <APR_SVC_AFE>;
7676

7777
dais {
7878
#sound-dai-cells = <1>;
79-
hdmi@1 {
80-
reg = <1>;
79+
dai@1 {
80+
reg = <HDMI_RX>;
8181
};
8282
};
8383
};
8484

85-
q6asm@7 {
85+
apr-service@7 {
8686
compatible = "qcom,q6asm";
8787
reg = <APR_SVC_ASM>;
8888
...
8989
};
9090

91-
q6adm@8 {
91+
apr-service@8 {
9292
compatible = "qcom,q6adm";
9393
reg = <APR_SVC_ADM>;
9494
...
@@ -106,26 +106,26 @@ have no such dependency.
106106
qcom,glink-channels = "apr_audio_svc";
107107
qcom,apr-domain = <APR_DOMAIN_ADSP>;
108108

109-
q6core {
109+
apr-service@3 {
110110
compatible = "qcom,q6core";
111111
reg = <APR_SVC_ADSP_CORE>;
112112
};
113113

114-
q6afe: q6afe {
114+
q6afe: apr-service@4 {
115115
compatible = "qcom,q6afe";
116116
reg = <APR_SVC_AFE>;
117117
qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";
118118
...
119119
};
120120

121-
q6asm: q6asm {
121+
q6asm: apr-service@7 {
122122
compatible = "qcom,q6asm";
123123
reg = <APR_SVC_ASM>;
124124
qcom,protection-domain = "tms/servreg", "msm/slpi/sensor_pd";
125125
...
126126
};
127127

128-
q6adm: q6adm {
128+
q6adm: apr-service@8 {
129129
compatible = "qcom,q6adm";
130130
reg = <APR_SVC_ADM>;
131131
qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd";

drivers/firmware/qcom_scm-legacy.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct scm_legacy_command {
5656
__le32 buf_offset;
5757
__le32 resp_hdr_offset;
5858
__le32 id;
59-
__le32 buf[0];
59+
__le32 buf[];
6060
};
6161

6262
/**

drivers/firmware/qcom_scm.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <linux/init.h>
77
#include <linux/cpumask.h>
88
#include <linux/export.h>
9-
#include <linux/dma-direct.h>
109
#include <linux/dma-mapping.h>
1110
#include <linux/module.h>
1211
#include <linux/types.h>
@@ -806,8 +805,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
806805
struct qcom_scm_mem_map_info *mem_to_map;
807806
phys_addr_t mem_to_map_phys;
808807
phys_addr_t dest_phys;
809-
phys_addr_t ptr_phys;
810-
dma_addr_t ptr_dma;
808+
dma_addr_t ptr_phys;
811809
size_t mem_to_map_sz;
812810
size_t dest_sz;
813811
size_t src_sz;
@@ -824,10 +822,9 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
824822
ptr_sz = ALIGN(src_sz, SZ_64) + ALIGN(mem_to_map_sz, SZ_64) +
825823
ALIGN(dest_sz, SZ_64);
826824

827-
ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_dma, GFP_KERNEL);
825+
ptr = dma_alloc_coherent(__scm->dev, ptr_sz, &ptr_phys, GFP_KERNEL);
828826
if (!ptr)
829827
return -ENOMEM;
830-
ptr_phys = dma_to_phys(__scm->dev, ptr_dma);
831828

832829
/* Fill source vmid detail */
833830
src = ptr;
@@ -855,7 +852,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,
855852

856853
ret = __qcom_scm_assign_mem(__scm->dev, mem_to_map_phys, mem_to_map_sz,
857854
ptr_phys, src_sz, dest_phys, dest_sz);
858-
dma_free_coherent(__scm->dev, ptr_sz, ptr, ptr_dma);
855+
dma_free_coherent(__scm->dev, ptr_sz, ptr, ptr_phys);
859856
if (ret) {
860857
dev_err(__scm->dev,
861858
"Assign memory protection call failed %d\n", ret);
@@ -943,7 +940,7 @@ bool qcom_scm_hdcp_available(void)
943940

944941
qcom_scm_clk_disable();
945942

946-
return ret > 0 ? true : false;
943+
return ret > 0;
947944
}
948945
EXPORT_SYMBOL(qcom_scm_hdcp_available);
949946

drivers/soc/qcom/Kconfig

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ config QCOM_RPMH
117117
help apply the aggregated state on the resource.
118118

119119
config QCOM_RPMHPD
120-
bool "Qualcomm RPMh Power domain driver"
120+
tristate "Qualcomm RPMh Power domain driver"
121121
depends on QCOM_RPMH && QCOM_COMMAND_DB
122122
help
123123
QCOM RPMh Power domain driver to support power-domains with
@@ -126,8 +126,8 @@ config QCOM_RPMHPD
126126
for the voltage rail.
127127

128128
config QCOM_RPMPD
129-
bool "Qualcomm RPM Power domain driver"
130-
depends on QCOM_SMD_RPM=y
129+
tristate "Qualcomm RPM Power domain driver"
130+
depends on QCOM_SMD_RPM
131131
help
132132
QCOM RPM Power domain driver to support power-domains with
133133
performance states. The driver communicates a performance state

drivers/soc/qcom/cmd-db.c

Lines changed: 76 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. */
33

4+
#include <linux/debugfs.h>
45
#include <linux/kernel.h>
56
#include <linux/of.h>
67
#include <linux/of_address.h>
7-
#include <linux/of_platform.h>
88
#include <linux/of_reserved_mem.h>
99
#include <linux/platform_device.h>
10+
#include <linux/seq_file.h>
1011
#include <linux/types.h>
1112

1213
#include <soc/qcom/cmd-db.h>
@@ -236,6 +237,77 @@ enum cmd_db_hw_type cmd_db_read_slave_id(const char *id)
236237
}
237238
EXPORT_SYMBOL(cmd_db_read_slave_id);
238239

240+
#ifdef CONFIG_DEBUG_FS
241+
static int cmd_db_debugfs_dump(struct seq_file *seq, void *p)
242+
{
243+
int i, j;
244+
const struct rsc_hdr *rsc;
245+
const struct entry_header *ent;
246+
const char *name;
247+
u16 len, version;
248+
u8 major, minor;
249+
250+
seq_puts(seq, "Command DB DUMP\n");
251+
252+
for (i = 0; i < MAX_SLV_ID; i++) {
253+
rsc = &cmd_db_header->header[i];
254+
if (!rsc->slv_id)
255+
break;
256+
257+
switch (le16_to_cpu(rsc->slv_id)) {
258+
case CMD_DB_HW_ARC:
259+
name = "ARC";
260+
break;
261+
case CMD_DB_HW_VRM:
262+
name = "VRM";
263+
break;
264+
case CMD_DB_HW_BCM:
265+
name = "BCM";
266+
break;
267+
default:
268+
name = "Unknown";
269+
break;
270+
}
271+
272+
version = le16_to_cpu(rsc->version);
273+
major = version >> 8;
274+
minor = version;
275+
276+
seq_printf(seq, "Slave %s (v%u.%u)\n", name, major, minor);
277+
seq_puts(seq, "-------------------------\n");
278+
279+
ent = rsc_to_entry_header(rsc);
280+
for (j = 0; j < le16_to_cpu(rsc->cnt); j++, ent++) {
281+
seq_printf(seq, "0x%05x: %*pEp", le32_to_cpu(ent->addr),
282+
(int)sizeof(ent->id), ent->id);
283+
284+
len = le16_to_cpu(ent->len);
285+
if (len) {
286+
seq_printf(seq, " [%*ph]",
287+
len, rsc_offset(rsc, ent));
288+
}
289+
seq_putc(seq, '\n');
290+
}
291+
}
292+
293+
return 0;
294+
}
295+
296+
static int open_cmd_db_debugfs(struct inode *inode, struct file *file)
297+
{
298+
return single_open(file, cmd_db_debugfs_dump, inode->i_private);
299+
}
300+
#endif
301+
302+
static const struct file_operations cmd_db_debugfs_ops = {
303+
#ifdef CONFIG_DEBUG_FS
304+
.open = open_cmd_db_debugfs,
305+
#endif
306+
.read = seq_read,
307+
.llseek = seq_lseek,
308+
.release = single_release,
309+
};
310+
239311
static int cmd_db_dev_probe(struct platform_device *pdev)
240312
{
241313
struct reserved_mem *rmem;
@@ -259,12 +331,14 @@ static int cmd_db_dev_probe(struct platform_device *pdev)
259331
return -EINVAL;
260332
}
261333

334+
debugfs_create_file("cmd-db", 0400, NULL, NULL, &cmd_db_debugfs_ops);
335+
262336
return 0;
263337
}
264338

265339
static const struct of_device_id cmd_db_match_table[] = {
266340
{ .compatible = "qcom,cmd-db" },
267-
{ },
341+
{ }
268342
};
269343

270344
static struct platform_driver cmd_db_dev_driver = {

drivers/soc/qcom/pdr_interface.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,6 @@ static int pdr_register_listener(struct pdr_handle *pdr,
155155
return ret;
156156
}
157157

158-
if ((int)resp.curr_state < INT_MIN || (int)resp.curr_state > INT_MAX)
159-
pr_err("PDR: %s notification state invalid: 0x%x\n",
160-
pds->service_path, resp.curr_state);
161-
162158
pds->state = resp.curr_state;
163159

164160
return 0;

drivers/soc/qcom/qcom_aoss.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ static const struct of_device_id qmp_dt_match[] = {
599599
{ .compatible = "qcom,sc7180-aoss-qmp", },
600600
{ .compatible = "qcom,sdm845-aoss-qmp", },
601601
{ .compatible = "qcom,sm8150-aoss-qmp", },
602+
{ .compatible = "qcom,sm8250-aoss-qmp", },
602603
{}
603604
};
604605
MODULE_DEVICE_TABLE(of, qmp_dt_match);

drivers/soc/qcom/rpmh-internal.h

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,23 @@ struct rsc_drv;
2222
* struct tcs_group: group of Trigger Command Sets (TCS) to send state requests
2323
* to the controller
2424
*
25-
* @drv: the controller
26-
* @type: type of the TCS in this group - active, sleep, wake
27-
* @mask: mask of the TCSes relative to all the TCSes in the RSC
28-
* @offset: start of the TCS group relative to the TCSes in the RSC
29-
* @num_tcs: number of TCSes in this type
30-
* @ncpt: number of commands in each TCS
31-
* @lock: lock for synchronizing this TCS writes
32-
* @req: requests that are sent from the TCS
33-
* @cmd_cache: flattened cache of cmds in sleep/wake TCS
34-
* @slots: indicates which of @cmd_addr are occupied
25+
* @drv: The controller.
26+
* @type: Type of the TCS in this group - active, sleep, wake.
27+
* @mask: Mask of the TCSes relative to all the TCSes in the RSC.
28+
* @offset: Start of the TCS group relative to the TCSes in the RSC.
29+
* @num_tcs: Number of TCSes in this type.
30+
* @ncpt: Number of commands in each TCS.
31+
* @req: Requests that are sent from the TCS; only used for ACTIVE_ONLY
32+
* transfers (could be on a wake/sleep TCS if we are borrowing for
33+
* an ACTIVE_ONLY transfer).
34+
* Start: grab drv->lock, set req, set tcs_in_use, drop drv->lock,
35+
* trigger
36+
* End: get irq, access req,
37+
* grab drv->lock, clear tcs_in_use, drop drv->lock
38+
* @slots: Indicates which of @cmd_addr are occupied; only used for
39+
* SLEEP / WAKE TCSs. Things are tightly packed in the
40+
* case that (ncpt < MAX_CMDS_PER_TCS). That is if ncpt = 2 and
41+
* MAX_CMDS_PER_TCS = 16 then bit[2] = the first bit in 2nd TCS.
3542
*/
3643
struct tcs_group {
3744
struct rsc_drv *drv;
@@ -40,9 +47,7 @@ struct tcs_group {
4047
u32 offset;
4148
int num_tcs;
4249
int ncpt;
43-
spinlock_t lock;
4450
const struct tcs_request *req[MAX_TCS_PER_TYPE];
45-
u32 *cmd_cache;
4651
DECLARE_BITMAP(slots, MAX_TCS_SLOTS);
4752
};
4853

@@ -84,20 +89,32 @@ struct rpmh_ctrlr {
8489
* struct rsc_drv: the Direct Resource Voter (DRV) of the
8590
* Resource State Coordinator controller (RSC)
8691
*
87-
* @name: controller identifier
88-
* @tcs_base: start address of the TCS registers in this controller
89-
* @id: instance id in the controller (Direct Resource Voter)
90-
* @num_tcs: number of TCSes in this DRV
91-
* @tcs: TCS groups
92-
* @tcs_in_use: s/w state of the TCS
93-
* @lock: synchronize state of the controller
94-
* @client: handle to the DRV's client.
92+
* @name: Controller identifier.
93+
* @tcs_base: Start address of the TCS registers in this controller.
94+
* @id: Instance id in the controller (Direct Resource Voter).
95+
* @num_tcs: Number of TCSes in this DRV.
96+
* @rsc_pm: CPU PM notifier for controller.
97+
* Used when solver mode is not present.
98+
* @cpus_in_pm: Number of CPUs not in idle power collapse.
99+
* Used when solver mode is not present.
100+
* @tcs: TCS groups.
101+
* @tcs_in_use: S/W state of the TCS; only set for ACTIVE_ONLY
102+
* transfers, but might show a sleep/wake TCS in use if
103+
* it was borrowed for an active_only transfer. You
104+
* must hold the lock in this struct (AKA drv->lock) in
105+
* order to update this.
106+
* @lock: Synchronize state of the controller. If RPMH's cache
107+
* lock will also be held, the order is: drv->lock then
108+
* cache_lock.
109+
* @client: Handle to the DRV's client.
95110
*/
96111
struct rsc_drv {
97112
const char *name;
98113
void __iomem *tcs_base;
99114
int id;
100115
int num_tcs;
116+
struct notifier_block rsc_pm;
117+
atomic_t cpus_in_pm;
101118
struct tcs_group tcs[TCS_TYPE_NR];
102119
DECLARE_BITMAP(tcs_in_use, MAX_TCS_NR);
103120
spinlock_t lock;
@@ -107,7 +124,7 @@ struct rsc_drv {
107124
int rpmh_rsc_send_data(struct rsc_drv *drv, const struct tcs_request *msg);
108125
int rpmh_rsc_write_ctrl_data(struct rsc_drv *drv,
109126
const struct tcs_request *msg);
110-
int rpmh_rsc_invalidate(struct rsc_drv *drv);
127+
void rpmh_rsc_invalidate(struct rsc_drv *drv);
111128

112129
void rpmh_tx_done(const struct tcs_request *msg, int r);
113130
int rpmh_flush(struct rpmh_ctrlr *ctrlr);

0 commit comments

Comments
 (0)