Commit Graph

974078 Commits

Author SHA1 Message Date
Cristian Marussi
6ffe326ac2 FROMLIST: firmware: arm_scmi: remove legacy scmi_perf_ops protocol interface
Now that all the SCMI driver users have been migrated to the new interface
remove the legacy interface and all the transient code.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Ifd74693644daae8e0aa1ee5997cdb4edf1ed8460
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:31 -08:00
Cristian Marussi
8b0d407157 FROMLIST: cpufreq: scmi: port driver to the new scmi_perf_proto_ops interface
Port driver to the new SCMI Perf interface based on protocol handles
and common devm_get_ops().

Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Id27af751053ba5f289a3989fdaa6cd28e8e2fa66
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:31 -08:00
Cristian Marussi
213ea76908 FROMLIST: firmware: arm_scmi: port Perf protocol to new protocols interface
Convert internals of protocol implementation to use protocol handles and
expose a new protocol operations interface for SCMI driver using the new
get/put common operations, while keeping the old handle->perf_ops still
around to ease transition.

Remove handle->perf_priv now unused.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Ia8d5dc1c40c392df41e19873064900f681588a9c
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:31 -08:00
Cristian Marussi
59d6bfe64f FROMLIST: firmware: arm_scmi: port Base protocol to new interface
Port Base protocol to new protocol handles based interface.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: I57264cc7d4708e513ae85b69099bf32a274b0e16
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:31 -08:00
Cristian Marussi
f4423d3944 FROMLIST: firmware: arm_scmi: add helper to access revision area memory
Add an helper to grab, from a protocol handle, the handle common memory
area allocated to store SCMI version data which is exposed on sysfs.
Such helper will be needed by SCMI Base protocol initialization once it
will be moved to new protocol handles scheme.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Ic1d9a6c0b7940abfc7e370c0d955aae83c449c6a
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:31 -08:00
Cristian Marussi
a3433ea580 FROMLIST: firmware: arm_scmi: add new protocol handle core xfer ops
Add new core SCMI xfer operations based on protocol handles to enable
protocols to builds and send their own protocol specific messages.

Keep old original scmi_xfer_ operations interface as wrappers around the
new interface in order to let coexist old and new interfaces to ease
protocol by protocol migration.

In order to support such migration the above wrappers and some additional
transient code is also introduced in this commit: it will be later removed
as a whole once the full migration of protocols and SCMI drivers will have
been completed.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Ia2a11c4f20573f9185e591625faa017883857b55
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:30 -08:00
Cristian Marussi
a0a8e0f761 FROMLIST: firmware: arm_scmi: convert events registration to protocol handles
Convert refactored events registration routines to use protocol handles.

In order to maintain bisectability and to allow protocols and drivers
to be later ported to the new protocol handle interface one by one,
introduce here also some transient code and typing that will be removed
later in order to ease such transition.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Ic74cc4576b9189c0fff8968b8063a86375bb7ae7
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:30 -08:00
Cristian Marussi
834134abe6 FROMLIST: firmware: arm_scmi: refactor events registration
Add a new refactored protocol events registration helper and invoke it
from the centralized initialization process triggered by get_ops() and
friends.

Add a .get_num_sources as a new optional callback amongst protocol events
operations; finally remove events registration call-sites from within the
legacy protocol init routines.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Ib875eb3ec6be086c7d02175a6ff3742eb112026e
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:30 -08:00
Cristian Marussi
0c203b198e FROMLIST: firmware: arm_scmi: introduce new devres notification ops
Expose to the SCMI drivers a new alternative devres managed notifications
API based on protocol handles.

All drivers still keep using the old API, no functional change.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: I3867be1ada472e5d09335cb8be25cbcac84763b1
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:30 -08:00
Cristian Marussi
d25dc33d27 FROMLIST: firmware: arm_scmi: make notifications aware of protocols users
Account for any active registered notifier against the proper related
protocol; do not consider pending event handlers, only active handlers
will concur to protocol usage accounting.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Ic705bf7ccf5dfbd46f687c467a7597ba141ef04e
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:30 -08:00
Cristian Marussi
4225eb5ab1 FROMLIST: firmware: arm_scmi: add devm_acquire_protocol helper
Add a method to get hold of a protocol, causing it to be initialized and
its resource accounting updated, without getting access to its operations
and handle.

