msm: camera: common: Add support for DRV config

Add DRV config blob handling for programming required
registers per request. Also, add debugfs entry for
disabling DRV feature from ife hw manager. Update
existing BW voting logs to reflect DRV vote level info.
Add support for communicating with rsc device upon update
in MNOC BW. Also, update BW voting logic in cpas to accommodate
DRV voting to interconnect framework.

CRs-Fixed: 3065551
Change-Id: I8ac4820b7af824f5ff46614ae6804001deca9b01
Signed-off-by: Mukund Madhusudan Atre <quic_matre@quicinc.com>
This commit is contained in:
Mukund Madhusudan Atre
2022-02-10 15:05:32 -08:00
committed by Camera Software Integration
parent c73578236c
commit 65878f05bb
26 changed files with 1697 additions and 487 deletions

View File

@@ -9,11 +9,107 @@
#include <linux/of_address.h>
#include <linux/slab.h>
#include <soc/qcom/rpmh.h>
#include "cam_compat.h"
#include "cam_debug_util.h"
#include "cam_cpas_api.h"
#include "camera_main.h"
#if IS_ENABLED(CONFIG_USE_RPMH_DRV_API)
#define CAM_RSC_DRV_IDENTIFIER "cam_rsc"
const struct device *cam_cpas_get_rsc_dev_for_drv(uint32_t index)
{
const struct device *rsc_dev;
rsc_dev = rpmh_get_device(CAM_RSC_DRV_IDENTIFIER, index);
if (!rsc_dev) {
CAM_ERR(CAM_CPAS, "Invalid dev for index: %u", index);
return NULL;
}
return rsc_dev;
}
int cam_cpas_start_drv_for_dev(const struct device *dev)
{
int rc = 0;
if (!dev) {
CAM_ERR(CAM_CPAS, "Invalid dev for DRV enable");
return -EINVAL;
}
rc = rpmh_drv_start(dev);
if (rc) {
CAM_ERR(CAM_CPAS, "[%s] Failed in DRV start", dev_name(dev));
return rc;
}
return rc;
}
int cam_cpas_stop_drv_for_dev(const struct device *dev)
{
int rc = 0;
if (!dev) {
CAM_ERR(CAM_CPAS, "Invalid dev for DRV disable");
return -EINVAL;
}
rc = rpmh_drv_stop(dev);
if (rc) {
CAM_ERR(CAM_CPAS, "[%s] Failed in DRV stop", dev_name(dev));
return rc;
}
return rc;
}
int cam_cpas_drv_channel_switch_for_dev(const struct device *dev)
{
int rc = 0;
if (!dev) {
CAM_ERR(CAM_CPAS, "Invalid dev for DRV channel switch");
return -EINVAL;
}
rc = rpmh_write_sleep_and_wake_no_child(dev);
if (rc) {
CAM_ERR(CAM_CPAS, "[%s] Failed in DRV channel switch", dev_name(dev));
return rc;
}
return rc;
}
#else
const struct device *cam_cpas_get_rsc_dev_for_drv(uint32_t index)
{
return NULL;
}
int cam_cpas_start_drv_for_dev(const struct device *dev)
{
return 0;
}
int cam_cpas_stop_drv_for_dev(const struct device *dev)
{
return 0;
}
int cam_cpas_drv_channel_switch_for_dev(const struct device *dev)
{
return 0;
}
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
int cam_reserve_icp_fw(struct cam_fw_alloc_info *icp_fw, size_t fw_length)
{