History log of /linux-master/drivers/soc/qcom/qcom_aoss.c
Revision Date Author Comments
# 9f378a62 25-Feb-2024 Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

soc: qcom: aoss: add missing kerneldoc for qmp members

Add missing kerneldoc to silence:

qcom_aoss.c:93: warning: Function parameter or struct member 'debugfs_root' not described in 'qmp'
qcom_aoss.c:93: warning: Function parameter or struct member 'debugfs_files' not described in 'qmp'

Fixes: d51d984c5525 ("soc: qcom: aoss: Add debugfs interface for sending messages")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20240225202545.59113-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# 651893a7 23-Jan-2024 Bjorn Andersson <quic_bjorande@quicinc.com>

soc: qcom: aoss: Add tracepoints in qmp_send()

Add tracepoint for tracing the messages being sent and the success
thereof. This is useful as the system has a variety of clients sending
requests to the always-on subsystem.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Reviewed-by: Chris Lew <quic_clew@quicinc.com>
Link: https://lore.kernel.org/r/20240123-qcom-aoss-tracepoints-v2-1-bd73baa31977@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# d51d984c 17-Jan-2024 Bjorn Andersson <quic_bjorande@quicinc.com>

soc: qcom: aoss: Add debugfs interface for sending messages

In addition to the normal runtime commands, the Always On Processor
(AOP) provides a number of debug commands which can be used during
system debugging for things such as preventing power collapse or placing
floor votes for certain resources. Some of these are documented in the
Robotics RB5 "Debug AOP ADB" linked below.

Provide a debugfs interface for the developer/tester to send some of
these commands to the AOP, which allow the user to override the DDR
frequency, preventing power collapse of cx and ddr, and prevent AOSS
from going to sleep.

Link: https://docs.qualcomm.com/bundle/publicresource/topics/80-88500-3/85_Debugging_AOP_ADB.html
Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Reviewed-by: Chris Lew <quic_clew@quicinc.com>
Link: https://lore.kernel.org/r/20240117-qcom-aoss-debugfs-v2-v3-1-1aa779124822@quicinc.com
[bjorn: Dropped S_IWGRP from the debugfs files]
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# b65a3fa3 19-Jan-2024 Bjorn Andersson <quic_bjorande@quicinc.com>

soc: qcom: aoss: Mark qmp_send() __printf()

As reported by lkp, qmp_send() would benefit from a __printf() marker to
allow the compiler to further validate the passed parameters, fix this.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401100855.UYl3HPPt-lkp@intel.com/
Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20240119-aoss-printf-annotation-v1-1-27e2ceb8937a@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# ffbe84a5 25-Sep-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

soc: qcom: qcom_aoss: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new() which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Konrad Dybcio <konrad.dybcio@linaro.org> # qcom
Link: https://lore.kernel.org/r/20230925095532.1984344-23-u.kleine-koenig@pengutronix.de
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# 9b09c0f2 22-Sep-2023 Unnathi Chalicheemala <quic_uchalich@quicinc.com>

soc: qcom: Switch to EXPORT_SYMBOL_GPL()

Switch to GPL version of EXPORT_SYMBOL for Qualcomm SoC drivers.

Signed-off-by: Unnathi Chalicheemala <quic_uchalich@quicinc.com>
Reviewed-by: Trilok Soni <quic_tsoni@quicinc.com>
Link: https://lore.kernel.org/r/20230922184817.5183-1-quic_uchalich@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# b4f63bbf 11-Aug-2023 Bjorn Andersson <quic_bjorande@quicinc.com>

soc: qcom: aoss: Tidy up qmp_send() callers

With qmp_send() handling variable length messages and string formatting
he callers of qmp_send() can be cleaned up to not care about these
things.

Drop the QMP_MSG_LEN sized buffers and use the message formatting, as
appropriate.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Link: https://lore.kernel.org/r/20230811205839.727373-5-quic_bjorande@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# 8873d1e2 11-Aug-2023 Bjorn Andersson <quic_bjorande@quicinc.com>