Some protocols, like SCMI SystemPower, do not expose any protocol ops to
the Kernel OSPM agent but still need to be at least initialized: this
helper avoids the need to invoke a full devm_get_protocol() only to get
the protocol initialized while throwing away unused the protocol ops and
handle.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Ic40ef47b4133e761db8eb3e93d00ab6b7c3c2fb8
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:29 -08:00
Cristian Marussi
bfacf9cff5 FROMLIST: firmware: arm_scmi: introduce devres get/put protocols operations
Expose to the SCMI drivers a new devres managed common protocols API based
on generic get/put methods and protocol handles.

All drivers still keep using the old API, no functional change.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Icd8d74fb4b40318f0acfcd882728d1ea1f33f363
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:29 -08:00
Cristian Marussi
bd376903a5 FROMLIST: firmware: arm_scmi: introduce protocol handle definitions
Add basic protocol handles definitions and private data helpers support.

A protocol handle identifies a protocol instance initialized against a
specific handle; it embeds all the references to the core SCMI xfer methods
that will be needed by a protocol implementation to build and send its own
protocol specific messages using common core methods.

As such, in the interface, a protocol handle will be passed down from the
core to the protocol specific initialization callback at init time.

Anyway at this point only definitions are introduced, all protocols
initialization code and SCMI drivers probing is still based on the old
interface, so no functional change.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: I30e1f6ca36c660ef887c263db13031c077c815db
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:29 -08:00
Cristian Marussi
cf516fb6f7 FROMLIST: firmware: arm_scmi: review protocol registration interface
Extend common protocol registration routines and provide some new generic
protocols get/put helpers that can track protocols usage and automatically
perform the proper initialization and de-initialization on demand when
required.

Convert all standard protocols to use this new registration scheme while
keeping them all still using the usual initialization logic bound to SCMI
devices probing.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: I8d40f1f25f8d007f1fa4788f432a7ffeb012e1c2
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:29 -08:00
Cristian Marussi
f1f7d0dfe6 UPSTREAM: firmware: arm_scmi: Fix call site of scmi_notification_exit
Call scmi_notification_exit() only when SCMI platform driver instance has
been really successfully removed.

Link: https://lore.kernel.org/r/20210112191326.29091-1-cristian.marussi@arm.com
Fixes: 6b8a69131d ("firmware: arm_scmi: Enable notification core")
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
[sudeep.holla: Move the call outside the list mutex locking]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit a90b6543bf)
Bug: 171409184
Change-Id: I163c317178e00a9177fc57cce78ffaef1781fa8d
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:29 -08:00
Sudeep Holla
3f910da297 UPSTREAM: MAINTAINERS: Update ARM SCMI entry
Cristian is actively developing new features and more involved than me.
So add Cristian as a designated reviewer. Also add the newly added scmi
regulator driver to the list.

Link: https://lore.kernel.org/r/20210105151945.406093-1-sudeep.holla@arm.com
Cc: Cristian Marussi <cristian.marussi@arm.com>
Acked-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit 6054d97ab5)
Bug: 171409184
Change-Id: I4418377ca19d39f5d30a6c72d6ef91c9caf452e5
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:29 -08:00
Jim Quinlan
3ff2080a11 UPSTREAM: firmware: arm_scmi: Augment SMC/HVC to allow optional interrupt
The SMC/HVC SCMI transport is modified to allow the completion of an
SCMI message to be indicated by an interrupt rather than the return of
the smc/hvc call. This accommodates the existing behavior of the
BrcmSTB SCMI "platform".

Link: https://lore.kernel.org/r/20201222145603.40192-3-jim2101024@gmail.com
Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
[sudeep.holla: added call to reinit_completion, whitespace cleanup, dropped
 irrelavant info in the commit log]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit dd820ee21d)
Bug: 171409184
Change-Id: I0267e59fad1ae7ac17eccb44322f9eebbf13e920
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:28 -08:00
Jim Quinlan
94696ee4a7 UPSTREAM: dt-bindings: arm: Add optional interrupt to smc/hvc SCMI transport
In the normal use of smc/hvc as SCMI transport, the message completion
is indicated by the return of the SMC call. This binding provides for
an optional interrupt named "a2p" which can be used instead to indicate
the completion of a message.

