Commit Graph

1073474 Commits

Author SHA1 Message Date
Subbaraman Narayanamurthy
dd2116df9a power: supply: Add QTI battery charger
Add Qualcomm Technologies, Inc. battery charger driver which
interfaces with the charger firmware running on the remote
subsystem (e.g. DSP) by communicating over PMIC Glink channel and
provides information about the battery, USB and wireless charging
by exposing them as power supply devices.

Change-Id: I36a2efd0b66bc5f79515b5faa318c537a5927e76
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2022-05-02 11:36:08 -07:00
Guru Das Srinagesh
1c675f15c0 soc: altmode: Add correct notify message length check
Add a check to ensure that the remote subsystem sends the full and
expected length of the notification message.

Change-Id: I78d2c708c924cb864b7636bda81f290e310beb54
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:31:24 -07:00
Guru Das Srinagesh
12f5185963 soc: qcom: altmode-glink: Execute client callback in work
Execute the client's callback in a separate thread to avoid the
following deadlock situation:

- altmode_callback() calls the client's callback when a valid amclient
  is found and program execution waits for it to finish.
- The client's callback calls altmode_send_data() to send the PAN_ACK.
- altmode_send_data() eventually calls altmode_write(), which is waiting
  for the response_received to be "completed" in altmode_callback().
- For response_received to be "completed", altmode_callback() must
  finish executing in order to process the USBC_CMD_WRITE_REQ message
  received from the remote subsystem.
- altmode_callback() cannot finish executing until altmode_send_data()
  returns.
- altmode_send_data() times out and passes on the error to the client.

Also perform the following:
- Add a check to ensure that the payload received from the remote
  subsystem is at least 9 bytes long.
- Prevent out of bounds access for USBC_CMD_WRITE_REQ message (which is
  of a different format than struct usbc_notify_ind_msg) by moving the
  port_index reading to only the USBC_NOTIFY_IND message in
  altmode_callback().

CRs-Fixed: 2713590
Fixes: 6c0ffc67e574 ("soc: altmode: Detect when remote subsys fails to respond")
Change-Id: I0f2c6ce0f843c43c9e7e301be9ff3ad913310f62
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:31:04 -07:00
Guru Das Srinagesh
011cf3718b soc: altmode: Detect when remote subsys fails to respond
The remote subsystem acknowledges all Altmode PMIC GLINK messages sent
to it. Print an error message anytime it fails to do this.

In the case when no client is found for a received message, do the
sending of the ack in a separate worker thread instead of a plain
function call to altmode_send_ack(). This is to avoid a deadlock and
consequent timing out in altmode_write(), which will happen in the
following scenario:
- A message is received for a nonexistent client.
- altmode_send_ack() is called from within altmode_callback().
- The PAN ACK is sent to the remote subsystem via pmic_glink_write() in
  altmode_write() and the remote subsystem replies with an ACK (opcode
  USBC_CMD_WRITE_REQ).
- Subsequently, in altmode_write() we wait for completion timeout, which
  will happen only if this new ACK message is processed by PMIC GLINK.
- PMIC GLINK is waiting for altmode_callback() to return so that it can
  process the new message.
- We are still waiting in altmode_callback() for altmode_send_ack() to
  complete.
- We time out in altmode_write() waiting for the completion to occur.

This problem is solved by firing off a worker thread to send the PAN ACK
so that altmode_callback() can exit quickly and allow the incoming new
ACK to hit the complete() in the USBC_CMD_WRITE_REQ case in
altmode_callback().

Also add a couple of minor fixes to some debug messages while we're at
it.

Change-Id: I3d80b1a7d6cc03b0eba61b5c9cc660ce7d377942
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:30:19 -07:00
Guru Das Srinagesh
5063ec589d soc: altmode: Add debugfs nodes to send PAN EN and PAN ACK
Add debugfs nodes to send Pin Assignment Notifications Enable (PAN EN)
and Acknowledgment (ACK) commands manually if needed, to aid in
debugging situations where it is unclear whether clients are sending
these commands synchronously as per design.