soc: qcom: aoss: Format string in qmp_send()

The majority of callers to qmp_send() composes the message dynamically
using some form of sprintf(), resulting in unnecessary complication and
stack usage.

By changing the interface of qmp_send() to take a format string and
arguments, the duplicated composition of the commands can be moved to a
single location.

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Link: https://lore.kernel.org/r/20230811205839.727373-4-quic_bjorande@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# 59e09100 11-Aug-2023 Bjorn Andersson <quic_bjorande@quicinc.com>

soc: qcom: aoss: Move length requirements from caller

The existing implementation of qmp_send() requires the caller to provide
a buffer which is of word-aligned. The underlying reason for this is
that message ram only supports word accesses, but pushing this
requirement onto the clients results in the same boiler plate code
sprinkled in every call site.

By using a temporary buffer in qmp_send() we can hide the underlying
hardware limitations from the clients and allow them to pass their
NUL-terminates C string directly.

Signed-off-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Link: https://lore.kernel.org/r/20230811205839.727373-2-quic_bjorande@quicinc.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>


# 4a1b9f4e 10-Mar-2023 Rob Herring <robh@kernel.org>

soc: qcom: Use of_property_present() for testing DT property presence

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties. As
part of this, convert of_get_property/of_find_property calls to the
recently added of_property_present() helper when we just want to test
for presence of a property and nothing more.

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Signed-off-by: Bjorn Andersson <andersson@kernel.org>
Link: https://lore.kernel.org/r/20230310144724.1545153-1-robh@kernel.org


# e6e09514 06-Jun-2022 Miaoqian Lin <linmq006@gmail.com>

soc: qcom: aoss: Fix refcount leak in qmp_cooling_devices_register

Every iteration of for_each_available_child_of_node() decrements
the reference count of the previous node.
When breaking early from a for_each_available_child_of_node() loop,
we need to explicitly call of_node_put() on the child node.
Add missing of_node_put() to avoid refcount leak.

Fixes: 05589b30b21a ("soc: qcom: Extend AOSS QMP driver to support resources that are used to wake up the SoC.")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220606064252.42595-1-linmq006@gmail.com


# 8030cb9a 27-Jan-2022 Daniel Thompson <daniel.thompson@linaro.org>

soc: qcom: aoss: remove spurious IRQF_ONESHOT flags

Quoting the header comments, IRQF_ONESHOT is "Used by threaded interrupts
which need to keep the irq line disabled until the threaded handler has
been run.". When applied to an interrupt that doesn't request a threaded
irq then IRQF_ONESHOT has a lesser known (undocumented?) side effect,
which it to disable the forced threading of the irq. For "normal" kernels
(without forced threading) then, if there is no thread_fn, then
IRQF_ONESHOT is a nop.

In this case disabling forced threading is not appropriate for this driver
because it calls wake_up_all() and this API cannot be called from
no-thread interrupt handlers on PREEMPT_RT systems (deadlock risk, triggers
sleeping-while-atomic warnings).

Fix this by removing IRQF_ONESHOT.

Fixes: 2209481409b7 ("soc: qcom: Add AOSS QMP driver")
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
[bjorn: Added Fixes tag]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220127173554.158111-1-daniel.thompson@linaro.org


# 4b41a9d0 08-Jan-2022 Miaoqian Lin <linmq006@gmail.com>

soc: qcom: aoss: Fix missing put_device call in qmp_get

The reference taken by 'of_find_device_by_node()' must be released when
not needed anymore.
Add the corresponding 'put_device()' in the error handling paths.

Fixes: 8c75d585b931 ("soc: qcom: aoss: Expose send for generic usecase")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20220108095931.21527-1-linmq006@gmail.com


# 3925b909 28-Nov-2021 Rikard Falkeborn <rikard.falkeborn@gmail.com>

soc: qcom: aoss: constify static struct thermal_cooling_device_ops

The only usage of qmp_cooling_device_ops is to pass its address to
devm_thermal_of_cooling_device_register() which takes a pointer to const
struct thermal_cooling_device_ops as argument. Make it const to allow
the compiler to put it in read-only memory.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20211128210317.25504-1-rikard.falkeborn@gmail.com