Link: https://lore.kernel.org/r/20201222145603.40192-2-jim2101024@gmail.com
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jim Quinlan <jim2101024@gmail.com>
[sudeep.holla: minor wording changes to the commit log]
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit 99a064fb3a)
Bug: 171409184
Change-Id: Ib9a89d395e04ad9f74c22d7a0197da9662b7f688
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:28 -08:00
Lukasz Luba
0b22645317 UPSTREAM: cpufreq: arm_scmi: Discover the power scale in performance protocol
Add mechanism to discover the power scale present in the performance
protocol for all domains. Provide this information to Energy Model,
which then can be checked in other frameworks, e.g. thermal.

Suggested-by: Morten Rasmussen <morten.rasmussen@arm.com>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

(cherry picked from commit f9b0498d29)
Bug: 171409184
Change-Id: Id198065d55d4e54f55fc4e7ad00a0610da1ce9a7
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:28 -08:00
Lukasz Luba
9580671a65 UPSTREAM: PM: EM: Add a flag indicating units of power values in Energy Model
There are different platforms and devices which might use different scale
for the power values. Kernel sub-systems might need to check if all
Energy Model (EM) devices are using the same scale. Address that issue and
store the information inside EM for each device. Thanks to that they can
be easily compared and proper action triggered.

Suggested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Quentin Perret <qperret@google.com>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

(cherry picked from commit c250d50fe2)
Bug: 171409184
Change-Id: Ie6dc51db1e431b7287ed986114ce2f5b6732bd3b
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:28 -08:00
Lukasz Luba
8a015a325d UPSTREAM: firmware: arm_scmi: Add power_scale_mw_get() interface
Add a new interface to the existing perf_ops and export the information
about the power values scale.

This would be used by the cpufreq driver and Energy Model framework to
set the performance domains scale: milli-Watts or abstract scale.

Suggested-by: Morten Rasmussen <morten.rasmussen@arm.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

(cherry picked from commit 76ea4d8eee)
Bug: 171409184
Change-Id: Ibc3fb4b9bdb0c7175c1d53c9e953e46d30f362b6
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:28 -08:00
Florian Fainelli
0128f170b3 UPSTREAM: arm64: defconfig: Enable ARM SCMI protocol and drivers
Enable the ARM SCMI protocol and the common clock, cpufreq, reset and
sensors drivers. Broadcom STB platforms (ARCH_BRCMSTB) implement SCMI to
provide support for CPU frequency scaling, clock configuration and
temperature and current sensors.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit 6a7dc2b363)
Bug: 171409184
Change-Id: I8ce128c46a27c3490b1d44694b07d0b179141c28
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:28 -08:00
Cristian Marussi
a76ebab186 UPSTREAM: regulator: add SCMI driver
Add a simple regulator based on SCMI Voltage Domain Protocol.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
----
v6 --> v7
- add proper blank lines between semantic blocks
- fix return value on error path of scmi_reg_is_enabled()
- use generic Failure message on err path of info_get()
- fix comment containing apostrophe

v3 --> v4
- using of_match_full_name core regulator flag
- avoid coccinelle falde complaints about pointer-sized allocations

v2 --> v3
- remove multiple linear mappings support
- removed duplicated voltage name printout
- added a few comments
- simplified return path in scmi_reg_set_voltage_sel()

v1 --> v2
- removed duplicate regulator naming
- removed redundant .get/set_voltage ops: only _sel variants implemented
- removed condexpr on fail path to increase readability

v0 --> v1
- fixed init_data constraint parsing
- fixes for v5.8 (linear_range.h)
- fixed commit message content and subject line format
- factored out SCMI core specific changes to distinct patch
- reworked Kconfig and Makefile to keep proper alphabetic order
- fixed SPDX comment style
- removed unneeded inline functions
- reworked conditionals for legibility
- fixed some return paths to properly report SCMI original errors codes
- added some more descriptive error messages when fw returns invalid ranges
- removed unneeded explicit devm_regulator_unregister from .remove()
Link: https://lore.kernel.org/r/20201123202336.46701-4-cristian.marussi@arm.com

Signed-off-by: Mark Brown <broonie@kernel.org>

