mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 21:07:02 +09:00
dvb: merge from projects/verimatrix/905d-android-0425. [1/1]
PD# 152116 support config aysncfifo buffer length in dts file. Change-Id: Ie996fb93b654f1c7ebd86cab0656a0959c6fd537
This commit is contained in:
@@ -421,6 +421,7 @@ static u32 first_video_pts;
|
||||
static u32 first_audio_pts;
|
||||
static int demux_skipbyte;
|
||||
static int tsfile_clkdiv = 4;
|
||||
static int asyncfifo_buf_len = ASYNCFIFO_BUFFER_SIZE_DEFAULT;
|
||||
|
||||
#define SF_DMX_ID 2
|
||||
#define SF_AFIFO_ID 1
|
||||
@@ -1358,9 +1359,11 @@ static void dvr_process_channel(struct aml_asyncfifo *afifo,
|
||||
{
|
||||
int cnt;
|
||||
int ret = 0;
|
||||
struct aml_dvr_block blk;
|
||||
|
||||
if (afifo->buf_read > afifo->buf_toggle) {
|
||||
cnt = total - afifo->buf_read;
|
||||
if (!afifo->secure_enable) {
|
||||
dma_sync_single_for_cpu(asyncfifo_get_dev(afifo),
|
||||
afifo->pages_map+afifo->buf_read*size,
|
||||
cnt*size,
|
||||
@@ -1374,11 +1377,27 @@ static void dvr_process_channel(struct aml_asyncfifo *afifo,
|
||||
(u8 *)afifo->pages+afifo->buf_read*size,
|
||||
cnt*size, NULL, 0,
|
||||
&channel->dvr_feed->feed.ts);
|
||||
} else {
|
||||
blk.addr = afifo->blk.addr+afifo->buf_read*size;
|
||||
blk.len = cnt*size;
|
||||
if (sf)
|
||||
ret = _rbuf_write(&sf->rbuf,
|
||||
(u8 *)afifo->pages+afifo->buf_read*size,
|
||||
cnt*size);
|
||||
else {
|
||||
channel->dvr_feed->cb.ts(
|
||||
(u8 *)&blk,
|
||||
sizeof(struct aml_dvr_block),
|
||||
NULL, 0,
|
||||
&channel->dvr_feed->feed.ts);
|
||||
}
|
||||
}
|
||||
afifo->buf_read = 0;
|
||||
}
|
||||
|
||||
if (afifo->buf_toggle > afifo->buf_read) {
|
||||
cnt = afifo->buf_toggle - afifo->buf_read;
|
||||
if (!afifo->secure_enable) {
|
||||
dma_sync_single_for_cpu(asyncfifo_get_dev(afifo),
|
||||
afifo->pages_map+afifo->buf_read*size,
|
||||
cnt*size,
|
||||
@@ -1388,11 +1407,27 @@ static void dvr_process_channel(struct aml_asyncfifo *afifo,
|
||||
ret = _rbuf_write(&sf->rbuf,
|
||||
(u8 *)afifo->pages+afifo->buf_read*size,
|
||||
cnt*size);
|
||||
} else
|
||||
} else {
|
||||
channel->dvr_feed->cb.ts(
|
||||
(u8 *)afifo->pages+afifo->buf_read*size,
|
||||
cnt*size, NULL, 0,
|
||||
&channel->dvr_feed->feed.ts);
|
||||
}
|
||||
} else {
|
||||
blk.addr = afifo->blk.addr+afifo->buf_read*size;
|
||||
blk.len = cnt*size;
|
||||
if (sf)
|
||||
ret = _rbuf_write(&sf->rbuf,
|
||||
(u8 *)afifo->pages+afifo->buf_read*size,
|
||||
cnt*size);
|
||||
else {
|
||||
channel->dvr_feed->cb.ts(
|
||||
(u8 *)&blk,
|
||||
sizeof(struct aml_dvr_block),
|
||||
NULL, 0,
|
||||
&channel->dvr_feed->feed.ts);
|
||||
}
|
||||
}
|
||||
afifo->buf_read = afifo->buf_toggle;
|
||||
}
|
||||
|
||||
@@ -1732,7 +1767,9 @@ static int dsc_set_csa_key(struct aml_dsc_channel *ch, int flags,
|
||||
((ch->id + type * DSC_COUNT)+
|
||||
(is_dsc2 ? 16 : 0)));
|
||||
}
|
||||
if (get_cpu_type() == MESON_CPU_MAJOR_ID_GXL) {
|
||||
if (get_cpu_type() == MESON_CPU_MAJOR_ID_GXL ||
|
||||
get_cpu_type() == MESON_CPU_MAJOR_ID_GXM) {
|
||||
pr_info("do kl..\n");
|
||||
WRITE_MPEG_REG(COMM_DESC_KEY_RW,
|
||||
(type ? (1 << 6) : (1 << 5)) | (1<<7) |
|
||||
((ch->id + type * DSC_COUNT)+
|
||||
@@ -2196,7 +2233,7 @@ static int asyncfifo_set_buffer(struct aml_asyncfifo *afifo,
|
||||
afifo->buf_toggle = 0;
|
||||
afifo->buf_read = 0;
|
||||
afifo->buf_len = len;
|
||||
pr_error("async fifo %d buf size %d, flush size %d\n",
|
||||
pr_error("++++async fifo %d buf size %d, flush size %d\n",
|
||||
afifo->id, afifo->buf_len, afifo->flush_size);
|
||||
|
||||
if ((afifo->flush_size <= 0)
|
||||
@@ -2447,12 +2484,22 @@ static int dmx_init(struct aml_dmx *dmx)
|
||||
{
|
||||
struct aml_dvb *dvb = (struct aml_dvb *)dmx->demux.priv;
|
||||
int irq;
|
||||
int ret = 0;
|
||||
char buf[32];
|
||||
u32 value = 0;
|
||||
|
||||
if (dmx->init)
|
||||
return 0;
|
||||
|
||||
pr_inf("demux init\n");
|
||||
|
||||
memset(buf, 0, 32);
|
||||
snprintf(buf, sizeof(buf), "asyncfifo_buf_len");
|
||||
ret = of_property_read_u32(dvb->pdev->dev.of_node, buf, &value);
|
||||
if (!ret) {
|
||||
pr_inf("%s: 0x%x\n", buf, value);
|
||||
asyncfifo_buf_len = value;
|
||||
}
|
||||
/*Register irq handlers */
|
||||
if (dmx->dmx_irq != -1) {
|
||||
pr_dbg("request irq\n");
|
||||
@@ -2656,7 +2703,10 @@ static int dmx_enable(struct aml_dmx *dmx)
|
||||
case AM_TS_SRC_HIU:
|
||||
fec_sel = 7;
|
||||
fec_ctrl = 0;
|
||||
/*
|
||||
support record in HIU mode
|
||||
record = 0;
|
||||
*/
|
||||
break;
|
||||
default:
|
||||
fec_sel = 0;
|
||||
@@ -2726,7 +2776,7 @@ static int dmx_enable(struct aml_dmx *dmx)
|
||||
pr_dbg("dsc2 ctrl: 0x%x\n", READ_MPEG_REG(COMM_DESC_2_CTL));
|
||||
}
|
||||
|
||||
pr_dbg("[dmx-%d]src: %d, rec: %d, hi_bsf: %d, dsc: %d\n",
|
||||
pr_info("[dmx-%d]src: %d, rec: %d, hi_bsf: %d, dsc: %d\n",
|
||||
dmx->id, dmx->source, record, hi_bsf, fec_core_sel);
|
||||
|
||||
if (dmx->chan_count) {
|
||||
@@ -3138,12 +3188,13 @@ static void dmx_clear_filter_buffer(struct aml_dmx *dmx, int fid)
|
||||
|
||||
static void async_fifo_set_regs(struct aml_asyncfifo *afifo, int source_val)
|
||||
{
|
||||
u32 start_addr = virt_to_phys((void *)afifo->pages);
|
||||
u32 start_addr = afifo->secure_enable ? afifo->blk.addr :
|
||||
virt_to_phys((void *)afifo->pages);
|
||||
u32 size = afifo->buf_len;
|
||||
u32 flush_size = afifo->flush_size;
|
||||
int factor = dmx_get_order(size / flush_size);
|
||||
|
||||
pr_dbg("ASYNC FIFO id=%d, link to DMX%d, start_addr %x, buf_size %d,source value 0x%x, factor %d\n",
|
||||
pr_error("ASYNC FIFO id=%d, link to DMX%d, start_addr %x, buf_size %d,"
|
||||
"source value 0x%x, factor %d\n",
|
||||
afifo->id, afifo->source, start_addr, size, source_val, factor);
|
||||
/* Destination address */
|
||||
WRITE_ASYNC_FIFO_REG(afifo->id, REG0, start_addr);
|
||||
@@ -4351,7 +4402,7 @@ int aml_asyncfifo_hw_init(struct aml_asyncfifo *afifo)
|
||||
*/
|
||||
int ret;
|
||||
|
||||
int len = ASYNCFIFO_BUFFER_SIZE_DEFAULT;
|
||||
int len = asyncfifo_buf_len;
|
||||
unsigned long buf = asyncfifo_alloc_buffer(len);
|
||||
|
||||
if (!buf)
|
||||
@@ -4401,9 +4452,9 @@ int aml_asyncfifo_hw_reset(struct aml_asyncfifo *afifo)
|
||||
unsigned long flags;
|
||||
int ret, src = -1;
|
||||
|
||||
int len = ASYNCFIFO_BUFFER_SIZE_DEFAULT;
|
||||
unsigned long buf = asyncfifo_alloc_buffer(len);
|
||||
|
||||
unsigned long buf = 0;
|
||||
int len = asyncfifo_buf_len;
|
||||
buf = asyncfifo_alloc_buffer(len);
|
||||
if (!buf)
|
||||
return -1;
|
||||
|
||||
|
||||
@@ -670,6 +670,9 @@ static int aml_dvb_asyncfifo_init(struct aml_dvb *advb,
|
||||
asyncfifo->id = id;
|
||||
asyncfifo->init = 0;
|
||||
asyncfifo->flush_size = 256 * 1024;
|
||||
asyncfifo->secure_enable = 0;
|
||||
asyncfifo->blk.addr = 0;
|
||||
asyncfifo->blk.len = 0;
|
||||
|
||||
return aml_asyncfifo_hw_init(asyncfifo);
|
||||
}
|
||||
@@ -1281,6 +1284,77 @@ ASYNCFIFO_FLUSHSIZE_FUNC_DECL(0)
|
||||
#if ASYNCFIFO_COUNT > 1
|
||||
ASYNCFIFO_FLUSHSIZE_FUNC_DECL(1)
|
||||
#endif
|
||||
/*Show the async fifo secure buffer addr*/
|
||||
#define ASYNCFIFO_SECUREADDR_FUNC_DECL(i) \
|
||||
static ssize_t asyncfifo##i##_show_secure_addr(struct class *class, \
|
||||
struct class_attribute *attr, char *buf)\
|
||||
{\
|
||||
struct aml_dvb *dvb = &aml_dvb_device;\
|
||||
struct aml_asyncfifo *afifo = &dvb->asyncfifo[i];\
|
||||
ssize_t ret = 0;\
|
||||
ret = sprintf(buf, "0x%x\n", afifo->blk.addr);\
|
||||
return ret;\
|
||||
} \
|
||||
static ssize_t asyncfifo##i##_store_secure_addr(struct class *class, \
|
||||
struct class_attribute *attr, \
|
||||
const char *buf, size_t size)\
|
||||
{\
|
||||
struct aml_dvb *dvb = &aml_dvb_device;\
|
||||
struct aml_asyncfifo *afifo = &dvb->asyncfifo[i];\
|
||||
unsigned long value;\
|
||||
int ret = kstrtol(buf, 0, &value);\
|
||||
if (ret == 0 && value != afifo->blk.addr) {\
|
||||
afifo->blk.addr = value;\
|
||||
aml_asyncfifo_hw_reset(&aml_dvb_device.asyncfifo[i]);\
|
||||
} \
|
||||
return size;\
|
||||
}
|
||||
|
||||
#if ASYNCFIFO_COUNT > 0
|
||||
ASYNCFIFO_SECUREADDR_FUNC_DECL(0)
|
||||
#endif
|
||||
|
||||
#if ASYNCFIFO_COUNT > 1
|
||||
ASYNCFIFO_SECUREADDR_FUNC_DECL(1)
|
||||
#endif
|
||||
|
||||
|
||||
/*Show the async fifo secure enable*/
|
||||
#define ASYNCFIFO_SECURENABLE_FUNC_DECL(i) \
|
||||
static ssize_t asyncfifo##i##_show_secure_enable(struct class *class, \
|
||||
struct class_attribute *attr, char *buf)\
|
||||
{\
|
||||
struct aml_dvb *dvb = &aml_dvb_device;\
|
||||
struct aml_asyncfifo *afifo = &dvb->asyncfifo[i];\
|
||||
ssize_t ret = 0;\
|
||||
ret = sprintf(buf, "%d\n", afifo->secure_enable);\
|
||||
return ret;\
|
||||
} \
|
||||
static ssize_t asyncfifo##i##_store_secure_enable(struct class *class, \
|
||||
struct class_attribute *attr, \
|
||||
const char *buf, size_t size)\
|
||||
{\
|
||||
struct aml_dvb *dvb = &aml_dvb_device;\
|
||||
struct aml_asyncfifo *afifo = &dvb->asyncfifo[i];\
|
||||
int enable = 0;\
|
||||
long value;\
|
||||
int ret = kstrtol(buf, 0, &value);\
|
||||
if (ret == 0)\
|
||||
enable = value;\
|
||||
if (enable != afifo->secure_enable) {\
|
||||
afifo->secure_enable = enable;\
|
||||
aml_asyncfifo_hw_reset(&aml_dvb_device.asyncfifo[i]);\
|
||||
} \
|
||||
return size;\
|
||||
}
|
||||
|
||||
#if ASYNCFIFO_COUNT > 0
|
||||
ASYNCFIFO_SECURENABLE_FUNC_DECL(0)
|
||||
#endif
|
||||
|
||||
#if ASYNCFIFO_COUNT > 1
|
||||
ASYNCFIFO_SECURENABLE_FUNC_DECL(1)
|
||||
#endif
|
||||
/*Reset the Demux*/
|
||||
static ssize_t demux_do_reset(struct class *class,
|
||||
struct class_attribute *attr,
|
||||
@@ -1516,13 +1590,26 @@ static struct class_attribute aml_stb_class_attrs[] = {
|
||||
__ATTR(asyncfifo##i##_flush_size, 0664,\
|
||||
asyncfifo##i##_show_flush_size, \
|
||||
asyncfifo##i##_store_flush_size)
|
||||
#define ASYNCFIFO_SECUREADDR_ATTR_DECL(i)\
|
||||
__ATTR(asyncfifo##i##_secure_addr, S_IRUGO | S_IWUSR | S_IWGRP,\
|
||||
asyncfifo##i##_show_secure_addr, \
|
||||
asyncfifo##i##_store_secure_addr)
|
||||
#define ASYNCFIFO_SECURENABLE_ATTR_DECL(i)\
|
||||
__ATTR(asyncfifo##i##_secure_enable, S_IRUGO | S_IWUSR | S_IWGRP,\
|
||||
asyncfifo##i##_show_secure_enable, \
|
||||
asyncfifo##i##_store_secure_enable)
|
||||
|
||||
#if ASYNCFIFO_COUNT > 0
|
||||
ASYNCFIFO_SOURCE_ATTR_DECL(0),
|
||||
ASYNCFIFO_FLUSHSIZE_ATTR_DECL(0),
|
||||
ASYNCFIFO_SECUREADDR_ATTR_DECL(0),
|
||||
ASYNCFIFO_SECURENABLE_ATTR_DECL(0),
|
||||
#endif
|
||||
#if ASYNCFIFO_COUNT > 1
|
||||
ASYNCFIFO_SOURCE_ATTR_DECL(1),
|
||||
ASYNCFIFO_FLUSHSIZE_ATTR_DECL(1),
|
||||
ASYNCFIFO_SECUREADDR_ATTR_DECL(1),
|
||||
ASYNCFIFO_SECURENABLE_ATTR_DECL(1),
|
||||
#endif
|
||||
|
||||
__ATTR(demux_reset, 0644, NULL, demux_do_reset),
|
||||
|
||||
@@ -214,6 +214,11 @@ struct aml_dmx {
|
||||
u32 crc_check_time;
|
||||
};
|
||||
|
||||
struct aml_dvr_block {
|
||||
u32 addr;
|
||||
u32 len;
|
||||
};
|
||||
|
||||
struct aml_asyncfifo {
|
||||
int id;
|
||||
int init;
|
||||
@@ -225,8 +230,10 @@ struct aml_asyncfifo {
|
||||
int buf_toggle;
|
||||
int buf_read;
|
||||
int flush_size;
|
||||
int secure_enable;
|
||||
struct tasklet_struct asyncfifo_tasklet;
|
||||
struct aml_dvb *dvb;
|
||||
struct aml_dvr_block blk;
|
||||
};
|
||||
|
||||
enum{
|
||||
|
||||
Reference in New Issue
Block a user