# 7b4d7894 31-Aug-2021 Deepak Kumar Singh <deesin@codeaurora.org>

soc: qcom: aoss: Expose send for generic usecase

Not all upcoming usecases will have an interface to allow the aoss
driver to hook onto. Expose the send api and create a get function to
enable drivers to send their own messages to aoss.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/1630420228-31075-2-git-send-email-deesin@codeaurora.org


# 99512191 16-Sep-2021 Sibi Sankar <sibis@codeaurora.org>

soc: qcom: aoss: Drop power domain support

Strip out the load state power-domain support from the driver since the
low power mode signalling for the co-processors is now accessible through
the direct qmp message send interface.

Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/1631800770-371-12-git-send-email-sibis@codeaurora.org


# c318dcbc 08-Sep-2021 Cai Huoqing <caihuoqing@baidu.com>

soc: qcom: aoss: Make use of the helper function devm_platform_ioremap_resource()

Use the devm_platform_ioremap_resource() helper instead of
calling platform_get_resource() and devm_ioremap_resource()
separately

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20210908080216.1301-4-caihuoqing@baidu.com


# 8c75d585 31-Aug-2021 Deepak Kumar Singh <deesin@codeaurora.org>

soc: qcom: aoss: Expose send for generic usecase

Not all upcoming usecases will have an interface to allow the aoss
driver to hook onto. Expose the send api and create a get function to
enable drivers to send their own messages to aoss.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/1630420228-31075-2-git-send-email-deesin@codeaurora.org


# a89f355e 29-Jun-2021 Manivannan Sadhasivam <mani@kernel.org>

soc: qcom: aoss: Fix the out of bound usage of cooling_devs

In "qmp_cooling_devices_register", the count value is initially
QMP_NUM_COOLING_RESOURCES, which is 2. Based on the initial count value,
the memory for cooling_devs is allocated. Then while calling the
"qmp_cooling_device_add" function, count value is post-incremented for
each child node.

This makes the out of bound access to the cooling_dev array. Fix it by
passing the QMP_NUM_COOLING_RESOURCES definition to devm_kzalloc() and
initializing the count to 0.

While at it, let's also free the memory allocated to cooling_dev if no
cooling device is found in DT and during unroll phase.

Cc: stable@vger.kernel.org # 5.4
Fixes: 05589b30b21a ("soc: qcom: Extend AOSS QMP driver to support resources that are used to wake up the SoC.")
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20210629153249.73428-1-manivannan.sadhasivam@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# d63486dd 09-Jul-2021 Bjorn Andersson <bjorn.andersson@linaro.org>

soc: qcom: aoss: Add generic compatible

It seems we don't need platform specific implementation for the AOSS
QMP, so let's introduce a generic compatible to avoid having to update
the driver for each platform.

Reviewed-by: Sibi Sankar <sibis@codeaurora.org>
Tested-by: Sibi Sankar <sibis@codeaurora.org>
Link: https://lore.kernel.org/r/20210709174142.1274554-4-bjorn.andersson@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# ce6e674a 25-Feb-2021 Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>

soc: qcom: aoss: Add AOSS QMP support for SC7280

Add AOSS QMP support for SC7280 SoC.

Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Link: https://lore.kernel.org/r/d311b75428da7d87638208490fa9a64b5ef15d6f.1614244789.git.saiprakash.ranjan@codeaurora.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# e161ce8e 27-Jan-2021 Vinod Koul <vkoul@kernel.org>

soc: qcom: aoss: Add SM8350 compatible

Add SM8350 compatible to the qcom_aoss binding and driver.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Link: https://lore.kernel.org/r/20210127123054.263231-3-vkoul@kernel.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 96ec310d 03-Nov-2020 Lee Jones <lee.jones@linaro.org>

soc: qcom: qcom_aoss: Add missing description for 'cooling_devs'

Fixes the following W=1 kernel build warning(s):