(cherry picked from commit 0fbeae70ee)
Bug: 171409184
Change-Id: I4fd47805d821ad993f0240cf3fb1879ce01a4a06
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:27 -08:00
Cristian Marussi
126a7a4649 UPSTREAM: regulator: core: add of_match_full_name boolean flag
During regulators registration, if .of_match and .regulators_node are
defined as non-null strings in struct regulator_desc the core searches the
DT subtree rooted at .regulators_node trying to match, at first, .of_match
against the 'regulator-compatible' property and, then, falling back to use
the name of the node itself to determine a good match.

Property 'regulator-compatible', though, is now deprecated and falling back
to match against the node name, works fine only as long as the involved
nodes are named in an unique way across the searched subtree; if that's not
the case, like when using <common-name>@<unit> style naming for properties
indexed via 'reg' property (as advised by the standard), the above matching
mechanism based on the simple common name will lead to multiple matches and
the only viable alternative would be to properly define the now deprecated
'regulator-compatible' as the node full name, i.e. <common-name>@<unit>.

In order to address this case without using such deprecated binding, define
a new boolean flag .of_match_full_name in struct regulator_desc to force
the core to match against the node full-name instead of the plain name.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20201119191051.46363-4-cristian.marussi@arm.com
Signed-off-by: Mark Brown <broonie@kernel.org>

(cherry picked from commit e7095c35ab)
Bug: 171409184
Change-Id: Ic1fea2f338f0691f7470365f757d49d50587b191
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:27 -08:00
Cristian Marussi
d3c7786605 UPSTREAM: dt-bindings: arm: remove optional properties for SCMI Regulators
Remove optional properties bindings descriptions for SCMI Regulators.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20201123202336.46701-2-cristian.marussi@arm.com
Signed-off-by: Mark Brown <broonie@kernel.org>

(cherry picked from commit e8056bf010)
Bug: 171409184
Change-Id: Id8bc01fbda1d908f4df777fbd49b5f7ccb76ca53
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:27 -08:00
Cristian Marussi
9b9cac3804 UPSTREAM: firmware: arm_scmi: Remove residual _le structs naming
For sake of consistency, remove any residual naming based on _le
suffixes in SCMI sensors protocol, since little endianness is already
assumed across all of SCMI implementation and, as such, all currently
existent names do not explicitly state their endianness.

No functional change.

Link: https://lore.kernel.org/r/20201123162008.35814-1-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit e945927dc7)
Bug: 171409184
Change-Id: I4a34b7cb607e873e37acdac6c3f184f2ecb2f95a
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:27 -08:00
Cristian Marussi
9d5f3776d3 UPSTREAM: firmware: arm_scmi: Add SCMI v3.0 sensor notifications
Add support for new SCMI v3.0 SENSOR_UPDATE notification.

Link: https://lore.kernel.org/r/20201119174906.43862-7-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit e3811190ac)
Bug: 171409184
Change-Id: Ica718e92cbdefe9d28360a3ba39d6b7d9c821517
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:27 -08:00
Cristian Marussi
ac18ef8d26 UPSTREAM: firmware: arm_scmi: Add SCMI v3.0 sensor configuration support
Add SCMI v3.0 sensor support for CONFIG_GET/CONFIG_SET commands.

Link: https://lore.kernel.org/r/20201119174906.43862-6-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit 7b83c5f410)
Bug: 171409184
Change-Id: Id03823bdf67f108de679198a9447c4c5456dac60
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:27 -08:00
Cristian Marussi
69e0cb32b5 UPSTREAM: firmware: arm_scmi: Add SCMI v3.0 sensors timestamped reads
Add new .reading_get_timestamped() method to sensor_ops to support SCMI v3.0
timestamped reads.

Link: https://lore.kernel.org/r/20201119174906.43862-5-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit e2083d3673)
Bug: 171409184
Change-Id: Ic743ae3414a7ebb256f054b3028844455240bb08
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:26 -08:00
Cristian Marussi
7f202f96e1 UPSTREAM: hwmon: (scmi) Update hwmon internal scale data type
Use an int to calculate scale values inside scmi_hwmon_scale() to match
the updated scale data type in struct scmi_sensor_info.

