Merge commit '3d9e7100637001159451fc7421209106987fe1d0'

* commit '3d9e7100637001159451fc7421209106987fe1d0':
  mtd: spinand: Winbond: Support new device W25N01JWZEIG
  media: i2c: sc4336 adapt sleep_wakeup
  media: rockchip: vicap fixes the probability of stream data loss after tool nodes capture raw data

Change-Id: I9541ed8bacbd39618a7395ed5240b344adceabf0
This commit is contained in:
Tao Huang
2024-01-30 11:44:36 +08:00
3 changed files with 64 additions and 2 deletions

View File

@@ -28,6 +28,8 @@
#include <media/v4l2-subdev.h>
#include <linux/pinctrl/consumer.h>
#include "../platform/rockchip/isp/rkisp_tb_helper.h"
#include "cam-tb-setup.h"
#include "cam-sleep-wakeup.h"
#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x01)
@@ -157,6 +159,7 @@ struct sc4336 {
u32 cur_vts;
bool is_thunderboot;
bool is_first_streamoff;
struct cam_sw_info *cam_sw_inf;
};
#define to_sc4336(sd) container_of(sd, struct sc4336, subdev)
@@ -958,6 +961,9 @@ static int __sc4336_power_on(struct sc4336 *sc4336)
dev_err(dev, "Failed to enable xvclk\n");
return ret;
}
cam_sw_regulator_bulk_init(sc4336->cam_sw_inf, SC4336_NUM_SUPPLIES, sc4336->supplies);
if (sc4336->is_thunderboot)
return 0;
@@ -1022,6 +1028,42 @@ static void __sc4336_power_off(struct sc4336 *sc4336)
regulator_bulk_disable(SC4336_NUM_SUPPLIES, sc4336->supplies);
}
#if IS_REACHABLE(CONFIG_VIDEO_CAM_SLEEP_WAKEUP)
static int __maybe_unused sc4336_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct sc4336 *sc4336 = to_sc4336(sd);
cam_sw_prepare_wakeup(sc4336->cam_sw_inf, dev);
usleep_range(4000, 5000);
cam_sw_write_array(sc4336->cam_sw_inf);
if (__v4l2_ctrl_handler_setup(&sc4336->ctrl_handler))
dev_err(dev, "__v4l2_ctrl_handler_setup fail!");
return 0;
}
static int __maybe_unused sc4336_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
struct v4l2_subdev *sd = i2c_get_clientdata(client);
struct sc4336 *sc4336 = to_sc4336(sd);
cam_sw_write_array_cb_init(sc4336->cam_sw_inf, client,
(void *)sc4336->cur_mode->reg_list,
(sensor_write_array)sc4336_write_array);
cam_sw_prepare_sleep(sc4336->cam_sw_inf);
return 0;
}
#else
#define sc4336_resume NULL
#define sc4336_suspend NULL
#endif
static int __maybe_unused sc4336_runtime_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
@@ -1082,6 +1124,7 @@ static int sc4336_enum_frame_interval(struct v4l2_subdev *sd,
static const struct dev_pm_ops sc4336_pm_ops = {
SET_RUNTIME_PM_OPS(sc4336_runtime_suspend,
sc4336_runtime_resume, NULL)
SET_LATE_SYSTEM_SLEEP_PM_OPS(sc4336_suspend, sc4336_resume)
};
#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
@@ -1439,6 +1482,14 @@ static int sc4336_probe(struct i2c_client *client,
goto err_power_off;
#endif
if (!sc4336->cam_sw_inf) {
sc4336->cam_sw_inf = cam_sw_init();
cam_sw_clk_init(sc4336->cam_sw_inf, sc4336->xvclk, SC4336_XVCLK_FREQ);
cam_sw_reset_pin_init(sc4336->cam_sw_inf, sc4336->reset_gpio, 0);
if (!IS_ERR(sc4336->pwdn_gpio))
cam_sw_pwdn_pin_init(sc4336->cam_sw_inf, sc4336->pwdn_gpio, 0);
}
memset(facing, 0, sizeof(facing));
if (strcmp(sc4336->module_facing, "back") == 0)
facing[0] = 'b';
@@ -1489,6 +1540,8 @@ static void sc4336_remove(struct i2c_client *client)
v4l2_ctrl_handler_free(&sc4336->ctrl_handler);
mutex_destroy(&sc4336->mutex);
cam_sw_deinit(sc4336->cam_sw_inf);
pm_runtime_disable(&client->dev);
if (!pm_runtime_status_suspended(&client->dev))
__sc4336_power_off(sc4336);

View File

@@ -784,9 +784,9 @@ static void rkcif_tools_work(struct work_struct *work)
struct rkcif_tools_vdev *tools_vdev = container_of(work,
struct rkcif_tools_vdev,
work);
if (tools_vdev->stream->dma_en & RKCIF_DMAEN_BY_VICAP)
if (tools_vdev->stream->cur_stream_mode & RKCIF_STREAM_MODE_CAPTURE)
rkcif_tools_buf_done(tools_vdev);
else if (tools_vdev->stream->dma_en & RKCIF_DMAEN_BY_ISP)
else if (tools_vdev->stream->cur_stream_mode & RKCIF_STREAM_MODE_TOISP_RDBK)
rkcif_tools_buf_done_rdbk(tools_vdev);
}

View File

@@ -207,6 +207,15 @@ static const struct spinand_info winbond_spinand_table[] = {
0,
SPINAND_ECCINFO(&w25n02kv_ooblayout,
w25n02kv_ecc_get_status)),
SPINAND_INFO("W25N01JWZEIG",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBC),
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
NAND_ECCREQ(1, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
&update_cache_variants),
SPINAND_HAS_QE_BIT,
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
};
static int winbond_spinand_init(struct spinand_device *spinand)