Change-Id: I7a68d676df86cbf6952158202c8e4958db032d5b
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:29:47 -07:00
Guru Das Srinagesh
51467ac1d6 soc: altmode: Remove altmode device name
Remove the device tree property "qcom,altmode-name" and the logic it
feeds as it was meant to help in the cases when there are multiple
altmode devices. Since there is going to be only one altmode device as
per design, this is no longer needed.

Change-Id: Ife15e39becee5f4ff03bdcc56ff62ae812fe2726
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:29:00 -07:00
Guru Das Srinagesh
88a5ed5970 soc: altmode: Update client APIs, notifier bookkeeping
Client API changes:
- Update client APIs to align them more closely with upstream
  conventions.
- In particular, change the link between altmode device and client from
  the altmode device's name string to a phandle to the altmode device
  followed by the port index of the client.
- Instead of using solely the client's SVID as the key for idr_alloc,
  include port_index as well because the unique identifier of a client
  is the (SVID, port_index) tuple.

Updates to client notifying mechanism:
- Get rid of the standard notifier APIs in favour of a simpler callback
  function-based mechanism to notify clients of probe completion.
- In addition, if clients probe after altmode finishes probing, they
  will not get notified of probe completion as this is done only once at
  the end of altmode_probe(). Fix this so that if a client registers for
  probe completion notifications after altmode probes, they get notified
  immediately.

While at it, get rid of the global list of altmode devices (amdev_list)
as there will only be a single altmode device in the system as per
design.

Change-Id: Iea450d30d9cc94671f505b7ff0c6e98b0b8a4467
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:28:16 -07:00
Subbaraman Narayanamurthy
44c3a6cfe8 soc: qcom: altmode-glink: add SSR support
Add subsystem restart (SSR) support to altmode glink driver so
that when subsystem goes down and comes up again, it can send
PAN_EN to charger firmware to receive notifications about altmode
interface.

Change-Id: Ie011d5110b6c26790fe1dd6149115019f8bc261c
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2022-04-28 13:27:34 -07:00
Guru Das Srinagesh
46cbba2946 soc: qcom: Add Type-C alternate mode driver
The Type-C standard defines various "alternate (alt) modes" which enable
standard Type-C connectors to carry non-USB signals and data.

This driver provides an interface for Type-C alternate mode clients to
receive data such as Pin Assignment Notifications from the Type-C stack
running on a remote subsystem (e.g. DSP) via the PMIC GLINK interface.

Change-Id: Ic7eacb6901830cab181d91a1775cf02cddbccae2
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:26:26 -07:00
Subbaraman Narayanamurthy
ad98e248e2 soc: qcom: qti_battery_debug: add support for 2S battery context dump
Currently, qti_battery_debug driver supports collecting QBG
context dump only for 1S battery. Add support to collect QBG
context dump for more than single cell to support 2S battery.
User can set "battery_cell_id" to select the QBG context dump
they would like to receive from the charger firmware that runs
on a remote subsystem.

Change-Id: I863b908a8c5bfae441431d31ac4dc8a491a0310c
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2022-04-28 13:23:01 -07:00
Guru Das Srinagesh
d9197e1de2 soc: qti_battery_debug: Move qbg_context to device bin file
Replace the "qbg_context" debugfs blob with a binary file associated
with the battery_debug device that provides the same functionality as
the existing debugfs blob for getting QBG context.

Usage:
  # cd /sys/devices/platform/soc/soc:qcom,pmic_glink_log/\
    soc:qcom,pmic_glink_log:qcom,battery_debug
  # echo 1 > qbg_context
  # cat qbg_context > file.bin

Change-Id: I59cfea2880362a95d8c87c02b4d823bfdca4e1e2
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:22:18 -07:00
Guru Das Srinagesh
e4ea2b8741 soc: qcom: qti_battery_debug: Add NULL check
Ensure that valid memory is allocated for the array of all votables
before an attempt is made to populate it.