Link: https://lore.kernel.org/r/20201119174906.43862-4-cristian.marussi@arm.com
Cc: linux-hwmon@vger.kernel.org
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit d7971d57d2)
Bug: 171409184
Change-Id: I07d67bd30f54f6162177e760b1c8c3983b0ab3c8
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:26 -08:00
Cristian Marussi
d0bd251a41 UPSTREAM: firmware: arm_scmi: Add support to enumerated SCMI voltage domain device
Add SCMI voltage domain device name to the core list of supported protocol
devices so that it can be enumerated if the firmware supports it.

Link: https://lore.kernel.org/r/20201119191051.46363-3-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit ec88381936)
Bug: 171409184
Change-Id: Ifb7786f84068d6d29b766a29bcb53102e412a533
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:26 -08:00
Cristian Marussi
fb2b659b60 UPSTREAM: firmware: arm_scmi: Add voltage domain management protocol support
SCMI v3.0 introduces voltage domain protocol which provides commands to:
 - Discover the voltage levels supported by a domain
 - Get the configuration and voltage level of a domain
 - Set the configuration and voltage level of a domain

Let us add support for the same.

Link: https://lore.kernel.org/r/20201119191051.46363-2-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit 2add5cacff)
Bug: 171409184
Change-Id: I946649c8f66b33a200bba5457e7c0d5e1eb86d05
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:26 -08:00
Cristian Marussi
f69c97b468 UPSTREAM: dt-bindings: arm: Add support for SCMI Regulators
Add devicetree bindings to support regulators based on SCMI Voltage
Domain Protocol.

Link: https://lore.kernel.org/r/20201119191051.46363-5-cristian.marussi@arm.com
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit 0f80fcec08)
Bug: 171409184
Change-Id: I16e901929416c0753d12750691f485fdcd2fda0e
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:26 -08:00
Cristian Marussi
fb6cf398a7 UPSTREAM: firmware: arm_scmi: Add SCMI v3.0 sensors descriptors extensions
Add support for new SCMI v3.0 Sensors extensions related to new sensors'
features, like multiple axis and update intervals, while keeping
compatibility with SCMI v2.0 features.

While at that, refactor and simplify all the internal helpers macros and
move struct scmi_sensor_info to use only non-fixed-size typing.

Link: https://lore.kernel.org/r/20201119174906.43862-3-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit 1fe00b8b42)
Bug: 171409184
Change-Id: I43b13acb8d5decf088a46e71be0881560763aa1c
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:25 -08:00
Sudeep Holla
98bf01ed8c UPSTREAM: firmware: arm_scmi: Add full list of sensor type enumeration
SCMI v2.0 provides a big list of sensor type enumeration from the
sensorUnits enumeration table of Distributed Management Task Force(DMTF)
specification number DSP 0248 (Platform Level Data Model for Platform
Monitoring and Control Specification). It is however not an exact
replica of the sensorUnits enumeration table.

Let us just update the table as per SCMI v2.0 specification.

Link: https://lore.kernel.org/r/20201119174906.43862-3-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit 607a4672b4)
Bug: 171409184
Change-Id: If5b290218746032ace0f80da37b2968411ada0e9
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:25 -08:00
Cristian Marussi
a9d549b86b UPSTREAM: firmware: arm_scmi: Rework scmi_sensors_protocol_init
Properly handle return values from initialization helpers and avoid
setting sensor_ops before sensor_priv.

Link: https://lore.kernel.org/r/20201119174906.43862-2-cristian.marussi@arm.com
Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

(cherry picked from commit f25fb6de67)
Bug: 171409184
Change-Id: Id61e9e8df425b1dbd92afcb7985b127d1ad5d22a
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
2021-03-02 17:34:25 -08:00
Subash Abhinov Kasiviswanathan
dba7b4b504 ANDROID: GKI: Enable more networking configs
Enable the following netfilter and tc configs-

CONFIG_NETFILTER_XT_TARGET_DSCP=y
CONFIG_NETFILTER_XT_TARGET_NOTRACK=y
CONFIG_NETFILTER_XT_MATCH_DSCP=y
CONFIG_NETFILTER_XT_MATCH_ESP=y
CONFIG_NETFILTER_XT_MATCH_MULTIPORT=y
CONFIG_NET_SCH_PRIO=y
CONFIG_NET_CLS_FW=y

