msm: camera: common: Change get irq resources method
Get irq resources method changed between kernel verion 5.15 and 5.18. CRs-Fixed: 3258913 Change-Id: Ica0ed0feac55e99f6f88b0b6e56540fb98ed0311 Signed-off-by: zhuo <quic_zhuo@quicinc.com>
This commit is contained in:

committed by
Camera Software Integration

parent
3e05e54587
commit
ab10a69b93
@@ -1468,7 +1468,7 @@ int cam_cpas_soc_init_resources(struct cam_hw_soc_info *soc_info,
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (soc_info->irq_line && !irq_handler) {
|
if ((soc_info->irq_num > 0) && !irq_handler) {
|
||||||
CAM_ERR(CAM_CPAS, "Invalid IRQ handler");
|
CAM_ERR(CAM_CPAS, "Invalid IRQ handler");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
@@ -383,7 +383,7 @@ static int cam_cci_irq_routine(struct v4l2_subdev *sd, u32 status,
|
|||||||
struct cam_hw_soc_info *soc_info =
|
struct cam_hw_soc_info *soc_info =
|
||||||
&cci_dev->soc_info;
|
&cci_dev->soc_info;
|
||||||
|
|
||||||
ret = cam_cci_irq(soc_info->irq_line->start, cci_dev);
|
ret = cam_cci_irq(soc_info->irq_num, cci_dev);
|
||||||
*handled = true;
|
*handled = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@@ -571,6 +571,19 @@ void cam_eeprom_spi_driver_remove(struct spi_device *sdev)
|
|||||||
v4l2_set_subdevdata(&e_ctrl->v4l2_dev_str.sd, NULL);
|
v4l2_set_subdevdata(&e_ctrl->v4l2_dev_str.sd, NULL);
|
||||||
kfree(e_ctrl);
|
kfree(e_ctrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cam_compat_util_get_irq(struct cam_hw_soc_info *soc_info)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
soc_info->irq_num = platform_get_irq(soc_info->pdev, 0);
|
||||||
|
if (soc_info->irq_num < 0) {
|
||||||
|
rc = soc_info->irq_num;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
int cam_eeprom_spi_driver_remove(struct spi_device *sdev)
|
int cam_eeprom_spi_driver_remove(struct spi_device *sdev)
|
||||||
{
|
{
|
||||||
@@ -611,4 +624,20 @@ int cam_eeprom_spi_driver_remove(struct spi_device *sdev)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int cam_compat_util_get_irq(struct cam_hw_soc_info *soc_info)
|
||||||
|
{
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
soc_info->irq_line =
|
||||||
|
platform_get_resource_byname(soc_info->pdev,
|
||||||
|
IORESOURCE_IRQ, soc_info->irq_name);
|
||||||
|
if (!soc_info->irq_line) {
|
||||||
|
rc = -ENODEV;
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
soc_info->irq_num = soc_info->irq_line->start;
|
||||||
|
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -86,4 +86,6 @@ void cam_eeprom_spi_driver_remove(struct spi_device *sdev);
|
|||||||
int cam_eeprom_spi_driver_remove(struct spi_device *sdev);
|
int cam_eeprom_spi_driver_remove(struct spi_device *sdev);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int cam_compat_util_get_irq(struct cam_hw_soc_info *soc_info);
|
||||||
|
|
||||||
#endif /* _CAM_COMPAT_H_ */
|
#endif /* _CAM_COMPAT_H_ */
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
#include "cam_cx_ipeak.h"
|
#include "cam_cx_ipeak.h"
|
||||||
#include "cam_mem_mgr.h"
|
#include "cam_mem_mgr.h"
|
||||||
#include "cam_presil_hw_access.h"
|
#include "cam_presil_hw_access.h"
|
||||||
|
#include "cam_compat.h"
|
||||||
|
|
||||||
#define CAM_TO_MASK(bitn) (1 << (int)(bitn))
|
#define CAM_TO_MASK(bitn) (1 << (int)(bitn))
|
||||||
#define CAM_IS_BIT_SET(mask, bit) ((mask) & CAM_TO_MASK(bit))
|
#define CAM_IS_BIT_SET(mask, bit) ((mask) & CAM_TO_MASK(bit))
|
||||||
@@ -811,12 +812,12 @@ int cam_soc_util_irq_enable(struct cam_hw_soc_info *soc_info)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!soc_info->irq_line) {
|
if (soc_info->irq_num < 0) {
|
||||||
CAM_ERR(CAM_UTIL, "No IRQ line available");
|
CAM_ERR(CAM_UTIL, "No IRQ line available");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
enable_irq(soc_info->irq_line->start);
|
enable_irq(soc_info->irq_num);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -828,12 +829,12 @@ int cam_soc_util_irq_disable(struct cam_hw_soc_info *soc_info)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!soc_info->irq_line) {
|
if (soc_info->irq_num < 0) {
|
||||||
CAM_ERR(CAM_UTIL, "No IRQ line available");
|
CAM_ERR(CAM_UTIL, "No IRQ line available");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
disable_irq(soc_info->irq_line->start);
|
disable_irq(soc_info->irq_num);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -2056,13 +2057,10 @@ int cam_soc_util_get_dt_properties(struct cam_hw_soc_info *soc_info)
|
|||||||
soc_info->dev_name);
|
soc_info->dev_name);
|
||||||
rc = 0;
|
rc = 0;
|
||||||
} else {
|
} else {
|
||||||
soc_info->irq_line =
|
rc = cam_compat_util_get_irq(soc_info);
|
||||||
platform_get_resource_byname(soc_info->pdev,
|
if (rc < 0) {
|
||||||
IORESOURCE_IRQ, soc_info->irq_name);
|
CAM_ERR(CAM_UTIL, "get irq resource failed: %d", rc);
|
||||||
if (!soc_info->irq_line) {
|
|
||||||
CAM_ERR(CAM_UTIL, "no irq resource");
|
|
||||||
#ifndef CONFIG_CAM_PRESIL
|
#ifndef CONFIG_CAM_PRESIL
|
||||||
rc = -ENODEV;
|
|
||||||
return rc;
|
return rc;
|
||||||
#else
|
#else
|
||||||
/* Pre-sil for new devices not present on old */
|
/* Pre-sil for new devices not present on old */
|
||||||
@@ -2642,10 +2640,10 @@ int cam_soc_util_request_platform_resource(
|
|||||||
goto put_regulator;
|
goto put_regulator;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (soc_info->irq_line) {
|
if (soc_info->irq_num > 0) {
|
||||||
|
|
||||||
rc = cam_soc_util_request_irq(soc_info->dev,
|
rc = cam_soc_util_request_irq(soc_info->dev,
|
||||||
soc_info->irq_line->start,
|
soc_info->irq_num,
|
||||||
handler, IRQF_TRIGGER_RISING,
|
handler, IRQF_TRIGGER_RISING,
|
||||||
soc_info->irq_name, irq_data,
|
soc_info->irq_name, irq_data,
|
||||||
soc_info->mem_block[0]->start);
|
soc_info->mem_block[0]->start);
|
||||||
@@ -2747,10 +2745,10 @@ put_clk:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (soc_info->irq_line) {
|
if (soc_info->irq_num > 0) {
|
||||||
disable_irq(soc_info->irq_line->start);
|
disable_irq(soc_info->irq_num);
|
||||||
devm_free_irq(soc_info->dev,
|
devm_free_irq(soc_info->dev,
|
||||||
soc_info->irq_line->start, irq_data);
|
soc_info->irq_num, irq_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
put_regulator:
|
put_regulator:
|
||||||
@@ -2816,7 +2814,7 @@ int cam_soc_util_release_platform_resource(struct cam_hw_soc_info *soc_info)
|
|||||||
soc_info->reg_map[i].size = 0;
|
soc_info->reg_map[i].size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (soc_info->irq_line) {
|
if (soc_info->irq_num > 0) {
|
||||||
if (cam_presil_mode_enabled()) {
|
if (cam_presil_mode_enabled()) {
|
||||||
if (cam_soc_util_is_presil_address_space(soc_info->mem_block[0]->start)) {
|
if (cam_soc_util_is_presil_address_space(soc_info->mem_block[0]->start)) {
|
||||||
b_ret = cam_presil_unsubscribe_device_irq(
|
b_ret = cam_presil_unsubscribe_device_irq(
|
||||||
@@ -2826,9 +2824,9 @@ int cam_soc_util_release_platform_resource(struct cam_hw_soc_info *soc_info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
disable_irq(soc_info->irq_line->start);
|
disable_irq(soc_info->irq_num);
|
||||||
devm_free_irq(soc_info->dev,
|
devm_free_irq(soc_info->dev,
|
||||||
soc_info->irq_line->start, soc_info->irq_data);
|
soc_info->irq_num, soc_info->irq_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
cam_soc_util_release_pinctrl(soc_info);
|
cam_soc_util_release_pinctrl(soc_info);
|
||||||
|
@@ -154,6 +154,7 @@ struct cam_soc_gpio_data {
|
|||||||
* @irq_name: Name of the irq associated with the device
|
* @irq_name: Name of the irq associated with the device
|
||||||
* @label_name: label name
|
* @label_name: label name
|
||||||
* @irq_line: Irq resource
|
* @irq_line: Irq resource
|
||||||
|
* @irq_num: Irq number
|
||||||
* @irq_data: Private data that is passed when IRQ is requested
|
* @irq_data: Private data that is passed when IRQ is requested
|
||||||
* @compatible: Compatible string associated with the device
|
* @compatible: Compatible string associated with the device
|
||||||
* @num_mem_block: Number of entry in the "reg-names"
|
* @num_mem_block: Number of entry in the "reg-names"
|
||||||
@@ -218,6 +219,7 @@ struct cam_hw_soc_info {
|
|||||||
const char *irq_name;
|
const char *irq_name;
|
||||||
const char *label_name;
|
const char *label_name;
|
||||||
struct resource *irq_line;
|
struct resource *irq_line;
|
||||||
|
int irq_num;
|
||||||
void *irq_data;
|
void *irq_data;
|
||||||
const char *compatible;
|
const char *compatible;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user