mirror of
https://github.com/torvalds/linux.git
synced 2024-12-14 23:25:54 +00:00
34d1324edd
Support for boards based on Techwell TW5864 chip which provides multichannel video & audio grabbing and encoding (H.264, MJPEG, ADPCM G.726). This submission implements only H.264 encoding of all channels at D1 resolution. Thanks to Mark Thompson <sw@jkqxz.net> for help, and for contribution of H.264 startcode emulation prevention code. Signed-off-by: Andrey Utkin <andrey.utkin@corp.bluecherry.net> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
38 lines
894 B
C
38 lines
894 B
C
#include "tw5864.h"
|
|
|
|
void tw5864_indir_writeb(struct tw5864_dev *dev, u16 addr, u8 data)
|
|
{
|
|
int retries = 30000;
|
|
|
|
while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries)
|
|
;
|
|
if (!retries)
|
|
dev_err(&dev->pci->dev,
|
|
"tw_indir_writel() retries exhausted before writing\n");
|
|
|
|
tw_writel(TW5864_IND_DATA, data);
|
|
tw_writel(TW5864_IND_CTL, addr << 2 | TW5864_RW | TW5864_ENABLE);
|
|
}
|
|
|
|
u8 tw5864_indir_readb(struct tw5864_dev *dev, u16 addr)
|
|
{
|
|
int retries = 30000;
|
|
|
|
while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries)
|
|
;
|
|
if (!retries)
|
|
dev_err(&dev->pci->dev,
|
|
"tw_indir_readl() retries exhausted before reading\n");
|
|
|
|
tw_writel(TW5864_IND_CTL, addr << 2 | TW5864_ENABLE);
|
|
|
|
retries = 30000;
|
|
while (tw_readl(TW5864_IND_CTL) & BIT(31) && --retries)
|
|
;
|
|
if (!retries)
|
|
dev_err(&dev->pci->dev,
|
|
"tw_indir_readl() retries exhausted at reading\n");
|
|
|
|
return tw_readl(TW5864_IND_DATA);
|
|
}
|