Merge commit '18b58076972c32dd56a9f6125bbafbb80c52ae33'

* commit '18b58076972c32dd56a9f6125bbafbb80c52ae33':
  media: i2c: lt6911c: add lt6911c HDMI to MIPI-CSI2 bridge driver
  arm64: dts: rockchip: rk3588-evb: reserve more CMA memory for HDMIRX.
  thermal: rockchip: Round up code in rk_tsadcv2_temp_to_code
  media: i2c: rk628: add signal lost event report
  video: rockchip: vehicle: fix errors of get cif rst and irq
  media: rockchip: isp: fix isp32 bp min output
  crypto: rockchip: cryptodev: cipher support multithreading
  crypto: rockchip: cryptodev: add akcipher_request_set_callback for rsa
  media: rockchip: vicap fixes dma_en logic err with constrant electricity and readback mode
  ASoC: rockchip-spi-codec: fix kctonrol mute case crash

Change-Id: Ifd47e2c4f7dd1f56cd89976f2987780c2c8c91f9
This commit is contained in:
Tao Huang
2024-02-04 20:38:12 +08:00
17 changed files with 1541 additions and 64 deletions

View File

@@ -16,11 +16,11 @@
#size-cells = <2>;
ranges;
/* Reserve 128MB memory for hdmirx-controller@fdee0000 */
/* Reserve 256MB memory for hdmirx-controller@fdee0000 */
cma {
compatible = "shared-dma-pool";
reusable;
reg = <0x0 (256 * 0x100000) 0x0 (128 * 0x100000)>;
reg = <0x0 (256 * 0x100000) 0x0 (256 * 0x100000)>;
linux,cma-default;
};
};

View File

@@ -16,11 +16,11 @@
#size-cells = <2>;
ranges;
/* Reserve 128MB memory for hdmirx-controller@fdee0000 */
/* Reserve 256MB memory for hdmirx-controller@fdee0000 */
cma {
compatible = "shared-dma-pool";
reusable;
reg = <0x0 (256 * 0x100000) 0x0 (128 * 0x100000)>;
reg = <0x0 (256 * 0x100000) 0x0 (256 * 0x100000)>;
linux,cma-default;
};
};

View File

@@ -16,11 +16,11 @@
#size-cells = <2>;
ranges;
/* Reserve 128MB memory for hdmirx-controller@fdee0000 */
/* Reserve 256MB memory for hdmirx-controller@fdee0000 */
cma {
compatible = "shared-dma-pool";
reusable;
reg = <0x0 (256 * 0x100000) 0x0 (128 * 0x100000)>;
reg = <0x0 (256 * 0x100000) 0x0 (256 * 0x100000)>;
linux,cma-default;
};
};

View File

@@ -16,11 +16,11 @@
#size-cells = <2>;
ranges;
/* Reserve 128MB memory for hdmirx-controller@fdee0000 */
/* Reserve 256MB memory for hdmirx-controller@fdee0000 */
cma {
compatible = "shared-dma-pool";
reusable;
reg = <0x0 (256 * 0x100000) 0x0 (128 * 0x100000)>;
reg = <0x0 (256 * 0x100000) 0x0 (256 * 0x100000)>;
linux,cma-default;
};
};

View File

