mirror of
https://github.com/joel16/android_device_sony_kitakami-common.git
synced 2024-11-23 11:49:47 +00:00
kitakami-common: Camera3: Enable torchlight for PMIC driver
Flash interface driver has changed, making corresponding changes in HAL Bug: 21926212 Change-Id: I4c6203ace29c27eafb45a9e19a4be49e82de4121
This commit is contained in:
parent
9ec56a8710
commit
41be2f2fed
@ -175,10 +175,15 @@ int32_t QCameraFlash::initFlash(const int camera_id)
|
||||
flashPath);
|
||||
retVal = -EBUSY;
|
||||
} else {
|
||||
struct msm_camera_led_cfg_t cfg;
|
||||
cfg.cfgtype = MSM_CAMERA_LED_INIT;
|
||||
struct msm_flash_cfg_data_t cfg;
|
||||
struct msm_flash_init_info_t init_info;
|
||||
memset(&cfg, 0, sizeof(struct msm_flash_cfg_data_t));
|
||||
memset(&init_info, 0, sizeof(struct msm_flash_init_info_t));
|
||||
init_info.flash_driver_type = FLASH_DRIVER_DEFAULT;
|
||||
cfg.cfg.flash_init_info = &init_info;
|
||||
cfg.cfg_type = CFG_FLASH_INIT;
|
||||
retVal = ioctl(m_flashFds[camera_id],
|
||||
VIDIOC_MSM_FLASH_LED_DATA_CFG,
|
||||
VIDIOC_MSM_FLASH_CFG,
|
||||
&cfg);
|
||||
if (retVal < 0) {
|
||||
ALOGE("%s: Unable to init flash for camera id: %d",
|
||||
@ -190,6 +195,7 @@ int32_t QCameraFlash::initFlash(const int camera_id)
|
||||
}
|
||||
}
|
||||
|
||||
CDBG("%s: X, retVal = %d", __func__, retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@ -212,7 +218,7 @@ int32_t QCameraFlash::initFlash(const int camera_id)
|
||||
int32_t QCameraFlash::setFlashMode(const int camera_id, const bool mode)
|
||||
{
|
||||
int32_t retVal = 0;
|
||||
struct msm_camera_led_cfg_t cfg;
|
||||
struct msm_flash_cfg_data_t cfg;
|
||||
|
||||
if (camera_id < 0 || camera_id >= MM_CAMERA_MAX_NUM_SENSORS) {
|
||||
ALOGE("%s: Invalid camera id: %d", __func__, camera_id);
|
||||
@ -227,13 +233,19 @@ int32_t QCameraFlash::setFlashMode(const int camera_id, const bool mode)
|
||||
ALOGE("%s: called for uninited flash: %d", __func__, camera_id);
|
||||
retVal = -EINVAL;
|
||||
} else {
|
||||
cfg.cfgtype = mode ? MSM_CAMERA_LED_LOW : MSM_CAMERA_LED_OFF;
|
||||
memset(&cfg, 0, sizeof(struct msm_flash_cfg_data_t));
|
||||
for (int i = 0; i < MAX_LED_TRIGGERS; i++)
|
||||
cfg.flash_current[i] = QCAMERA_TORCH_CURRENT_VALUE;
|
||||
cfg.cfg_type = mode ? CFG_FLASH_LOW: CFG_FLASH_OFF;
|
||||
|
||||
retVal = ioctl(m_flashFds[camera_id],
|
||||
VIDIOC_MSM_FLASH_LED_DATA_CFG,
|
||||
&cfg);
|
||||
if (retVal == 0) {
|
||||
VIDIOC_MSM_FLASH_CFG,
|
||||
&cfg);
|
||||
if (retVal < 0)
|
||||
ALOGE("%s: Unable to change flash mode to %d for camera id: %d",
|
||||
__func__, mode, camera_id);
|
||||
else
|
||||
m_flashOn[camera_id] = mode;
|
||||
}
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
@ -265,10 +277,10 @@ int32_t QCameraFlash::deinitFlash(const int camera_id)
|
||||
} else {
|
||||
setFlashMode(camera_id, false);
|
||||
|
||||
struct msm_camera_led_cfg_t cfg;
|
||||
cfg.cfgtype = MSM_CAMERA_LED_RELEASE;
|
||||
struct msm_flash_cfg_data_t cfg;
|
||||
cfg.cfg_type = CFG_FLASH_RELEASE;
|
||||
retVal = ioctl(m_flashFds[camera_id],
|
||||
VIDIOC_MSM_FLASH_LED_DATA_CFG,
|
||||
VIDIOC_MSM_FLASH_CFG,
|
||||
&cfg);
|
||||
if (retVal < 0) {
|
||||
ALOGE("%s: Failed to release flash for camera id: %d",
|
||||
|
@ -38,6 +38,8 @@ extern "C" {
|
||||
|
||||
namespace qcamera {
|
||||
|
||||
#define QCAMERA_TORCH_CURRENT_VALUE 200
|
||||
|
||||
class QCameraFlash {
|
||||
public:
|
||||
static QCameraFlash& getInstance();
|
||||
|
Loading…
Reference in New Issue
Block a user