media: add imx219 sensor driver

Add imx219 camera sensor driver code,
mode tables and makefile changes.

Bug 3583587

Change-Id: Ic7693de3cbdeeaecd7d9118a1e7819eaab5fdb3a
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2862964
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Ankur Pawar
2023-02-24 05:47:55 +00:00
committed by mobile promotions
parent 2279d375da
commit ff01ad1318
6 changed files with 1252 additions and 3 deletions

29
include/media/imx219.h Normal file
View File

@@ -0,0 +1,29 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2014-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
*/
#ifndef __IMX219_H__
#define __IMX219_H__
#include <uapi/media/imx219.h>
#define IMX219_FUSE_ID_SIZE 6
#define IMX219_FUSE_ID_STR_SIZE (IMX219_FUSE_ID_SIZE * 2)
struct imx219_power_rail {
struct regulator *dvdd;
struct regulator *avdd;
struct regulator *iovdd;
struct regulator *vdd_af;
};
struct imx219_platform_data {
struct imx219_flash_control flash_cap;
const char *mclk_name; /* NULL for default default_mclk */
int (*power_on)(struct imx219_power_rail *pw);
int (*power_off)(struct imx219_power_rail *pw);
};
#endif /* __IMX219_H__ */

View File

@@ -1,7 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2012-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* Copyright (c) 2012-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*/
#ifndef __NVC_H__

View File

@@ -0,0 +1,59 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2014-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
*
* include/uapi/linux/imx219.h
*/
#ifndef __UAPI_IMX219_H__
#define __UAPI_IMX219_H__
#include <linux/ioctl.h>
#include <media/nvc.h>
#define IMX219_IOCTL_SET_MODE _IOW('o', 1, struct imx219_mode)
#define IMX219_IOCTL_GET_STATUS _IOR('o', 2, __u8)
#define IMX219_IOCTL_SET_FRAME_LENGTH _IOW('o', 3, __u32)
#define IMX219_IOCTL_SET_COARSE_TIME _IOW('o', 4, __u32)
#define IMX219_IOCTL_SET_GAIN _IOW('o', 5, struct imx219_gain)
#define IMX219_IOCTL_GET_FUSEID _IOR('o', 6, struct nvc_fuseid)
#define IMX219_IOCTL_SET_GROUP_HOLD _IOW('o', 7, struct imx219_ae)
#define IMX219_IOCTL_GET_AFDAT _IOR('o', 8, __u32)
#define IMX219_IOCTL_SET_POWER _IOW('o', 20, __u32)
#define IMX219_IOCTL_GET_FLASH_CAP _IOR('o', 30, __u32)
#define IMX219_IOCTL_SET_FLASH_MODE _IOW('o', 31, \
struct imx219_flash_control)
/* TODO: revisit these values for IMX219 */
#define IMX219_FRAME_LENGTH_ADDR_MSB 0x0160
#define IMX219_FRAME_LENGTH_ADDR_LSB 0x0161
#define IMX219_COARSE_TIME_ADDR_MSB 0x015a
#define IMX219_COARSE_TIME_ADDR_LSB 0x015b
#define IMX219_GAIN_ADDR 0x0157
struct imx219_flash_control {
__u8 enable;
__u8 edge_trig_en;
__u8 start_edge;
__u8 repeat;
__u16 delay_frm;
};
struct imx219_mode {
int xres;
int yres;
__u32 frame_length;
__u32 coarse_time;
__u32 gain;
};
struct imx219_ae {
__u32 frame_length;
__u8 frame_length_enable;
__u32 coarse_time;
__u8 coarse_time_enable;
__u32 gain;
__u8 gain_enable;
};
#endif /* __UAPI_IMX219_H__ */