Commit d8f2638b authored by Arnd Bergmann's avatar Arnd Bergmann

Merge tag 'qcom-drivers-fixes-for-6.11' of...

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.orgSigned-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parents 27795c50 c158ceb8
...@@ -354,6 +354,8 @@ Kenneth Westfield <quic_kwestfie@quicinc.com> <kwestfie@codeaurora.org> ...@@ -354,6 +354,8 @@ Kenneth Westfield <quic_kwestfie@quicinc.com> <kwestfie@codeaurora.org>
Kiran Gunda <quic_kgunda@quicinc.com> <kgunda@codeaurora.org> Kiran Gunda <quic_kgunda@quicinc.com> <kgunda@codeaurora.org>
Kirill Tkhai <tkhai@ya.ru> <ktkhai@virtuozzo.com> Kirill Tkhai <tkhai@ya.ru> <ktkhai@virtuozzo.com>
Kishon Vijay Abraham I <kishon@kernel.org> <kishon@ti.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> <khlebnikov@yandex-team.ru>
Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com> Konstantin Khlebnikov <koct9i@gmail.com> <k.khlebnikov@samsung.com>
Koushik <raghavendra.koushik@neterion.com> Koushik <raghavendra.koushik@neterion.com>
......
...@@ -2745,7 +2745,7 @@ F: include/linux/soc/qcom/ ...@@ -2745,7 +2745,7 @@ F: include/linux/soc/qcom/
ARM/QUALCOMM SUPPORT ARM/QUALCOMM SUPPORT
M: Bjorn Andersson <andersson@kernel.org> 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 L: linux-arm-msm@vger.kernel.org
S: Maintained S: Maintained
T: git git://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git 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 ...@@ -7106,7 +7106,7 @@ F: drivers/gpu/drm/tiny/panel-mipi-dbi.c
DRM DRIVER for Qualcomm Adreno GPUs DRM DRIVER for Qualcomm Adreno GPUs
M: Rob Clark <robdclark@gmail.com> M: Rob Clark <robdclark@gmail.com>
R: Sean Paul <sean@poorly.run> 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: linux-arm-msm@vger.kernel.org
L: dri-devel@lists.freedesktop.org L: dri-devel@lists.freedesktop.org
L: freedreno@lists.freedesktop.org L: freedreno@lists.freedesktop.org
...@@ -18774,7 +18774,7 @@ F: include/uapi/drm/qaic_accel.h ...@@ -18774,7 +18774,7 @@ F: include/uapi/drm/qaic_accel.h
QUALCOMM CORE POWER REDUCTION (CPR) AVS DRIVER QUALCOMM CORE POWER REDUCTION (CPR) AVS DRIVER
M: Bjorn Andersson <andersson@kernel.org> 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-pm@vger.kernel.org
L: linux-arm-msm@vger.kernel.org L: linux-arm-msm@vger.kernel.org
S: Maintained S: Maintained
......
...@@ -73,7 +73,7 @@ int scm_get_wq_ctx(u32 *wq_ctx, u32 *flags, u32 *more_pending) ...@@ -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_res get_wq_res;
struct arm_smccc_args get_wq_ctx = {0}; 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, ARM_SMCCC_SMC_64, ARM_SMCCC_OWNER_SIP,
SCM_SMC_FNID(QCOM_SCM_SVC_WAITQ, QCOM_SCM_WAITQ_GET_WQ_CTX)); SCM_SMC_FNID(QCOM_SCM_SVC_WAITQ, QCOM_SCM_WAITQ_GET_WQ_CTX));
......
...@@ -40,7 +40,6 @@ struct qcom_tzmem_pool { ...@@ -40,7 +40,6 @@ struct qcom_tzmem_pool {
}; };
struct qcom_tzmem_chunk { struct qcom_tzmem_chunk {
phys_addr_t paddr;
size_t size; size_t size;
struct qcom_tzmem_pool *owner; struct qcom_tzmem_pool *owner;
}; };
...@@ -78,6 +77,7 @@ static bool qcom_tzmem_using_shm_bridge; ...@@ -78,6 +77,7 @@ static bool qcom_tzmem_using_shm_bridge;
/* List of machines that are known to not support SHM bridge correctly. */ /* List of machines that are known to not support SHM bridge correctly. */
static const char *const qcom_tzmem_blacklist[] = { static const char *const qcom_tzmem_blacklist[] = {
"qcom,sc8180x", "qcom,sc8180x",
"qcom,sdm670", /* failure in GPU firmware loading */
"qcom,sdm845", /* reset in rmtfs memory assignment */ "qcom,sdm845", /* reset in rmtfs memory assignment */
"qcom,sm8150", /* reset in rmtfs memory assignment */ "qcom,sm8150", /* reset in rmtfs memory assignment */
NULL NULL
...@@ -385,7 +385,6 @@ void *qcom_tzmem_alloc(struct qcom_tzmem_pool *pool, size_t size, gfp_t gfp) ...@@ -385,7 +385,6 @@ void *qcom_tzmem_alloc(struct qcom_tzmem_pool *pool, size_t size, gfp_t gfp)
return NULL; return NULL;
} }
chunk->paddr = gen_pool_virt_to_phys(pool->genpool, vaddr);
chunk->size = size; chunk->size = size;
chunk->owner = pool; chunk->owner = pool;
...@@ -431,25 +430,37 @@ void qcom_tzmem_free(void *vaddr) ...@@ -431,25 +430,37 @@ void qcom_tzmem_free(void *vaddr)
EXPORT_SYMBOL_GPL(qcom_tzmem_free); EXPORT_SYMBOL_GPL(qcom_tzmem_free);
/** /**
* qcom_tzmem_to_phys() - Map the virtual address of a TZ buffer to physical. * qcom_tzmem_to_phys() - Map the virtual address of TZ memory to physical.
* @vaddr: Virtual address of the buffer allocated from a TZ memory pool. * @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 * Can be used in any context. The address must point to memory allocated
* to qcom_tzmem_alloc(). * 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) phys_addr_t qcom_tzmem_to_phys(void *vaddr)
{ {
struct qcom_tzmem_chunk *chunk; struct qcom_tzmem_chunk *chunk;
struct radix_tree_iter iter;
void __rcu **slot;
phys_addr_t ret;
guard(spinlock_irqsave)(&qcom_tzmem_chunks_lock); guard(spinlock_irqsave)(&qcom_tzmem_chunks_lock);
chunk = radix_tree_lookup(&qcom_tzmem_chunks, (unsigned long)vaddr); radix_tree_for_each_slot(slot, &qcom_tzmem_chunks, &iter, 0) {
if (!chunk) chunk = radix_tree_deref_slot_protected(slot,
return 0; &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); EXPORT_SYMBOL_GPL(qcom_tzmem_to_phys);
......
...@@ -1387,12 +1387,16 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev, ...@@ -1387,12 +1387,16 @@ static int qcom_battmgr_probe(struct auxiliary_device *adev,
"failed to register wireless charing power supply\n"); "failed to register wireless charing power supply\n");
} }
battmgr->client = devm_pmic_glink_register_client(dev, battmgr->client = devm_pmic_glink_client_alloc(dev, PMIC_GLINK_OWNER_BATTMGR,
PMIC_GLINK_OWNER_BATTMGR, qcom_battmgr_callback,
qcom_battmgr_callback, qcom_battmgr_pdr_notify,
qcom_battmgr_pdr_notify, battmgr);
battmgr); if (IS_ERR(battmgr->client))
return PTR_ERR_OR_ZERO(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[] = { static const struct auxiliary_device_id qcom_battmgr_id_table[] = {
......
...@@ -77,7 +77,7 @@ config QCOM_PD_MAPPER ...@@ -77,7 +77,7 @@ config QCOM_PD_MAPPER
select QCOM_QMI_HELPERS select QCOM_QMI_HELPERS
select QCOM_PDR_MSG select QCOM_PDR_MSG
select AUXILIARY_BUS select AUXILIARY_BUS
depends on NET && QRTR depends on NET && QRTR && (ARCH_QCOM || COMPILE_TEST)
default QCOM_RPROC_COMMON default QCOM_RPROC_COMMON
help help
The Protection Domain Mapper maps registered services to the domains The Protection Domain Mapper maps registered services to the domains
......
...@@ -349,7 +349,7 @@ static int cmd_db_dev_probe(struct platform_device *pdev) ...@@ -349,7 +349,7 @@ static int cmd_db_dev_probe(struct platform_device *pdev)
return -EINVAL; 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) { if (!cmd_db_header) {
ret = -ENOMEM; ret = -ENOMEM;
cmd_db_header = NULL; cmd_db_header = NULL;
......
...@@ -66,15 +66,14 @@ static void _devm_pmic_glink_release_client(struct device *dev, void *res) ...@@ -66,15 +66,14 @@ static void _devm_pmic_glink_release_client(struct device *dev, void *res)
spin_unlock_irqrestore(&pg->client_lock, flags); spin_unlock_irqrestore(&pg->client_lock, flags);
} }
struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev, struct pmic_glink_client *devm_pmic_glink_client_alloc(struct device *dev,
unsigned int id, unsigned int id,
void (*cb)(const void *, size_t, void *), void (*cb)(const void *, size_t, void *),
void (*pdr)(void *, int), void (*pdr)(void *, int),
void *priv) void *priv)
{ {
struct pmic_glink_client *client; struct pmic_glink_client *client;
struct pmic_glink *pg = dev_get_drvdata(dev->parent); struct pmic_glink *pg = dev_get_drvdata(dev->parent);
unsigned long flags;
client = devres_alloc(_devm_pmic_glink_release_client, sizeof(*client), GFP_KERNEL); client = devres_alloc(_devm_pmic_glink_release_client, sizeof(*client), GFP_KERNEL);
if (!client) if (!client)
...@@ -85,6 +84,18 @@ struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev, ...@@ -85,6 +84,18 @@ struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev,
client->cb = cb; client->cb = cb;
client->pdr_notify = pdr; client->pdr_notify = pdr;
client->priv = priv; 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); mutex_lock(&pg->state_lock);
spin_lock_irqsave(&pg->client_lock, flags); spin_lock_irqsave(&pg->client_lock, flags);
...@@ -95,17 +106,22 @@ struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev, ...@@ -95,17 +106,22 @@ struct pmic_glink_client *devm_pmic_glink_register_client(struct device *dev,
spin_unlock_irqrestore(&pg->client_lock, flags); spin_unlock_irqrestore(&pg->client_lock, flags);
mutex_unlock(&pg->state_lock); 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) int pmic_glink_send(struct pmic_glink_client *client, void *data, size_t len)
{ {
struct pmic_glink *pg = client->pg; 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); EXPORT_SYMBOL_GPL(pmic_glink_send);
...@@ -175,7 +191,7 @@ static void pmic_glink_state_notify_clients(struct pmic_glink *pg) ...@@ -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) if (pg->pdr_state == SERVREG_SERVICE_STATE_UP && pg->ept)
new_state = SERVREG_SERVICE_STATE_UP; new_state = SERVREG_SERVICE_STATE_UP;
} else { } 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; new_state = SERVREG_SERVICE_STATE_DOWN;
} }
......
...@@ -520,12 +520,17 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev, ...@@ -520,12 +520,17 @@ static int pmic_glink_altmode_probe(struct auxiliary_device *adev,
return ret; return ret;
} }
altmode->client = devm_pmic_glink_register_client(dev, altmode->client = devm_pmic_glink_client_alloc(dev,
altmode->owner_id, altmode->owner_id,
pmic_glink_altmode_callback, pmic_glink_altmode_callback,
pmic_glink_altmode_pdr_notify, pmic_glink_altmode_pdr_notify,
altmode); altmode);
return PTR_ERR_OR_ZERO(altmode->client); 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[] = { static const struct auxiliary_device_id pmic_glink_altmode_id_table[] = {
......
...@@ -517,7 +517,7 @@ static const struct qcom_pdm_domain_data *sm8550_domains[] = { ...@@ -517,7 +517,7 @@ static const struct qcom_pdm_domain_data *sm8550_domains[] = {
NULL, 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,apq8064", .data = NULL, },
{ .compatible = "qcom,apq8074", .data = NULL, }, { .compatible = "qcom,apq8074", .data = NULL, },
{ .compatible = "qcom,apq8084", .data = NULL, }, { .compatible = "qcom,apq8084", .data = NULL, },
...@@ -635,6 +635,8 @@ static int qcom_pdm_probe(struct auxiliary_device *auxdev, ...@@ -635,6 +635,8 @@ static int qcom_pdm_probe(struct auxiliary_device *auxdev,
ret = PTR_ERR(data); ret = PTR_ERR(data);
else else
__qcom_pdm_data = data; __qcom_pdm_data = data;
} else {
refcount_inc(&__qcom_pdm_data->refcnt);
} }
auxiliary_set_drvdata(auxdev, __qcom_pdm_data); auxiliary_set_drvdata(auxdev, __qcom_pdm_data);
......
...@@ -68,6 +68,9 @@ struct pmic_glink_ucsi { ...@@ -68,6 +68,9 @@ struct pmic_glink_ucsi {
struct work_struct notify_work; struct work_struct notify_work;
struct work_struct register_work; struct work_struct register_work;
spinlock_t state_lock;
bool ucsi_registered;
bool pd_running;
u8 read_buf[UCSI_BUF_SIZE]; u8 read_buf[UCSI_BUF_SIZE];
}; };
...@@ -244,8 +247,20 @@ static void pmic_glink_ucsi_notify(struct work_struct *work) ...@@ -244,8 +247,20 @@ static void pmic_glink_ucsi_notify(struct work_struct *work)
static void pmic_glink_ucsi_register(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); 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) 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) ...@@ -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) static void pmic_glink_ucsi_pdr_notify(void *priv, int state)
{ {
struct pmic_glink_ucsi *ucsi = priv; struct pmic_glink_ucsi *ucsi = priv;
unsigned long flags;
if (state == SERVREG_SERVICE_STATE_UP) spin_lock_irqsave(&ucsi->state_lock, flags);
schedule_work(&ucsi->register_work); ucsi->pd_running = (state == SERVREG_SERVICE_STATE_UP);
else if (state == SERVREG_SERVICE_STATE_DOWN) spin_unlock_irqrestore(&ucsi->state_lock, flags);
ucsi_unregister(ucsi->ucsi); schedule_work(&ucsi->register_work);
} }
static void pmic_glink_ucsi_destroy(void *data) static void pmic_glink_ucsi_destroy(void *data)
...@@ -320,6 +336,7 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev, ...@@ -320,6 +336,7 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev,
INIT_WORK(&ucsi->register_work, pmic_glink_ucsi_register); INIT_WORK(&ucsi->register_work, pmic_glink_ucsi_register);
init_completion(&ucsi->read_ack); init_completion(&ucsi->read_ack);
init_completion(&ucsi->write_ack); init_completion(&ucsi->write_ack);
spin_lock_init(&ucsi->state_lock);
mutex_init(&ucsi->lock); mutex_init(&ucsi->lock);
ucsi->ucsi = ucsi_create(dev, &pmic_glink_ucsi_ops); ucsi->ucsi = ucsi_create(dev, &pmic_glink_ucsi_ops);
...@@ -367,12 +384,16 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev, ...@@ -367,12 +384,16 @@ static int pmic_glink_ucsi_probe(struct auxiliary_device *adev,
ucsi->port_orientation[port] = desc; ucsi->port_orientation[port] = desc;
} }
ucsi->client = devm_pmic_glink_register_client(dev, ucsi->client = devm_pmic_glink_client_alloc(dev, PMIC_GLINK_OWNER_USBC,
PMIC_GLINK_OWNER_USBC, pmic_glink_ucsi_callback,
pmic_glink_ucsi_callback, pmic_glink_ucsi_pdr_notify,
pmic_glink_ucsi_pdr_notify, ucsi);
ucsi); if (IS_ERR(ucsi->client))
return PTR_ERR_OR_ZERO(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) static void pmic_glink_ucsi_remove(struct auxiliary_device *adev)
......
...@@ -25,51 +25,6 @@ struct qseecom_client { ...@@ -25,51 +25,6 @@ struct qseecom_client {
u32 app_id; 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. * qcom_qseecom_app_send() - Send to and receive data from a given QSEE app.
* @client: The QSEECOM client associated with the target app. * @client: The QSEECOM client associated with the target app.
......
...@@ -23,10 +23,11 @@ struct pmic_glink_hdr { ...@@ -23,10 +23,11 @@ struct pmic_glink_hdr {
int pmic_glink_send(struct pmic_glink_client *client, void *data, size_t len); 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, struct pmic_glink_client *devm_pmic_glink_client_alloc(struct device *dev,
unsigned int id, unsigned int id,
void (*cb)(const void *, size_t, void *), void (*cb)(const void *, size_t, void *),
void (*pdr)(void *, int), void (*pdr)(void *, int),
void *priv); void *priv);
void pmic_glink_client_register(struct pmic_glink_client *client);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment