feature/spiri-kernel-cti-jetpack-4.4.1 #1

Manually merged
dchvs merged 11 commits from feature/spiri-kernel-cti-jetpack-4.4.1 into master 2021-03-16 01:40:35 -03:00
6 changed files with 157 additions and 4 deletions
Showing only changes of commit e7952b2f70 - Show all commits

View File

@ -5,7 +5,7 @@ KERNEL_OVERLAYS += $(CURDIR)/../nvgpu
KERNEL_OVERLAYS += $(CURDIR)/../nvgpu-next KERNEL_OVERLAYS += $(CURDIR)/../nvgpu-next
KERNEL_OVERLAYS += $(CURDIR)/../nvidia-t23x KERNEL_OVERLAYS += $(CURDIR)/../nvidia-t23x
LI_MT9M021_KERNEL_PATH=./li-mt9m021/kernel/nvidia-spiri LI_MT9M021_KERNEL_PATH=./li-mt9m021/kernel/nvidia-spiri
KERNEL_OVERLAYS += $(CURDIR)/../../$(LI_MT9M021_KERNEL_PATH) KERNEL_OVERLAYS += $(CURDIR)/../../../drivers/$(LI_MT9M021_KERNEL_PATH)
else else
override KERNEL_OVERLAYS := $(subst :, ,$(KERNEL_OVERLAYS)) override KERNEL_OVERLAYS := $(subst :, ,$(KERNEL_OVERLAYS))
endif endif

View File

@ -99,8 +99,10 @@ DTBO_LIST += $(dtbo-y)
DTBO_NEW_RULE_LIST := $(dtbo-y) DTBO_NEW_RULE_LIST := $(dtbo-y)
######### Include RidgeRun ######### Include RidgeRun
LI_MT9M021_PATH=$(tegra-rel-dtstree)/../source/li-mt9m021/hardware/nvidia-spiri LI_MT9M021_PATH=$(tegra-rel-dtstree)/../../source/drivers/li-mt9m021/hardware/nvidia-spiri
LI_MT9M021_MAKEFILE_PATH=$(tegra-dtstree)/../../li-mt9m021/hardware/nvidia-spiri/platform/ LI_MT9M021_MAKEFILE_PATH=$(tegra-dtstree)/../../../drivers/li-mt9m021/hardware/nvidia-spiri/platform/
#LI_MT9M021_PATH=$(tegra-rel-dtstree)/../source/li-mt9m021/hardware/nvidia-spiri
#LI_MT9M021_MAKEFILE_PATH=$(tegra-dtstree)/../../li-mt9m021/hardware/nvidia-spiri/platform/
dtb-y := dtb-y :=
dts_makefile=$(foreach d,$(wildcard $1*), $(call dts_makefile,$(d)/,$(2)) $(if $(findstring Makefile,$(d)),$(d))) dts_makefile=$(foreach d,$(wildcard $1*), $(call dts_makefile,$(d)/,$(2)) $(if $(findstring Makefile,$(d)),$(d)))

View File