drivers/soc/qcom/qcom_aoss.c:86: warning: Function parameter or member 'cooling_devs' not described in 'qmp'

Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-arm-msm@vger.kernel.org
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201103152838.1290217-4-lee.jones@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 54f8ebda 03-Nov-2020 Lee Jones <lee.jones@linaro.org>

soc: qcom: qcom_aoss: Remove set but unused variable 'tlen'

Fixes the following W=1 kernel build warning(s):

drivers/soc/qcom/qcom_aoss.c: In function ‘qmp_send’:
drivers/soc/qcom/qcom_aoss.c:228:9: warning: variable ‘tlen’ set but not used [-Wunused-but-set-variable]

Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: linux-arm-msm@vger.kernel.org
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20201103152838.1290217-3-lee.jones@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# ce187859 26-Apr-2020 Bjorn Andersson <bjorn.andersson@linaro.org>

soc: qcom: aoss: Add SM8250 compatible

Add SM8250 compatible to the qcom_aoss binding and driver.

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Link: https://lore.kernel.org/r/20200427054202.2822144-1-bjorn.andersson@linaro.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 89e7edde 22-Jan-2020 Arun Kumar Neelakantam <aneela@codeaurora.org>

soc: qcom: aoss: Read back before triggering the IRQ

In some device memory used by msm_qmp, there can be an early ack of a
write to memory succeeding. This may cause the outgoing interrupt to be
triggered before the msgram reflects the write.

Add a readback to ensure the data is flushed to device memory before
triggering the ipc interrupt.

Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Link: https://lore.kernel.org/r/1579681454-1229-1-git-send-email-aneela@codeaurora.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# df636eea 22-Jan-2020 Arun Kumar Neelakantam <aneela@codeaurora.org>

soc: qcom: aoss: Use wake_up_all() instead of wake_up_interruptible_all()

During the probe the task is waiting in TASK_UNINTERRUPTIBLE state which
cannot be woken-up by wake_up_interruptible_all() function.

Use wake_up_all() to wake-up both TASK_UNINTERRUPTIBLE and
TASK_INTERRUPTIBLE state tasks.

Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Link: https://lore.kernel.org/r/1579681417-1155-1-git-send-email-aneela@codeaurora.org
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# c55b5c66 18-Sep-2019 Thara Gopinath <thara.gopinath@linaro.org>

soc: qcom: Invert the cooling states for the aoss warming devices

Thermal framework takes 0 as the lowest/default state for a
cooling/warming device. The current code has the order inverted with 1
corresponding to lowest state in hardware and 0 the highest state.
Invert this for a better fit with the thermal framework.

Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 17095102 06-Aug-2019 Sibi Sankar <sibis@codeaurora.org>

soc: qcom: aoss: Add AOSS QMP support

Add AOSS QMP support for SM8150 and SC7180 SoCs.

Reviewed-by: Vinod Koul <vkoul@kernel.org>
Tested-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 05589b30 30-Jul-2019 Thara Gopinath <thara.gopinath@linaro.org>

soc: qcom: Extend AOSS QMP driver to support resources that are used to wake up the SoC.

The AOSS QMP driver is extended to communicate with the additional
resources. These resources are then registered as cooling devices
with the thermal framework.

Signed-off-by: Thara Gopinath <thara.gopinath@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>


# 22094814 11-Jun-2019 Bjorn Andersson <bjorn.andersson@linaro.org>

soc: qcom: Add AOSS QMP driver

The Always On Subsystem (AOSS) Qualcomm Messaging Protocol (QMP) driver
is used to communicate with the AOSS for certain side-channel requests,
that are not available through the RPMh interface.

The communication is a very simple synchronous mechanism of messages
being written in message RAM and a doorbell in the AOSS is rung. As the
AOSS has processed the message length is cleared and an interrupt is
fired by the AOSS as acknowledgment.

The driver exposes the QDSS clock as a clock and the low-power state
associated with the remoteprocs in the system as a set of power-domains.

Reviewed-by: Douglas Anderson <dianders@chromium.org>
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Tested-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>