Change-Id: I9a0c3e35e345a88560e39d47484348b6c476628d
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:20:09 -07:00
Guru Das Srinagesh
cd857f2b69 soc: qti_battery_debug: Remove CONFIG_DEBUG_FS dependency
As a preparatory move to adding device attributes to the battery_debug
device, remove the dependency on DEBUG_FS for driver enablement and add
config guards in the driver instead.

Change-Id: I8fcb385a583564935ce472416552e25ca79f4a84
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:18:57 -07:00
Guru Das Srinagesh
1069d0fec8 soc: qti_battery_debug: Add votables R/W support
Add debugfs nodes to read and set votables from the firmware running on
the remote subsystem (e.g. DSP).

Also modify error handling logic in battery_dbg_add_debugfs().

Change-Id: I50f191add22cd500e04475f264e86cf16c6be48f
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:17:08 -07:00
Subbaraman Narayanamurthy
b7a6f73833 soc: qcom: qti_battery_debug: Update QBG device context dump length
QBG device context dump length has been increased to 598 words in
the charger firmware. Increase the length to support upto 4KB.

Change-Id: I4a0a28044a54cdbde146101384f5a1ccf73b1562
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2022-04-28 13:16:19 -07:00
Subbaraman Narayanamurthy
13fb635d44 soc: qcom: add initial version of qti_battery_debug driver
QTI battery debug driver helps to get logs and debug information
by communicating with charger firmware (CHGFW) running on the
remote subsystem (e.g. DSP) over PMIC Glink. Currently, it
supports getting the device context dump of battery gauging
software which is part of CHGFW.

Change-Id: I7bb303cf61a97f3087f8c024fc6b37e68e5d1f1e
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2022-04-28 13:12:41 -07:00
Guru Das Srinagesh
f4ec9d39d0 soc: Kconfig: Add QTI_PMIC_GLINK_CLIENT_DEBUG
This option enables the generation of debugfs files in PMIC GLINK client
drivers that are strictly meant for internal debugging only.

Change-Id: I0c0c27b38754dcc694a4b98d6cd29e4a78cd7426
Signed-off-by: Guru Das Srinagesh <gurus@codeaurora.org>
2022-04-28 13:08:53 -07:00
Subbaraman Narayanamurthy
2ec0cddc2d soc: qcom: Add PMIC Glink driver
The PMIC Glink driver provides the interface for clients to
communicate over GLink for sending and receiving data to charger
firmware that runs on a remote subsystem (e.g. ADSP) which
supports charging and gauging.

This enables clients to read/write battery charging parameters
and get notifications.