@ -989,7 +989,7 @@ int camera_common_initialize(struct camera_common_data *s_data,
const char *dev_name) const char *dev_name)
{ {
int err = 0; int err = 0;
char debugfs_name[10]; char debugfs_name[50];
if (s_data->dev == NULL) if (s_data->dev == NULL)
return -EINVAL; return -EINVAL;

View File

@ -33,6 +33,18 @@
#define TEGRACAM_DEF_CTRLS 1 #define TEGRACAM_DEF_CTRLS 1
/* MT9M021 Controls Information */
#define MT9M021_DEFAULT_ANALOG_GAIN (0x0)
#define MT9M021_MAX_ANALOG_GAIN (0x3)
static const char * const mt9m021_test_pattern_menu[] = {
"0:Disabled",
"1:Solid color test pattern",
"2:color bar test pattern",
"3:Fade to gray color bar test pattern",
"256:Walking 1s test pattern (12 bit)"
};
static int tegracam_s_ctrl(struct v4l2_ctrl *ctrl); static int tegracam_s_ctrl(struct v4l2_ctrl *ctrl);
static const struct v4l2_ctrl_ops tegracam_ctrl_ops = { static const struct v4l2_ctrl_ops tegracam_ctrl_ops = {
.s_ctrl = tegracam_s_ctrl, .s_ctrl = tegracam_s_ctrl,
@ -163,6 +175,109 @@ static struct v4l2_ctrl_config ctrl_cfg_list[] = {
.max = CTRL_MAX_STR_SIZE, .max = CTRL_MAX_STR_SIZE,
.step = 2, .step = 2,
}, },
/* Controls extension for MT9M021 */
{
.ops = &tegracam_ctrl_ops,
.id = V4L2_CID_ANALOGUE_GAIN,
.name = "Analog Gain",
.type = V4L2_CTRL_TYPE_INTEGER64,
.flags = V4L2_CTRL_FLAG_SLIDER,
.min = CTRL_U64_MIN,
.max = MT9M021_MAX_ANALOG_GAIN,
.def = MT9M021_DEFAULT_ANALOG_GAIN,
.step = 1,
},
{
.ops = &tegracam_ctrl_ops,
.id = V4L2_CID_GAIN_RED,
.name = "Red Gain",
.type = V4L2_CTRL_TYPE_INTEGER64,
.flags = V4L2_CTRL_FLAG_SLIDER,
.min = CTRL_U64_MIN,
.max = CTRL_U64_MAX,
.def = CTRL_U64_MIN,
.step = 1,
},
{
.ops = &tegracam_ctrl_ops,
.id = V4L2_CID_GAIN_GREENR,
.name = "GreenR Gain",
.type = V4L2_CTRL_TYPE_INTEGER64,
.flags = V4L2_CTRL_FLAG_SLIDER,
.min = CTRL_U64_MIN,
.max = CTRL_U64_MAX,
.def = CTRL_U64_MIN,
.step = 1,
},
{
.ops = &tegracam_ctrl_ops,
.id = V4L2_CID_GAIN_GREENB,
.name = "GreenB Gain",
.type = V4L2_CTRL_TYPE_INTEGER64,
.flags = V4L2_CTRL_FLAG_SLIDER,
.min = CTRL_U64_MIN,
.max = CTRL_U64_MAX,
.def = CTRL_U64_MIN,
.step = 1,
},
{
.ops = &tegracam_ctrl_ops,
.id = V4L2_CID_GAIN_BLUE,
.name = "Blue Gain",
.type = V4L2_CTRL_TYPE_INTEGER64,
.flags = V4L2_CTRL_FLAG_SLIDER,
.min = CTRL_U64_MIN,
.max = CTRL_U64_MAX,
.def = CTRL_U64_MIN,
.step = 1,
},
{
.ops = &tegracam_ctrl_ops,
.id = V4L2_CID_TEST_PATTERN,
.type = V4L2_CTRL_TYPE_MENU,
.name = "Test Pattern",
.min = 0,
.max = ARRAY_SIZE(mt9m021_test_pattern_menu) - 1,
.step = 0,
.def = 0,
.flags = 0,
.menu_skip_mask = 0,
.qmenu = mt9m021_test_pattern_menu,
},
{
.ops = &tegracam_ctrl_ops,
.id = V4L2_CID_FLASH_LED_MODE,
.name = "Flash",
.type = V4L2_CTRL_TYPE_INTEGER,
.flags = 0,
.min = V4L2_FLASH_LED_MODE_NONE,
.max = V4L2_FLASH_LED_MODE_FLASH,
.def = V4L2_FLASH_LED_MODE_FLASH,
.step = 1,
},
{
.ops = &tegracam_ctrl_ops,
.id = V4L2_CID_HFLIP,
.name = "Horizontal Flip",
.type = V4L2_CTRL_TYPE_INTEGER_MENU,
.min = 0,
.max = ARRAY_SIZE(switch_ctrl_qmenu) - 1,
.menu_skip_mask = 0,
.def = 0,
.qmenu_int = switch_ctrl_qmenu,
},
{
.ops = &tegracam_ctrl_ops,
.id = V4L2_CID_VFLIP,
.name = "Vertical Flip",
.type = V4L2_CTRL_TYPE_INTEGER_MENU,
.min = 0,
.max = ARRAY_SIZE(switch_ctrl_qmenu) - 1,
.menu_skip_mask = 0,
.def = 0,
.qmenu_int = switch_ctrl_qmenu,
},
}; };
static int tegracam_get_ctrl_index(u32 cid) static int tegracam_get_ctrl_index(u32 cid)
@ -266,6 +381,26 @@ static int tegracam_set_ctrls(struct tegracam_ctrl_handler *handler,
case TEGRA_CAMERA_CID_GROUP_HOLD: case TEGRA_CAMERA_CID_GROUP_HOLD:
err = ops->set_group_hold(tc_dev, ctrl->val); err = ops->set_group_hold(tc_dev, ctrl->val);
break; break;
case V4L2_CID_ANALOGUE_GAIN:
err = ops->set_analog_gain(tc_dev, *ctrl->p_new.p_s64);
break;
case V4L2_CID_GAIN_RED:
case V4L2_CID_GAIN_GREENR:
case V4L2_CID_GAIN_GREENB:
case V4L2_CID_GAIN_BLUE:
err = ops->set_digital_gain(tc_dev, *ctrl->p_new.p_s64,
ctrl->id);
break;
case V4L2_CID_TEST_PATTERN:
err = ops->set_test_pattern(tc_dev, ctrl->val);
break;
case V4L2_CID_FLASH_LED_MODE:
err = ops->set_flash(tc_dev, ctrl->val);
break;
case V4L2_CID_HFLIP:
case V4L2_CID_VFLIP:
err = ops->set_flip(tc_dev, ctrl->val, ctrl->id);
break;
default: default:
pr_err("%s: unknown ctrl id.\n", __func__); pr_err("%s: unknown ctrl id.\n", __func__);
return -EINVAL; return -EINVAL;
@ -459,6 +594,10 @@ int tegracam_init_ctrl_ranges_by_mode(
switch (ctrl->id) { switch (ctrl->id) {
case TEGRA_CAMERA_CID_GAIN: case TEGRA_CAMERA_CID_GAIN:
case V4L2_CID_GAIN_RED:
case V4L2_CID_GAIN_GREENR:
case V4L2_CID_GAIN_GREENB:
case V4L2_CID_GAIN_BLUE:
err = v4l2_ctrl_modify_range(ctrl, err = v4l2_ctrl_modify_range(ctrl,
ctrlprops->min_gain_val, ctrlprops->min_gain_val,
ctrlprops->max_gain_val, ctrlprops->max_gain_val,

View File

@ -205,6 +205,12 @@ struct tegracam_ctrl_ops {
struct sensor_blob *blob, s64 val); struct sensor_blob *blob, s64 val);
int (*set_group_hold_ex)(struct tegracam_device *tc_dev, int (*set_group_hold_ex)(struct tegracam_device *tc_dev,
struct sensor_blob *blob, bool val); struct sensor_blob *blob, bool val);
int (*set_analog_gain)(struct tegracam_device *tc_dev, s64 val);
int (*set_digital_gain)(struct tegracam_device *tc_dev, s64 val,
int id);
int (*set_test_pattern)(struct tegracam_device *tc_dev, s32 val);
int (*set_flash)(struct tegracam_device *tc_dev, s32 val);
int (*set_flip)(struct tegracam_device *tc_dev, s32 val, int id);
}; };
struct tegracam_ctrl_handler { struct tegracam_ctrl_handler {

View File

@ -55,6 +55,12 @@
#define TEGRA_CAMERA_CID_LOW_LATENCY (TEGRA_CAMERA_CID_BASE+109) #define TEGRA_CAMERA_CID_LOW_LATENCY (TEGRA_CAMERA_CID_BASE+109)
#define TEGRA_CAMERA_CID_VI_PREFERRED_STRIDE (TEGRA_CAMERA_CID_BASE+110) #define TEGRA_CAMERA_CID_VI_PREFERRED_STRIDE (TEGRA_CAMERA_CID_BASE+110)
/* Custom Controls */
#define V4L2_CID_GAIN_RED V4L2_CID_USER_BASE
#define V4L2_CID_GAIN_GREENR V4L2_CID_USER_BASE + 1
#define V4L2_CID_GAIN_GREENB V4L2_CID_USER_BASE + 2
#define V4L2_CID_GAIN_BLUE V4L2_CID_USER_BASE + 3
/** /**
* This is temporary with the current v4l2 infrastructure * This is temporary with the current v4l2 infrastructure
* currently discussing with upstream maintainers our proposals and * currently discussing with upstream maintainers our proposals and