CONFIG_NETFILTER_XT_TARGET_NOTRACK=y automatically selects
NETFILTER_XT_TARGET_CT in Kconfig so it is not actually removed in
the commit despite it showing up in the diff.

Bug: 181587536
Change-Id: Id1b4e9fbee9dc0a7a6220fb8a9db32fbc5d78a5a
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
2021-03-03 00:04:12 +00:00
Nick Desaulniers
1b106caa69 ANDROID: clang: update to 12.0.3
Bug: 180726982
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
Change-Id: I8a67ee80c4eb7d62fc342f4f7b5c6e6d8f3e55f7
2021-03-02 20:48:19 +00:00
Kevin Hilman
7f0f442086 ANDROID: GKI: amlogic: enable BCM WLAN as modules
Broadcom FMAC (brcmfmac) drivers are used on several Amlogic-based
designs, including Khadas VIM3/VIM3L.

Bug: 179406580
Change-Id: I9f441facbf6c98d25483634105c915fd52ea87c6
Cc: Dmitry Shmidt <dimitrysh@google.com>
Signed-off-by: Kevin Hilman <khilman@baylibre.com>
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
(cherry picked from commit 42b8f4b026)
2021-03-02 09:26:57 +00:00
Badhri Jagan Sridharan
af4cedd719 FROMGIT: usb: typec: tcpm: Wait for vbus discharge to VSAFE0V before toggling
When vbus auto discharge is enabled, TCPM can sometimes be faster than
the TCPC i.e. TCPM can go ahead and move the port to unattached state
(involves disabling vbus auto discharge) before TCPC could effectively
discharge vbus to VSAFE0V. This leaves vbus with residual charge and
increases the decay time which prevents tsafe0v from being met.
This change makes TCPM waits for a maximum of tSafe0V(max) for vbus
to discharge to VSAFE0V before transitioning to unattached state
and re-enable toggling. If vbus discharges to vsafe0v sooner, then,
transition to unattached state
happens right away.

Also, while in SNK_READY, when auto discharge is enabled, drive
disconnect based on vbus turning off instead of Rp disappearing on
CC pins. Rp disappearing on CC pins is almost instanteous compared
to vbus decay.

Sink detach:
[  541.703058] CC1: 3 -> 0, CC2: 0 -> 0 [state SNK_READY, polarity 0, disconnected]
[  541.703331] Setting voltage/current limit 5000 mV 0 mA
[  541.727235] VBUS on
[  541.749650] VBUS off
[  541.749653] pending state change SNK_READY -> SNK_UNATTACHED @ 650 ms [rev3 NONE_AMS]
[  541.749944] VBUS VSAFE0V
[  541.749945] state change SNK_READY -> SNK_UNATTACHED [rev3 NONE_AMS]
[  541.750806] Disable vbus discharge ret:0
[  541.907345] Start toggling
[  541.922799] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0, disconnected]