This is a snapshot taken as of msm-5.10
commit 0f4075248b75 ("soc: qcom: pmic_glink: Use
SERVREG_SERVICE_STATE_DOWN for handling PDR").

Change-Id: I1e4c09d1ee10c8c5397f4459afe8d656593d718a
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
Signed-off-by: David Collins <collinsd@codeaurora.org>
2022-04-28 13:05:08 -07:00
Huang Yiwei
b91a83b811 soc: qcom: socinfo: Add PINEAPPLE soc id
Add PINEAPPLE mapping from SOC ID -> name.

Change-Id: I5616f82d2645ae1890557293c17cb0c806b6c1c5
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-28 10:34:08 +08:00
qctecmdr
0a2f06a0a3 Merge "soc: qcom: Add snapshot of minidump driver" 2022-04-27 12:12:28 -07:00
qctecmdr
d39513b72f Merge "soc: qcom: Add snapshot of watchdog driver" 2022-04-27 12:12:27 -07:00
qctecmdr
fd253fa298 Merge "secure_buffer: Port a snapshot of the secure-buffer driver" 2022-04-22 15:33:36 -07:00
qctecmdr
4325803d1c Merge "soc: qcom: Add snapshot of memory dump driver" 2022-04-22 12:20:07 -07:00
qctecmdr
1c7cf63f87 Merge "secure_buffer: Add the secure_buffer.h header file" 2022-04-21 16:30:53 -07:00
Chris Goldsworthy
69b737bb70 secure_buffer: Port a snapshot of the secure-buffer driver
Take a snapshot of the secure-buffer driver as of commit f843a80d2c45
("Merge "defconfig: gen3auto: Separated if_changed"") on msm-5.15.
secure_buffer.h is already merged.

Change-Id: I98cfe097d6b3b332a8a1a6ab2e42f090308585d3
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2022-04-21 13:33:38 -07:00
Chris Goldsworthy
9b3ea8593a secure_buffer: Add the secure_buffer.h header file
Take a snapshot of the secure_buffer.h file as of commit f843a80d2c45
("Merge "defconfig: gen3auto: Separated if_changed"") on msm-5.15.

Change-Id: Ic6f1b59ead3bb2947d05ed3d2ea0eecf70597fe7
Signed-off-by: Chris Goldsworthy <quic_cgoldswo@quicinc.com>
2022-04-21 13:33:38 -07:00
qctecmdr
4726ba2157 Merge "defconfig:pineapple_consolidate: Enable CONFIG_UFS_DBG" 2022-04-21 06:05:43 -07:00
Huang Yiwei
1ce2d41f84 soc: qcom: Add snapshot of minidump driver
This is a snapshot of the minidump driver as of msm-5.15
commit <908a517b050d> ("Merge "sched/walt: remove duplicate
definitions of rt_task_arrival_time"").

Change-Id: I47eba0f9aedb1732724b94f567404287378c6189
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-21 18:55:13 +08:00
Can Guo
2fe724d3cc defconfig:pineapple_consolidate: Enable CONFIG_UFS_DBG
Enable UFS debug features for consolidate build.

Change-Id: Iad925570af96eb1490010c8582ad12f1215d23c3
Signed-off-by: Can Guo <quic_cang@quicinc.com>
2022-04-21 01:07:36 -07:00
Bao D. Nguyen
c905f4e5f4 scsi: ufs: Add configuration option for UFS debug support
Add CONFIG_UFS_DBG option to support UFS debug features.

Change-Id: I98fb46223b74da587f265d96abd51526f0b488fd
Signed-off-by: Bao D. Nguyen <quic_nguyenb@quicinc.com>
Signed-off-by: Can Guo <quic_cang@quicinc.com>
2022-04-21 00:54:14 -07:00
Huang Yiwei
c06fec2f03 soc: qcom: Add snapshot of watchdog driver
This is a snapshot of the soc watchdog, gunyah
watchdog and watchdog core driver as of msm-5.15
commit <908a517b050d> ("Merge "sched/walt: remove
duplicate definitions of rt_task_arrival_time"").

Change-Id: I78134e1b42e0abd74c3b4630c135715ee959afa1
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-21 14:06:26 +08:00
qctecmdr
686aa245d9 Merge "soc: qcom: Add snapshot of cpu vendor hooks driver" 2022-04-20 19:12:34 -07:00
qctecmdr
490cb81275 Merge "power: reset: Add snapshot of qcom-dload-mode driver" 2022-04-20 12:25:15 -07:00
qctecmdr
e05c2a8819 Merge "soc: qcom: Add snapshot of socinfo driver" 2022-04-20 10:04:09 -07:00
qctecmdr
8f3a41f605 Merge "build.config.msm.gki: Enable downstream symbol trimming" 2022-04-20 10:04:08 -07:00
Huang Yiwei
80fc3aba43 power: reset: Add snapshot of qcom-dload-mode driver
This is a snapshot of the qcom-dload-mode driver as of msm-5.15
commit <908a517b050d> ("Merge "sched/walt: remove duplicate
definitions of rt_task_arrival_time"").

Change-Id: I267e2ef3d4d86aba285e38d8b03ce5f3037d3c13
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-20 20:18:31 +08:00
Huang Yiwei
8979557e1e soc: qcom: Add snapshot of memory dump driver
This is a snapshot of the memory dump driver as of msm-5.15
commit <908a517b050d> ("Merge "sched/walt: remove duplicate
definitions of rt_task_arrival_time"").

Change-Id: If6fd016ee13340ec90cdd6f34bbc87293f5a39ee
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-20 19:52:07 +08:00
Huang Yiwei
15d0a17a18 soc: qcom: Add snapshot of socinfo driver
This is a snapshot of the socinfo driver as of msm-5.15
commit <908a517b050d> ("Merge "sched/walt: remove duplicate
definitions of rt_task_arrival_time"").

Change-Id: Ib969b851ccbfc5651259aba5872575d0fa3994db
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-20 19:26:28 +08:00
Huang Yiwei
d4a31c35fb soc: qcom: Add snapshot of cpu vendor hooks driver
This is a snapshot of the cpu vendor hooks driver as of
msm-5.15 commit <908a517b050d> ("Merge "sched/walt: remove
duplicate definitions of rt_task_arrival_time"").

Change-Id: Ia878a0e8ac111bd6247382539a159f16f641de0a
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-20 18:20:14 +08:00
Huang Yiwei
afb375e663 soc: qcom: Add snapshot of qcom_logbuf_vendor_hooks
This is a snapshot of the qcom_logbuf_vendor_hooks as of
msm-5.15 commit <908a517b050d> ("Merge "sched/walt: remove
duplicate definitions of rt_task_arrival_time"").

Change-Id: I4e409c56acc59c38fcd7fdc10e03c3edb81ee1a3
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-20 17:09:33 +08:00
qctecmdr
e80d68e98c Merge "soc: qcom: Add snapshot of Core Hang Detection driver" 2022-04-19 23:10:45 -07:00
qctecmdr
75f80cd65e Merge "soc: qcom: Add snapshot of reboot reason driver" 2022-04-19 20:45:40 -07:00
Elliot Berman
8cf09a8792 build.config.msm.gki: Enable downstream symbol trimming
Enable downstream symbol trimming on mixed build. Will be partially
reverted once ACK has enabled symbol trimming.

Change-Id: Ia44da298809137b5def9ed14bfe3f4888bbca4b7
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
Signed-off-by: Guru Das Srinagesh <quic_gurus@quicinc.com>
2022-04-19 12:52:33 -07:00
qctecmdr
13baa64984 Merge "dt-bindings: Add include DT binding headers for IPCC" 2022-04-19 10:18:58 -07:00
qctecmdr
b84ae5a65c Merge "soc: qcom: Add snapshot of boot stats driver" 2022-04-19 10:18:57 -07:00
qctecmdr
55b439d0b0 Merge "soc: qcom: Add snapshot of IPCC driver" 2022-04-19 10:18:57 -07:00
Huang Yiwei
cf88b9b75e soc: qcom: Add snapshot of Core Hang Detection driver
This is a snapshot of the Core Hang Detection driver as of
commit <908a517b050d> ("Merge "sched/walt: remove duplicate
definitions of rt_task_arrival_time"").

Change-Id: Ic1d9b61b3488e88e08eb317f0e406a350dd73310
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-19 14:29:44 +08:00
Huang Yiwei
5b4abda897 soc: qcom: Add snapshot of rq_stats driver
This is a snapshot of the rq_stats driver as of msm-5.15
commit <908a517b050d> ("Merge "sched/walt: remove duplicate
definitions of rt_task_arrival_time"").

Change-Id: I83cc75fe4dcbb843810628825df7ef0d5516b2bb
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-19 14:29:24 +08:00
Huang Yiwei
5d483393ce soc: qcom: Add snapshot of boot stats driver
This is a snapshot of the boot_stats driver as of msm-5.15
commit <908a517b050d> ("Merge "sched/walt: remove duplicate
definitions of rt_task_arrival_time"").

Change-Id: I0a2e95f6079037972af1d86db8781ab2bb47808d
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-19 14:28:28 +08:00
Huang Yiwei
d2e521397e soc: qcom: Add snapshot of reboot reason driver
This is a snapshot of the reboot reason driver as of msm-5.15
commit <908a517b050d> ("Merge "sched/walt: remove duplicate
definitions of rt_task_arrival_time"").

Change-Id: I7cf898ac8d4232d1e00a58f97091ebc2e52fcb5b
Signed-off-by: Huang Yiwei <quic_hyiwei@quicinc.com>
2022-04-19 13:18:31 +08:00