mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
media: i2c: maxim: driver version v3.02.00
Signed-off-by: Cai Wenzhong <cwz@rock-chips.com> Change-Id: I1582b70b760ed71881ebffd826a8c2b18705c8b7
This commit is contained in:
@@ -21,8 +21,6 @@
|
||||
#include "maxim2c_pattern.h"
|
||||
#include "maxim2c_drv.h"
|
||||
|
||||
#define MAXIM2C_NAME "maxim2c"
|
||||
|
||||
/* Maxim Deserializer Test Pattern */
|
||||
#define MAXIM2C_TEST_PATTERN 0
|
||||
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
* 1. fixed remote camera s_stream and s_power api return error.
|
||||
* 2. compatible with kernel v4.19/v5.10/v6.1
|
||||
*
|
||||
* V3.02.00
|
||||
* 1. support remote dummy sensor
|
||||
* 2. record the status of the serializer
|
||||
* 3. remote serializer support more chip id
|
||||
* 4. support mode add crop rect dts config
|
||||
*
|
||||
*/
|
||||
#include <linux/clk.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -55,7 +61,9 @@
|
||||
|
||||
#include "maxim2c_api.h"
|
||||
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x01, 0x00)
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x02, 0x00)
|
||||
|
||||
#define MAXIM2C_NAME "maxim2c"
|
||||
|
||||
#define MAXIM2C_XVCLK_FREQ 25000000
|
||||
|
||||
@@ -609,6 +617,8 @@ static int maxim2c_probe(struct i2c_client *client,
|
||||
maxim2c->client = client;
|
||||
maxim2c->chipid = chip_id;
|
||||
|
||||
maxim2c->sensor_name = MAXIM2C_NAME;
|
||||
|
||||
ret = of_property_read_u32(node, RKMODULE_CAMERA_MODULE_INDEX,
|
||||
&maxim2c->module_index);
|
||||
ret |= of_property_read_string(node, RKMODULE_CAMERA_MODULE_FACING,
|
||||
|
||||
@@ -99,6 +99,7 @@ typedef struct maxim2c {
|
||||
const char *module_facing;
|
||||
const char *module_name;
|
||||
const char *len_name;
|
||||
const char *sensor_name;
|
||||
|
||||
maxim2c_gmsl_link_t gmsl_link;
|
||||
maxim2c_video_pipe_t video_pipe;
|
||||
|
||||
@@ -307,7 +307,7 @@ static void maxim2c_get_module_inf(maxim2c_t *maxim2c,
|
||||
struct rkmodule_inf *inf)
|
||||
{
|
||||
memset(inf, 0, sizeof(*inf));
|
||||
strscpy(inf->base.sensor, MAXIM2C_NAME, sizeof(inf->base.sensor));
|
||||
strscpy(inf->base.sensor, maxim2c->sensor_name, sizeof(inf->base.sensor));
|
||||
strscpy(inf->base.module, maxim2c->module_name,
|
||||
sizeof(inf->base.module));
|
||||
strscpy(inf->base.lens, maxim2c->len_name, sizeof(inf->base.lens));
|
||||
@@ -1082,7 +1082,7 @@ int maxim2c_v4l2_subdev_init(maxim2c_t *maxim2c)
|
||||
facing[0] = 'f';
|
||||
|
||||
snprintf(sd->name, sizeof(sd->name), "m%02d_%s_%s %s",
|
||||
maxim2c->module_index, facing, MAXIM2C_NAME,
|
||||
maxim2c->module_index, facing, maxim2c->sensor_name,
|
||||
dev_name(sd->dev));
|
||||
|
||||
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE
|
||||
|
||||
@@ -21,8 +21,6 @@
|
||||
#include "maxim4c_pattern.h"
|
||||
#include "maxim4c_drv.h"
|
||||
|
||||
#define MAXIM4C_NAME "maxim4c"
|
||||
|
||||
/* Maxim Deserializer Test Pattern */
|
||||
#define MAXIM4C_TEST_PATTERN 0
|
||||
|
||||
|
||||
@@ -51,6 +51,12 @@
|
||||
* 1. fixed remote camera s_stream and s_power api return error.
|
||||
* 2. compatible with kernel v4.19/v5.10/v6.1
|
||||
*
|
||||
* V3.02.00
|
||||
* 1. support remote dummy sensor
|
||||
* 2. record the status of the serializer
|
||||
* 3. remote serializer support more chip id
|
||||
* 4. support mode add crop rect dts config
|
||||
*
|
||||
*/
|
||||
#include <linux/clk.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -78,7 +84,9 @@
|
||||
|
||||
#include "maxim4c_api.h"
|
||||
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x01, 0x00)
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x02, 0x00)
|
||||
|
||||
#define MAXIM4C_NAME "maxim4c"
|
||||
|
||||
#define MAXIM4C_XVCLK_FREQ 25000000
|
||||
|
||||
@@ -676,6 +684,8 @@ static int maxim4c_probe(struct i2c_client *client,
|
||||
maxim4c->client = client;
|
||||
maxim4c->chipid = chip_id;
|
||||
|
||||
maxim4c->sensor_name = MAXIM4C_NAME;
|
||||
|
||||
ret = of_property_read_u32(node, RKMODULE_CAMERA_MODULE_INDEX,
|
||||
&maxim4c->module_index);
|
||||
ret |= of_property_read_string(node, RKMODULE_CAMERA_MODULE_FACING,
|
||||
|
||||
@@ -99,6 +99,7 @@ typedef struct maxim4c {
|
||||
const char *module_facing;
|
||||
const char *module_name;
|
||||
const char *len_name;
|
||||
const char *sensor_name;
|
||||
|
||||
maxim4c_gmsl_link_t gmsl_link;
|
||||
maxim4c_video_pipe_t video_pipe;
|
||||
|
||||
@@ -307,7 +307,7 @@ static void maxim4c_get_module_inf(maxim4c_t *maxim4c,
|
||||
struct rkmodule_inf *inf)
|
||||
{
|
||||
memset(inf, 0, sizeof(*inf));
|
||||
strscpy(inf->base.sensor, MAXIM4C_NAME, sizeof(inf->base.sensor));
|
||||
strscpy(inf->base.sensor, maxim4c->sensor_name, sizeof(inf->base.sensor));
|
||||
strscpy(inf->base.module, maxim4c->module_name,
|
||||
sizeof(inf->base.module));
|
||||
strscpy(inf->base.lens, maxim4c->len_name, sizeof(inf->base.lens));
|
||||
@@ -1082,7 +1082,7 @@ int maxim4c_v4l2_subdev_init(maxim4c_t *maxim4c)
|
||||
facing[0] = 'f';
|
||||
|
||||
snprintf(sd->name, sizeof(sd->name), "m%02d_%s_%s %s",
|
||||
maxim4c->module_index, facing, MAXIM4C_NAME,
|
||||
maxim4c->module_index, facing, maxim4c->sensor_name,
|
||||
dev_name(sd->dev));
|
||||
|
||||
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE
|
||||
|
||||
@@ -12,11 +12,12 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/compat.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_graph.h>
|
||||
|
||||
#include "maxim_remote.h"
|
||||
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x01, 0x00)
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x02, 0x00)
|
||||
|
||||
#define MAX9295_NAME "maxim-max9295"
|
||||
|
||||
@@ -334,13 +335,15 @@ static int max9295_check_chipid(maxim_remote_ser_t *max9295)
|
||||
max9295_i2c_addr_def(max9295);
|
||||
}
|
||||
|
||||
if (chip_id != MAX9295_CHIP_ID) {
|
||||
dev_err(dev, "Unexpected chip id = %02x\n", chip_id);
|
||||
return -ENODEV;
|
||||
if (chip_id == max9295->chip_id) {
|
||||
if (chip_id == MAX9295_CHIP_ID) {
|
||||
dev_info(dev, "MAX9295 is Detected\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
dev_info(dev, "Detected MAX9295 chip id: 0x%02x\n", chip_id);
|
||||
|
||||
return 0;
|
||||
dev_err(dev, "Unexpected MAX9295 chipid = %02x\n", chip_id);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -506,10 +509,19 @@ static int max9295_probe(struct i2c_client *client,
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
maxim_remote_ser_t *max9295 = NULL;
|
||||
u32 chip_id;
|
||||
|
||||
dev_info(dev, "driver version: %02x.%02x.%02x", DRIVER_VERSION >> 16,
|
||||
(DRIVER_VERSION & 0xff00) >> 8, DRIVER_VERSION & 0x00ff);
|
||||
|
||||
chip_id = (uintptr_t)of_device_get_match_data(dev);
|
||||
if (chip_id == MAX9295_CHIP_ID) {
|
||||
dev_info(dev, "driver for max9295\n");
|
||||
} else {
|
||||
dev_err(dev, "driver unknown chip\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
max9295 = devm_kzalloc(dev, sizeof(*max9295), GFP_KERNEL);
|
||||
if (!max9295) {
|
||||
dev_err(dev, "max9295 probe no memory error\n");
|
||||
@@ -517,6 +529,7 @@ static int max9295_probe(struct i2c_client *client,
|
||||
}
|
||||
|
||||
max9295->client = client;
|
||||
max9295->chip_id = chip_id;
|
||||
max9295->ser_i2c_addr_map = client->addr;
|
||||
max9295->ser_ops = &max9295_ser_ops;
|
||||
max9295->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
@@ -550,7 +563,10 @@ static void max9295_remove(struct i2c_client *client)
|
||||
}
|
||||
|
||||
static const struct of_device_id max9295_of_match[] = {
|
||||
{ .compatible = "maxim,ser,max9295" },
|
||||
{
|
||||
.compatible = "maxim,ser,max9295",
|
||||
.data = (const void *)MAX9295_CHIP_ID
|
||||
},
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, max9295_of_match);
|
||||
|
||||
@@ -12,11 +12,12 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/compat.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_graph.h>
|
||||
|
||||
#include "maxim_remote.h"
|
||||
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x01, 0x00)
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x02, 0x00)
|
||||
|
||||
#define MAX96715_NAME "maxim-max96715"
|
||||
|
||||
@@ -367,13 +368,15 @@ static int max96715_check_chipid(maxim_remote_ser_t *max96715)
|
||||
max96715_i2c_addr_def(max96715);
|
||||
}
|
||||
|
||||
if (chip_id != MAX96715_CHIP_ID) {
|
||||
dev_err(dev, "Unexpected chip id = %02x\n", chip_id);
|
||||
return -ENODEV;
|
||||
if (chip_id == max96715->chip_id) {
|
||||
if (chip_id == MAX96715_CHIP_ID) {
|
||||
dev_info(dev, "MAX96715 is Detected\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
dev_info(dev, "Detected MAX96715 chip id: 0x%02x\n", chip_id);
|
||||
|
||||
return 0;
|
||||
dev_err(dev, "Unexpected MAX96715 chipid = %02x\n", chip_id);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -507,10 +510,19 @@ static int max96715_probe(struct i2c_client *client,
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
maxim_remote_ser_t *max96715 = NULL;
|
||||
u32 chip_id;
|
||||
|
||||
dev_info(dev, "driver version: %02x.%02x.%02x", DRIVER_VERSION >> 16,
|
||||
(DRIVER_VERSION & 0xff00) >> 8, DRIVER_VERSION & 0x00ff);
|
||||
|
||||
chip_id = (uintptr_t)of_device_get_match_data(dev);
|
||||
if (chip_id == MAX96715_CHIP_ID) {
|
||||
dev_info(dev, "driver for max96715\n");
|
||||
} else {
|
||||
dev_err(dev, "driver unknown chip\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
max96715 = devm_kzalloc(dev, sizeof(*max96715), GFP_KERNEL);
|
||||
if (!max96715) {
|
||||
dev_err(dev, "max96715 probe no memory error\n");
|
||||
@@ -518,6 +530,7 @@ static int max96715_probe(struct i2c_client *client,
|
||||
}
|
||||
|
||||
max96715->client = client;
|
||||
max96715->chip_id = chip_id;
|
||||
max96715->ser_i2c_addr_map = client->addr;
|
||||
max96715->ser_ops = &max96715_ser_ops;
|
||||
max96715->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
@@ -551,7 +564,10 @@ static void max96715_remove(struct i2c_client *client)
|
||||
}
|
||||
|
||||
static const struct of_device_id max96715_of_match[] = {
|
||||
{ .compatible = "maxim,ser,max96715" },
|
||||
{
|
||||
.compatible = "maxim,ser,max96715",
|
||||
.data = (const void *)MAX96715_CHIP_ID
|
||||
},
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, max96715_of_match);
|
||||
|
||||
@@ -12,17 +12,19 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/compat.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/of_graph.h>
|
||||
|
||||
#include "maxim_remote.h"
|
||||
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x01, 0x00)
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x02, 0x00)
|
||||
|
||||
#define MAX96717_NAME "maxim-max96717"
|
||||
|
||||
#define MAX96717_I2C_ADDR_DEF 0x40
|
||||
|
||||
#define MAX96717_CHIP_ID 0xBF
|
||||
#define MAX96717F_CHIP_ID 0xC8
|
||||
#define MAX96717_REG_CHIP_ID 0x0D
|
||||
|
||||
/* register address: 16bit */
|
||||
@@ -334,13 +336,20 @@ static int max96717_check_chipid(maxim_remote_ser_t *max96717)
|
||||
max96717_i2c_addr_def(max96717);
|
||||
}
|
||||
|
||||
if (chip_id != MAX96717_CHIP_ID) {
|
||||
dev_err(dev, "Unexpected chip id = %02x\n", chip_id);
|
||||
return -ENODEV;
|
||||
}
|
||||
dev_info(dev, "Detected MAX96717 chip id: 0x%02x\n", chip_id);
|
||||
if (chip_id == max96717->chip_id) {
|
||||
if (chip_id == MAX96717_CHIP_ID) {
|
||||
dev_info(dev, "MAX96717 is Detected\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (chip_id == MAX96717F_CHIP_ID) {
|
||||
dev_info(dev, "MAX96717F is Detected\n");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
dev_err(dev, "Unexpected MAX96717 chipid = %02x\n", chip_id);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -456,10 +465,21 @@ static int max96717_probe(struct i2c_client *client,
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
maxim_remote_ser_t *max96717 = NULL;
|
||||
u32 chip_id;
|
||||
|
||||
dev_info(dev, "driver version: %02x.%02x.%02x", DRIVER_VERSION >> 16,
|
||||
(DRIVER_VERSION & 0xff00) >> 8, DRIVER_VERSION & 0x00ff);
|
||||
|
||||
chip_id = (uintptr_t)of_device_get_match_data(dev);
|
||||
if (chip_id == MAX96717_CHIP_ID) {
|
||||
dev_info(dev, "driver for max96717\n");
|
||||
} else if (chip_id == MAX96717F_CHIP_ID) {
|
||||
dev_info(dev, "driver for max96717f\n");
|
||||
} else {
|
||||
dev_err(dev, "driver unknown chip\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
max96717 = devm_kzalloc(dev, sizeof(*max96717), GFP_KERNEL);
|
||||
if (!max96717) {
|
||||
dev_err(dev, "max96717 probe no memory error\n");
|
||||
@@ -467,6 +487,7 @@ static int max96717_probe(struct i2c_client *client,
|
||||
}
|
||||
|
||||
max96717->client = client;
|
||||
max96717->chip_id = chip_id;
|
||||
max96717->ser_i2c_addr_map = client->addr;
|
||||
max96717->ser_ops = &max96717_ser_ops;
|
||||
max96717->ser_state = MAXIM_REMOTE_SER_DEINIT;
|
||||
@@ -500,7 +521,14 @@ static void max96717_remove(struct i2c_client *client)
|
||||
}
|
||||
|
||||
static const struct of_device_id max96717_of_match[] = {
|
||||
{ .compatible = "maxim,ser,max96717" },
|
||||
{
|
||||
.compatible = "maxim,ser,max96717",
|
||||
.data = (const void *)MAX96717_CHIP_ID
|
||||
},
|
||||
{
|
||||
.compatible = "maxim,ser,max96717f",
|
||||
.data = (const void *)MAX96717F_CHIP_ID
|
||||
},
|
||||
{ /* sentinel */ },
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, max96717_of_match);
|
||||
|
||||
@@ -74,6 +74,8 @@ typedef struct maxim_remote_ser {
|
||||
|
||||
struct mutex mutex;
|
||||
|
||||
u32 chip_id;
|
||||
|
||||
u8 ser_i2c_addr_def;
|
||||
u8 ser_i2c_addr_map;
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ struct ox03j10 {
|
||||
struct maxim_remote_ser *remote_ser;
|
||||
};
|
||||
|
||||
static const struct i2c_regval ox03j10_1920x1080_regs[] = {
|
||||
static const struct i2c_regval ox03j10_1920x1280_regs[] = {
|
||||
{ REG_NULL, 0x00 },
|
||||
};
|
||||
|
||||
@@ -118,15 +118,15 @@ static const struct i2c_regval ox03j10_1920x1080_regs[] = {
|
||||
static const struct ox03j10_mode supported_modes[] = {
|
||||
{
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.height = 1280,
|
||||
.max_fps = {
|
||||
.numerator = 10000,
|
||||
.denominator = 300000,
|
||||
},
|
||||
.link_freq_idx = 0,
|
||||
.bus_fmt = MEDIA_BUS_FMT_UYVY8_2X8,
|
||||
.bus_fmt = MEDIA_BUS_FMT_YUYV8_2X8,
|
||||
.bpp = 16,
|
||||
.reg_list = ox03j10_1920x1080_regs,
|
||||
.reg_list = ox03j10_1920x1280_regs,
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user