162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-or-later
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (C) 2010-2013 Bluecherry, LLC <https://www.bluecherrydvr.com>
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Original author:
662306a36Sopenharmony_ci * Ben Collins <bcollins@ubuntu.com>
762306a36Sopenharmony_ci *
862306a36Sopenharmony_ci * Additional work by:
962306a36Sopenharmony_ci * John Brooks <john.brooks@bluecherry.net>
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#include <linux/kernel.h>
1362306a36Sopenharmony_ci#include <linux/font.h>
1462306a36Sopenharmony_ci#include <linux/bitrev.h>
1562306a36Sopenharmony_ci#include <linux/slab.h>
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#include "solo6x10.h"
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci#define VI_PROG_HSIZE			(1280 - 16)
2062306a36Sopenharmony_ci#define VI_PROG_VSIZE			(1024 - 16)
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define IRQ_LEVEL			2
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_cistatic void solo_capture_config(struct solo_dev *solo_dev)
2562306a36Sopenharmony_ci{
2662306a36Sopenharmony_ci	unsigned long height;
2762306a36Sopenharmony_ci	unsigned long width;
2862306a36Sopenharmony_ci	void *buf;
2962306a36Sopenharmony_ci	int i;
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_CAP_BASE,
3262306a36Sopenharmony_ci		       SOLO_CAP_MAX_PAGE((SOLO_CAP_EXT_SIZE(solo_dev)
3362306a36Sopenharmony_ci					  - SOLO_CAP_PAGE_SIZE) >> 16)
3462306a36Sopenharmony_ci		       | SOLO_CAP_BASE_ADDR(SOLO_CAP_EXT_ADDR(solo_dev) >> 16));
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci	/* XXX: Undocumented bits at b17 and b24 */
3762306a36Sopenharmony_ci	if (solo_dev->type == SOLO_DEV_6110) {
3862306a36Sopenharmony_ci		/* NOTE: Ref driver has (62 << 24) here as well, but it causes
3962306a36Sopenharmony_ci		 * wacked out frame timing on 4-port 6110. */
4062306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_CAP_BTW,
4162306a36Sopenharmony_ci			       (1 << 17) | SOLO_CAP_PROG_BANDWIDTH(2) |
4262306a36Sopenharmony_ci			       SOLO_CAP_MAX_BANDWIDTH(36));
4362306a36Sopenharmony_ci	} else {
4462306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_CAP_BTW,
4562306a36Sopenharmony_ci			       (1 << 17) | SOLO_CAP_PROG_BANDWIDTH(2) |
4662306a36Sopenharmony_ci			       SOLO_CAP_MAX_BANDWIDTH(32));
4762306a36Sopenharmony_ci	}
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ci	/* Set scale 1, 9 dimension */
5062306a36Sopenharmony_ci	width = solo_dev->video_hsize;
5162306a36Sopenharmony_ci	height = solo_dev->video_vsize;
5262306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_DIM_SCALE1,
5362306a36Sopenharmony_ci		       SOLO_DIM_H_MB_NUM(width / 16) |
5462306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FRAME(height / 8) |
5562306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FIELD(height / 16));
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci	/* Set scale 2, 10 dimension */
5862306a36Sopenharmony_ci	width = solo_dev->video_hsize / 2;
5962306a36Sopenharmony_ci	height = solo_dev->video_vsize;
6062306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_DIM_SCALE2,
6162306a36Sopenharmony_ci		       SOLO_DIM_H_MB_NUM(width / 16) |
6262306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FRAME(height / 8) |
6362306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FIELD(height / 16));
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci	/* Set scale 3, 11 dimension */
6662306a36Sopenharmony_ci	width = solo_dev->video_hsize / 2;
6762306a36Sopenharmony_ci	height = solo_dev->video_vsize / 2;
6862306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_DIM_SCALE3,
6962306a36Sopenharmony_ci		       SOLO_DIM_H_MB_NUM(width / 16) |
7062306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FRAME(height / 8) |
7162306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FIELD(height / 16));
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ci	/* Set scale 4, 12 dimension */
7462306a36Sopenharmony_ci	width = solo_dev->video_hsize / 3;
7562306a36Sopenharmony_ci	height = solo_dev->video_vsize / 3;
7662306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_DIM_SCALE4,
7762306a36Sopenharmony_ci		       SOLO_DIM_H_MB_NUM(width / 16) |
7862306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FRAME(height / 8) |
7962306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FIELD(height / 16));
8062306a36Sopenharmony_ci
8162306a36Sopenharmony_ci	/* Set scale 5, 13 dimension */
8262306a36Sopenharmony_ci	width = solo_dev->video_hsize / 4;
8362306a36Sopenharmony_ci	height = solo_dev->video_vsize / 2;
8462306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_DIM_SCALE5,
8562306a36Sopenharmony_ci		       SOLO_DIM_H_MB_NUM(width / 16) |
8662306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FRAME(height / 8) |
8762306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FIELD(height / 16));
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci	/* Progressive */
9062306a36Sopenharmony_ci	width = VI_PROG_HSIZE;
9162306a36Sopenharmony_ci	height = VI_PROG_VSIZE;
9262306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_DIM_PROG,
9362306a36Sopenharmony_ci		       SOLO_DIM_H_MB_NUM(width / 16) |
9462306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FRAME(height / 16) |
9562306a36Sopenharmony_ci		       SOLO_DIM_V_MB_NUM_FIELD(height / 16));
9662306a36Sopenharmony_ci
9762306a36Sopenharmony_ci	/* Clear OSD */
9862306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_OSD_CH, 0);
9962306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_OSD_BASE, SOLO_EOSD_EXT_ADDR >> 16);
10062306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_OSD_CLR,
10162306a36Sopenharmony_ci		       0xF0 << 16 | 0x80 << 8 | 0x80);
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci	if (solo_dev->type == SOLO_DEV_6010)
10462306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_VE_OSD_OPT,
10562306a36Sopenharmony_ci			       SOLO_VE_OSD_H_SHADOW | SOLO_VE_OSD_V_SHADOW);
10662306a36Sopenharmony_ci	else
10762306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_VE_OSD_OPT, SOLO_VE_OSD_V_DOUBLE
10862306a36Sopenharmony_ci			       | SOLO_VE_OSD_H_SHADOW | SOLO_VE_OSD_V_SHADOW);
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ci	/* Clear OSG buffer */
11162306a36Sopenharmony_ci	buf = kzalloc(SOLO_EOSD_EXT_SIZE(solo_dev), GFP_KERNEL);
11262306a36Sopenharmony_ci	if (!buf)
11362306a36Sopenharmony_ci		return;
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci	for (i = 0; i < solo_dev->nr_chans; i++) {
11662306a36Sopenharmony_ci		solo_p2m_dma(solo_dev, 1, buf,
11762306a36Sopenharmony_ci			     SOLO_EOSD_EXT_ADDR +
11862306a36Sopenharmony_ci			     (SOLO_EOSD_EXT_SIZE(solo_dev) * i),
11962306a36Sopenharmony_ci			     SOLO_EOSD_EXT_SIZE(solo_dev), 0, 0);
12062306a36Sopenharmony_ci	}
12162306a36Sopenharmony_ci	kfree(buf);
12262306a36Sopenharmony_ci}
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci#define SOLO_OSD_WRITE_SIZE (16 * OSD_TEXT_MAX)
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci/* Should be called with enable_lock held */
12762306a36Sopenharmony_ciint solo_osd_print(struct solo_enc_dev *solo_enc)
12862306a36Sopenharmony_ci{
12962306a36Sopenharmony_ci	struct solo_dev *solo_dev = solo_enc->solo_dev;
13062306a36Sopenharmony_ci	u8 *str = solo_enc->osd_text;
13162306a36Sopenharmony_ci	u8 *buf = solo_enc->osd_buf;
13262306a36Sopenharmony_ci	u32 reg;
13362306a36Sopenharmony_ci	const struct font_desc *vga = find_font("VGA8x16");
13462306a36Sopenharmony_ci	const u8 *vga_data;
13562306a36Sopenharmony_ci	int i, j;
13662306a36Sopenharmony_ci
13762306a36Sopenharmony_ci	if (WARN_ON_ONCE(!vga))
13862306a36Sopenharmony_ci		return -ENODEV;
13962306a36Sopenharmony_ci
14062306a36Sopenharmony_ci	reg = solo_reg_read(solo_dev, SOLO_VE_OSD_CH);
14162306a36Sopenharmony_ci	if (!*str) {
14262306a36Sopenharmony_ci		/* Disable OSD on this channel */
14362306a36Sopenharmony_ci		reg &= ~(1 << solo_enc->ch);
14462306a36Sopenharmony_ci		goto out;
14562306a36Sopenharmony_ci	}
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci	memset(buf, 0, SOLO_OSD_WRITE_SIZE);
14862306a36Sopenharmony_ci	vga_data = (const u8 *)vga->data;
14962306a36Sopenharmony_ci
15062306a36Sopenharmony_ci	for (i = 0; *str; i++, str++) {
15162306a36Sopenharmony_ci		for (j = 0; j < 16; j++) {
15262306a36Sopenharmony_ci			buf[(j << 1) | (i & 1) | ((i & ~1) << 4)] =
15362306a36Sopenharmony_ci			    bitrev8(vga_data[(*str << 4) | j]);
15462306a36Sopenharmony_ci		}
15562306a36Sopenharmony_ci	}
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci	solo_p2m_dma(solo_dev, 1, buf,
15862306a36Sopenharmony_ci		     SOLO_EOSD_EXT_ADDR_CHAN(solo_dev, solo_enc->ch),
15962306a36Sopenharmony_ci		     SOLO_OSD_WRITE_SIZE, 0, 0);
16062306a36Sopenharmony_ci
16162306a36Sopenharmony_ci	/* Enable OSD on this channel */
16262306a36Sopenharmony_ci	reg |= (1 << solo_enc->ch);
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ciout:
16562306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_OSD_CH, reg);
16662306a36Sopenharmony_ci	return 0;
16762306a36Sopenharmony_ci}
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci/*
17062306a36Sopenharmony_ci * Set channel Quality Profile (0-3).
17162306a36Sopenharmony_ci */
17262306a36Sopenharmony_civoid solo_s_jpeg_qp(struct solo_dev *solo_dev, unsigned int ch,
17362306a36Sopenharmony_ci		    unsigned int qp)
17462306a36Sopenharmony_ci{
17562306a36Sopenharmony_ci	unsigned long flags;
17662306a36Sopenharmony_ci	unsigned int idx, reg;
17762306a36Sopenharmony_ci
17862306a36Sopenharmony_ci	if ((ch > 31) || (qp > 3))
17962306a36Sopenharmony_ci		return;
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci	if (solo_dev->type == SOLO_DEV_6010)
18262306a36Sopenharmony_ci		return;
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_ci	if (ch < 16) {
18562306a36Sopenharmony_ci		idx = 0;
18662306a36Sopenharmony_ci		reg = SOLO_VE_JPEG_QP_CH_L;
18762306a36Sopenharmony_ci	} else {
18862306a36Sopenharmony_ci		ch -= 16;
18962306a36Sopenharmony_ci		idx = 1;
19062306a36Sopenharmony_ci		reg = SOLO_VE_JPEG_QP_CH_H;
19162306a36Sopenharmony_ci	}
19262306a36Sopenharmony_ci	ch *= 2;
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci	spin_lock_irqsave(&solo_dev->jpeg_qp_lock, flags);
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci	solo_dev->jpeg_qp[idx] &= ~(3 << ch);
19762306a36Sopenharmony_ci	solo_dev->jpeg_qp[idx] |= (qp & 3) << ch;
19862306a36Sopenharmony_ci
19962306a36Sopenharmony_ci	solo_reg_write(solo_dev, reg, solo_dev->jpeg_qp[idx]);
20062306a36Sopenharmony_ci
20162306a36Sopenharmony_ci	spin_unlock_irqrestore(&solo_dev->jpeg_qp_lock, flags);
20262306a36Sopenharmony_ci}
20362306a36Sopenharmony_ci
20462306a36Sopenharmony_ciint solo_g_jpeg_qp(struct solo_dev *solo_dev, unsigned int ch)
20562306a36Sopenharmony_ci{
20662306a36Sopenharmony_ci	int idx;
20762306a36Sopenharmony_ci
20862306a36Sopenharmony_ci	if (solo_dev->type == SOLO_DEV_6010)
20962306a36Sopenharmony_ci		return 2;
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci	if (WARN_ON_ONCE(ch > 31))
21262306a36Sopenharmony_ci		return 2;
21362306a36Sopenharmony_ci
21462306a36Sopenharmony_ci	if (ch < 16) {
21562306a36Sopenharmony_ci		idx = 0;
21662306a36Sopenharmony_ci	} else {
21762306a36Sopenharmony_ci		ch -= 16;
21862306a36Sopenharmony_ci		idx = 1;
21962306a36Sopenharmony_ci	}
22062306a36Sopenharmony_ci	ch *= 2;
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci	return (solo_dev->jpeg_qp[idx] >> ch) & 3;
22362306a36Sopenharmony_ci}
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci#define SOLO_QP_INIT 0xaaaaaaaa
22662306a36Sopenharmony_ci
22762306a36Sopenharmony_cistatic void solo_jpeg_config(struct solo_dev *solo_dev)
22862306a36Sopenharmony_ci{
22962306a36Sopenharmony_ci	if (solo_dev->type == SOLO_DEV_6010) {
23062306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_VE_JPEG_QP_TBL,
23162306a36Sopenharmony_ci			       (2 << 24) | (2 << 16) | (2 << 8) | 2);
23262306a36Sopenharmony_ci	} else {
23362306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_VE_JPEG_QP_TBL,
23462306a36Sopenharmony_ci			       (4 << 24) | (3 << 16) | (2 << 8) | 1);
23562306a36Sopenharmony_ci	}
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ci	spin_lock_init(&solo_dev->jpeg_qp_lock);
23862306a36Sopenharmony_ci
23962306a36Sopenharmony_ci	/* Initialize Quality Profile for all channels */
24062306a36Sopenharmony_ci	solo_dev->jpeg_qp[0] = solo_dev->jpeg_qp[1] = SOLO_QP_INIT;
24162306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_JPEG_QP_CH_L, SOLO_QP_INIT);
24262306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_JPEG_QP_CH_H, SOLO_QP_INIT);
24362306a36Sopenharmony_ci
24462306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_JPEG_CFG,
24562306a36Sopenharmony_ci		(SOLO_JPEG_EXT_SIZE(solo_dev) & 0xffff0000) |
24662306a36Sopenharmony_ci		((SOLO_JPEG_EXT_ADDR(solo_dev) >> 16) & 0x0000ffff));
24762306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_JPEG_CTRL, 0xffffffff);
24862306a36Sopenharmony_ci	if (solo_dev->type == SOLO_DEV_6110) {
24962306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_VE_JPEG_CFG1,
25062306a36Sopenharmony_ci			       (0 << 16) | (30 << 8) | 60);
25162306a36Sopenharmony_ci	}
25262306a36Sopenharmony_ci}
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_cistatic void solo_mp4e_config(struct solo_dev *solo_dev)
25562306a36Sopenharmony_ci{
25662306a36Sopenharmony_ci	int i;
25762306a36Sopenharmony_ci	u32 cfg;
25862306a36Sopenharmony_ci
25962306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_CFG0,
26062306a36Sopenharmony_ci		       SOLO_VE_INTR_CTRL(IRQ_LEVEL) |
26162306a36Sopenharmony_ci		       SOLO_VE_BLOCK_SIZE(SOLO_MP4E_EXT_SIZE(solo_dev) >> 16) |
26262306a36Sopenharmony_ci		       SOLO_VE_BLOCK_BASE(SOLO_MP4E_EXT_ADDR(solo_dev) >> 16));
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci	cfg = SOLO_VE_BYTE_ALIGN(2) | SOLO_VE_INSERT_INDEX
26662306a36Sopenharmony_ci		| SOLO_VE_MOTION_MODE(0);
26762306a36Sopenharmony_ci	if (solo_dev->type != SOLO_DEV_6010) {
26862306a36Sopenharmony_ci		cfg |= SOLO_VE_MPEG_SIZE_H(
26962306a36Sopenharmony_ci			(SOLO_MP4E_EXT_SIZE(solo_dev) >> 24) & 0x0f);
27062306a36Sopenharmony_ci		cfg |= SOLO_VE_JPEG_SIZE_H(
27162306a36Sopenharmony_ci			(SOLO_JPEG_EXT_SIZE(solo_dev) >> 24) & 0x0f);
27262306a36Sopenharmony_ci	}
27362306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_CFG1, cfg);
27462306a36Sopenharmony_ci
27562306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_WMRK_POLY, 0);
27662306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_VMRK_INIT_KEY, 0);
27762306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_WMRK_STRL, 0);
27862306a36Sopenharmony_ci	if (solo_dev->type == SOLO_DEV_6110)
27962306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_VE_WMRK_ENABLE, 0);
28062306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_ENCRYP_POLY, 0);
28162306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_ENCRYP_INIT, 0);
28262306a36Sopenharmony_ci
28362306a36Sopenharmony_ci	solo_reg_write(solo_dev, SOLO_VE_ATTR,
28462306a36Sopenharmony_ci		       SOLO_VE_LITTLE_ENDIAN |
28562306a36Sopenharmony_ci		       SOLO_COMP_ATTR_FCODE(1) |
28662306a36Sopenharmony_ci		       SOLO_COMP_TIME_INC(0) |
28762306a36Sopenharmony_ci		       SOLO_COMP_TIME_WIDTH(15) |
28862306a36Sopenharmony_ci		       SOLO_DCT_INTERVAL(solo_dev->type == SOLO_DEV_6010 ? 9 : 10));
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci	for (i = 0; i < solo_dev->nr_chans; i++) {
29162306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_VE_CH_REF_BASE(i),
29262306a36Sopenharmony_ci			       (SOLO_EREF_EXT_ADDR(solo_dev) +
29362306a36Sopenharmony_ci			       (i * SOLO_EREF_EXT_SIZE)) >> 16);
29462306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_VE_CH_REF_BASE_E(i),
29562306a36Sopenharmony_ci			       (SOLO_EREF_EXT_ADDR(solo_dev) +
29662306a36Sopenharmony_ci			       ((i + 16) * SOLO_EREF_EXT_SIZE)) >> 16);
29762306a36Sopenharmony_ci	}
29862306a36Sopenharmony_ci
29962306a36Sopenharmony_ci	if (solo_dev->type == SOLO_DEV_6110) {
30062306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_VE_COMPT_MOT, 0x00040008);
30162306a36Sopenharmony_ci	} else {
30262306a36Sopenharmony_ci		for (i = 0; i < solo_dev->nr_chans; i++)
30362306a36Sopenharmony_ci			solo_reg_write(solo_dev, SOLO_VE_CH_MOT(i), 0x100);
30462306a36Sopenharmony_ci	}
30562306a36Sopenharmony_ci}
30662306a36Sopenharmony_ci
30762306a36Sopenharmony_ciint solo_enc_init(struct solo_dev *solo_dev)
30862306a36Sopenharmony_ci{
30962306a36Sopenharmony_ci	int i;
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci	solo_capture_config(solo_dev);
31262306a36Sopenharmony_ci	solo_mp4e_config(solo_dev);
31362306a36Sopenharmony_ci	solo_jpeg_config(solo_dev);
31462306a36Sopenharmony_ci
31562306a36Sopenharmony_ci	for (i = 0; i < solo_dev->nr_chans; i++) {
31662306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_CAP_CH_SCALE(i), 0);
31762306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_CAP_CH_COMP_ENA_E(i), 0);
31862306a36Sopenharmony_ci	}
31962306a36Sopenharmony_ci
32062306a36Sopenharmony_ci	return 0;
32162306a36Sopenharmony_ci}
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_civoid solo_enc_exit(struct solo_dev *solo_dev)
32462306a36Sopenharmony_ci{
32562306a36Sopenharmony_ci	int i;
32662306a36Sopenharmony_ci
32762306a36Sopenharmony_ci	for (i = 0; i < solo_dev->nr_chans; i++) {
32862306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_CAP_CH_SCALE(i), 0);
32962306a36Sopenharmony_ci		solo_reg_write(solo_dev, SOLO_CAP_CH_COMP_ENA_E(i), 0);
33062306a36Sopenharmony_ci	}
33162306a36Sopenharmony_ci}
332