mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 04:18:39 +08:00
Qualcomm driver fixes for v6.11
This corrects the tzmem virt-to-phys conversion, which caused issues for the uefisecapp implementation of EFI variable access. SDM670 is excluded from tzmem usage due to reported issues. The SCM get wait queue context call is corrected to be marked ATOMIC and some dead code in qseecom, following the tzmem conversion, is removed. The memory backing command DB is remapped writecombined, to avoid XPU violations when Linux runs without the Qualcomm hypervisor. Two compile fixes are added for pd-mapper, and the broken reference count is corrected, to make pd-mapper deal with remoteprocs going away. In pmic_glink a race condition where the client callbacks might be called before we returned the client handle is corrected. The broken conditions for when to signal that the firmware is going down is also corrected. In the pmic_glink UCSI driver, the ucsi_unregister() is moved out of the pdr callback, as this is being invoked in atomic context. Konrad's email address is updated in MAINTAINERS, and related mailmap entries are added. -----BEGIN PGP SIGNATURE----- iQJJBAABCAAzFiEEBd4DzF816k8JZtUlCx85Pw2ZrcUFAmbMlmAVHGFuZGVyc3Nv bkBrZXJuZWwub3JnAAoJEAsfOT8Nma3FwZwP/iXn8Okj8Xsg0paofr9jwetFaGAr b6BGd09Ygm8xdNi9zNqLHBZFJQaKlX5Ah5iG0trX1ljDZvdK6JjDz5IUGxXY8T5l R0TW/h/kHiA0UdsQDiGiwK68r4k/9rCwHP14CFSFMSLbTyrX/fiVZy2+GyjJ4/CS 53Dn3swGVeGU4HOZzh9AN4GVtzQu4ECUUZp50StuRvuDqCdjaHbc3JWieTtEWcSt 1dJkacNi1yJi1XxHSW6o7jR7ogDxLvMz95x26zhramPBzbsfAAjrkiwNDMz4w2Cj P+TjGunlYAOUoqwx0r3ffawNqQg5IoQRSH5fe/39UjzAAXdZoBv81BiQYypkWAdz 9Iyc13oEkKXUViS9tad9Qba31Ajxdgs2k0T8+XkLoEiFy9CIx7TtTcAP7549wxUI 89U1LMMZN0iAnEtSmGIc/C7Pr5iap+0beVOJuIZ8tX2vPf2QP8rxe52gvNW39mD3 IQeLnmxrmTSB9wk/ObddGNfftzA4yEOsnzHddv4w9AVoUH9dsvLuv+Y7C7oALTU+ RRvHcuUjJ0NJp7xcK0iTR0iqCKg0Rs+VHTnvWxFaIDGH6QdUMMgdBHXWF/f5mR7K Jx19VHm2u4IyNLxE6tzC/048PM0qEFEQws1C+dXvtuaC38VX5PBIVWGHTeU4ctsN nfkPYQDcEo71FNI5 =Zo90 -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmbPiDsACgkQYKtH/8kJ Uifk1xAAzHhy/tsQXK0IPSSzvJZJN9NeTkkGad6Nt6nN+jMXf9c+vTtDcPFlKMlp hPgXLJ/lh3l6NkEZ+3oI11CL/s3XJEbJaXJ9sqG3E6CUzzO15yII4hd4IqZWIa6x +YxdOlAgoQ6LgumidlgeiwRMxBM51KY7kgJIjv3aNQR0EL1F8tgBOqWCpU7cf8nC dtAdMy7oaVQFLzW4vtSMipmp0ppr2Evgae/u7qAZuSBunFReeQWggIMI3+hAJvtb hInoo8DNksZPfkfLteBmMPO1eyh6ByL2c8PvsriCf+QOK8ADKTwON+6mIya6ubLI Azvvz9cBOuXFPhc5OJKG7ZaN1SLRbuhwN2bf//5H6s54/WZFW9/lKQtxq8zjpGW5 NHKUGoIk/DgyfLs/rEZhvSEXr3jQUCBDNyMAAY0xoPwfqXhPS9flV4FcZn4qiIRh bnW1O4a1xwAT5Dwwla62LnzGbYJiKZ6Xi/VJQqg0uZABGdtw0FtjvY/Z8KJCEzYL H7T4iu9u+K43SNL/TytBXqMkVZNYMzSncu6NkYFpI0G3Pzw+h5q+BjncODn0Y8tX b8ZP/ee84Mumwi8k5lDBllaMoP3I7fyowgFsq5vrE9zpxRiMGJFDf9pxALXJddzN jgm/qia9XIU9VZe+Vnq9O73IPjd5P44v/HgUTRcJAB+5aHcylAk= =pkFq -----END PGP SIGNATURE----- Merge tag 'qcom-drivers-fixes-for-6.11' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux into arm/fixes Qualcomm driver fixes for v6.11 This corrects the tzmem virt-to-phys conversion, which caused issues for the uefisecapp implementation of EFI variable access. SDM670 is excluded from tzmem usage due to reported issues. The SCM get wait queue context call is corrected to be marked ATOMIC and some dead code in qseecom, following the tzmem conversion, is removed. The memory backing command DB is remapped writecombined, to avoid XPU violations when Linux runs without the Qualcomm hypervisor. Two compile fixes are added for pd-mapper, and the broken reference count is corrected, to make pd-mapper deal with remoteprocs going away. In pmic_glink a race condition where the client callbacks might be called before we returned the client handle is corrected. The broken conditions for when to signal that the firmware is going down is also corrected. In the pmic_glink UCSI driver, the ucsi_unregister() is moved out of the pdr callback, as this is being invoked in atomic context. Konrad's email address is updated in MAINTAINERS, and related mailmap entries are added. * tag 'qcom-drivers-fixes-for-6.11' of https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux: soc: qcom: pd-mapper: Fix singleton refcount firmware: qcom: tzmem: disable sdm670 platform soc: qcom: pmic_glink: Actually communicate when remote goes down usb: typec: ucsi: Move unregister out of atomic section soc: qcom: pmic_glink: Fix race during initialization firmware: qcom: qseecom: remove unused functions firmware: qcom: tzmem: fix virtual-to-physical address conversion firmware: qcom: scm: Mark get_wq_ctx() as atomic call MAINTAINERS: Update Konrad Dybcio's email address mailmap: Add an entry for Konrad Dybcio soc: qcom: pd-mapper: mark qcom_pdm_domains as __maybe_unused soc: qcom: cmd-db: Map shared memory as WC, not WB soc: qcom: pd-mapper: Depend on ARCH_QCOM || COMPILE_TEST Link: https://lore.kernel.org/r/20240826145209.1646159-1-andersson@kernel.org Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
d8f2638b83
2
.mailmap
2
.mailmap
@ -354,6 +354,8 @@ Kenneth Westfield <quic_kwestfie@quicinc.com> <kwestfie@codeaurora.org>
|
||||
Kiran Gunda <quic_kgunda@quicinc.com> <kgunda@codeaurora.org>
|
||||
Kirill Tkhai <tkhai@ya.ru> <ktkhai@virtuozzo.com>
|
||||
Kishon Vijay Abraham I <kishon@kernel.org> <kishon@ti.com>
|
||||
Konrad Dybcio <konradybcio@kernel.org> <konrad.dybcio@linaro.org>
|
||||
Konrad Dybcio <konradybcio@kernel.org> <konrad.dybcio@somainline.org>
|
||||
Konstantin Khlebnikov <koct9i@gmail.com> <khlebnikov@yandex-team.ru>
|
||||
Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com>
|
||||
Koushik <raghavendra.koushik@neterion.com>
|
||||
|
@ -2745,7 +2745,7 @@ F: include/linux/soc/qcom/
|
||||
|
||||
ARM/QUALCOMM SUPPORT
|
||||
M: Bjorn Andersson <andersson@kernel.org>
|
||||
M: Konrad Dybcio <konrad.dybcio@linaro.org>
|
||||
M: Konrad Dybcio <konradybcio@kernel.org>
|
||||
L: linux-arm-msm@vger.kernel.org
|
||||
S: Maintained
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git
|
||||
@ -7106,7 +7106,7 @@ F: drivers/gpu/drm/tiny/panel-mipi-dbi.c
|
||||
DRM DRIVER for Qualcomm Adreno GPUs
|
||||
M: Rob Clark <robdclark@gmail.com>
|
||||
R: Sean Paul <sean@poorly.run>
|
||||
R: Konrad Dybcio <konrad.dybcio@linaro.org>
|
||||
R: Konrad Dybcio <konradybcio@kernel.org>
|
||||
L: linux-arm-msm@vger.kernel.org
|
||||
L: dri-devel@lists.freedesktop.org
|
||||
L: freedreno@lists.freedesktop.org
|
||||
@ -18774,7 +18774,7 @@ F: include/uapi/drm/qaic_accel.h
|
||||
|
||||
QUALCOMM CORE POWER REDUCTION (CPR) AVS DRIVER
|
||||
M: Bjorn Andersson <andersson@kernel.org>
|
||||
M: Konrad Dybcio <konrad.dybcio@linaro.org>
|
||||
M: Konrad Dybcio <konradybcio@kernel.org>
|
||||
L: linux-pm@vger.kernel.org
|
||||
L: linux-arm-msm@vger.kernel.org
|
||||
S: Maintained
|
||||
|
@ -73,7 +73,7 @@ int scm_get_wq_ctx(u32 *wq_ctx, u32 *flags, u32 *more_pending)
|
||||
struct arm_smccc_res get_wq_res;
|
||||
struct arm_smccc_args get_wq_ctx = {0};
|
||||
|
||||
get_wq_ctx.args[0] = ARM_SMCCC_CALL_VAL(ARM_SMCCC_STD_CALL,
|
||||
get_wq_ctx.args[0] = ARM_SMCCC_CALL_VAL(ARM_SMCCC_FAST_CALL,
|
||||
ARM_SMCCC_SMC_64, ARM_SMCCC_OWNER_SIP,
|
||||
SCM_SMC_FNID(QCOM_SCM_SVC_WAITQ, QCOM_SCM_WAITQ_GET_WQ_CTX));
|
||||
|
||||
|
@ -40,7 +40,6 @@ struct qcom_tzmem_pool {
|
||||
};
|
||||
|
||||
struct qcom_tzmem_chunk {
|
||||
phys_addr_t paddr;
|
||||
size_t size;
|
||||
struct qcom_tzmem_pool *owner;
|
||||
};
|
||||
@ -78,6 +77,7 @@ static bool qcom_tzmem_using_shm_bridge;
|
||||
/* List of machines that are known to not support SHM bridge correctly. */
|
||||
static const char *const qcom_tzmem_blacklist[] = {
|
||||
"qcom,sc8180x",
|
||||
"qcom,sdm670", /* failure in GPU firmware loading */
|
||||
"qcom,sdm845", /* reset in rmtfs memory assignment */
|
||||
"qcom,sm8150", /* reset in rmtfs memory assignment */
|
||||
NULL
|
||||
@ -385,7 +385,6 @@ again:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
chunk->paddr = gen_pool_virt_to_phys(pool->genpool, vaddr);
|
||||
chunk->size = size;
|
||||
chunk->owner = pool;
|
||||
|
||||
@ -431,25 +430,37 @@ void qcom_tzmem_free(void *vaddr)
|
||||
EXPORT_SYMBOL_GPL(qcom_tzmem_free);
|
||||
|
||||
/**
|
||||
* qcom_tzmem_to_phys() - Map the virtual address of a TZ buffer to physical.
|
||||
* @vaddr: Virtual address of the buffer allocated from a TZ memory pool.
|
||||
* qcom_tzmem_to_phys() - Map the virtual address of TZ memory to physical.
|
||||
* @vaddr: Virtual address of memory allocated from a TZ memory pool.
|
||||
*
|
||||
* Can be used in any context. The address must have been returned by a call
|
||||
* to qcom_tzmem_alloc().
|
||||
* Can be used in any context. The address must point to memory allocated
|
||||
* using qcom_tzmem_alloc().
|
||||
*
|
||||
* Returns: Physical address of the buffer.
|
||||
* Returns:
|
||||
* Physical address mapped from the virtual or 0 if the mapping failed.
|
||||
*/
|
||||
phys_addr_t qcom_tzmem_to_phys(void *vaddr)
|
||||
{
|
||||
struct qcom_tzmem_chunk *chunk;
|
||||
struct radix_tree_iter iter;
|
||||
void __rcu **slot;
|
||||
phys_addr_t ret;
|
||||
|
||||
guard(spinlock_irqsave)(&qcom_tzmem_chunks_lock);
|
||||
|
||||
chunk = radix_tree_lookup(&qcom_tzmem_chunks, (unsigned long)vaddr);
|
||||
if (!chunk)
|
||||
return 0;
|
||||
radix_tree_for_each_slot(slot, &qcom_tzmem_chunks, &iter, 0) {
|
||||
chunk = radix_tree_deref_slot_protected(slot,
|
||||
&qcom_tzmem_chunks_lock);
|
||||
|
||||
return chunk->paddr;
|
||||
ret = gen_pool_virt_to_phys(chunk->owner->genpool,
|
||||
(unsigned long)vaddr);
|
||||
if (ret == -1)
|
||||
continue;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(qcom_tzmem_to_phys);
|
||||
|
||||
|
@ -1387,12 +1387,16 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev,
|
||||
"failed to register wireless charing power supply\n");
|
||||
}
|
||||
|
||||
battmgr->client = devm_pmic_glink_register_client(dev,
|
||||
PMIC_GLINK_OWNER_BATTMGR,
|
||||
qcom_battmgr_callback,
|
||||
qcom_battmgr_pdr_notify,
|
||||
battmgr);
|
||||
return PTR_ERR_OR_ZERO(battmgr->client);
|
||||
battmgr->client = devm_pmic_glink_client_alloc(dev, PMIC_GLINK_OWNER_BATTMGR,
|
||||
qcom_battmgr_callback,
|
||||
qcom_battmgr_pdr_notify,
|
||||
battmgr);
|
||||
if (IS_ERR(battmgr->client))
|
||||
return PTR_ERR(battmgr->client);
|
||||
|
||||
pmic_glink_client_register(battmgr->client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct auxiliary_device_id qcom_battmgr_id_table[] = {
|
||||
|
@ -77,7 +77,7 @@ config QCOM_PD_MAPPER
|
||||
select QCOM_QMI_HELPERS
|
||||
select QCOM_PDR_MSG
|
||||
select AUXILIARY_BUS
|
||||
depends on NET && QRTR
|
||||
depends on NET && QRTR && (ARCH_QCOM || COMPILE_TEST)
|
||||
default QCOM_RPROC_COMMON
|
||||
help
|
||||
The Protection Domain Mapper maps registered services to the domains
|
||||
|
@ -349,7 +349,7 @@ static int cmd_db_dev_probe(struct platform_device *pdev)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WB);
|
||||
cmd_db_header = memremap(rmem->base, rmem->size, MEMREMAP_WC);
|
||||
if (!cmd_db_header) {
|
||||
ret = -ENOMEM;
|
||||
cmd_db_header = NULL;
|
||||
|
@ -66,15 +66,14 @@ static void _devm_pmic_glink_release_client(struct device *dev, void *res)
|
||||
spin_unlock_irqrestore(&pg->client_lock, flags);
|
||||
}
|
||||
|
||||
struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev,
|
||||
unsigned int id,
|
||||
void (*cb)(const void *, size_t, void *),
|
||||
void (*pdr)(void *, int),
|
||||
void *priv)
|
||||
struct pmic_glink_client *devm_pmic_glink_client_alloc(struct device *dev,
|
||||
unsigned int id,
|
||||
void (*cb)(const void *, size_t, void *),
|
||||
void (*pdr)(void *, int),
|
||||
void *priv)
|
||||
{
|
||||
struct pmic_glink_client *client;
|
||||
struct pmic_glink *pg = dev_get_drvdata(dev->parent);
|
||||
unsigned long flags;
|
||||
|
||||
client = devres_alloc(_devm_pmic_glink_release_client, sizeof(*client), GFP_KERNEL);
|
||||
if (!client)
|
||||
@ -85,6 +84,18 @@ struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev,
|
||||
client->cb = cb;
|
||||
client->pdr_notify = pdr;
|
||||
client->priv = priv;
|
||||
INIT_LIST_HEAD(&client->node);
|
||||
|
||||
devres_add(dev, client);
|
||||
|
||||
return client;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_pmic_glink_client_alloc);
|
||||
|
||||
void pmic_glink_client_register(struct pmic_glink_client *client)
|
||||
{
|
||||
struct pmic_glink *pg = client->pg;
|
||||
unsigned long flags;
|
||||
|
||||
mutex_lock(&pg->state_lock);
|
||||
spin_lock_irqsave(&pg->client_lock, flags);
|
||||
@ -95,17 +106,22 @@ struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev,
|
||||
spin_unlock_irqrestore(&pg->client_lock, flags);
|
||||
mutex_unlock(&pg->state_lock);
|
||||
|
||||
devres_add(dev, client);
|
||||
|
||||
return client;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(devm_pmic_glink_register_client);
|
||||
EXPORT_SYMBOL_GPL(pmic_glink_client_register);
|
||||
|
||||
int pmic_glink_send(struct pmic_glink_client *client, void *data, size_t len)
|
||||
{
|
||||
struct pmic_glink *pg = client->pg;
|
||||
int ret;
|
||||
|
||||
return rpmsg_send(pg->ept, data, len);
|
||||
mutex_lock(&pg->state_lock);
|
||||
if (!pg->ept)
|
||||
ret = -ECONNRESET;
|
||||
else
|
||||
ret = rpmsg_send(pg->ept, data, len);
|
||||
mutex_unlock(&pg->state_lock);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(pmic_glink_send);
|
||||
|
||||
@ -175,7 +191,7 @@ static void pmic_glink_state_notify_clients(struct pmic_glink *pg)
|
||||
if (pg->pdr_state == SERVREG_SERVICE_STATE_UP && pg->ept)
|
||||
new_state = SERVREG_SERVICE_STATE_UP;
|
||||
} else {
|
||||
if (pg->pdr_state == SERVREG_SERVICE_STATE_UP && pg->ept)
|
||||
if (pg->pdr_state == SERVREG_SERVICE_STATE_DOWN || !pg->ept)
|
||||
new_state = SERVREG_SERVICE_STATE_DOWN;
|
||||
}
|
||||
|
||||
|
@ -520,12 +520,17 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
altmode->client = devm_pmic_glink_register_client(dev,
|
||||
altmode->owner_id,
|
||||
pmic_glink_altmode_callback,
|
||||
pmic_glink_altmode_pdr_notify,
|
||||
altmode);
|
||||
return PTR_ERR_OR_ZERO(altmode->client);
|
||||
altmode->client = devm_pmic_glink_client_alloc(dev,
|
||||
altmode->owner_id,
|
||||
pmic_glink_altmode_callback,
|
||||
pmic_glink_altmode_pdr_notify,
|
||||
altmode);
|
||||
if (IS_ERR(altmode->client))
|
||||
return PTR_ERR(altmode->client);
|
||||
|
||||
pmic_glink_client_register(altmode->client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct auxiliary_device_id pmic_glink_altmode_id_table[] = {
|
||||
|
@ -517,7 +517,7 @@ static const struct qcom_pdm_domain_data *sm8550_domains[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct of_device_id qcom_pdm_domains[] = {
|
||||
static const struct of_device_id qcom_pdm_domains[] __maybe_unused = {
|
||||
{ .compatible = "qcom,apq8064", .data = NULL, },
|
||||
{ .compatible = "qcom,apq8074", .data = NULL, },
|
||||
{ .compatible = "qcom,apq8084", .data = NULL, },
|
||||
@ -635,6 +635,8 @@ static int qcom_pdm_probe(struct auxiliary_device *auxdev,
|
||||
ret = PTR_ERR(data);
|
||||
else
|
||||
__qcom_pdm_data = data;
|
||||
} else {
|
||||
refcount_inc(&__qcom_pdm_data->refcnt);
|
||||
}
|
||||
|
||||
auxiliary_set_drvdata(auxdev, __qcom_pdm_data);
|
||||
|
@ -68,6 +68,9 @@ struct pmic_glink_ucsi {
|
||||
|
||||
struct work_struct notify_work;
|
||||
struct work_struct register_work;
|
||||
spinlock_t state_lock;
|
||||
bool ucsi_registered;
|
||||
bool pd_running;
|
||||
|
||||
u8 read_buf[UCSI_BUF_SIZE];
|
||||
};
|
||||
@ -244,8 +247,20 @@ static void pmic_glink_ucsi_notify(struct work_struct *work)
|
||||
static void pmic_glink_ucsi_register(struct work_struct *work)
|
||||
{
|
||||
struct pmic_glink_ucsi *ucsi = container_of(work, struct pmic_glink_ucsi, register_work);
|
||||
unsigned long flags;
|
||||
bool pd_running;
|
||||
|
||||
ucsi_register(ucsi->ucsi);
|
||||
spin_lock_irqsave(&ucsi->state_lock, flags);
|
||||
pd_running = ucsi->pd_running;
|
||||
spin_unlock_irqrestore(&ucsi->state_lock, flags);
|
||||
|
||||
if (!ucsi->ucsi_registered && pd_running) {
|
||||
ucsi_register(ucsi->ucsi);
|
||||
ucsi->ucsi_registered = true;
|
||||
} else if (ucsi->ucsi_registered && !pd_running) {
|
||||
ucsi_unregister(ucsi->ucsi);
|
||||
ucsi->ucsi_registered = false;
|
||||
}
|
||||
}
|
||||
|
||||
static void pmic_glink_ucsi_callback(const void *data, size_t len, void *priv)
|
||||
@ -269,11 +284,12 @@ static void pmic_glink_ucsi_callback(const void *data, size_t len, void *priv)
|
||||
static void pmic_glink_ucsi_pdr_notify(void *priv, int state)
|
||||
{
|
||||
struct pmic_glink_ucsi *ucsi = priv;
|
||||
unsigned long flags;
|
||||
|
||||
if (state == SERVREG_SERVICE_STATE_UP)
|
||||
schedule_work(&ucsi->register_work);
|
||||
else if (state == SERVREG_SERVICE_STATE_DOWN)
|
||||
ucsi_unregister(ucsi->ucsi);
|
||||
spin_lock_irqsave(&ucsi->state_lock, flags);
|
||||
ucsi->pd_running = (state == SERVREG_SERVICE_STATE_UP);
|
||||
spin_unlock_irqrestore(&ucsi->state_lock, flags);
|
||||
schedule_work(&ucsi->register_work);
|
||||
}
|
||||
|
||||
static void pmic_glink_ucsi_destroy(void *data)
|
||||
@ -320,6 +336,7 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev,
|
||||
INIT_WORK(&ucsi->register_work, pmic_glink_ucsi_register);
|
||||
init_completion(&ucsi->read_ack);
|
||||
init_completion(&ucsi->write_ack);
|
||||
spin_lock_init(&ucsi->state_lock);
|
||||
mutex_init(&ucsi->lock);
|
||||
|
||||
ucsi->ucsi = ucsi_create(dev, &pmic_glink_ucsi_ops);
|
||||
@ -367,12 +384,16 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev,
|
||||
ucsi->port_orientation[port] = desc;
|
||||
}
|
||||
|
||||
ucsi->client = devm_pmic_glink_register_client(dev,
|
||||
PMIC_GLINK_OWNER_USBC,
|
||||
pmic_glink_ucsi_callback,
|
||||
pmic_glink_ucsi_pdr_notify,
|
||||
ucsi);
|
||||
return PTR_ERR_OR_ZERO(ucsi->client);
|
||||
ucsi->client = devm_pmic_glink_client_alloc(dev, PMIC_GLINK_OWNER_USBC,
|
||||
pmic_glink_ucsi_callback,
|
||||
pmic_glink_ucsi_pdr_notify,
|
||||
ucsi);
|
||||
if (IS_ERR(ucsi->client))
|
||||
return PTR_ERR(ucsi->client);
|
||||
|
||||
pmic_glink_client_register(ucsi->client);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pmic_glink_ucsi_remove(struct auxiliary_device *adev)
|
||||
|
@ -25,51 +25,6 @@ struct qseecom_client {
|
||||
u32 app_id;
|
||||
};
|
||||
|
||||
/**
|
||||
* qseecom_scm_dev() - Get the SCM device associated with the QSEECOM client.
|
||||
* @client: The QSEECOM client device.
|
||||
*
|
||||
* Returns the SCM device under which the provided QSEECOM client device
|
||||
* operates. This function is intended to be used for DMA allocations.
|
||||
*/
|
||||
static inline struct device *qseecom_scm_dev(struct qseecom_client *client)
|
||||
{
|
||||
return client->aux_dev.dev.parent->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* qseecom_dma_alloc() - Allocate DMA memory for a QSEECOM client.
|
||||
* @client: The QSEECOM client to allocate the memory for.
|
||||
* @size: The number of bytes to allocate.
|
||||
* @dma_handle: Pointer to where the DMA address should be stored.
|
||||
* @gfp: Allocation flags.
|
||||
*
|
||||
* Wrapper function for dma_alloc_coherent(), allocating DMA memory usable for
|
||||
* TZ/QSEECOM communication. Refer to dma_alloc_coherent() for details.
|
||||
*/
|
||||
static inline void *qseecom_dma_alloc(struct qseecom_client *client, size_t size,
|
||||
dma_addr_t *dma_handle, gfp_t gfp)
|
||||
{
|
||||
return dma_alloc_coherent(qseecom_scm_dev(client), size, dma_handle, gfp);
|
||||
}
|
||||
|
||||
/**
|
||||
* dma_free_coherent() - Free QSEECOM DMA memory.
|
||||
* @client: The QSEECOM client for which the memory has been allocated.
|
||||
* @size: The number of bytes allocated.
|
||||
* @cpu_addr: Virtual memory address to free.
|
||||
* @dma_handle: DMA memory address to free.
|
||||
*
|
||||
* Wrapper function for dma_free_coherent(), freeing memory previously
|
||||
* allocated with qseecom_dma_alloc(). Refer to dma_free_coherent() for
|
||||
* details.
|
||||
*/
|
||||
static inline void qseecom_dma_free(struct qseecom_client *client, size_t size,
|
||||
void *cpu_addr, dma_addr_t dma_handle)
|
||||
{
|
||||
return dma_free_coherent(qseecom_scm_dev(client), size, cpu_addr, dma_handle);
|
||||
}
|
||||
|
||||
/**
|
||||
* qcom_qseecom_app_send() - Send to and receive data from a given QSEE app.
|
||||
* @client: The QSEECOM client associated with the target app.
|
||||
|
@ -23,10 +23,11 @@ struct pmic_glink_hdr {
|
||||
|
||||
int pmic_glink_send(struct pmic_glink_client *client, void *data, size_t len);
|
||||
|
||||
struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev,
|
||||
unsigned int id,
|
||||
void (*cb)(const void *, size_t, void *),
|
||||
void (*pdr)(void *, int),
|
||||
void *priv);
|
||||
struct pmic_glink_client *devm_pmic_glink_client_alloc(struct device *dev,
|
||||
unsigned int id,
|
||||
void (*cb)(const void *, size_t, void *),
|
||||
void (*pdr)(void *, int),
|
||||
void *priv);
|
||||
void pmic_glink_client_register(struct pmic_glink_client *client);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user