mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
media: i2c: maxim: driver version v3.07.00
Signed-off-by: Cai Wenzhong <cwz@rock-chips.com> Change-Id: Idfd53c2055d8496efd4624f1aaaa6fda0397cfcf
This commit is contained in:
@@ -52,6 +52,10 @@
|
||||
* 2. mode vc initialization when vc-array isn't configured
|
||||
* 3. fix the issue of mutex deadlock during hot plug
|
||||
*
|
||||
* V3.07.00
|
||||
* 1. v4l2 ioctl add command to support quick stream setting
|
||||
* 2. dev_pm_ops add suspend and resume for system sleep
|
||||
*
|
||||
*/
|
||||
#include <linux/clk.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -79,7 +83,7 @@
|
||||
|
||||
#include "maxim2c_api.h"
|
||||
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x06, 0x00)
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x07, 0x00)
|
||||
|
||||
#define MAXIM2C_NAME "maxim2c"
|
||||
|
||||
@@ -420,9 +424,43 @@ static int maxim2c_runtime_suspend(struct device *dev)
|
||||
#endif /* MAXIM2C_LOCAL_DES_ON_OFF_EN */
|
||||
}
|
||||
|
||||
static int __maybe_unused maxim2c_resume(struct device *dev)
|
||||
{
|
||||
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;
|
||||
|
||||
dev_info(dev, "maxim2c resume\n");
|
||||
|
||||
#if (MAXIM2C_LOCAL_DES_ON_OFF_EN == 0)
|
||||
#if MAXIM2C_TEST_PATTERN
|
||||
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;
|
||||
}
|
||||
#endif /* MAXIM2C_TEST_PATTERN */
|
||||
#endif /* MAXIM2C_LOCAL_DES_ON_OFF_EN */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused maxim2c_suspend(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops maxim2c_pm_ops = {
|
||||
SET_RUNTIME_PM_OPS(
|
||||
maxim2c_runtime_suspend, maxim2c_runtime_resume, NULL)
|
||||
SET_LATE_SYSTEM_SLEEP_PM_OPS(maxim2c_suspend, maxim2c_resume)
|
||||
};
|
||||
|
||||
static void maxim2c_module_data_init(maxim2c_t *maxim2c)
|
||||
|
||||
@@ -436,6 +436,7 @@ static long maxim2c_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
struct rkmodule_csi_dphy_param *dphy_param;
|
||||
struct rkmodule_capture_info *capture_info;
|
||||
struct rkmodule_channel_info *ch_info;
|
||||
u32 stream = 0;
|
||||
long ret = 0;
|
||||
|
||||
dev_dbg(&maxim2c->client->dev, "ioctl cmd = 0x%08x\n", cmd);
|
||||
@@ -473,6 +474,17 @@ static long maxim2c_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
ch_info = (struct rkmodule_channel_info *)arg;
|
||||
ret = maxim2c_get_channel_info(maxim2c, ch_info);
|
||||
break;
|
||||
case RKMODULE_SET_QUICK_STREAM:
|
||||
stream = *((u32 *)arg);
|
||||
|
||||
if (stream)
|
||||
ret = maxim2c_mipi_csi_output(maxim2c, true);
|
||||
else
|
||||
ret = maxim2c_mipi_csi_output(maxim2c, false);
|
||||
|
||||
dev_info(&maxim2c->client->dev,
|
||||
"set quick stream = %d: mipi csi output ret = %ld\n", stream, ret);
|
||||
break;
|
||||
default:
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
@@ -491,6 +503,7 @@ static long maxim2c_compat_ioctl32(struct v4l2_subdev *sd, unsigned int cmd,
|
||||
struct rkmodule_csi_dphy_param *dphy_param;
|
||||
struct rkmodule_capture_info *capture_info;
|
||||
struct rkmodule_channel_info *ch_info;
|
||||
u32 stream = 0;
|
||||
long ret = 0;
|
||||
|
||||
switch (cmd) {
|
||||
@@ -598,6 +611,13 @@ static long maxim2c_compat_ioctl32(struct v4l2_subdev *sd, unsigned int cmd,
|
||||
}
|
||||
kfree(ch_info);
|
||||
break;
|
||||
case RKMODULE_SET_QUICK_STREAM:
|
||||
ret = copy_from_user(&stream, up, sizeof(u32));
|
||||
if (!ret)
|
||||
ret = maxim2c_ioctl(sd, cmd, &stream);
|
||||
else
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
default:
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
|
||||
@@ -75,6 +75,10 @@
|
||||
* 2. mode vc initialization when vc-array isn't configured
|
||||
* 3. fix the issue of mutex deadlock during hot plug
|
||||
*
|
||||
* V3.07.00
|
||||
* 1. v4l2 ioctl add command to support quick stream setting
|
||||
* 2. dev_pm_ops add suspend and resume for system sleep
|
||||
*
|
||||
*/
|
||||
#include <linux/clk.h>
|
||||
#include <linux/i2c.h>
|
||||
@@ -102,7 +106,7 @@
|
||||
|
||||
#include "maxim4c_api.h"
|
||||
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x06, 0x00)
|
||||
#define DRIVER_VERSION KERNEL_VERSION(3, 0x07, 0x00)
|
||||
|
||||
#define MAXIM4C_NAME "maxim4c"
|
||||
|
||||
@@ -495,9 +499,43 @@ static int maxim4c_runtime_suspend(struct device *dev)
|
||||
#endif /* MAXIM4C_LOCAL_DES_ON_OFF_EN */
|
||||
}
|
||||
|
||||
static int __maybe_unused maxim4c_resume(struct device *dev)
|
||||
{
|
||||
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;
|
||||
|
||||
dev_info(dev, "maxim4c resume\n");
|
||||
|
||||
#if (MAXIM4C_LOCAL_DES_ON_OFF_EN == 0)
|
||||
#if MAXIM4C_TEST_PATTERN
|
||||
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;
|
||||
}
|
||||
#endif /* MAXIM4C_TEST_PATTERN */
|
||||
#endif /* MAXIM4C_LOCAL_DES_ON_OFF_EN */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused maxim4c_suspend(struct device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops maxim4c_pm_ops = {
|
||||
SET_RUNTIME_PM_OPS(
|
||||
maxim4c_runtime_suspend, maxim4c_runtime_resume, NULL)
|
||||
SET_LATE_SYSTEM_SLEEP_PM_OPS(maxim4c_suspend, maxim4c_resume)
|
||||
};
|
||||
|
||||
static void maxim4c_module_data_init(maxim4c_t *maxim4c)
|
||||
|
||||
@@ -436,6 +436,7 @@ static long maxim4c_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
struct rkmodule_csi_dphy_param *dphy_param;
|
||||
struct rkmodule_capture_info *capture_info;
|
||||
struct rkmodule_channel_info *ch_info;
|
||||
u32 stream = 0;
|
||||
long ret = 0;
|
||||
|
||||
dev_dbg(&maxim4c->client->dev, "ioctl cmd = 0x%08x\n", cmd);
|
||||
@@ -473,6 +474,17 @@ static long maxim4c_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
|
||||
ch_info = (struct rkmodule_channel_info *)arg;
|
||||
ret = maxim4c_get_channel_info(maxim4c, ch_info);
|
||||
break;
|
||||
case RKMODULE_SET_QUICK_STREAM:
|
||||
stream = *((u32 *)arg);
|
||||
|
||||
if (stream)
|
||||
ret = maxim4c_mipi_csi_output(maxim4c, true);
|
||||
else
|
||||
ret = maxim4c_mipi_csi_output(maxim4c, false);
|
||||
|
||||
dev_info(&maxim4c->client->dev,
|
||||
"set quick stream = %d: mipi csi output ret = %ld\n", stream, ret);
|
||||
break;
|
||||
default:
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
@@ -491,6 +503,7 @@ static long maxim4c_compat_ioctl32(struct v4l2_subdev *sd, unsigned int cmd,
|
||||
struct rkmodule_csi_dphy_param *dphy_param;
|
||||
struct rkmodule_capture_info *capture_info;
|
||||
struct rkmodule_channel_info *ch_info;
|
||||
u32 stream = 0;
|
||||
long ret = 0;
|
||||
|
||||
switch (cmd) {
|
||||
@@ -598,6 +611,13 @@ static long maxim4c_compat_ioctl32(struct v4l2_subdev *sd, unsigned int cmd,
|
||||
}
|
||||
kfree(ch_info);
|
||||
break;
|
||||
case RKMODULE_SET_QUICK_STREAM:
|
||||
ret = copy_from_user(&stream, up, sizeof(u32));
|
||||
if (!ret)
|
||||
ret = maxim4c_ioctl(sd, cmd, &stream);
|
||||
else
|
||||
ret = -EFAULT;
|
||||
break;
|
||||
default:
|
||||
ret = -ENOIOCTLCMD;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user