Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9323c4c authored by Kyle Yan's avatar Kyle Yan Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: Add uapi header for camera sensor" into msm-4.9

parents bed4cbb7 29a2c777
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -3,6 +3,7 @@ header-y += cam_defs.h
header-y += cam_isp.h
header-y += cam_isp.h
header-y += cam_isp_vfe.h
header-y += cam_isp_vfe.h
header-y += cam_isp_ife.h
header-y += cam_isp_ife.h
header-y += cam_sensor.h
header-y += msm_media_info.h
header-y += msm_media_info.h
header-y += msm_vidc.h
header-y += msm_vidc.h
header-y += msm_sde_rotator.h
header-y += msm_sde_rotator.h
+315 −0
Original line number Original line Diff line number Diff line
#ifndef __UAPI_CAM_SENSOR_H__
#define __UAPI_CAM_SENSOR_H__

#include <linux/types.h>
#include <linux/ioctl.h>
#include <media/cam_defs.h>

#define CAM_SENSOR_PROBE_CMD   (CAM_COMMON_OPCODE_MAX + 1)

/**
 * struct cam_sensor_query_cap - capabilities info for sensor
 *
 * @slot_info        :  Indicates about the slotId or cell Index
 * @secure_camera    :  Camera is in secure/Non-secure mode
 * @pos_pitch        :  Sensor position pitch
 * @pos_roll         :  Sensor position roll
 * @pos_yaw          :  Sensor position yaw
 * @actuator_slot_id :  Actuator slot id which connected to sensor
 * @eeprom_slot_id   :  EEPROM slot id which connected to sensor
 * @ois_slot_id      :  OIS slot id which connected to sensor
 * @flash_slot_id    :  Flash slot id which connected to sensor
 * @csiphy_slot_id   :  CSIphy slot id which connected to sensor
 *
 */
struct  cam_sensor_query_cap {
	uint32_t        slot_info;
	uint32_t        secure_camera;
	uint32_t        pos_pitch;
	uint32_t        pos_roll;
	uint32_t        pos_yaw;
	uint32_t        actuator_slot_id;
	uint32_t        eeprom_slot_id;
	uint32_t        ois_slot_id;
	uint32_t        flash_slot_id;
	uint32_t        csiphy_slot_id;
} __attribute__((packed));

/**
 * struct cam_csiphy_query_cap - capabilities info for csiphy
 *
 * @slot_info        :  Indicates about the slotId or cell Index
 * @version          :  CSIphy version
 * @clk lane         :  Of the 5 lanes, informs lane configured
 *                      as clock lane
 */
struct cam_csiphy_query_cap {
	uint32_t            slot_info;
	uint32_t            version;
	uint32_t            clk_lane;
	uint32_t            reserved;
} __attribute__((packed));

/**
 * struct cam_actuator_query_cap - capabilities info for actuator
 *
 * @slot_info        :  Indicates about the slotId or cell Index
 */
struct cam_actuator_query_cap {
	uint32_t            slot_info;
	uint32_t            reserved;
} __attribute__((packed));

/**
 * struct cam_cmd_i2c_info - Contains slave I2C related info
 *
 * @slave_addr      :    Slave address
 * @i2c_freq_mode   :    4 bits are used for I2c freq mode
 * @cmd_type        :    Explains type of command
 */
struct cam_cmd_i2c_info {
	uint16_t    slave_addr;
	uint8_t     i2c_freq_mode;
	uint8_t     cmd_type;
} __attribute__((packed));

/**
 * struct cam_cmd_probe - Contains sensor slave info
 *
 * @data_type       :   Slave register data type
 * @addr_type       :   Slave register address type
 * @op_code         :   Don't Care
 * @cmd_type        :   Explains type of command
 * @reg_addr        :   Slave register address
 * @expected_data   :   Data expected at slave register address
 * @data_mask       :   Data mask if only few bits are valid
 * @camera_id       :   Indicates the slot to which camera
 *                      needs to be probed
 */
struct cam_cmd_probe {
	uint8_t     data_type;
	uint8_t     addr_type;
	uint8_t     op_code;
	uint8_t     cmd_type;
	uint32_t    reg_addr;
	uint32_t    expected_data;
	uint32_t    data_mask;
	uint16_t    camera_id;
	uint16_t    reserved;
} __attribute__((packed));

/**
 * struct cam_power_settings - Contains sensor slave info
 *
 * @power_seq_type  :   Type of power sequence
 * @config_val_low  :   Lower 32 bit value configuration value
 * @config_val_high :   Higher 32 bit value configuration value
 *
 */
struct cam_power_settings {
	uint16_t    power_seq_type;
	uint16_t    reserved;
	uint32_t    config_val_low;
	uint32_t    config_val_high;
} __attribute__((packed));

/**
 * struct cam_cmd_power - Explains about the power settings
 *
 * @count           :    Number of power settings follows
 * @cmd_type        :    Explains type of command
 *
 */
struct cam_cmd_power {
	uint16_t                    count;
	uint8_t                     reserved;
	uint8_t                     cmd_type;
	struct cam_power_settings   power_settings[1];
} __attribute__((packed));

/**
 * struct i2c_rdwr_header - header of READ/WRITE I2C command
 *
 * @ count           :   Number of registers / data / reg-data pairs
 * @ op_code         :   Operation code
 * @ cmd_type        :   Command buffer type
 * @ data_type       :   I2C data type
 * @ addr_type       :   I2C address type
 *
 */