@@ -324,8 +324,9 @@ crypto_create_session(struct fcrypt *fcr, struct session_op *sop)
goto session_error;
}
/* Non-multithreaded can only create one session */
if (!rk_cryptodev_multi_thread(NULL) &&
/* Non-multithreaded can only create one session for hash */
if (ses_new->hdata.init &&
!rk_cryptodev_multi_thread(NULL) &&
!atomic_dec_and_test(&cryptodev_sess)) {
atomic_inc(&cryptodev_sess);
ddebug(2, "Non-multithreaded can only create one session. sess = %d",
@@ -379,6 +380,14 @@ crypto_destroy_session(struct csession *ses_ptr)
mutex_lock(&ses_ptr->sem);
}
ddebug(2, "Removed session 0x%08X", ses_ptr->sid);
/* Non-multithreaded can only create one session for hash */
if (ses_ptr->hdata.init &&
!rk_cryptodev_multi_thread(NULL)) {
atomic_inc(&cryptodev_sess);
ddebug(2, "Release cryptodev_sess = %d", atomic_read(&cryptodev_sess));
}
cryptodev_cipher_deinit(&ses_ptr->cdata);
cryptodev_hash_deinit(&ses_ptr->hdata);
ddebug(2, "freeing space for %d user pages", ses_ptr->array_size);
@@ -387,12 +396,6 @@ crypto_destroy_session(struct csession *ses_ptr)
mutex_unlock(&ses_ptr->sem);
mutex_destroy(&ses_ptr->sem);
kfree(ses_ptr);
/* Non-multithreaded can only create one session */
if (!rk_cryptodev_multi_thread(NULL)) {
atomic_inc(&cryptodev_sess);
ddebug(2, "Release cryptodev_sess = %d", atomic_read(&cryptodev_sess));
}
}
/* Look up a session by ID and remove. */
@@ -567,8 +570,6 @@ static void cryptask_routine(struct work_struct *work)
}
/* ====== /dev/crypto ====== */
static atomic_t cryptodev_node = ATOMIC_INIT(1);
static int
cryptodev_open(struct inode *inode, struct file *filp)
{
@@ -576,18 +577,6 @@ cryptodev_open(struct inode *inode, struct file *filp)
struct crypt_priv *pcr;
int i;
/* Non-multithreaded can only be opened once */
if (!rk_cryptodev_multi_thread(NULL) &&
!atomic_dec_and_test(&cryptodev_node)) {
atomic_inc(&cryptodev_node);
ddebug(2, "Non-multithreaded can only be opened once. node = %d",
atomic_read(&cryptodev_node));
return -EBUSY;
}
/* make sure sess == 1 after open */
atomic_set(&cryptodev_sess, 1);
pcr = kzalloc(sizeof(*pcr), GFP_KERNEL);
if (!pcr)
return -ENOMEM;
@@ -646,12 +635,6 @@ cryptodev_release(struct inode *inode, struct file *filp)
if (!pcr)
return 0;
/* Non-multithreaded can only be opened once */
if (!rk_cryptodev_multi_thread(NULL)) {
atomic_inc(&cryptodev_node);
ddebug(2, "Release cryptodev_node = %d", atomic_read(&cryptodev_node));
}
cancel_work_sync(&pcr->cryptask);
list_splice_tail(&pcr->todo.list, &pcr->free.list);

View File

@@ -710,6 +710,9 @@ static int crypto_rsa_run(struct fcrypt *fcr, struct kernel_crypt_rsa_op *krop)
crypto_init_wait(&wait);
akcipher_request_set_crypt(req, &src, &dst, rop->in_len, out_len_max);
akcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
crypto_req_done, &wait);
switch (rop->op) {
case AOP_ENCRYPT:
ret = crypto_wait_req(crypto_akcipher_encrypt(req), &wait);

View File

@@ -2559,6 +2559,19 @@ config VIDEO_KS0127
To compile this driver as a module, choose M here: the
module will be called ks0127.
config VIDEO_LT6911C
tristate "Lontium LT6911UXC decoder"
depends on VIDEO_DEV && I2C
select HDMI
select MEDIA_CONTROLLER
select VIDEO_V4L2_SUBDEV_API
select V4L2_FWNODE
help
Support for the Lontium LT6911C series HDMI to MIPI CSI-2 bridge.
To compile this driver as a module, choose M here: the
module will be called lt6911c.
config VIDEO_LT6911UXC
tristate "Lontium LT6911UXC decoder"
depends on VIDEO_DEV && I2C

View File

@@ -110,6 +110,7 @@ obj-$(CONFIG_VIDEO_JX_K17) += jx_k17.o
obj-$(CONFIG_VIDEO_KS0127) += ks0127.o
obj-$(CONFIG_VIDEO_LM3560) += lm3560.o
obj-$(CONFIG_VIDEO_LM3646) += lm3646.o
obj-$(CONFIG_VIDEO_LT6911C) += lt6911c.o
obj-$(CONFIG_VIDEO_LT6911UXC) += lt6911uxc.o
obj-$(CONFIG_VIDEO_LT6911UXE) += lt6911uxe.o
obj-$(CONFIG_VIDEO_LT7911D) += lt7911d.o

1465
drivers/media/i2c/lt6911c.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -34,6 +34,7 @@
#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#include <video/videomode.h>
#include <linux/rk_hdmirx_config.h>
#include "rk628.h"
#include "rk628_combrxphy.h"
@@ -1530,6 +1531,9 @@ static void rk628_work_isr(struct work_struct *work)
bool handled = false;
u32 csi0_raw_ints, csi1_raw_ints = 0x0;
u32 int0_status;
const struct v4l2_event evt_signal_lost = {
.type = RK_HDMIRX_V4L2_EVENT_SIGNAL_LOST,
};
mutex_lock(&csi->rk628->rst_lock);
rk628_i2c_read(csi->rk628, GRF_INTR0_STATUS, &int0_status);
@@ -1579,6 +1583,7 @@ static void rk628_work_isr(struct work_struct *work)
enable_stream(sd, false);
csi->nosignal = true;
}
v4l2_event_queue(sd->devnode, &evt_signal_lost);
schedule_delayed_work(&csi->delayed_work_res_change, msecs_to_jiffies(100));
v4l2_dbg(1, debug, sd, "%s: hact/vact change, md_ints: %#x\n",
@@ -1681,6 +1686,8 @@ static int rk628_csi_subscribe_event(struct v4l2_subdev *sd, struct v4l2_fh *fh,
return v4l2_src_change_event_subdev_subscribe(sd, fh, sub);
case V4L2_EVENT_CTRL:
return v4l2_ctrl_subdev_subscribe_event(sd, fh, sub);
case RK_HDMIRX_V4L2_EVENT_SIGNAL_LOST:
return v4l2_event_subscribe(fh, sub, 0, NULL);
default:
return -EINVAL;
}
@@ -2471,10 +2478,13 @@ static irqreturn_t plugin_detect_irq(int irq, void *dev_id)
{
struct rk628_csi *csi = dev_id;
struct v4l2_subdev *sd = &csi->sd;
const struct v4l2_event evt_signal_lost = {
.type = RK_HDMIRX_V4L2_EVENT_SIGNAL_LOST,
};
/* control hpd after 50ms */
schedule_delayed_work(&csi->delayed_work_enable_hotplug, HZ / 20);
tx_5v_power_present(sd);
v4l2_event_queue(sd->devnode, &evt_signal_lost);
return IRQ_HANDLED;
}

View File

@@ -4481,7 +4481,8 @@ static void rkcif_check_buffer_update_pingpong(struct rkcif_stream *stream,
stream->to_stop_dma = 0;
wake_up(&stream->wq_stopped);
} else {
stream->to_en_dma = RKCIF_DMAEN_BY_VICAP;
if (stream->cifdev->resume_mode != RKISP_RTT_MODE_ONE_FRAME)
stream->to_en_dma = RKCIF_DMAEN_BY_VICAP;
v4l2_dbg(3, rkcif_debug, &stream->cifdev->v4l2_dev,
"%s stream[%d] start dma capture, frame cnt %d\n",
__func__, stream->id, stream->frame_idx);
@@ -7443,6 +7444,7 @@ static long rkcif_ioctl_default(struct file *file, void *fh,
rkcif_dphy_quick_stream(dev, stream_param->on);
v4l2_subdev_call(dev->terminal_sensor.sd, core, ioctl,
RKMODULE_SET_QUICK_STREAM, &stream_param->on);
dev->resume_mode = RKISP_RTT_MODE_MULTI_FRAME;
} else {
if (dev->sditf[0]->mode.rdbk_mode == RKISP_VICAP_ONLINE) {
for (i = 0; i < stream_num - 1; i++) {

View File

@@ -13,14 +13,6 @@
#include "regs.h"
#include "rkisp_tb_helper.h"
#define STREAM_MAX_MP_RSZ_OUTPUT_WIDTH 4416
#define STREAM_MAX_MP_RSZ_OUTPUT_HEIGHT 3312
#define STREAM_MAX_SP_RSZ_OUTPUT_WIDTH 1920
#define STREAM_MAX_SP_RSZ_OUTPUT_HEIGHT 1080
#define STREAM_MIN_RSZ_OUTPUT_WIDTH 32
#define STREAM_MIN_RSZ_OUTPUT_HEIGHT 32
#define STREAM_OUTPUT_STEP_WISE 8
#define STREAM_MIN_MP_SP_INPUT_WIDTH STREAM_MIN_RSZ_OUTPUT_WIDTH
#define STREAM_MIN_MP_SP_INPUT_HEIGHT STREAM_MIN_RSZ_OUTPUT_HEIGHT

View File

@@ -57,6 +57,14 @@
#define DMATX2_VDEV_NAME DRIVER_NAME "_rawwr2"
#define DMATX3_VDEV_NAME DRIVER_NAME "_rawwr3"
#define STREAM_MAX_MP_RSZ_OUTPUT_WIDTH 4416
#define STREAM_MAX_MP_RSZ_OUTPUT_HEIGHT 3312
#define STREAM_MAX_SP_RSZ_OUTPUT_WIDTH 1920
#define STREAM_MAX_SP_RSZ_OUTPUT_HEIGHT 1080
#define STREAM_MIN_RSZ_OUTPUT_WIDTH 32
#define STREAM_MIN_RSZ_OUTPUT_HEIGHT 32
#define STREAM_OUTPUT_STEP_WISE 8
struct rkisp_stream;
enum {

View File

@@ -359,8 +359,8 @@ static struct stream_config rkisp_bp_stream_config = {
.fmt_size = ARRAY_SIZE(bp_fmts),
.max_rsz_width = CIF_ISP_INPUT_W_MAX_V32,
.max_rsz_height = CIF_ISP_INPUT_H_MAX_V32,
.min_rsz_width = CIF_ISP_INPUT_W_MIN,
.min_rsz_height = CIF_ISP_INPUT_H_MIN,
.min_rsz_width = STREAM_MIN_RSZ_OUTPUT_WIDTH,
.min_rsz_height = STREAM_MIN_RSZ_OUTPUT_HEIGHT,
.frame_end_id = ISP3X_MI_BP_FRAME,
.rsz = {
.ctrl = ISP32_BP_RESIZE_CTRL,

View File

@@ -787,7 +787,7 @@ static u32 rk_tsadcv2_temp_to_code(const struct chip_tsadc_table *table,
u32 error = table->data_mask;
if (table->kNum)
return (((temp / 1000) * table->kNum) / 1000 + table->bNum);
return DIV_ROUND_UP(temp / 100 * table->kNum, 10000) + table->bNum;
low = 0;
high = (table->length - 1) - 1; /* ignore the last check for table */
@@ -819,9 +819,9 @@ static u32 rk_tsadcv2_temp_to_code(const struct chip_tsadc_table *table,
switch (table->mode) {
case ADC_DECREMENT:
return table->id[mid].code - (num / denom);
return table->id[mid].code - DIV_ROUND_UP(num, denom);
case ADC_INCREMENT:
return table->id[mid].code + (num / denom);
return table->id[mid].code + DIV_ROUND_UP(num, denom);
default:
pr_err("%s: unknown table mode: %d\n", __func__, table->mode);
return error;

View File

@@ -5136,7 +5136,7 @@ int vehicle_cif_init(struct vehicle_cif *cif)
for (i = 0; i < clk->rsts_num; i++) {
struct reset_control *rst = NULL;
if (rk3568_cif_rsts[i])
if (rk3588_cif_rsts[i])
rst = devm_reset_control_get(dev, rk3588_cif_rsts[i]);
if (IS_ERR(rst)) {
dev_err(dev, "failed to get %s\n", rk3588_cif_rsts[i]);
@@ -5148,7 +5148,7 @@ int vehicle_cif_init(struct vehicle_cif *cif)
for (i = 0; i < clk->rsts_num; i++) {
struct reset_control *rst = NULL;
if (rk3568_cif_rsts[i])
if (rk3562_cif_rsts[i])
rst = devm_reset_control_get(dev, rk3562_cif_rsts[i]);
if (IS_ERR(rst)) {
dev_err(dev, "failed to get %s\n", rk3562_cif_rsts[i]);
@@ -5181,13 +5181,15 @@ int vehicle_cif_init(struct vehicle_cif *cif)
/* 3. request cif irq & mipi csi irq1-2 */
if (cif->chip_id >= CHIP_RK3588_VEHICLE_CIF) {
ret = request_irq(cif->irq, rk_camera_irq_v1, IRQF_SHARED, "vehicle_cif", cif);
ret = devm_request_irq(dev, cif->irq,
rk_camera_irq_v1, IRQF_SHARED, "vehicle_cif", cif);
if (ret < 0) {
VEHICLE_DGERR("request cif irq failed!\n");
return -EINVAL;
}
} else {
ret = request_irq(cif->irq, rk_camera_irq, IRQF_SHARED, "vehicle_cif", cif);
ret = devm_request_irq(dev, cif->irq,
rk_camera_irq, IRQF_SHARED, "vehicle_cif", cif);
if (ret < 0) {
VEHICLE_DGERR("request cif irq failed!\n");
return -EINVAL;
@@ -5197,14 +5199,14 @@ int vehicle_cif_init(struct vehicle_cif *cif)
VEHICLE_DG("%s(%d):\n", __func__, __LINE__);
if (inf_id == RKCIF_MIPI_LVDS) {
ret = request_irq(cif->csi2_irq1, vehicle_csirx_irq1,
ret = devm_request_irq(dev, cif->csi2_irq1, vehicle_csirx_irq1,
IRQF_SHARED, "vehicle_csi_intr1", cif);
if (ret < 0) {
VEHICLE_DGERR("request csirx irq1 failed!\n");
return -EINVAL;
}
ret = request_irq(cif->csi2_irq2, vehicle_csirx_irq2,
ret = devm_request_irq(dev, cif->csi2_irq2, vehicle_csirx_irq2,
IRQF_SHARED, "vehicle_csi_intr2", cif);
if (ret < 0) {
VEHICLE_DGERR("request csirx irq2 failed!\n");
@@ -5318,10 +5320,10 @@ int vehicle_cif_deinit(struct vehicle_cif *cif)
mutex_destroy(&dphy_hw->mutex);
}
free_irq(cif->irq, cif);
devm_free_irq(dev, cif->irq, cif);
if (inf_id == RKCIF_MIPI_LVDS) {
free_irq(cif->csi2_irq1, cif);
free_irq(cif->csi2_irq2, cif);
devm_free_irq(dev, cif->csi2_irq1, cif);
devm_free_irq(dev, cif->csi2_irq2, cif);
}
if (cif->err_state.err_print_wq) {
flush_workqueue(cif->err_state.err_print_wq);

View File

@@ -148,8 +148,7 @@ static int spi_codec_ext_ch_mute_get(struct snd_kcontrol *kcontrol,
{
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct spi_codec_private *priv = snd_soc_component_get_drvdata(component);
struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
unsigned int ch = mc->reg;
unsigned int ch = (unsigned int)kcontrol->private_value;
ucontrol->value.integer.value[0] = priv->tdm_mute[ch];
@@ -161,8 +160,7 @@ static int spi_codec_ext_ch_mute_put(struct snd_kcontrol *kcontrol,
{
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
struct spi_codec_private *priv = snd_soc_component_get_drvdata(component);
struct soc_mixer_control *mc = (struct soc_mixer_control *)kcontrol->private_value;
unsigned int ch = mc->reg;
unsigned int ch = (unsigned int)kcontrol->private_value;
priv->tdm_mute[ch] = ucontrol->value.integer.value[0];