Source detach:
[ 2555.310414] state change SRC_SEND_CAPABILITIES -> SRC_READY [rev3 POWER_NEGOTIATION]
[ 2555.310675] AMS POWER_NEGOTIATION finished
[ 2555.310679] cc:=3
[ 2593.645886] CC1: 0 -> 0, CC2: 2 -> 0 [state SRC_READY, polarity 1, disconnected]
[ 2593.645919] pending state change SRC_READY -> SNK_UNATTACHED @ 650 ms [rev3 NONE_AMS]
[ 2593.648419] VBUS off
[ 2593.648960] VBUS VSAFE0V
[ 2593.648965] state change SRC_READY -> SNK_UNATTACHED [rev3 NONE_AMS]
[ 2593.649962] Disable vbus discharge ret:0
[ 2593.890322] Start toggling
[ 2593.925663] CC1: 0 -> 0, CC2: 0 -> 0 [state TOGGLING, polarity 0,

Fixes: f321a02cae ("usb: typec: tcpm: Implement enabling Auto Discharge disconnect support")
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Link: https://lore.kernel.org/r/20210225101104.1680697-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ff04213171cf329d6a3e0d844e4a6672c84d0398
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I688ea245671a8d1b4bd52d5c04fce73a75b8a535
2021-03-02 08:24:53 +01:00
Ray Chi
e82f5e70b0 FROMGIT: usb: dwc3: add an alternate path in vbus_draw callback
This patch adds an alternate path in vbus_draw callback through
power supply property POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT.

Signed-off-by: Ray Chi <raychi@google.com>
Link: https://lore.kernel.org/r/20210222115149.3606776-3-raychi@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit effcaf3f59b5557b0423f4b0d64df49658a9ec64
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Id0b67ec0c4f811fdde441250a5d15f4aa1978d7b
2021-03-02 08:24:43 +01:00
Ray Chi
790c8081d9 FROMGIT: usb: dwc3: add a power supply for current control
Currently, VBUS draw callback does no action when the
generic PHYs are used. This patch adds an additional
path to control charging current through power supply
interface.

Signed-off-by: Ray Chi <raychi@google.com>
Link: https://lore.kernel.org/r/20210222115149.3606776-2-raychi@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 59fa3def35de957881ac142a384487e27e8fe527
 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I394373ad476d21c9666fa7daa9fd2d9ecfcf6ab7
2021-03-02 08:24:34 +01:00
Jaegeuk Kim
d92620d79b Merge remote-tracking branch 'aosp/upstream-f2fs-stable-linux-5.10.y' into android12-5.10
* aosp/upstream-f2fs-stable-linux-5.10.y:
  fs-verity: support reading signature with ioctl
  fs-verity: support reading descriptor with ioctl
  fs-verity: support reading Merkle tree with ioctl
  fs-verity: add FS_IOC_READ_VERITY_METADATA ioctl
  fs-verity: don't pass whole descriptor to fsverity_verify_signature()
  fs-verity: factor out fsverity_get_descriptor()
  fs: simplify freeze_bdev/thaw_bdev
  f2fs: remove FAULT_ALLOC_BIO
  f2fs: use blkdev_issue_flush in __submit_flush_wait
  f2fs: remove a few bd_part checks
  Documentation: f2fs: fix typo s/automaic/automatic
  f2fs: give a warning only for readonly partition
  f2fs: don't grab superblock freeze for flush/ckpt thread
  f2fs: add ckpt_thread_ioprio sysfs node
  f2fs: introduce checkpoint_merge mount option
  f2fs: relocate inline conversion from mmap() to mkwrite()
  f2fs: fix a wrong condition in __submit_bio
  f2fs: remove unnecessary initialization in xattr.c
  f2fs: fix to avoid inconsistent quota data
  f2fs: flush data when enabling checkpoint back
  f2fs: deprecate f2fs_trace_io
  f2fs: Remove readahead collision detection
  f2fs: remove unused stat_{inc, dec}_atomic_write
  f2fs: introduce sb_status sysfs node
  f2fs: fix to use per-inode maxbytes
  f2fs: compress: fix potential deadlock
  libfs: unexport generic_ci_d_compare() and generic_ci_d_hash()
  f2fs: fix to set/clear I_LINKABLE under i_lock
  f2fs: fix null page reference in redirty_blocks
  f2fs: clean up post-read processing
  f2fs: trival cleanup in move_data_block()
  f2fs: fix out-of-repair __setattr_copy()
  f2fs: fix to tag FIEMAP_EXTENT_MERGED in f2fs_fiemap()
  f2fs: introduce a new per-sb directory in sysfs
  f2fs: compress: support compress level
  f2fs: compress: deny setting unsupported compress algorithm
  f2fs: relocate f2fs_precache_extents()
  f2fs: enforce the immutable flag on open files
  f2fs: enhance to update i_mode and acl atomically in f2fs_setattr()
  f2fs: fix to set inode->i_mode correctly for posix_acl_update_mode
  f2fs: Replace expression with offsetof()
  f2fs: handle unallocated section and zone on pinned/atgc

Bug: 178226640
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: I95112779a0a75f3cdbc222126a198d54f1e378ac
2021-03-01 19:06:56 -08:00
Dikshita Agarwal
252e1705cf BACKPORT: media: v4l2-ctrl: Add base layer priority id control.
This control indicates the priority id to be applied
to base layer.

[hverkuil: renumbered V4L2_CID_MPEG_VIDEO_BASELAYER_PRIORITY_ID]

Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
(cherry picked from commit 6bde70da98)
Bug: 175370801
Link: https://lkml.org/lkml/2021/1/4/9
[dikshita : Original change has multiple dependencies, hence
 needs manual modifications to pick up the change in
 simplified way]
Change-Id: I59dfdbb366d966d3ce2d2b4ab009111975d7c660
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
2021-03-02 01:43:47 +00:00
Hridya Valsaraju
5d112ffc6f ANDROID: GKI: defconfig: disable CONFIG_ION
Bug: 181592552
Test: build and boot cuttlefish
Change-Id: Iacb2ea7f900b5d6ba8991a705fc41ecd791f430d
Signed-off-by: Hridya Valsaraju <hridya@google.com>
2021-03-01 23:02:14 +00:00
Jaegeuk Kim
0d213c5921 ANDROID: scsi: ufs: replace variants with android vendor hooks
This converts the existing android-specific hooks to official vendor hooks.
Per not-restricted hooks, vendor body should not enter into sleep mode by
mutex or similar.

Bug: 181359082
Signed-off-by: Jaegeuk Kim <jaegeuk@google.com>
Change-Id: Ic66077b3c42e63a5496a1d0c107bad8ae3601f3c
2021-03-01 14:41:44 -08:00
Dikshita Agarwal
059ab33f5f BACKPORT: media: v4l2-ctrl: Add layer wise bitrate controls for h264
Adds bitrate control for all coding layers for h264
same as hevc.

Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
(cherry picked from commit 4ca134ee98)
Change-Id: I83f3fa4ee81885eda62c006f0702edabe4577a17
Bug: 175370800
Link: https://lkml.org/lkml/2020/12/24/137
[dikshita : Original change has multiple dependencies, hence
 needs manual modifications to pick up the change in
 simplified way]
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
2021-03-01 22:13:59 +00:00
Dikshita Agarwal
ee1fdcb814 BACKPORT: media: v4l2-ctrl: Add frame-specific min/max qp controls for hevc
- Adds min/max qp controls for B frame for h264.
- Adds min/max qp controls for I/P/B frames for hevc similar to h264.
- Update valid range of min/max qp for hevc to accommodate 10 bit.

Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
(cherry picked from commit 99d0cbe4be)
Bug: 175376073
Link: https://lkml.org/lkml/2020/12/24/139
[dikshita : Original change has multiple dependencies, hence
 needs manual modifications to pick up the change in
 simplified way]
Change-Id: Ifb70c13b23311623d2bf79383adeca0ec0686922
Signed-off-by: Dikshita Agarwal <dikshita@codeaurora.org>
2021-03-01 22:13:18 +00:00
Suzuki K Poulose
04dc43bd98 FROMLIST: dts: bindings: Document device tree bindings for Arm TRBE
Document the device tree bindings for Trace Buffer Extension (TRBE).

Bug: 174685394
Cc: Anshuman Khandual <anshuman.khandual@arm.com>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Rob Herring <robh@kernel.org>
Cc: devicetree@vger.kernel.org
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/linux-arm-kernel/20210225193543.2920532-20-suzuki.poulose@arm.com/
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Change-Id: I72dc33a185649809622273dd67ae227b11e8faaf
2021-03-01 12:52:16 -08:00
Anshuman Khandual
c122dd3c01 FROMLIST: coresight: sink: Add TRBE driver
Trace Buffer Extension (TRBE) implements a trace buffer per CPU which is
accessible via the system registers. The TRBE supports different addressing
modes including CPU virtual address and buffer modes including the circular
buffer mode. The TRBE buffer is addressed by a base pointer (TRBBASER_EL1),
an write pointer (TRBPTR_EL1) and a limit pointer (TRBLIMITR_EL1). But the
access to the trace buffer could be prohibited by a higher exception level
(EL3 or EL2), indicated by TRBIDR_EL1.P. The TRBE can also generate a CPU
private interrupt (PPI) on address translation errors and when the buffer
is full. Overall implementation here is inspired from the Arm SPE driver.

Bug: 174685394
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/linux-arm-kernel/20210225193543.2920532-19-suzuki.poulose@arm.com/
Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Change-Id: I7b19c009c9f4b98d7d10d6e9c9a7ce76f9096eac
2021-03-01 12:52:16 -08:00