struct i2c_rdwr_header {
	uint16_t    count;
	uint8_t     op_code;
	uint8_t     cmd_type;
	uint8_t     data_type;
	uint8_t     addr_type;
	uint16_t    reserved;
} __attribute__((packed));

/**
 * struct i2c_random_wr_payload - payload for I2C random write
 *
 * @ reg_addr        :   Register address
 * @ reg_data        :   Register data
 *
 */
struct i2c_random_wr_payload {
	uint32_t     reg_addr;
	uint32_t     reg_data;
} __attribute__((packed));

/**
 * struct cam_cmd_i2c_random_wr - I2C random write command
 *
 */
struct cam_cmd_i2c_random_wr {
	struct i2c_rdwr_header       header;
	struct i2c_random_wr_payload random_wr_payload[1];
} __attribute__((packed));

/**
 * struct cam_cmd_read - I2C read command
 * @ reg_data        :   Register data
 *
 */
struct cam_cmd_read {
	uint32_t                reg_data;
	uint32_t                reserved;
} __attribute__((packed));

/**
 * struct cam_cmd_i2c_continuous_wr - I2C continuous write command
 * @ reg_addr        :   Register address
 *
 */
struct cam_cmd_i2c_continuous_wr {
	struct i2c_rdwr_header  header;
	uint32_t                reg_addr;
	struct cam_cmd_read     data_read[1];
} __attribute__((packed));

/**
 * struct cam_cmd_i2c_random_rd - I2C random read command
 *
 */
struct cam_cmd_i2c_random_rd {
	struct i2c_rdwr_header  header;
	struct cam_cmd_read     data_read[1];
} __attribute__((packed));

/**
 * struct cam_cmd_i2c_continuous_rd - I2C continuous continuous read command
 * @ reg_addr        :   Register address
 *
 */
struct cam_cmd_i2c_continuous_rd {
	struct i2c_rdwr_header  header;
	uint32_t                reg_addr;
} __attribute__((packed));

/**
 * struct cam_cmd_conditional_wait - Conditional wait command
 * @data_type       :   Data type
 * @addr_type       :   Address type
 * @op_code         :   Opcode
 * @cmd_type        :   Explains type of command
 * @timeout         :   Timeout for retries
 * @reg_addr        :   Register Address
 * @reg_data        :   Register data
 * @data_mask       :   Data mask if only few bits are valid
 * @camera_id       :   Indicates the slot to which camera
 *                      needs to be probed
 *
 */
struct cam_cmd_conditional_wait {
	uint8_t     data_type;
	uint8_t     addr_type;
	uint8_t     op_code;
	uint8_t     cmd_type;
	uint16_t    timeout;
	uint16_t    reserved;
	uint32_t    reg_addr;
	uint32_t    reg_data;
	uint32_t    data_mask;
} __attribute__((packed));

/**
 * struct cam_cmd_unconditional_wait - Un-conditional wait command
 * @delay           :   Delay
 * @op_code         :   Opcode
 *
 */
struct cam_cmd_unconditional_wait {
	int16_t     delay;
	uint8_t     op_code;
	uint8_t     cmd_type;
} __attribute__((packed));

/**
 * cam_csiphy_info: Provides cmdbuffer structre
 * @lane_mask     :  Lane mask details
 * @lane_assign   :  Lane sensor will be using
 * @csiphy_3phase :  Total number of lanes
 * @combo_mode    :  Info regarding combo_mode is enable / disable
 * @lane_cnt      :  Total number of lanes
 * @3phase        :  Details whether 3Phase / 2Phase operation
 * @settle_time   :  Settling time in ms
 * @data_rate     :  Data rate
 *
 */
struct cam_csiphy_info {
	uint16_t    lane_mask;
	uint16_t    lane_assign;
	uint8_t     csiphy_3phase;
	uint8_t     combo_mode;
	uint8_t     lane_cnt;
	uint8_t     reserved;
	uint64_t    settle_time;
	uint64_t    data_rate;
} __attribute__((packed));

/**
 * cam_csiphy_acquire_dev_info : Information needed for
 *                        csiphy at the time of acquire
 * @combo_mode     :    Indicates the device mode of operation
 *
 */
struct cam_csiphy_acquire_dev_info {
	uint32_t    combo_mode;
	uint32_t    reserved;
} __attribute__((packed));

/**
 * cam_sensor_acquire_dev : Updates sensor acuire cmd
 * @device_handle  :    Updates device handle
 * @session_handle :    Session handle for acquiring device
 * @handle_type    :    Resource handle type
 * @info_handle    :    Handle to additional info
 *                      needed for sensor sub modules
 *
 */
struct cam_sensor_acquire_dev {
	uint32_t    session_handle;
	uint32_t    device_handle;
	uint32_t    handle_type;
	uint32_t    reserved;
	uint64_t    info_handle;
} __attribute__((packed));

/**
 * cam_sensor_streamon_dev : StreamOn command for the sensor
 * @session_handle :    Session handle for acquiring device
 * @device_handle  :    Updates device handle
 * @handle_type    :    Resource handle type
 * @info_handle    :    Information Needed at the time of streamOn
 *
 */
struct cam_sensor_streamon_dev {
	uint32_t    session_handle;
	uint32_t    device_handle;
	uint32_t    handle_type;
	uint32_t    reserved;
	uint64_t    info_handle;
} __attribute__((packed));

#endif