summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixelBot AutoMerger <android-nexus-securitybot@system.gserviceaccount.com>2023-10-29 18:56:51 -0700
committerSecurityBot <android-nexus-securitybot@system.gserviceaccount.com>2023-10-29 18:56:51 -0700
commit35e06d6bda27b88e8d92e07d9ba17dafc34d2233 (patch)
tree8317453cd7d9d44977f62b3d0ed3f72373e8abe9
parent86a6983702d2b43f9ad2108b457f9aded0620322 (diff)
parentb27213834701c3ce0c70fa57093447d2cab31a0e (diff)
downloadaoc-35e06d6bda27b88e8d92e07d9ba17dafc34d2233.tar.gz
Merge android14-gs-pixel-5.15-24Q1 into android14-gs-pixel-5.15
SBMerger: 571992243 Change-Id: I4d842d42fdf4fe67d5d7f0bccfe347f344690541 Signed-off-by: SecurityBot <android-nexus-securitybot@system.gserviceaccount.com>
-rw-r--r--alsa/aoc_alsa.h4
-rw-r--r--alsa/aoc_alsa_ctl.c6
-rw-r--r--alsa/aoc_alsa_incall.c16
-rw-r--r--alsa/aoc_alsa_path.c6
-rw-r--r--aoc-interface-gs101.h68
-rw-r--r--aoc.c38
-rw-r--r--aoc.h9
-rw-r--r--aoc_v1.c30
-rw-r--r--usb/aoc_usb.h4
-rw-r--r--usb/aoc_usb_dev.c25
-rw-r--r--usb/xhci_hooks_impl_whi.c5
11 files changed, 144 insertions, 67 deletions
diff --git a/alsa/aoc_alsa.h b/alsa/aoc_alsa.h
index 711563c..e3c017c 100644
--- a/alsa/aoc_alsa.h
+++ b/alsa/aoc_alsa.h
@@ -222,7 +222,8 @@ enum aec_ref_source {
BT_PLAYBACK,
NUM_AEC_REF_SOURCE
};
-enum { INCALL_CAPTURE_OFF = 0, INCALL_CAPTURE_UL, INCALL_CAPTURE_DL, INCALL_CAPTURE_UL_DL };
+enum { INCALL_CAPTURE_OFF = 0, INCALL_CAPTURE_UL, INCALL_CAPTURE_DL, INCALL_CAPTURE_UL_DL,
+ INCALL_CAPTURE_3MIC };
enum { NONBLOCKING = 0, BLOCKING = 1 };
enum { STOP = 0, START };
enum { PLAYBACK_MODE, VOICE_TX_MODE, VOICE_RX_MODE, HAPTICS_MODE, OFFLOAD_MODE };
@@ -344,6 +345,7 @@ struct aoc_alsa_stream {
int params_rate; /* Sampling rate */
int pcm_format_width; /* Number of bits */
bool pcm_float_fmt; /* Floating point */
+ bool reused_for_voip;
struct vm_area_struct *vma; /* for MMAP */
unsigned int period_size;
diff --git a/alsa/aoc_alsa_ctl.c b/alsa/aoc_alsa_ctl.c
index e0e0440..320a9c1 100644
--- a/alsa/aoc_alsa_ctl.c
+++ b/alsa/aoc_alsa_ctl.c
@@ -2206,11 +2206,13 @@ static SOC_ENUM_SINGLE_DECL(sink_4_state_enum, 1, 4,
sink_processing_state_texts);
/* audio dsp state switch */
-static const char *audio_dsp_state_switch_texts[] = { "Ambient", "Record", "Telephony"};
+static const char *audio_dsp_state_switch_texts[] = { "Ambient", "Record", "Telephony",
+ "RESERVED_0", "RESERVED_1", "RESERVED_2",
+ "Telephony_APMG3"};
static SOC_ENUM_SINGLE_DECL(audio_dsp_state_switch_enum, 1, 0, audio_dsp_state_switch_texts);
/* incall capture stream state */
-static const char *incall_capture_stream_texts[] = { "Off", "UL", "DL", "UL_DL" };
+static const char *incall_capture_stream_texts[] = { "Off", "UL", "DL", "UL_DL", "3MIC" };
static SOC_ENUM_SINGLE_DECL(incall_capture_stream0_enum, 1, 0, incall_capture_stream_texts);
static SOC_ENUM_SINGLE_DECL(incall_capture_stream1_enum, 1, 1, incall_capture_stream_texts);
static SOC_ENUM_SINGLE_DECL(incall_capture_stream2_enum, 1, 2, incall_capture_stream_texts);
diff --git a/alsa/aoc_alsa_incall.c b/alsa/aoc_alsa_incall.c
index eb8be56..29e1bbd 100644
--- a/alsa/aoc_alsa_incall.c
+++ b/alsa/aoc_alsa_incall.c
@@ -239,6 +239,10 @@ static int snd_aoc_pcm_open(struct snd_soc_component *component,
/* TODO: refactor needed on mapping between device number and entrypoint */
alsa_stream->entry_point_idx = (idx == 7) ? HAPTICS : idx;
+ if (rtd->dai_link->id == IDX_INCALL_CAP0_TX &&
+ chip->incall_capture_state[0] == INCALL_CAPTURE_3MIC) {
+ alsa_stream->reused_for_voip = true;
+ }
mutex_unlock(&chip->audio_mutex);
return 0;
@@ -319,6 +323,12 @@ static int snd_aoc_pcm_close(struct snd_soc_component *component,
*/
chip->opened &= ~(1 << alsa_stream->idx);
+ if (alsa_stream->reused_for_voip) {
+ /* Userspace should only select one EP for VoIP capture and one EP for
+ * VoIP playback.
+ */
+ teardown_voipcall(alsa_stream);
+ }
mutex_unlock(&chip->audio_mutex);
return 0;
@@ -421,6 +431,12 @@ static int snd_aoc_pcm_prepare(struct snd_soc_component *component,
alsa_stream->buffer_size, alsa_stream->period_size, alsa_stream->pos,
runtime->frame_bits);
+ if (alsa_stream->reused_for_voip) {
+ /* Userspace should only select one EP for VoIP capture and one EP for
+ * VoIP playback.
+ */
+ prepare_voipcall(alsa_stream);
+ }
mutex_unlock(&chip->audio_mutex);
return 0;
}
diff --git a/alsa/aoc_alsa_path.c b/alsa/aoc_alsa_path.c
index 531d77a..429fd19 100644
--- a/alsa/aoc_alsa_path.c
+++ b/alsa/aoc_alsa_path.c
@@ -493,7 +493,7 @@ static struct snd_soc_dai_driver aoc_dai_drv[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
- .channels_max = 4,
+ .channels_max = 8,
},
.name = "audio_incall_cap_0",
.id = IDX_INCALL_CAP0_TX,
@@ -507,7 +507,7 @@ static struct snd_soc_dai_driver aoc_dai_drv[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
- .channels_max = 4,
+ .channels_max = 8,
},
.name = "audio_incall_cap_1",
.id = IDX_INCALL_CAP1_TX,
@@ -521,7 +521,7 @@ static struct snd_soc_dai_driver aoc_dai_drv[] = {
SNDRV_PCM_FMTBIT_S24_LE |
SNDRV_PCM_FMTBIT_S32_LE,
.channels_min = 1,
- .channels_max = 4,
+ .channels_max = 8,
},
.name = "audio_incall_cap_2",
.id = IDX_INCALL_CAP2_TX,
diff --git a/aoc-interface-gs101.h b/aoc-interface-gs101.h
index 7b71b07..d876c6c 100644
--- a/aoc-interface-gs101.h
+++ b/aoc-interface-gs101.h
@@ -18,7 +18,7 @@
* Autogenerated AoC interface matching AoC source code
* associated with the following source code:
*
- * hash: 57ceae13174538d1ee19a1aaba563ec44f89e900
+ * hash: 369ba3d57af1d698f311a3a33f876930b6eb2b3b
*
* DO NOT MODIFY THIS FILE
*
@@ -83,7 +83,8 @@ enum AOC_COMMAND {
CMD_DBG_MEM_DUMP_ID = 38, /* [0x0026] -> struct CMD_DBG_MEM_DUMP */
CMD_DBG_MEM_INVAL_ACCESS_ID = 45, /* [0x002d] -> struct CMD_CORE_GENERIC */
CMD_DBG_MCPS_ID = 47, /* [0x002f] -> struct CMD_DBG_MCPS */
- CMD_DBG_SCRIB_ID = 48, /* [0x0030] -> struct CMD_DBG_SCRIB */
+ CMD_DBG_SCRIB_ID = 50, /* [0x0032] -> struct CMD_DBG_SCRIB */
+ CMD_DBG_PRIVATE_ID = 51, /* [0x0033] -> struct CMD_DBG_PRIVATE */
CMD_IPC_NOTIF_ENABLE_ID = 100, /* [0x0064] -> struct CMD_IPC_NOTIF_ENABLE */
CMD_AUDIO_OUTPUT_SINK_ID = 200, /* [0x00c8] -> struct CMD_AUDIO_OUTPUT_SINK */
CMD_DIAG_CORE_POWER_ID = 200, /* [0x00c8] -> struct CMD_DIAG_CORE_POWER */
@@ -255,7 +256,11 @@ enum AOC_COMMAND {
CMD_USB_CONTROL_SEND_FEEDBACK_EP_INFO_ID = 287, /* [0x011f] -> struct CMD_USB_CONTROL_SEND_FEEDBACK_EP_INFO */
CMD_AUDIO_INPUT_AMBIENT_MUSIC_BREAK_LOAD_MODEL_ID = 288, /* [0x0120] -> struct CMD_HDR */
CMD_AUDIO_INPUT_AMBIENT_MUSIC_BREAK_UNLOAD_MODEL_ID = 289, /* [0x0121] -> struct CMD_HDR */
+ CMD_AUDIO_OUTPUT_TELEPHONY_RTP_START_ID = 289, /* [0x0121] -> struct CMD_HDR */
+ CMD_AUDIO_OUTPUT_TELEPHONY_RTP_STOP_ID = 290, /* [0x0122] -> struct CMD_HDR */
+ CMD_AUDIO_OUTPUT_VOICE_ENABLE_CCA_ON_VOIP_ID = 291, /* [0x0123] -> struct CMD_HDR */
CMD_AUDIO_INPUT_MIC_RECORD_AP_START_PREPARE_ID = 292, /* [0x0124] -> struct CMD_HDR */
+ CMD_AUDIO_OUTPUT_VOICE_DISABLE_CCA_ON_VOIP_ID = 292, /* [0x0124] -> struct CMD_HDR */
CMD_AUDIO_INPUT_MIC_RECORD_AP_START_DATA_ID = 293, /* [0x0125] -> struct CMD_HDR */
CMD_AUDIO_INPUT_MIC_MMAP_ENABLE_ID = 294, /* [0x0126] -> struct CMD_AUDIO_INPUT_AP_INPUT_START */
CMD_AUDIO_INPUT_MIC_MMAP_DISABLE_ID = 295, /* [0x0127] -> struct CMD_HDR */
@@ -298,6 +303,13 @@ enum AOC_COMMAND {
CMD_AUDIO_INPUT_CAPTURE_INJECTION_STOP_ID = 341, /* [0x0155] -> struct CMD_HDR */
CMD_AUDIO_INPUT_HOTWORD_ENABLE_PRIMARY_MIC_SWAP_ID = 342, /* [0x0156] -> struct CMD_HDR */
CMD_AUDIO_INPUT_HOTWORD_DISABLE_PRIMARY_MIC_SWAP_ID = 343, /* [0x0157] -> struct CMD_HDR */
+ CMD_AUDIO_INPUT_SET_CHRE_SRC_AEC_TIMEOUT_ID = 345, /* [0x0159] -> struct CMD_AUDIO_INPUT_SET_CHRE_SRC_AEC_TIMEOUT */
+ CMD_AUDIO_INPUT_SET_CHRE_SRC_PDM_GAIN_ID = 346, /* [0x015a] -> struct CMD_AUDIO_INPUT_SET_CHRE_SRC_PDM_GAIN */
+ CMD_AUDIO_INPUT_SET_CHRE_SRC_AEC_GAIN_ID = 347, /* [0x015b] -> struct CMD_AUDIO_INPUT_SET_CHRE_SRC_AEC_GAIN */
+ CMD_AUDIO_INPUT_HOTWORD_ENABLE_NEURAL_AEC_ID = 350, /* [0x015e] -> struct CMD_HDR */
+ CMD_AUDIO_INPUT_HOTWORD_DISABLE_NEURAL_AEC_ID = 351, /* [0x015f] -> struct CMD_HDR */
+ CMD_AUDIO_INPUT_HOTWORD_ENABLE_HOTWORD_TAP_ID = 352, /* [0x0160] -> struct CMD_HDR */
+ CMD_AUDIO_INPUT_HOTWORD_DISABLE_HOTWORD_TAP_ID = 353, /* [0x0161] -> struct CMD_HDR */
};
/**
@@ -370,7 +382,11 @@ struct CONTAINER_HDR {
* CMD_AUDIO_OUTPUT_DECODER_GAPLESS_DEINIT_ID, UUID: a77ecb0deb43d8b2cff697ec83bd8571
* CMD_AUDIO_INPUT_AMBIENT_MUSIC_BREAK_LOAD_MODEL_ID, UUID: 3667c2affee42fed78892d05626d0a88
* CMD_AUDIO_INPUT_AMBIENT_MUSIC_BREAK_UNLOAD_MODEL_ID, UUID: d3b7cbecbc7f3c607bf090245f691002
+ * CMD_AUDIO_OUTPUT_TELEPHONY_RTP_START_ID, UUID: 9d12f53f498b427930257a6d8010478c
+ * CMD_AUDIO_OUTPUT_TELEPHONY_RTP_STOP_ID, UUID: cc499dc1692b5fe55df8fc02f9809c7f
+ * CMD_AUDIO_OUTPUT_VOICE_ENABLE_CCA_ON_VOIP_ID, UUID: 514450e55854eed2a15651067d6a3e55
* CMD_AUDIO_INPUT_MIC_RECORD_AP_START_PREPARE_ID, UUID: a2d983137ee5c50405f719a310c20971
+ * CMD_AUDIO_OUTPUT_VOICE_DISABLE_CCA_ON_VOIP_ID, UUID: 67226e15aef11c25557ca1130234a756
* CMD_AUDIO_INPUT_MIC_RECORD_AP_START_DATA_ID, UUID: eb4ca3ecc1e61d8abbdc79671dc0edbb
* CMD_AUDIO_INPUT_MIC_MMAP_DISABLE_ID, UUID: 02aa59769391dbf4e0bae82fbcaebb3c
* CMD_AUDIO_INPUT_WNR_START_ID, UUID: cdfe4c6b0cbbebb53cd4f1de4cf7d10a
@@ -395,6 +411,10 @@ struct CONTAINER_HDR {
* CMD_AUDIO_INPUT_CAPTURE_INJECTION_STOP_ID, UUID: 59bd69e4f8da57ee844043c426239ba0
* CMD_AUDIO_INPUT_HOTWORD_ENABLE_PRIMARY_MIC_SWAP_ID, UUID: 14406b26352156fc3fd45dbd2afe8f21
* CMD_AUDIO_INPUT_HOTWORD_DISABLE_PRIMARY_MIC_SWAP_ID, UUID: 8dcc7c59a45658053cffdef0ac6d079e
+ * CMD_AUDIO_INPUT_HOTWORD_ENABLE_NEURAL_AEC_ID, UUID: 9d485929dc61d3babd81ddff05cf9392
+ * CMD_AUDIO_INPUT_HOTWORD_DISABLE_NEURAL_AEC_ID, UUID: c8a19d5b447ce1fae9a8666883c723d7
+ * CMD_AUDIO_INPUT_HOTWORD_ENABLE_HOTWORD_TAP_ID, UUID: 26bde63caffd544e581a7293f1cf793c
+ * CMD_AUDIO_INPUT_HOTWORD_DISABLE_HOTWORD_TAP_ID, UUID: 228b2b4c01e7c126658056a596ac4e5c
*/
struct CMD_HDR {
struct CONTAINER_HDR parent;
@@ -2266,7 +2286,8 @@ struct CMD_AUDIO_INPUT_FEEDBACK_SRC_SELECT_REF {
} __attribute__((packed));
enum UDFPS_INPUT_SOURCE {
- SOURCE_OSC = 0,
+ SOURCE_NONE = 0,
+ SOURCE_OSC,
SOURCE_DISP,
SOURCE_TOT,
};
@@ -2389,6 +2410,17 @@ struct CMD_DBG_SCRIB {
int32_t free_after_free;
} __attribute__((packed));
+/**
+ * Structure associated with the following commands:
+ *
+ * CMD_DBG_PRIVATE_ID, UUID: e338efdfe6222a0d2dd95100233654c1
+ */
+struct CMD_DBG_PRIVATE {
+ struct CMD_CORE_GENERIC parent;
+ uint8_t sub_cmd;
+ uint8_t payload_size;
+} __attribute__((packed));
+
enum ApStateTransition {
ENTER_SLEEP = 0,
EXIT_SLEEP,
@@ -2407,6 +2439,36 @@ struct CMD_AP_STATE_TRANSITION {
uint8_t transition; /* For valid values, refer to "enum ApStateTransition" */
} __attribute__((packed));
+/**
+ * Structure associated with the following commands:
+ *
+ * CMD_AUDIO_INPUT_SET_CHRE_SRC_AEC_TIMEOUT_ID, UUID: cf9af404b8238148390eb250b535c2a9
+ */
+struct CMD_AUDIO_INPUT_SET_CHRE_SRC_AEC_TIMEOUT {
+ struct CMD_HDR parent;
+ uint32_t timeout_ms;
+} __attribute__((packed));
+
+/**
+ * Structure associated with the following commands:
+ *
+ * CMD_AUDIO_INPUT_SET_CHRE_SRC_PDM_GAIN_ID, UUID: 70ad1f841ce46465e2389e08938835c9
+ */
+struct CMD_AUDIO_INPUT_SET_CHRE_SRC_PDM_GAIN {
+ struct CMD_HDR parent;
+ int32_t gain_centibel;
+} __attribute__((packed));
+
+/**
+ * Structure associated with the following commands:
+ *
+ * CMD_AUDIO_INPUT_SET_CHRE_SRC_AEC_GAIN_ID, UUID: fde782e5f1431573bd867d163fbf43a1
+ */
+struct CMD_AUDIO_INPUT_SET_CHRE_SRC_AEC_GAIN {
+ struct CMD_HDR parent;
+ int32_t gain_centibel;
+} __attribute__((packed));
+
struct NOTIF_HDR {
struct CONTAINER_HDR parent;
uint32_t id;
diff --git a/aoc.c b/aoc.c
index 5110a1d..24f7c03 100644
--- a/aoc.c
+++ b/aoc.c
@@ -111,7 +111,11 @@ static bool aoc_panic_on_req_timeout = true;
module_param(aoc_panic_on_req_timeout, bool, 0644);
MODULE_PARM_DESC(aoc_panic_on_req_timeout, "Enable kernel panic when aoc_req times out.");
-static struct aoc_module_parameters *aoc_module_params;
+static struct aoc_module_parameters aoc_module_params = {
+ .aoc_autoload_firmware = &aoc_autoload_firmware,
+ .aoc_disable_restart = &aoc_disable_restart,
+ .aoc_panic_on_req_timeout = &aoc_panic_on_req_timeout,
+};
static int aoc_core_suspend(struct device *dev);
static int aoc_core_resume(struct device *dev);
@@ -303,7 +307,6 @@ static int allocate_mailbox_channels(struct aoc_prvdata *prv)
rc = PTR_ERR(slot->channel);
dev_err(dev, "failed to find mailbox interface %d : %d\n", i, rc);
slot->channel = NULL;
- rc = -EIO;
goto err_mbox_req;
}
}
@@ -642,7 +645,7 @@ static void aoc_fw_callback(const struct firmware *fw, void *ctx)
aoc_release_from_reset(prvdata);
}
- enable_irq(prvdata->watchdog_irq);
+ configure_crash_interrupts(prvdata, true);
/* Monitor if there is callback from aoc after 5sec */
cancel_delayed_work_sync(&prvdata->monitor_work);
@@ -949,7 +952,7 @@ static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
if (prvdata->no_ap_resets) {
dev_err(dev, "Reset request rejected, option disabled via persist options");
} else {
- disable_irq_nosync(prvdata->watchdog_irq);
+ configure_crash_interrupts(prvdata, false);
strlcpy(prvdata->ap_reset_reason, reason_str, AP_RESET_REASON_LENGTH);
prvdata->ap_triggered_reset = true;
schedule_work(&prvdata->watchdog_work);
@@ -1166,6 +1169,8 @@ static struct aoc_service_dev *create_service_device(struct aoc_prvdata *prvdata
return NULL;
dev = kzalloc(sizeof(struct aoc_service_dev), GFP_KERNEL);
+ if (!dev)
+ return NULL;
prvdata->services[index] = dev;
name = aoc_service_name(s);
@@ -1370,7 +1375,10 @@ static void aoc_did_become_online(struct work_struct *work)
}
for (i = 0; i < s; i++) {
- create_service_device(prvdata, i);
+ if (!create_service_device(prvdata, i)) {
+ dev_err(prvdata->dev, "failed to create service device at index %d\n", i);
+ goto err;
+ }
}
aoc_state = AOC_STATE_ONLINE;
@@ -1860,7 +1868,7 @@ err_coredump:
mutex_lock(&aoc_service_lock);
aoc_take_offline(prvdata);
- restart_rc = aoc_watchdog_restart(prvdata, aoc_module_params);
+ restart_rc = aoc_watchdog_restart(prvdata, &aoc_module_params);
if (restart_rc == AOC_RESTART_DISABLED_RC) {
dev_info(prvdata->dev, "aoc subsystem restart is disabled\n");
} else if (restart_rc) {
@@ -2122,10 +2130,8 @@ static void aoc_cleanup_resources(struct platform_device *pdev)
static void release_gsa_device(void *prv)
{
- struct aoc_prvdata *prvdata = prv;
-
- put_device(prvdata->gsa_dev);
- prvdata->gsa_dev = NULL;
+ struct device *gsa_device = (struct device *)prv;
+ put_device(gsa_device);
}
static int find_gsa_device(struct aoc_prvdata *prvdata)
@@ -2149,7 +2155,7 @@ static int find_gsa_device(struct aoc_prvdata *prvdata)
}
prvdata->gsa_dev = &gsa_pdev->dev;
return devm_add_action_or_reset(prvdata->dev, release_gsa_device,
- prvdata);
+ &gsa_pdev->dev);
}
static int aoc_core_suspend(struct device *dev)
@@ -2263,13 +2269,6 @@ static int aoc_platform_probe(struct platform_device *pdev)
int ret;
int rc;
int i;
- struct aoc_module_parameters module_params = {
- .aoc_autoload_firmware = aoc_autoload_firmware,
- .aoc_disable_restart = aoc_disable_restart,
- .aoc_panic_on_req_timeout = aoc_panic_on_req_timeout
- };
-
- aoc_module_params = &module_params;
if (aoc_platform_device != NULL) {
dev_err(dev,
@@ -2520,7 +2519,6 @@ err_mem_resources:
err_memnode:
deinit_chardev(prvdata);
err_chardev:
- kfree(prvdata);
err_failed_prvdata_alloc:
err_invalid_dt:
err_platform_not_null:
@@ -2559,7 +2557,7 @@ static void aoc_platform_shutdown(struct platform_device *pdev)
{
struct aoc_prvdata *prvdata = platform_get_drvdata(pdev);
- disable_irq_nosync(prvdata->watchdog_irq);
+ configure_crash_interrupts(prvdata, false);
aoc_take_offline(prvdata);
}
diff --git a/aoc.h b/aoc.h
index afa7fbc..44b4539 100644
--- a/aoc.h
+++ b/aoc.h
@@ -120,6 +120,7 @@ struct aoc_prvdata {
int watchdog_irq;
struct work_struct watchdog_work;
+ bool first_fw_load;
bool aoc_reset_done;
bool ap_triggered_reset;
bool force_release_aoc;
@@ -181,9 +182,9 @@ struct aoc_prvdata {
};
struct aoc_module_parameters {
- bool aoc_autoload_firmware;
- bool aoc_disable_restart;
- bool aoc_panic_on_req_timeout;
+ bool *aoc_autoload_firmware;
+ bool *aoc_disable_restart;
+ bool *aoc_panic_on_req_timeout;
};
#define AOC_DEVICE(_d) container_of((_d), struct aoc_service_dev, dev)
@@ -284,6 +285,8 @@ bool aoc_fw_ready(void);
u32 dt_property(struct device_node *node, const char *key);
+void configure_crash_interrupts(struct aoc_prvdata *prvdata, bool enable);
+
#define AOC_SERVICE_NAME_LENGTH 32
/* Rings should have the ring flag set, slots = 1, size = ring size
diff --git a/aoc_v1.c b/aoc_v1.c
index 3370e86..1147c43 100644
--- a/aoc_v1.c
+++ b/aoc_v1.c
@@ -132,12 +132,10 @@ int aoc_watchdog_restart(struct aoc_prvdata *prvdata,
if (!pcu)
return -ENODEV;
- if (aoc_module_params->aoc_disable_restart)
+ if (*(aoc_module_params->aoc_disable_restart))
return AOC_RESTART_DISABLED_RC;
aoc_reset_successful = false;
- disable_irq_nosync(prvdata->sysmmu_nonsecure_irq);
- disable_irq_nosync(prvdata->sysmmu_secure_irq);
for (i = 0; i < aoc_reset_tries; i++) {
dev_info(prvdata->dev, "asserting aoc_req\n");
request_aoc_on(prvdata, true);
@@ -174,13 +172,11 @@ int aoc_watchdog_restart(struct aoc_prvdata *prvdata,
}
}
- if (aoc_req_rc && aoc_module_params->aoc_panic_on_req_timeout) {
+ if (aoc_req_rc && *(aoc_module_params->aoc_panic_on_req_timeout)) {
dev_err(prvdata->dev, "timed out too many times waiting for aoc_ack, triggering kernel panic\n");
panic("AoC kernel panic: timed out waiting for aoc_ack");
}
- enable_irq(prvdata->sysmmu_nonsecure_irq);
- enable_irq(prvdata->sysmmu_secure_irq);
if (!aoc_reset_successful) {
/* Trigger acpm ramdump since we timed out the aoc reset request */
dbg_snapshot_emergency_reboot("AoC Restart timed out");
@@ -439,6 +435,7 @@ int configure_watchdog_interrupt(struct platform_device *pdev, struct aoc_prvdat
ret);
return -EIO;
}
+ prvdata->first_fw_load = true;
return ret;
}
@@ -496,3 +493,24 @@ void aoc_configure_ssmt(struct platform_device *pdev
{}
#endif
EXPORT_SYMBOL_GPL(aoc_configure_ssmt);
+
+void configure_crash_interrupts(struct aoc_prvdata *prvdata, bool enable)
+{
+ if (prvdata->first_fw_load) {
+ /* Default irq state of watchdog is off and sysmmu is on.
+ * When loading aoc firmware in first time
+ * Enable only irq of watchdog for balance irq state
+ */
+ enable_irq(prvdata->watchdog_irq);
+ prvdata->first_fw_load = false;
+ } else if (enable) {
+ enable_irq(prvdata->sysmmu_nonsecure_irq);
+ enable_irq(prvdata->sysmmu_secure_irq);
+ enable_irq(prvdata->watchdog_irq);
+ } else {
+ disable_irq(prvdata->sysmmu_nonsecure_irq);
+ disable_irq(prvdata->sysmmu_secure_irq);
+ disable_irq_nosync(prvdata->watchdog_irq);
+ }
+}
+EXPORT_SYMBOL_GPL(configure_crash_interrupts);
diff --git a/usb/aoc_usb.h b/usb/aoc_usb.h
index 82f3130..e1d589c 100644
--- a/usb/aoc_usb.h
+++ b/usb/aoc_usb.h
@@ -76,12 +76,10 @@ int usb_host_mode_state_notify(enum aoc_usb_state usb_state);
int xhci_set_isoc_tr_info(u16 ep_id, u16 dir, struct xhci_ring *ep_ring);
int xhci_get_usb_audio_count(void);
-bool is_aoc_usb_probe_done(void);
-
int xhci_offload_helper_init(void);
int usb_vendor_helper_init(void);
-extern int dwc3_otg_fsm_try_reset(bool enabled);
+extern int dwc3_otg_host_ready(bool ready);
extern bool aoc_alsa_usb_capture_enabled(void);
extern bool aoc_alsa_usb_playback_enabled(void);
diff --git a/usb/aoc_usb_dev.c b/usb/aoc_usb_dev.c
index 54b6067..3feec5c 100644
--- a/usb/aoc_usb_dev.c
+++ b/usb/aoc_usb_dev.c
@@ -355,12 +355,6 @@ static void usb_host_mode_checking_work(struct work_struct *ws)
return;
}
-/*
- * This variable used to present if aoc_usb module was probed done. If offload
- * is enabled, the controller needs to wait for the aoc_usb probe done and then
- * continue the controller's probe.
- */
-static bool aoc_usb_probe_done;
static int aoc_usb_probe(struct aoc_service_dev *adev)
{
struct device *dev = &adev->dev;
@@ -384,15 +378,11 @@ static int aoc_usb_probe(struct aoc_service_dev *adev)
drvdata->service_timeout = msecs_to_jiffies(100);
drvdata->nb.notifier_call = aoc_usb_notify;
register_aoc_usb_notifier(&drvdata->nb);
-
dev_set_drvdata(dev, drvdata);
-
- aoc_usb_probe_done = true;
-
schedule_work(&usb_host_mode_checking_ws);
- // Clear the fsm_reset flag to resume otg_fsm for host/gadget mode bring up.
- dwc3_otg_fsm_try_reset(false);
+ /* USB host mode needs support from AoC. */
+ dwc3_otg_host_ready(true);
return 0;
}
@@ -401,9 +391,8 @@ static int aoc_usb_remove(struct aoc_service_dev *adev)
{
struct aoc_usb_drvdata *drvdata = dev_get_drvdata(&adev->dev);
- // If gadget mode is engaged, we raise the fsm_reset flag and wait.
- // Otherwise, we reset otg_fsm directly.
- dwc3_otg_fsm_try_reset(true);
+ /* USB host mode needs support from AoC. */
+ dwc3_otg_host_ready(false);
unregister_aoc_usb_notifier(&drvdata->nb);
wakeup_source_unregister(drvdata->ws);
@@ -411,16 +400,10 @@ static int aoc_usb_remove(struct aoc_service_dev *adev)
kfree(drvdata);
- aoc_usb_probe_done = false;
return 0;
}
-bool is_aoc_usb_probe_done(void)
-{
- return aoc_usb_probe_done;
-}
-
static const char *const aoc_usb_service_names[] = {
"usb_control",
NULL,
diff --git a/usb/xhci_hooks_impl_whi.c b/usb/xhci_hooks_impl_whi.c
index df8ca03..610b95d 100644
--- a/usb/xhci_hooks_impl_whi.c
+++ b/usb/xhci_hooks_impl_whi.c
@@ -200,11 +200,6 @@ static int usb_audio_offload_init(struct xhci_hcd *xhci)
int ret;
u32 out_val;
- if (!is_aoc_usb_probe_done()) {
- dev_dbg(dev, "deferring the probe\n");
- return -EPROBE_DEFER;
- }
-
offload_data = kzalloc(sizeof(struct xhci_offload_data), GFP_KERNEL);
if (!offload_data) {
return -ENOMEM;