media: i2c: maxim: driver version v3.10.00

Signed-off-by: Cai Wenzhong <cwz@rock-chips.com>
Change-Id: Ib88178d5fd02484342a3b848db32d457c3fa3034
This commit is contained in:
Cai Wenzhong
2025-08-05 14:33:16 +08:00
parent 56b2414e42
commit 6542cc7762
10 changed files with 100 additions and 82 deletions

View File

@@ -24,9 +24,6 @@
/* Maxim Deserializer Test Pattern */
#define MAXIM2C_TEST_PATTERN 0
/* Maxim Deserializer pwdn on/off enable */
#define MAXIM2C_LOCAL_DES_ON_OFF_EN 0
/* maxim2c i2c mux api */
int maxim2c_i2c_mux_enable(maxim2c_t *maxim2c, u8 def_mask);
int maxim2c_i2c_mux_disable(maxim2c_t *maxim2c);

View File

@@ -69,6 +69,9 @@
* fix lockdep debug warning.
* 2. fix compile warning when MAXIM2C_LOCAL_DES_ON_OFF_EN enable.
*
* V3.10.00
* 1. local pwdn on/off enable replace MAXIM4C_LOCAL_DES_ON_OFF_EN with local_power_off_enable
*
*/
#include <linux/clk.h>
#include <linux/i2c.h>
@@ -96,7 +99,7 @@
#include "maxim2c_api.h"
#define DRIVER_VERSION KERNEL_VERSION(3, 0x09, 0x01)
#define DRIVER_VERSION KERNEL_VERSION(3, 0x10, 0x00)
#define MAXIM2C_NAME "maxim2c"
@@ -419,44 +422,40 @@ static void maxim2c_device_power_off(maxim2c_t *maxim2c)
static int maxim2c_runtime_resume(struct device *dev)
{
#if MAXIM2C_LOCAL_DES_ON_OFF_EN
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
maxim2c_t *maxim2c = v4l2_get_subdevdata(sd);
int ret = 0;
ret |= maxim2c_device_power_on(maxim2c);
if (maxim2c->local_power_off_enable == 0)
return 0;
return ret;
#else
return 0;
#endif /* MAXIM2C_LOCAL_DES_ON_OFF_EN */
return maxim2c_device_power_on(maxim2c);
}
static int maxim2c_runtime_suspend(struct device *dev)
{
#if MAXIM2C_LOCAL_DES_ON_OFF_EN
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
maxim2c_t *maxim2c = v4l2_get_subdevdata(sd);
int ret = 0;
if (maxim2c->local_power_off_enable == 0)
return 0;
maxim2c_device_power_off(maxim2c);
return ret;
#else
return 0;
#endif /* MAXIM2C_LOCAL_DES_ON_OFF_EN */
}
static int __maybe_unused maxim2c_resume(struct device *dev)
{
#if (MAXIM2C_LOCAL_DES_ON_OFF_EN == 0)
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
maxim2c_t *maxim2c = v4l2_get_subdevdata(sd);
int ret = 0;
if (maxim2c->local_power_off_enable == 0)
return 0;
dev_info(dev, "maxim2c resume\n");
#if MAXIM2C_TEST_PATTERN
@@ -472,7 +471,6 @@ static int __maybe_unused maxim2c_resume(struct device *dev)
return ret;
}
#endif /* MAXIM2C_TEST_PATTERN */
#endif /* MAXIM2C_LOCAL_DES_ON_OFF_EN */
return 0;
}
@@ -550,6 +548,12 @@ static int maxim2c_module_parse_dt(maxim2c_t *maxim2c)
return -ENODEV;
}
ret = of_property_read_u32(node, "local-power-off-enable", &value);
if (ret == 0) {
dev_info(dev, "local-power-off-enable property: %d\n", value);
maxim2c->local_power_off_enable = value;
}
ret = of_property_read_u32(node, "remote-routing-to-isp", &value);
if (ret == 0) {
dev_info(dev, "remote-routing-to-isp property: %d\n", value);
@@ -789,13 +793,13 @@ static int maxim2c_probe(struct i2c_client *client,
#if MAXIM2C_TEST_PATTERN
ret = maxim2c_pattern_data_init(maxim2c);
if (ret)
goto err_power_off;
goto err_subdev_deinit;
#if (MAXIM2C_LOCAL_DES_ON_OFF_EN == 0)
ret = maxim2c_pattern_hw_init(maxim2c);
if (ret)
goto err_power_off;
#endif /* MAXIM2C_LOCAL_DES_ON_OFF_EN */
if (maxim2c->local_power_off_enable == 0) {
ret = maxim2c_pattern_hw_init(maxim2c);
if (ret)
goto err_subdev_deinit;
}
pm_runtime_set_autosuspend_delay(dev, 1000);
pm_runtime_use_autosuspend(dev);
@@ -808,11 +812,11 @@ static int maxim2c_probe(struct i2c_client *client,
maxim2c_module_data_init(maxim2c);
maxim2c_module_parse_dt(maxim2c);
#if (MAXIM2C_LOCAL_DES_ON_OFF_EN == 0)
ret = maxim2c_module_hw_init(maxim2c);
if (ret)
goto err_subdev_deinit;
#endif /* MAXIM2C_LOCAL_DES_ON_OFF_EN */
if (maxim2c->local_power_off_enable == 0) {
ret = maxim2c_module_hw_init(maxim2c);
if (ret)
goto err_subdev_deinit;
}
ret = maxim2c_i2c_mux_init(maxim2c);
if (ret)

View File

@@ -104,6 +104,7 @@ typedef struct maxim2c {
u32 chipid;
bool local_power_off_enable;
bool remote_routing_to_isp;
bool streaming;

View File

@@ -253,6 +253,7 @@ int maxim2c_pattern_data_init(maxim2c_t *maxim2c)
struct maxim2c_mode *supported_mode = NULL;
struct maxim2c_pattern *pattern = NULL;
maxim2c_mipi_txphy_t *mipi_txphy = &maxim2c->mipi_txphy;
u32 value = 0;
int ret = 0;
// maxim serdes local
@@ -270,6 +271,12 @@ int maxim2c_pattern_data_init(maxim2c_t *maxim2c)
return -ENODEV;
}
ret = of_property_read_u32(node, "local-power-off-enable", &value);
if (ret == 0) {
dev_info(dev, "local-power-off-enable property: %d\n", value);
maxim2c->local_power_off_enable = value;
}
maxim2c_mipi_txphy_data_init(maxim2c);
/* mipi txphy parse dt */

View File

@@ -635,21 +635,21 @@ static int __maxim2c_start_stream(maxim2c_t *maxim2c)
u8 link_mask = 0, link_freq_idx = 0;
u8 video_pipe_mask = 0;
#if MAXIM2C_LOCAL_DES_ON_OFF_EN
if (maxim2c->local_power_off_enable != 0) {
#if MAXIM2C_TEST_PATTERN
ret = maxim2c_pattern_hw_init(maxim2c);
if (ret) {
dev_err(dev, "test pattern hw init error\n");
return ret;
}
ret = maxim2c_pattern_hw_init(maxim2c);
if (ret) {
dev_err(dev, "test pattern hw init error\n");
return ret;
}
#else
ret = maxim2c_module_hw_init(maxim2c);
if (ret) {
dev_err(dev, "maxim2c module hw init error\n");
return ret;
}
ret = maxim2c_module_hw_init(maxim2c);
if (ret) {
dev_err(dev, "maxim2c module hw init error\n");
return ret;
}
#endif /* MAXIM2C_TEST_PATTERN */
#endif /* MAXIM2C_LOCAL_DES_ON_OFF_EN */
}
link_mask = maxim2c->gmsl_link.link_enable_mask;
video_pipe_mask = maxim2c->video_pipe.pipe_enable_mask;

View File

@@ -24,9 +24,6 @@
/* Maxim Deserializer Test Pattern */
#define MAXIM4C_TEST_PATTERN 0
/* Maxim Deserializer pwdn on/off enable */
#define MAXIM4C_LOCAL_DES_ON_OFF_EN 0
/* maxim4c i2c mux api */
int maxim4c_i2c_mux_enable(maxim4c_t *maxim4c, u8 def_mask);
int maxim4c_i2c_mux_disable(maxim4c_t *maxim4c);

View File

@@ -92,6 +92,9 @@
* fix lockdep debug warning.
* 2. fix compile warning when MAXIM4C_LOCAL_DES_ON_OFF_EN enable.
*
* V3.10.00
* 1. local pwdn on/off enable replace MAXIM4C_LOCAL_DES_ON_OFF_EN with local_power_off_enable
*
*/
#include <linux/clk.h>
#include <linux/i2c.h>
@@ -119,7 +122,7 @@
#include "maxim4c_api.h"
#define DRIVER_VERSION KERNEL_VERSION(3, 0x09, 0x01)
#define DRIVER_VERSION KERNEL_VERSION(3, 0x10, 0x00)
#define MAXIM4C_NAME "maxim4c"
@@ -494,44 +497,40 @@ static void maxim4c_device_power_off(maxim4c_t *maxim4c)
static int maxim4c_runtime_resume(struct device *dev)
{
#if MAXIM4C_LOCAL_DES_ON_OFF_EN
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
maxim4c_t *maxim4c = v4l2_get_subdevdata(sd);
int ret = 0;
ret |= maxim4c_device_power_on(maxim4c);
if (maxim4c->local_power_off_enable == 0)
return 0;
return ret;
#else
return 0;
#endif /* MAXIM4C_LOCAL_DES_ON_OFF_EN */
return maxim4c_device_power_on(maxim4c);
}
static int maxim4c_runtime_suspend(struct device *dev)
{
#if MAXIM4C_LOCAL_DES_ON_OFF_EN
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
maxim4c_t *maxim4c = v4l2_get_subdevdata(sd);
int ret = 0;
if (maxim4c->local_power_off_enable == 0)
return 0;
maxim4c_device_power_off(maxim4c);
return ret;
#else
return 0;
#endif /* MAXIM4C_LOCAL_DES_ON_OFF_EN */
}
static int __maybe_unused maxim4c_resume(struct device *dev)
{
#if (MAXIM4C_LOCAL_DES_ON_OFF_EN == 0)
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
maxim4c_t *maxim4c = v4l2_get_subdevdata(sd);
int ret = 0;
if (maxim4c->local_power_off_enable == 0)
return 0;
dev_info(dev, "maxim4c resume\n");
#if MAXIM4C_TEST_PATTERN
@@ -547,7 +546,6 @@ static int __maybe_unused maxim4c_resume(struct device *dev)
return ret;
}
#endif /* MAXIM4C_TEST_PATTERN */
#endif /* MAXIM4C_LOCAL_DES_ON_OFF_EN */
return 0;
}
@@ -625,6 +623,12 @@ static int maxim4c_module_parse_dt(maxim4c_t *maxim4c)
return -ENODEV;
}
ret = of_property_read_u32(node, "local-power-off-enable", &value);
if (ret == 0) {
dev_info(dev, "local-power-off-enable property: %d\n", value);
maxim4c->local_power_off_enable = value;
}
ret = of_property_read_u32(node, "remote-routing-to-isp", &value);
if (ret == 0) {
dev_info(dev, "remote-routing-to-isp property: %d\n", value);
@@ -856,13 +860,13 @@ static int maxim4c_probe(struct i2c_client *client,
#if MAXIM4C_TEST_PATTERN
ret = maxim4c_pattern_data_init(maxim4c);
if (ret)
goto err_power_off;
goto err_subdev_deinit;
#if (MAXIM4C_LOCAL_DES_ON_OFF_EN == 0)
ret = maxim4c_pattern_hw_init(maxim4c);
if (ret)
goto err_power_off;
#endif /* MAXIM4C_LOCAL_DES_ON_OFF_EN */
if (maxim4c->local_power_off_enable == 0) {
ret = maxim4c_pattern_hw_init(maxim4c);
if (ret)
goto err_subdev_deinit;
}
pm_runtime_set_autosuspend_delay(dev, 1000);
pm_runtime_use_autosuspend(dev);
@@ -879,11 +883,11 @@ static int maxim4c_probe(struct i2c_client *client,
if (ret)
goto err_subdev_deinit;
#if (MAXIM4C_LOCAL_DES_ON_OFF_EN == 0)
ret = maxim4c_module_hw_init(maxim4c);
if (ret)
goto err_dbgfs_deinit;
#endif /* MAXIM4C_LOCAL_DES_ON_OFF_EN */
if (maxim4c->local_power_off_enable == 0) {
ret = maxim4c_module_hw_init(maxim4c);
if (ret)
goto err_dbgfs_deinit;
}
ret = maxim4c_i2c_mux_init(maxim4c);
if (ret)

View File

@@ -104,6 +104,7 @@ typedef struct maxim4c {
u32 chipid;
bool local_power_off_enable;
bool remote_routing_to_isp;
bool streaming;

View File

@@ -274,6 +274,7 @@ int maxim4c_pattern_data_init(maxim4c_t *maxim4c)
struct maxim4c_mode *supported_mode = NULL;
struct maxim4c_pattern *pattern = NULL;
maxim4c_mipi_txphy_t *mipi_txphy = &maxim4c->mipi_txphy;
u32 value = 0;
int ret = 0;
// maxim serdes local
@@ -291,6 +292,12 @@ int maxim4c_pattern_data_init(maxim4c_t *maxim4c)
return -ENODEV;
}
ret = of_property_read_u32(node, "local-power-off-enable", &value);
if (ret == 0) {
dev_info(dev, "local-power-off-enable property: %d\n", value);
maxim4c->local_power_off_enable = value;
}
maxim4c_mipi_txphy_data_init(maxim4c);
/* mipi txphy parse dt */

View File

@@ -635,21 +635,21 @@ static int __maxim4c_start_stream(maxim4c_t *maxim4c)
u8 link_mask = 0, link_freq_idx = 0;
u8 video_pipe_mask = 0;
#if MAXIM4C_LOCAL_DES_ON_OFF_EN
if (maxim4c->local_power_off_enable != 0) {
#if MAXIM4C_TEST_PATTERN
ret = maxim4c_pattern_hw_init(maxim4c);
if (ret) {
dev_err(dev, "test pattern hw init error\n");
return ret;
}
ret = maxim4c_pattern_hw_init(maxim4c);
if (ret) {
dev_err(dev, "test pattern hw init error\n");
return ret;
}
#else
ret = maxim4c_module_hw_init(maxim4c);
if (ret) {
dev_err(dev, "maxim4c module hw init error\n");
return ret;
}
ret = maxim4c_module_hw_init(maxim4c);
if (ret) {
dev_err(dev, "maxim4c module hw init error\n");
return ret;
}
#endif /* MAXIM4C_TEST_PATTERN */
#endif /* MAXIM4C_LOCAL_DES_ON_OFF_EN */
}
link_mask = maxim4c->gmsl_link.link_enable_mask;
video_pipe_mask = maxim4c->video_pipe.pipe_enable_mask;