replace common qcom sources with samsung ones

This commit is contained in:
SaschaNes
2025-08-12 22:13:00 +02:00
parent ba24dcded9
commit 6f7753de11
5682 changed files with 2450203 additions and 103634 deletions

View File

@@ -19,12 +19,16 @@
#include <linux/slab.h>
#include <linux/remoteproc.h>
#include <linux/remoteproc/qcom_rproc.h>
#include <sound/samsung/snd_debug_proc.h>
#define Q6_PIL_GET_DELAY_MS 100
#define BOOT_CMD 1
#define SSR_RESET_CMD 1
#define IMAGE_UNLOAD_CMD 0
#if IS_ENABLED(CONFIG_SEC_SENSORS_SSC)
#define SUB_SNS_VDD_CHECK_CMD 0
#endif
#define MAX_FW_IMAGES 4
#define ADSP_LOADER_APM_TIMEOUT_MS 10000
@@ -43,6 +47,16 @@ static ssize_t adsp_ssr_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count);
static ssize_t apss_crash_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count);
#if IS_ENABLED(CONFIG_SEC_SENSORS_SSC)
static ssize_t adsp_check_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf, size_t count);
#endif
struct adsp_loader_private {
void *pil_h;
struct kobject *boot_adsp_obj;
@@ -57,9 +71,21 @@ static struct kobj_attribute adsp_boot_attribute =
static struct kobj_attribute adsp_ssr_attribute =
__ATTR(ssr, 0220, NULL, adsp_ssr_store);
static struct kobj_attribute apss_crash_attribute =
__ATTR(crash, 0220, NULL, apss_crash_store);
#if IS_ENABLED(CONFIG_SEC_SENSORS_SSC)
static struct kobj_attribute adsp_check_attribute =
__ATTR(check, 0220, NULL, adsp_check_store);
#endif
static struct attribute *attrs[] = {
&adsp_boot_attribute.attr,
&adsp_ssr_attribute.attr,
&apss_crash_attribute.attr,
#if IS_ENABLED(CONFIG_SEC_SENSORS_SSC)
&adsp_check_attribute.attr,
#endif
NULL,
};
@@ -167,6 +193,10 @@ load_adsp:
if (rc) {
dev_err(&pdev->dev, "%s: pil get failed,\n",
__func__);
#if IS_ENABLED(CONFIG_SND_SOC_SAMSUNG_AUDIO)
sdp_boot_print("%s: ADSP loadig is failed = %d\n",
__func__, rc);
#endif
goto fail;
}
} else if (adsp_state == SPF_SUBSYS_LOADED) {
@@ -223,6 +253,28 @@ static ssize_t adsp_ssr_store(struct kobject *kobj,
return count;
}
static ssize_t apss_crash_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf,
size_t count)
{
int crash_command = 0;
struct platform_device *pdev = adsp_private;
dev_err(&pdev->dev, "%s: going to trigger crash \n ", __func__);
if (kstrtoint(buf, 10, &crash_command) < 0)
return -EINVAL;
if (crash_command != 1)
return -EINVAL;
panic("triggering crash to collect ram dump for audio issue debug");
return count;
}
static ssize_t adsp_boot_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf,
@@ -245,6 +297,36 @@ static ssize_t adsp_boot_store(struct kobject *kobj,
return count;
}
#if IS_ENABLED(CONFIG_SEC_SENSORS_SSC)
static ssize_t adsp_check_store(struct kobject *kobj,
struct kobj_attribute *attr,
const char *buf,
size_t count)
{
int check_command = 0;
if (kstrtoint(buf, 10, &check_command) < 0)
return -EINVAL;
if (check_command == SUB_SNS_VDD_CHECK_CMD) {
struct platform_device *pdev = adsp_private;
struct adsp_loader_private *priv = NULL;
struct rproc *adsp_rproc = NULL;
priv = platform_get_drvdata(pdev);
if (priv) {
adsp_rproc = (struct rproc *)priv->pil_h;
if (adsp_rproc) {
pr_info("check subsensor vdd\n");
adsp_init_subsensor_regulator(adsp_rproc,
NULL);
}
}
}
return count;
}
#endif
static void adsp_loader_unload(struct platform_device *pdev)
{
struct adsp_loader_private *priv = NULL;

View File

@@ -332,7 +332,7 @@ static int msm_audio_ion_unmap_kernel(struct dma_buf *dma_buf, struct msm_audio_
dev_err(cb_dev,
"%s: cannot find allocation for dma_buf %pK",
__func__, dma_buf);
rc = -ENOENT;
rc = -EINVAL;
goto err;
}
@@ -419,13 +419,13 @@ void msm_audio_update_fd_list(struct msm_audio_fd_data *msm_audio_fd_data)
mutex_unlock(&(msm_audio_ion_fd_list.list_mutex));
}
void msm_audio_delete_fd_entry(void *handle, int handle_fd)
void msm_audio_delete_fd_entry(void *handle)
{
struct msm_audio_fd_data *msm_audio_fd_data = NULL;
struct list_head *ptr, *next;
if (!handle || !handle_fd) {
pr_err("%s Invalid handle or fd\n", __func__);
if (!handle) {
pr_err("%s Invalid handle\n", __func__);
return;
}
@@ -434,10 +434,9 @@ void msm_audio_delete_fd_entry(void *handle, int handle_fd)
&msm_audio_ion_fd_list.fd_list) {
msm_audio_fd_data = list_entry(ptr, struct msm_audio_fd_data,
list);
if (msm_audio_fd_data->handle == handle
&& msm_audio_fd_data->fd == handle_fd) {
pr_debug("%s deleting handle %pK with fd = %d entry from list\n",
__func__, handle, handle_fd);
if (msm_audio_fd_data->handle == handle) {
pr_debug("%s deleting handle %pK entry from list\n",
__func__, handle);
list_del(&(msm_audio_fd_data->list));
kfree(msm_audio_fd_data);
break;
@@ -755,13 +754,9 @@ static long msm_audio_ion_ioctl(struct file *file, unsigned int ioctl_num,
ret = msm_audio_ion_free(mem_handle, ion_data);
if (ret < 0) {
pr_err("%s Ion free failed %d\n", __func__, ret);
if (ret == -ENOENT) {
msm_audio_delete_fd_entry(mem_handle, (int)ioctl_param);
return 0;
}
return ret;
}
msm_audio_delete_fd_entry(mem_handle, (int)ioctl_param);
msm_audio_delete_fd_entry(mem_handle);
break;
case IOCTL_MAP_HYP_ASSIGN:
ret = msm_audio_get_phy_addr((int)ioctl_param, &paddr, &pa_len);

View File

@@ -24,6 +24,7 @@
#include <dsp/spf-core.h>
#include <dsp/digital-cdc-rsc-mgr.h>
#include <linux/platform_device.h>
#include <sound/samsung/snd_debug_proc.h>
#define Q6_READY_TIMEOUT_MS 1000
#define Q6_CLOSE_ALL_TIMEOUT_MS 5000
@@ -346,6 +347,7 @@ static void spf_core_add_child_devices(struct work_struct *work)
} else {
dev_err(spf_core_priv->dev, "%s: apm is not up\n",
__func__);
sdp_boot_print("%s: apm is not up\n", __func__);
return;
}